I have a custom camera implementation which I would like to have have my own sound when the picture is taken how to enable shutter sound in hardware camera, I need to only play my camera sound and not the default one
private async void TakePhotoButtonTapped(object sender, EventArgs e)
{
Android.Hardware.Camera.CameraInfo info = new Android.Hardware.Camera.CameraInfo();
// mCameraFacing is CameraID.
Android.Hardware.Camera.GetCameraInfo(mCameraFacing, info);
if (info.CanDisableShutterSound)
camera.EnableShutterSound(false);
else
camera.EnableShutterSound(true);
Bitmap image = textureView.Bitmap;
using (var imageStream = new MemoryStream())
{
await image.CompressAsync(Bitmap.CompressFormat.Jpeg, 100, imageStream);
image.Recycle();
imageBytes = imageStream.ToArray();
AddImages(imageBytes);
Toast.MakeText(Android.App.Application.Context, _languageCache.Translate("Photo Captured"), ToastLength.Short).Show();
}
await Task.Delay(300);
}
You could use the code below of the sound settings and put it into the code which you used to take photo.
I use the system
ShutterClick
sound for reference. You could use your own as well.