bugfix - video playback upon press back button (and pause), playback notification might reappear if one swipes it away quickly.
This commit is contained in:
parent
7a905c0570
commit
6f7b937d07
|
@ -47,6 +47,7 @@ public class VideoplayerActivity extends MediaplayerActivity {
|
||||||
*/
|
*/
|
||||||
private boolean videoControlsShowing = true;
|
private boolean videoControlsShowing = true;
|
||||||
private boolean videoSurfaceCreated = false;
|
private boolean videoSurfaceCreated = false;
|
||||||
|
private boolean playbackStoppedUponExitVideo = false;
|
||||||
private boolean destroyingDueToReload = false;
|
private boolean destroyingDueToReload = false;
|
||||||
|
|
||||||
private VideoControlsHider videoControlsHider = new VideoControlsHider(this);
|
private VideoControlsHider videoControlsHider = new VideoControlsHider(this);
|
||||||
|
@ -77,6 +78,7 @@ public class VideoplayerActivity extends MediaplayerActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
playbackStoppedUponExitVideo = false;
|
||||||
if (TextUtils.equals(getIntent().getAction(), Intent.ACTION_VIEW)) {
|
if (TextUtils.equals(getIntent().getAction(), Intent.ACTION_VIEW)) {
|
||||||
playExternalMedia(getIntent(), MediaType.VIDEO);
|
playExternalMedia(getIntent(), MediaType.VIDEO);
|
||||||
} else if (PlaybackService.isCasting()) {
|
} else if (PlaybackService.isCasting()) {
|
||||||
|
@ -99,6 +101,16 @@ public class VideoplayerActivity extends MediaplayerActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
void stopPlaybackIfUserPreferencesSpecified() {
|
void stopPlaybackIfUserPreferencesSpecified() {
|
||||||
|
// to avoid the method being called twice during leaving Videoplayer
|
||||||
|
// , which will double-pause the media
|
||||||
|
// (it is usually first called by surfaceHolderCallback.surfaceDestroyed(),
|
||||||
|
// then VideoplayerActivity.onStop() , but sometimes VideoplayerActivity.onStop()
|
||||||
|
// will first be invoked.)
|
||||||
|
if (playbackStoppedUponExitVideo) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
playbackStoppedUponExitVideo = true;
|
||||||
|
|
||||||
if (controller != null && !destroyingDueToReload
|
if (controller != null && !destroyingDueToReload
|
||||||
&& UserPreferences.getVideoBackgroundBehavior()
|
&& UserPreferences.getVideoBackgroundBehavior()
|
||||||
!= UserPreferences.VideoBackgroundBehavior.CONTINUE_PLAYING) {
|
!= UserPreferences.VideoBackgroundBehavior.CONTINUE_PLAYING) {
|
||||||
|
|
Loading…
Reference in New Issue