From 3bcd77c0d291485f4ddc80ce20d7f6e5874b2cb6 Mon Sep 17 00:00:00 2001 From: daniel oeh Date: Sun, 5 Aug 2012 14:57:42 +0200 Subject: [PATCH] Switching between players should now work --- .../antennapod/activity/VideoplayerActivity.java | 1 - .../danoeh/antennapod/service/PlaybackService.java | 12 ++++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/de/danoeh/antennapod/activity/VideoplayerActivity.java b/src/de/danoeh/antennapod/activity/VideoplayerActivity.java index 6644cc29b..ba1e434d0 100644 --- a/src/de/danoeh/antennapod/activity/VideoplayerActivity.java +++ b/src/de/danoeh/antennapod/activity/VideoplayerActivity.java @@ -44,7 +44,6 @@ public class VideoplayerActivity extends MediaplayerActivity implements if (videoControlsToggler != null) { videoControlsToggler.cancel(true); } - finish(); } @Override diff --git a/src/de/danoeh/antennapod/service/PlaybackService.java b/src/de/danoeh/antennapod/service/PlaybackService.java index c34874893..53bed27ca 100644 --- a/src/de/danoeh/antennapod/service/PlaybackService.java +++ b/src/de/danoeh/antennapod/service/PlaybackService.java @@ -68,7 +68,7 @@ public class PlaybackService extends Service { public static final String ACTION_PLAYER_NOTIFICATION = "action.de.danoeh.antennapod.service.playerNotification"; public static final String EXTRA_NOTIFICATION_CODE = "extra.de.danoeh.antennapod.service.notificationCode"; public static final String EXTRA_NOTIFICATION_TYPE = "extra.de.danoeh.antennapod.service.notificationType"; - + /** Used in NOTIFICATION_TYPE_RELOAD. */ public static final int EXTRA_CODE_AUDIO = 1; public static final int EXTRA_CODE_VIDEO = 2; @@ -362,8 +362,12 @@ public class PlaybackService extends Service { /** Called after service has extracted the media it is supposed to play. */ private void setupMediaplayer() { + if (AppConfig.DEBUG) + Log.d(TAG, "Setting up media player"); try { if (media.getMime_type().startsWith("audio")) { + if (AppConfig.DEBUG) + Log.d(TAG, "Mime type is audio"); playingVideo = false; if (shouldStream) { player.setDataSource(media.getDownload_url()); @@ -375,6 +379,8 @@ public class PlaybackService extends Service { player.prepare(); } } else if (media.getMime_type().startsWith("video")) { + if (AppConfig.DEBUG) + Log.d(TAG, "Mime type is video"); playingVideo = true; setStatus(PlayerStatus.AWAITING_VIDEO_SURFACE); player.setScreenOnWhilePlaying(true); @@ -485,11 +491,13 @@ public class PlaybackService extends Service { int notificationCode = 0; if (media.getMime_type().startsWith("audio")) { notificationCode = EXTRA_CODE_AUDIO; + playingVideo = false; } else if (media.getMime_type().startsWith("video")) { notificationCode = EXTRA_CODE_VIDEO; } resetVideoSurface(); - sendNotificationBroadcast(NOTIFICATION_TYPE_RELOAD, notificationCode); + sendNotificationBroadcast(NOTIFICATION_TYPE_RELOAD, + notificationCode); } else { if (AppConfig.DEBUG) Log.d(TAG, "Stopping playback");