From f37735325307310745d01d5a4eca05270839238c Mon Sep 17 00:00:00 2001 From: jinwu Date: Sat, 9 Dec 2017 15:38:45 +0800 Subject: Play sound when start/stop recording Add an action of playing sound when start or stop recording. Change-Id: I5351d347beea26cddef7c87e8a2b37a1f2f421c2 --- src/com/android/camera/CaptureModule.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index d9625a5ee..129497d7e 100755 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -3196,6 +3196,7 @@ public class CaptureModule implements CameraModule, PhotoController, mIsRecordingVideo = true; mMediaRecorderPausing = false; + checkAndPlayRecordSound(cameraId, true); mActivity.updateStorageSpaceAndHint(); if (mActivity.getStorageSpaceBytes() <= Storage.LOW_STORAGE_THRESHOLD_BYTES) { Log.w(TAG, "Storage issue, ignore the start request"); @@ -3571,6 +3572,7 @@ public class CaptureModule implements CameraModule, PhotoController, mStopRecPending = true; boolean shouldAddToMediaStoreNow = false; // Stop recording + checkAndPlayRecordSound(cameraId, false); mFrameProcessor.setVideoOutputSurface(null); mFrameProcessor.onClose(); closePreviewSession(); @@ -4524,6 +4526,16 @@ public class CaptureModule implements CameraModule, PhotoController, } } + private void checkAndPlayRecordSound(int id, boolean isStarted) { + if (id == getMainCameraId()) { + String value = mSettingsManager.getValue(SettingsManager.KEY_SHUTTER_SOUND); + if (value != null && value.equals("on") && mSound != null) { + mSound.play(isStarted? MediaActionSound.START_VIDEO_RECORDING + : MediaActionSound.STOP_VIDEO_RECORDING); + } + } + } + public void checkAndPlayShutterSound(int id) { if (id == getMainCameraId()) { String value = mSettingsManager.getValue(SettingsManager.KEY_SHUTTER_SOUND); -- cgit v1.2.3