teslamotors / react-native-camera-kit

A high performance, easy to use, rock solid camera library for React Native apps.
MIT License
2.42k stars 577 forks source link

I turn off camera shutter sound but it not working #639

Open minkgkyaw9899 opened 5 months ago

minkgkyaw9899 commented 5 months ago

Describe the bug In Camera component I give shutterPhotoSound props to false value but it not working.

To Reproduce

Expected behavior I want to fix shutterPhotoSound props is working well

Screenshots

Screenshot 2024-01-31 at 10 15 44 AM

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context I have been tested in other phone like Samsung note 10+ and also same issues.

JuEunSung commented 4 months ago

facing same issue

DavidBertet commented 4 months ago

The code only adds a sound if true, it doesn't remove it if false

https://github.com/teslamotors/react-native-camera-kit/blob/master/android/src/main/java/com/rncamerakit/CKCamera.kt#L401

if (shutterPhotoSound) {
    val audio = getActivity().getSystemService(Context.AUDIO_SERVICE) as AudioManager
    if (audio.ringerMode == AudioManager.RINGER_MODE_NORMAL) {
        MediaActionSound().play(MediaActionSound.SHUTTER_CLICK)
    }
}

You can try to do something along the line of

} else if (camera?.cameraInfo?.canDisableShutterSound == true) {
    camera.enableShutterSound(false)
}