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 aaab579a2..86d4ec642 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java @@ -278,9 +278,6 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements @Override protected void onStart() { super.onStart(); - if (controller != null) { - controller.release(); - } controller = newPlaybackController(); controller.init(); loadMediaInfo(); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java index 2c35bdba4..508659f65 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java @@ -143,6 +143,7 @@ public class ExternalPlayerFragment extends Fragment { @Override public void onStart() { super.onStart(); + controller = setupPlaybackController(); controller.init(); EventBus.getDefault().register(this); } @@ -152,6 +153,7 @@ public class ExternalPlayerFragment extends Fragment { super.onStop(); if (controller != null) { controller.release(); + controller = null; } EventBus.getDefault().unregister(this); } @@ -233,7 +235,7 @@ public class ExternalPlayerFragment extends Fragment { .into(imgvCover); fragmentLayout.setVisibility(View.VISIBLE); - if (controller.isPlayingVideoLocally()) { + if (controller != null && controller.isPlayingVideoLocally()) { butPlay.setVisibility(View.GONE); } else { butPlay.setVisibility(View.VISIBLE); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java index 27ffb0a70..9cee59531 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java @@ -251,7 +251,7 @@ public class ItemDescriptionFragment extends Fragment { SharedPreferences prefs = getActivity().getSharedPreferences(PREF, Activity.MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); - if (controller.getMedia() != null && webvDescription != null) { + if (controller != null && controller.getMedia() != null && webvDescription != null) { Log.d(TAG, "Saving scroll position: " + webvDescription.getScrollY()); editor.putInt(PREF_SCROLL_Y, webvDescription.getScrollY()); editor.putString(PREF_PLAYABLE_ID, controller.getMedia().getIdentifier() @@ -272,7 +272,7 @@ public class ItemDescriptionFragment extends Fragment { PREF, Activity.MODE_PRIVATE); String id = prefs.getString(PREF_PLAYABLE_ID, ""); int scrollY = prefs.getInt(PREF_SCROLL_Y, -1); - if (scrollY != -1 && controller.getMedia() != null + if (controller != null && scrollY != -1 && controller.getMedia() != null && id.equals(controller.getMedia().getIdentifier().toString()) && webvDescription != null) { Log.d(TAG, "Restored scroll Position: " + scrollY);