You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.
It seems there is no way to open the front camera and take a picture using the media plugin.
I tried:
var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions{ DefaultCamera = CameraDevice.Front });
But it opens the Rear Camera always on my Samsung SM-T545 (Android 11) device.
The Camera2Basic xamarin android sample it is able to open the front camera.
I updated and attached that project. Can you have a look, in order to understand how to select the front camera ?
Bug Information
Version Number of Plugin: 5.0.1
Device Tested On: Samsung SM-T545
Simulator Tested On:
Version of VS: 2022
Version of Xamarin: Xamarin.AndroidX.AppCompat 1.3.1.5
Versions of other things you are using:
Steps to reproduce the Behavior
var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions{ DefaultCamera = CameraDevice.Front });
Expected Behavior
Front Camera opens
Actual Behavior
Rear Camera opens
Code snippet
var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions{ DefaultCamera = CameraDevice.Front });
Screenshots
none
The text was updated successfully, but these errors were encountered:
var cacheName = System.IO.Path.Combine(CacheDir.AbsolutePath, System.IO.Path.GetTempFileName());
using var cacheFile = new Java.IO.File(cacheName);
using var photoURI = FileProvider.GetUriForFile(this, PackageName + ".fileprovider", cacheFile);
using var cameraIntent = new Intent(MediaStore.ActionImageCapture);
cameraIntent.PutExtra(MediaStore.ExtraOutput, photoURI);
cameraIntent.PutExtra("com.google.assistant.extra.USE_FRONT_CAMERA", true);
cameraIntent.PutExtra("android.intent.extra.USE_FRONT_CAMERA", true);
cameraIntent.PutExtra("android.intent.extras.LENS_FACING_FRONT", 1);
cameraIntent.PutExtra("android.intent.extras.CAMERA_FACING", 1);
// Samsung
cameraIntent.PutExtra("camerafacing", "front");
cameraIntent.PutExtra("previous_mode", "front");
StartActivityForResult(cameraIntent, _CAMERA_PHOTO_REQUEST_CODE);
It seems there is no way to open the front camera and take a picture using the media plugin.
I tried:
var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions{ DefaultCamera = CameraDevice.Front });
But it opens the Rear Camera always on my Samsung SM-T545 (Android 11) device.
The Camera2Basic xamarin android sample it is able to open the front camera.
I updated and attached that project. Can you have a look, in order to understand how to select the front camera ?
Bug Information
Version Number of Plugin: 5.0.1
Device Tested On: Samsung SM-T545
Simulator Tested On:
Version of VS: 2022
Version of Xamarin: Xamarin.AndroidX.AppCompat 1.3.1.5
Versions of other things you are using:
Steps to reproduce the Behavior
var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions{ DefaultCamera = CameraDevice.Front });
Expected Behavior
Front Camera opens
Actual Behavior
Rear Camera opens
Code snippet
var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions{ DefaultCamera = CameraDevice.Front });
Screenshots
none
The text was updated successfully, but these errors were encountered: