summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/camera/VideoModule.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index b2175d7..c21a56a 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -1731,13 +1731,17 @@ public class VideoModule implements CameraModule,
* Make sure we're not recording music playing in the background, ask the
* MediaPlaybackService to pause playback.
*/
- private void pauseAudioPlayback() {
- // Shamelessly copied from MediaPlaybackService.java, which
- // should be public, but isn't.
- Intent i = new Intent("com.android.music.musicservicecommand");
- i.putExtra("command", "pause");
+ private void requestAudioFocus() {
+ AudioManager am = (AudioManager)mActivity.getSystemService(Context.AUDIO_SERVICE);
+
+ // Send request to obtain audio focus. This will stop other
+ // music stream.
+ int result = am.requestAudioFocus(null, AudioManager.STREAM_MUSIC,
+ AudioManager.AUDIOFOCUS_GAIN);
- mActivity.sendBroadcast(i);
+ if (result == AudioManager.AUDIOFOCUS_REQUEST_FAILED) {
+ Log.v(TAG, "Audio focus request failed");
+ }
}
// For testing.
@@ -1805,7 +1809,7 @@ public class VideoModule implements CameraModule,
return false;
}
- pauseAudioPlayback();
+ requestAudioFocus();
try {
mMediaRecorder.start(); // Recording is now started