mirror of
https://github.com/status-im/react-native-camera.git
synced 2026-08-30 21:21:06 +00:00
[captureWithOrientation()] Load shutter_click sound to reduce latency while playing during capture (#871)
This commit is contained in:
@@ -73,6 +73,7 @@ public class RCTCameraModule extends ReactContextBaseJavaModule
|
||||
|
||||
private static ReactApplicationContext _reactContext;
|
||||
private RCTSensorOrientationChecker _sensorOrientationChecker;
|
||||
private MediaActionSound sound = new MediaActionSound();
|
||||
|
||||
private MediaRecorder mMediaRecorder;
|
||||
private long MRStartTime;
|
||||
@@ -87,6 +88,7 @@ public class RCTCameraModule extends ReactContextBaseJavaModule
|
||||
_reactContext = reactContext;
|
||||
_sensorOrientationChecker = new RCTSensorOrientationChecker(_reactContext);
|
||||
_reactContext.addLifecycleEventListener(this);
|
||||
sound.load(MediaActionSound.SHUTTER_CLICK)
|
||||
}
|
||||
|
||||
public static ReactApplicationContext getReactContextSingleton() {
|
||||
@@ -516,7 +518,6 @@ public class RCTCameraModule extends ReactContextBaseJavaModule
|
||||
RCTCamera.getInstance().setCaptureQuality(options.getInt("type"), options.getString("quality"));
|
||||
|
||||
if (options.hasKey("playSoundOnCapture") && options.getBoolean("playSoundOnCapture")) {
|
||||
MediaActionSound sound = new MediaActionSound();
|
||||
sound.play(MediaActionSound.SHUTTER_CLICK);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user