Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

❓ shutter sound not playing on Android #1044

Closed
3 of 4 tasks
albert-pjj opened this issue May 13, 2022 · 11 comments · Fixed by #1466
Closed
3 of 4 tasks

❓ shutter sound not playing on Android #1044

albert-pjj opened this issue May 13, 2022 · 11 comments · Fixed by #1466
Labels
💭 question Further information is requested

Comments

@albert-pjj
Copy link

Question

The camera shutter sound plays in ios, but the shutter sound does not play in Android.

What I tried

<Camera
        ref={camera}
        device={device}
        format={formats[0]}
        isActive={isActive}
       photo={true}
       orientation="portrait"
/>

const result = await camera.current?.takePhoto({
        enableAutoStabilization: true,
        skipMetadata: Platform.OS === 'android',
        qualityPrioritization: 'speed',
        flash: 'off',
});
buildToolsVersion = "31.0.0"
minSdkVersion = 23
compileSdkVersion = 31
targetSdkVersion = 31
ndkVersion = "21.4.7075529"

react-native: 0.68.0

VisionCamera Version

2.13.3

Additional information

@albert-pjj albert-pjj added the 💭 question Further information is requested label May 13, 2022
@mrousavy
Copy link
Owner

I don't think there is any default shutter sound effect on Android?

@kesteer
Copy link

kesteer commented Jun 5, 2022

@mrousavy
You are correct in that sense. I think the issue comes from people who are moving over from RN Camera to RNVC, as IIRC RN Camera had a shutter sound implemented for Android.

A disclaimer in the documentation might be a good idea. Since people testing on both types of devices will probably get thrown off by it?

Or, I was considering making a PR that would add this feature since there is technically a default sound for this in the Android OS if you'd be open to that.
https://developer.android.com/reference/android/media/MediaActionSound#SHUTTER_CLICK

@mrousavy
Copy link
Owner

mrousavy commented Jun 5, 2022

from their docs:

The sound used by Camera.takePicture to indicate still image capture.

Why doesn't it play then? I think this would be a cool option for VisionCamera. It's configurable both on iOS and Android

@kesteer
Copy link

kesteer commented Jun 5, 2022

Why doesn't it play then? I think this would be a cool option for VisionCamera. It's configurable both on iOS and Android

True, I would assume it'd play anyways. A bit more annecdotal evidence, but in my recent implementation of VisionCamera on Android it also was not playing on my phone when taking a picture.

Looking back at the old code for RN Camera, it seems they manually called the sound directly instead of using it from Camera.takePicture. I wonder if something else is happening here?

https://github.com/react-native-camera/react-native-camera/pull/1441/files

@wilav-dev
Copy link

any update? i need to reproduce shutter sound

@uniquejava
Copy link

+1, we just switched from RNC to RCVC, the missing shutter sound makes our client unhappy. 😭

@bdobreav
Copy link

+1, please add shutter sound

@mrousavy
Copy link
Owner

Stop spamming +1. If you want me to work on VisionCamera to make your client happy, pay me to do so.

@robsonbbs
Copy link

@mrousavy Based on the code from RN Camera shared by @kesteer and the fact that android docs also point to MediaActionSound, seems like shutter sound should be called manually. I will try to take a look at this next weekend, and open a PR with the fix (possibly based on RN Camera solution).

Keep up the good work, this library is awesome!

@2sem
Copy link

2sem commented May 19, 2023

On android some devices, flash and shutter is not working.

@mrousavy
Copy link
Owner

Hey! I just implemented this in V3! :) #1702

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💭 question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants