fix video and music can be played at same time
requestAudioFocus() before play video in Gallery
Change-Id: If70e51eb86d7d4379473cf5bd2185bed9bb03eaa
diff --git a/src/com/android/gallery3d/app/MoviePlayer.java b/src/com/android/gallery3d/app/MoviePlayer.java
index 06773f8..c79c44f 100755
--- a/src/com/android/gallery3d/app/MoviePlayer.java
+++ b/src/com/android/gallery3d/app/MoviePlayer.java
@@ -579,6 +579,7 @@
boolean start) {
// For streams that we expect to be slow to start up, show a
// progress spinner until playback starts.
+ requestAudioFocus();
String scheme = mMovieItem.getUri().getScheme();
if ("http".equalsIgnoreCase(scheme) || "rtsp".equalsIgnoreCase(scheme)
|| "https".equalsIgnoreCase(scheme)) {
@@ -630,7 +631,7 @@
Log.w(TAG, "CS/CSVT Call is in progress, can't play video");
return false;
}
-
+ requestAudioFocus();
mTState = TState.PLAYING;
mVideoView.start();
mController.showPlaying();
@@ -808,6 +809,7 @@
mOverlayExt.setCanScrubbing(canSeek);
mController.setPlayPauseReplayResume();
if (!canPause && !mVideoView.isTargetPlaying()) {
+ requestAudioFocus();
mVideoView.start();
}
updateRewindAndForwardUI();