[Android] Detach vout views only if needed

Geoffrey Métais git at videolan.org
Thu Nov 17 17:59:53 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Nov 16 18:13:33 2016 +0100| [0db3ad89ec55583c0f5b15acbbc803f4502a3e4d] | committer: Geoffrey Métais

Detach vout views only if needed

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

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 13 +++++++------
 1 file changed, 7 insertions(+), 6 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 ac1b70a..2836cd7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -775,9 +775,11 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         mPlaybackStarted = true;
 
         final IVLCVout vlcVout = mService.getVLCVout();
-        if (vlcVout.areViewsAttached() && mService.isPlayingPopup())
-            mService.stopPlayback();
-        vlcVout.detachViews();
+        if (vlcVout.areViewsAttached()) {
+            if (mService.isPlayingPopup())
+                mService.stopPlayback();
+            vlcVout.detachViews();
+        }
         if (mPresentation == null) {
             vlcVout.setVideoView(mSurfaceView);
             if (mSubtitlesSurfaceView.getVisibility() != View.GONE)
@@ -2982,7 +2984,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
             media.removeFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
             media.addFlags(MediaWrapper.MEDIA_VIDEO);
 
-            if (savedTime <= 0L && media != null && media.getTime() > 0L)
+            if (savedTime <= 0L && media.getTime() > 0L)
                 savedTime = media.getTime();
             if (savedTime > 0L && !mService.isPlaying())
                 mService.saveTimeToSeek(savedTime);
@@ -2992,9 +2994,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
                 mService.load(media);
             else if (!mService.isPlaying())
                 mService.playIndex(positionInPlaylist);
-            else {
+            else
                 onPlaying();
-            }
 
             // Get possible subtitles
             getSubtitles();



More information about the Android mailing list