Camera preview option "position" doesn't seem to affect the preview
See original GitHub issueDescribe the bug The front camera preview is working, however the option “position” set to “rear” does not change the position of the activated camera.
import { Plugins, CameraDirection } from "@capacitor/core"
const { CameraPreview } = Plugins;
import { CameraPreviewOptions } from '@capacitor-community/camera-preview';
const cameraPreviewOptions: CameraPreviewOptions = {
parent: 'test-cam',
position: 'rear',
height: 1920,
width: 1080
};
@Component({ ... })
export class Content360Component implements OnInit {
ngOnInit() {
CameraPreview.start(cameraPreviewOptions);
}
}
Expected behavior The rear camera preview should be initialized instead of the front.
Smartphone (please complete the following information):
- Device: Android
- OS: 8.1
- Browser: WebView native App, built with Ionic 6.10.2
Additional context
This is the first mobile app I develop, please tell me if you need more informations regarding that particular issue.
On a side note, I wasn’t able to add the plugin to the MainActivity file, as stated in the readme:
this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
// Additional plugins you've installed go here
// Ex: add(TotallyAwesomePlugin.class);
add(CameraPreview.class);
}});
CameraPreview.class cannot be found when building, I suspect I am missing an import but I couldn’t find what I am supposed to import.
I tried:
import com.ahm.capacitor.camera.preview;
import com.getcapacitor.CameraPreview`
But none succeeded.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Camera preview | Android Developers
Cameras and camera previews aren't always in the same orientation on Android devices. A camera is in a fixed position on a device, ......
Read more >Preview without rendering in After Effects - Adobe Support
Select Composition > Preview > Play. When you select the Play option, settings assigned for the shortcut currently displayed in the Preview panel...
Read more >How to Fix the 'Cached Preview' Error in After Effects - YouTube
In this video tutorial we'll take a look at how to fix the 'cached preview ' error in After Effects. Read More: http://bit.ly/2uJWYnl....
Read more >Camera doesn't work in Windows - Microsoft Support
When your camera isn't working in Windows 11, it might be missing drivers after a recent update. It's also possible that your antivirus...
Read more >Change advanced camera settings on iPhone - Apple Support
Turn View Outside the Frame off and on. On iPhone 11 models, iPhone 12 models, iPhone 13 models, and iPhone 14 models, the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As far, as I understand:
If the Plugin is not added in the
MainAcitivity
, the Plugin is just not working at all, but the smartphone defaults to the web implementation. And it seems that the rear camera is just not implemented for the web platform.By the way, there seems to be a typo in the correct import. You should try it with:
Is still doesn’t work. I can use the web cam when in browser and only the front camera when using my phone. The button just doesn’t work.