From 6336db46edafc45821c6c046faee5d1b90d36169 Mon Sep 17 00:00:00 2001 From: daniel oeh Date: Sat, 18 Aug 2012 14:02:31 +0200 Subject: Made sure that mediaplayeractivity loads progress information as soon as possible --- src/de/danoeh/antennapod/activity/MediaplayerActivity.java | 8 +++++++- src/de/danoeh/antennapod/service/PlaybackService.java | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src/de') diff --git a/src/de/danoeh/antennapod/activity/MediaplayerActivity.java b/src/de/danoeh/antennapod/activity/MediaplayerActivity.java index d8c9c02b9..c55b06855 100644 --- a/src/de/danoeh/antennapod/activity/MediaplayerActivity.java +++ b/src/de/danoeh/antennapod/activity/MediaplayerActivity.java @@ -81,6 +81,12 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity bindToService(); } + @Override + protected void onPause() { + super.onPause(); + mediaInfoLoaded = false; + } + protected OnClickListener playbuttonListener = new OnClickListener() { @Override public void onClick(View v) { @@ -492,7 +498,7 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity txtvPosition.setText(Converter.getDurationStringLong((media .getPosition()))); - if (!playbackService.isShouldStream()) { + if (media.getDuration() != 0) { txtvLength.setText(Converter.getDurationStringLong(media .getDuration())); float progress = ((float) media.getPosition()) diff --git a/src/de/danoeh/antennapod/service/PlaybackService.java b/src/de/danoeh/antennapod/service/PlaybackService.java index d65b0257a..a2c062a64 100644 --- a/src/de/danoeh/antennapod/service/PlaybackService.java +++ b/src/de/danoeh/antennapod/service/PlaybackService.java @@ -432,6 +432,10 @@ public class PlaybackService extends Service { if (AppConfig.DEBUG) Log.d(TAG, "Resource prepared"); mp.seekTo(media.getPosition()); + if (media.getDuration() == 0) { + if (AppConfig.DEBUG) Log.d(TAG, "Setting duration of media"); + media.setDuration(mp.getDuration()); + } setStatus(PlayerStatus.PREPARED); if (startWhenPrepared) { play(); @@ -782,7 +786,7 @@ public class PlaybackService extends Service { } catch (InterruptedException e) { if (AppConfig.DEBUG) Log.d(TAG, - "Threżad was interrupted while waiting. Finishing now..."); + "Thread was interrupted while waiting. Finishing now..."); return null; } catch (IllegalStateException e) { if (AppConfig.DEBUG) -- cgit v1.2.3