Skip to content

Commit

Permalink
[captureWithOrientation()] Load shutter_click sound to reduce latency…
Browse files Browse the repository at this point in the history
… while playing during capture (react-native-camera#871)
  • Loading branch information
azanli authored and ptomasroos committed Sep 8, 2017
1 parent 161c568 commit 618f5ec
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -87,6 +88,7 @@ public RCTCameraModule(ReactApplicationContext reactContext) {
_reactContext = reactContext;
_sensorOrientationChecker = new RCTSensorOrientationChecker(_reactContext);
_reactContext.addLifecycleEventListener(this);
sound.load(MediaActionSound.SHUTTER_CLICK)
}

public static ReactApplicationContext getReactContextSingleton() {
Expand Down Expand Up @@ -516,7 +518,6 @@ private void captureWithOrientation(final ReadableMap options, final Promise pro
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);
}

Expand Down

0 comments on commit 618f5ec

Please sign in to comment.