summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorDomingos Lopes <domingos86lopes+github@gmail.com>2016-04-22 22:36:57 -0400
committerDomingos Lopes <domingos86lopes+github@gmail.com>2016-04-24 22:06:28 -0400
commite79a0773130d6455ab2196ce4fc098c9f7746293 (patch)
tree5d752c3e5d0f3387c4034b422fa1b7bc28a1ff23 /core/src
parent1a33830991b26fb306ef231e692eebdbd53e6683 (diff)
downloadAntennaPod-e79a0773130d6455ab2196ce4fc098c9f7746293.zip
fix the force close issue when starting casting from the video player
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java9
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/service/playback/RemotePSMP.java2
2 files changed, 6 insertions, 5 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java
index 598fc5eab..2a3e225ba 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java
@@ -1520,7 +1520,7 @@ public class PlaybackService extends Service {
info = new PlaybackServiceMediaPlayer.PSMPInfo(PlayerStatus.STOPPED, null);
}
switchMediaPlayer(new LocalPSMP(PlaybackService.this, mediaPlayerCallback),
- info, false);
+ info, true);
if (info.playable != null) {
sendNotificationBroadcast(NOTIFICATION_TYPE_RELOAD,
info.playable.getMediaType() == MediaType.AUDIO ? EXTRA_CODE_AUDIO : EXTRA_CODE_VIDEO);
@@ -1622,8 +1622,9 @@ public class PlaybackService extends Service {
private void onCastAppConnected(boolean wasLaunched) {
Log.d(TAG, "A cast device application was " + (wasLaunched ? "launched" : "joined"));
isCasting = true;
+ PlaybackServiceMediaPlayer.PSMPInfo info = null;
if (mediaPlayer != null) {
- PlaybackServiceMediaPlayer.PSMPInfo info = mediaPlayer.getPSMPInfo();
+ info = mediaPlayer.getPSMPInfo();
if (info.playerStatus == PlayerStatus.PLAYING) {
// could be pause, but this way we make sure the new player will get the correct position,
// since pause runs asynchronously and we could be directing the new player to play even before
@@ -1631,11 +1632,11 @@ public class PlaybackService extends Service {
saveCurrentPosition(false, 0);
}
}
+ sendNotificationBroadcast(NOTIFICATION_TYPE_RELOAD, EXTRA_CODE_CAST);
switchMediaPlayer(new RemotePSMP(PlaybackService.this, mediaPlayerCallback),
- (mediaPlayer != null) ? mediaPlayer.getPSMPInfo() :
+ (info != null) ? info :
new PlaybackServiceMediaPlayer.PSMPInfo(PlayerStatus.STOPPED, null),
wasLaunched);
- sendNotificationBroadcast(NOTIFICATION_TYPE_RELOAD, EXTRA_CODE_CAST);
// hardware volume buttons control the remote device volume
mediaRouter.setMediaSessionCompat(mediaSession);
registerWifiBroadcastReceiver();
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/RemotePSMP.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/RemotePSMP.java
index 2a9df4a75..96dbe9033 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/RemotePSMP.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/RemotePSMP.java
@@ -482,7 +482,7 @@ public class RemotePSMP extends PlaybackServiceMediaPlayer {
@Override
public void resetVideoSurface() {
- throw new UnsupportedOperationException("Resetting Video Surface unsupported in Remote Media Player");
+ Log.e(TAG, "Resetting Video Surface unsupported in Remote Media Player");
}
@Override