[Android] Fix video/audio switch in PlaybackService
Geoffrey Métais
git at videolan.org
Fri Dec 18 12:03:39 CET 2015
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Dec 18 11:25:00 2015 +0100| [930f60f3d66b7adbb7934c017a779e927c478b08] | committer: Geoffrey Métais
Fix video/audio switch in PlaybackService
> https://code.videolan.org/videolan/vlc-android/commit/930f60f3d66b7adbb7934c017a779e927c478b08
---
.../src/org/videolan/vlc/PlaybackService.java | 45 +++++++++++-----------
1 file changed, 22 insertions(+), 23 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 92ed5da..6ec342a 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -1598,13 +1598,7 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
// Add handler after loading the list
mMediaList.addEventListener(mListEventListener);
- MediaWrapper mw = mMediaList.getMedia(mCurrentIndex);
- if (mw .getType() != MediaWrapper.TYPE_VIDEO || mw.hasFlag(MediaWrapper.MEDIA_FORCE_AUDIO) || isVideoPlaying())
- playIndex(mCurrentIndex, 0);
- else {//Start VideoPlayer for first video, it will trigger playIndex when ready.
- VideoPlayerActivity.startOpened(VLCApplication.getAppContext(),
- getCurrentMediaWrapper().getUri(), mCurrentIndex);
- }
+ playIndex(mCurrentIndex, 0);
saveMediaList();
onMediaChanged();
}
@@ -1651,23 +1645,28 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
media.setEventListener(mMediaListener);
mMediaPlayer.setMedia(media);
media.release();
- mMediaPlayer.setEqualizer(VLCOptions.getEqualizer(this));
- mMediaPlayer.setVideoTitleDisplay(MediaPlayer.Position.Disable, 0);
- changeAudioFocus(true);
- mMediaPlayer.setEventListener(mMediaPlayerListener);
- mMediaPlayer.play();
- if(mSavedTime != 0l)
- mMediaPlayer.setTime(mSavedTime);
- mSavedTime = 0l;
+ if (mw .getType() != MediaWrapper.TYPE_VIDEO || mw.hasFlag(MediaWrapper.MEDIA_FORCE_AUDIO) || isVideoPlaying()) {
+ mMediaPlayer.setEqualizer(VLCOptions.getEqualizer(this));
+ mMediaPlayer.setVideoTitleDisplay(MediaPlayer.Position.Disable, 0);
+ changeAudioFocus(true);
+ mMediaPlayer.setEventListener(mMediaPlayerListener);
+ mMediaPlayer.play();
+ if(mSavedTime != 0l)
+ mMediaPlayer.setTime(mSavedTime);
+ mSavedTime = 0l;
- notifyTrackChanged();
- determinePrevAndNextIndices();
- VLCApplication.runBackground(new Runnable() {
- @Override
- public void run() {
- MediaDatabase.getInstance().addHistoryItem(mw);
- }
- });
+ notifyTrackChanged();
+ determinePrevAndNextIndices();
+ VLCApplication.runBackground(new Runnable() {
+ @Override
+ public void run() {
+ MediaDatabase.getInstance().addHistoryItem(mw);
+ }
+ });
+ } else {//Start VideoPlayer for first video, it will trigger playIndex when ready.
+ VideoPlayerActivity.startOpened(VLCApplication.getAppContext(),
+ getCurrentMediaWrapper().getUri(), mCurrentIndex);
+ }
}
/**
More information about the Android
mailing list