[Android] VideoPlayerActivity: ensure views are detached before attaching new ones
Thomas Guillem
git at videolan.org
Wed Jul 13 11:53:31 CEST 2016
vlc-android | branch: 2.0.x | Thomas Guillem <thomas at gllm.fr> | Wed Jul 13 11:45:05 2016 +0200| [6d77c4eeedfb21b37df6f29eb43059d8c92ad22a] | committer: Geoffrey Métais
VideoPlayerActivity: ensure views are detached before attaching new ones
(cherry picked from commit 21603a2a35952b74d3bda5d23b5ef9cf37fef266)
> https://code.videolan.org/videolan/vlc-android/commit/6d77c4eeedfb21b37df6f29eb43059d8c92ad22a
---
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 8 ++------
1 file changed, 2 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 235e0cd..dc217d4 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -318,7 +318,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
* (e.g. lock screen, or to restore the pause state)
*/
private boolean mPlaybackStarted = false;
- private boolean mSurfacesAttached = false;
// Tips
private View mOverlayTips;
@@ -742,6 +741,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
final IVLCVout vlcVout = mService.getVLCVout();
if (vlcVout.areViewsAttached() && mService.isPlayingPopup())
mService.stopPlayback();
+ vlcVout.detachViews();
if (mPresentation == null) {
vlcVout.setVideoView(mSurfaceView);
if (mSubtitlesSurfaceView.getVisibility() != View.GONE)
@@ -751,7 +751,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
if (mSubtitlesSurfaceView.getVisibility() != View.GONE)
vlcVout.setSubtitlesView(mPresentation.mSubtitlesSurfaceView);
}
- mSurfacesAttached = true;
vlcVout.addCallback(this);
vlcVout.attachViews();
mService.setVideoTrackEnabled(true);
@@ -854,8 +853,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
mHandler.removeCallbacksAndMessages(null);
final IVLCVout vlcVout = mService.getVLCVout();
vlcVout.removeCallback(this);
- if (mSurfacesAttached)
- vlcVout.detachViews();
+ vlcVout.detachViews();
if(mSwitchingView && mService != null) {
Log.d(TAG, "mLocation = \"" + mUri + "\"");
@@ -1866,7 +1864,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
SurfaceView surface;
SurfaceView subtitlesSurface;
FrameLayout surfaceFrame;
-
if (mPresentation == null) {
surface = mSurfaceView;
subtitlesSurface = mSubtitlesSurfaceView;
@@ -3425,7 +3422,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
@Override
public void onSurfacesDestroyed(IVLCVout vlcVout) {
- mSurfacesAttached = false;
}
@Override
More information about the Android
mailing list