[Android] VideoPlayer: fix a useless play/stop before for each Media
Thomas Guillem
git at videolan.org
Wed Jul 1 16:03:59 CEST 2015
vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Jul 1 16:03:37 2015 +0200| [b1ddf70e8132f815463e9fffad5e7e8e50cd7245] | committer: Thomas Guillem
VideoPlayer: fix a useless play/stop before for each Media
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=b1ddf70e8132f815463e9fffad5e7e8e50cd7245
---
.../vlc/gui/video/VideoPlayerActivity.java | 28 +++++++++-----------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index a743dd9..9e69d60 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -2550,18 +2550,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
mUri = openedMedia.getUri();
itemTitle = openedMedia.getTitle();
savedIndexPosition = openedPosition;
- } else {
- /* prepare playback */
- mService.stop();
- if (VLCOptions.isAudioHdmiEnabled() != mHasHdmiAudio) {
- VLCOptions.setAudioHdmiEnabled(mHasHdmiAudio);
- VLCInstance.restart(this);
- mService.restartMediaPlayer();
- }
- if (savedIndexPosition == -1 && mUri != null) {
- mService.load(new MediaWrapper(mUri));
- savedIndexPosition = mService.getCurrentMediaPosition();
- }
}
mCanSeek = false;
@@ -2609,12 +2597,20 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
// Start playback & seek
if (openedPosition == -1) {
- int flags = 0;
+ /* prepare playback */
+ mService.stop();
+ if (VLCOptions.isAudioHdmiEnabled() != mHasHdmiAudio) {
+ VLCOptions.setAudioHdmiEnabled(mHasHdmiAudio);
+ VLCInstance.restart(this);
+ mService.restartMediaPlayer();
+ }
+ final MediaWrapper mw = new MediaWrapper(mUri);
if (wasPaused)
- flags |= VLCOptions.MEDIA_PAUSED;
+ mw.addFlags(VLCOptions.MEDIA_PAUSED);
if (mHardwareAccelerationError)
- flags |= VLCOptions.MEDIA_NO_HWACCEL;
- mService.playIndex(savedIndexPosition, flags);
+ mw.addFlags(VLCOptions.MEDIA_NO_HWACCEL);
+ mService.load(mw);
+ savedIndexPosition = mService.getCurrentMediaPosition();
seek(intentPosition, mediaLength);
} else {
// AudioService-transitioned playback for item after sleep and resume
More information about the Android
mailing list