[Android] Fix resume video from background

Geoffrey Métais git at videolan.org
Fri Mar 18 15:07:32 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Mar 18 15:05:11 2016 +0100| [ddbcbe2fd654b11b2ebe42ffb2022b8573e6c14d] | committer: Geoffrey Métais

Fix resume video from background

> https://code.videolan.org/videolan/vlc-android/commit/ddbcbe2fd654b11b2ebe42ffb2022b8573e6c14d
---

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java        | 7 ++++---
 1 file changed, 4 insertions(+), 3 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 87e719c..293660b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -2785,7 +2785,10 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
             }
 
             // Start playback & seek
-            if (openedPosition == -1) {
+            mService.addCallback(this);
+            if (mService.isPlaying() && mService.getCurrentMediaWrapper().hasFlag(MediaWrapper.MEDIA_VIDEO)) {
+                onPlaying();
+            } else if (openedPosition == -1) {
                 /* prepare playback */
                 mService.stop();
                 final MediaWrapper mw = new MediaWrapper(mUri);
@@ -2795,11 +2798,9 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
                     mw.addFlags(MediaWrapper.MEDIA_NO_HWACCEL);
                 mw.removeFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
                 mw.addFlags(MediaWrapper.MEDIA_VIDEO);
-                mService.addCallback(this);
                 mService.load(mw);
             } else {
                 mService.getCurrentMediaWrapper().addFlags(MediaWrapper.MEDIA_VIDEO);
-                mService.addCallback(this);
                 // AudioService-transitioned playback for item after sleep and resume
                 if(!mService.isPlaying())
                     mService.playIndex(openedPosition);



More information about the Android mailing list