[captureWithOrientation()] Load shutter_click sound to reduce latency while playing during capture (#871)

This commit is contained in:
Andy Li
2017-09-08 22:03:35 +02:00
committed by Tomas Roos
parent 161c568095
commit 618f5ec92f
@@ -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);
}