diff options
author | Tom Hennen <TomHennen@users.noreply.github.com> | 2016-05-02 10:33:57 -0400 |
---|---|---|
committer | Tom Hennen <TomHennen@users.noreply.github.com> | 2016-05-02 10:33:57 -0400 |
commit | 935192d1dcd23d6598c9f62087ae31b4f11baeba (patch) | |
tree | 73756a0a37a03e4e848a8c9224498c8eeaace5a3 /app/src/main/java/de/danoeh | |
parent | c4b0df6f09a379ff311ccab1e8e6517ae375a5ff (diff) | |
parent | 96c3594806b96564cd4af860f3706266d43013b4 (diff) | |
download | AntennaPod-935192d1dcd23d6598c9f62087ae31b4f11baeba.zip |
Merge pull request #1903 from domingos86/playback-pausing-fix
avoid stopping playback after skipping (and changing media type)
Diffstat (limited to 'app/src/main/java/de/danoeh')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java | 4 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java | 14 |
2 files changed, 12 insertions, 6 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java index 8ee91c7a3..71d288725 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java @@ -211,11 +211,11 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements @Override protected void onPause() { - super.onPause(); if(controller != null) { controller.reinitServiceIfPaused(); controller.pause(); } + super.onPause(); } /** @@ -257,12 +257,12 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements @Override protected void onStop() { - super.onStop(); Log.d(TAG, "onStop()"); if (controller != null) { controller.release(); controller = null; // prevent leak } + super.onStop(); } @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) diff --git a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java index a52382dea..a4ffebae2 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java @@ -41,6 +41,7 @@ public class VideoplayerActivity extends MediaplayerActivity { */ private boolean videoControlsShowing = true; private boolean videoSurfaceCreated = false; + private boolean destroyingDueToReload = false; private VideoControlsHider videoControlsHider = new VideoControlsHider(this); @@ -86,6 +87,7 @@ public class VideoplayerActivity extends MediaplayerActivity { } else if (PlaybackService.isCasting()) { Intent intent = PlaybackService.getPlayerActivityIntent(this); if (!intent.getComponent().getClassName().equals(VideoplayerActivity.class.getName())) { + destroyingDueToReload = true; finish(); startActivity(intent); } @@ -94,18 +96,18 @@ public class VideoplayerActivity extends MediaplayerActivity { @Override protected void onPause() { - super.onPause(); videoControlsHider.stop(); if (controller != null && controller.getStatus() == PlayerStatus.PLAYING) { controller.pause(); } + super.onPause(); } @Override protected void onDestroy() { - super.onDestroy(); videoControlsHider.stop(); videoControlsHider = null; + super.onDestroy(); } @Override @@ -242,7 +244,7 @@ public class VideoplayerActivity extends MediaplayerActivity { if (controller.serviceAvailable()) { controller.setVideoSurface(holder); } else { - Log.e(TAG, "Could'nt attach surface to mediaplayer - reference to service was null"); + Log.e(TAG, "Couldn't attach surface to mediaplayer - reference to service was null"); } } @@ -252,7 +254,9 @@ public class VideoplayerActivity extends MediaplayerActivity { public void surfaceDestroyed(SurfaceHolder holder) { Log.d(TAG, "Videosurface was destroyed"); videoSurfaceCreated = false; - controller.notifyVideoSurfaceAbandoned(); + if (!destroyingDueToReload) { + controller.notifyVideoSurfaceAbandoned(); + } } }; @@ -261,10 +265,12 @@ public class VideoplayerActivity extends MediaplayerActivity { protected void onReloadNotification(int notificationCode) { if (notificationCode == PlaybackService.EXTRA_CODE_AUDIO) { Log.d(TAG, "ReloadNotification received, switching to Audioplayer now"); + destroyingDueToReload = true; finish(); startActivity(new Intent(this, AudioplayerActivity.class)); } else if (notificationCode == PlaybackService.EXTRA_CODE_CAST) { Log.d(TAG, "ReloadNotification received, switching to Castplayer now"); + destroyingDueToReload = true; finish(); startActivity(new Intent(this, CastplayerActivity.class)); } |