diff options
author | Domingos Lopes <domingos86lopes+github@gmail.com> | 2016-04-17 02:12:44 -0400 |
---|---|---|
committer | Domingos Lopes <domingos86lopes+github@gmail.com> | 2016-04-24 22:06:26 -0400 |
commit | 9939f8f4612746d10064134e62e3b771c5e83bf3 (patch) | |
tree | 85cd052717db3edfa69f4456fb7cac0479269856 /core | |
parent | 376ffed56caea63bf6e30e9320df5e5cf5d85cfe (diff) | |
download | AntennaPod-9939f8f4612746d10064134e62e3b771c5e83bf3.zip |
change references to PSMPInfo out of LocalPSMP
make video playback callback dependent on casting
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java index 03f0ab497..246be7297 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java @@ -34,8 +34,8 @@ import de.danoeh.antennapod.core.feed.FeedMedia; import de.danoeh.antennapod.core.feed.MediaType; import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences; -import de.danoeh.antennapod.core.service.playback.LocalPSMP; import de.danoeh.antennapod.core.service.playback.PlaybackService; +import de.danoeh.antennapod.core.service.playback.PlaybackServiceMediaPlayer; import de.danoeh.antennapod.core.service.playback.PlayerStatus; import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.util.Converter; @@ -176,7 +176,7 @@ public abstract class PlaybackController { if(serviceBinder != null) { serviceBinder.unsubscribe(); } - serviceBinder = Observable.fromCallable(() -> getPlayLastPlayedMediaIntent()) + serviceBinder = Observable.fromCallable(this::getPlayLastPlayedMediaIntent) .subscribeOn(Schedulers.newThread()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(intent -> { @@ -281,7 +281,7 @@ public abstract class PlaybackController { public void onReceive(Context context, Intent intent) { Log.d(TAG, "Received statusUpdate Intent."); if (isConnectedToPlaybackService()) { - LocalPSMP.PSMPInfo info = playbackService.getPSMPInfo(); + PlaybackServiceMediaPlayer.PSMPInfo info = playbackService.getPSMPInfo(); status = info.playerStatus; media = info.playable; handleStatus(); @@ -392,7 +392,7 @@ public abstract class PlaybackController { } /** - * Is called whenever the PlaybackService changes it's status. This method + * Is called whenever the PlaybackService changes its status. This method * should be used to update the GUI or start/cancel background threads. */ private void handleStatus() { @@ -424,14 +424,16 @@ public abstract class PlaybackController { cancelPositionObserver(); onPositionObserverUpdate(); updatePlayButtonAppearance(playResource, playText); - if (PlaybackService.getCurrentMediaType() == MediaType.VIDEO) { + if (!PlaybackService.isCasting() && + PlaybackService.getCurrentMediaType() == MediaType.VIDEO) { setScreenOn(false); } break; case PLAYING: clearStatusMsg(); checkMediaInfoLoaded(); - if (PlaybackService.getCurrentMediaType() == MediaType.VIDEO) { + if (!PlaybackService.isCasting() && + PlaybackService.getCurrentMediaType() == MediaType.VIDEO) { onAwaitingVideoSurface(); setScreenOn(true); } @@ -502,8 +504,9 @@ public abstract class PlaybackController { private void queryService() { Log.d(TAG, "Querying service info"); if (playbackService != null) { - status = playbackService.getStatus(); - media = playbackService.getPlayable(); + PlaybackServiceMediaPlayer.PSMPInfo info = playbackService.getPSMPInfo(); + status = info.playerStatus; + media = info.playable; /* if (media == null) { Log.w(TAG, @@ -712,6 +715,7 @@ public abstract class PlaybackController { } } + // TODO this method probably needs to change public boolean isPlayingVideo() { return playbackService != null && PlaybackService.getCurrentMediaType() == MediaType.VIDEO; } |