Made sure that mediaplayeractivity loads progress information as soon as

possible
This commit is contained in:
daniel oeh 2012-08-18 14:02:31 +02:00
parent bd2d65f6f9
commit 6336db46ed
2 changed files with 12 additions and 2 deletions

View File

@ -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())

View File

@ -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)