PlaybackService crashed when media file was incorrect/not found
This commit is contained in:
parent
46459b7c43
commit
462ff3cadc
|
@ -1282,18 +1282,20 @@ public class PlaybackService extends Service {
|
|||
isPlaying = true;
|
||||
}
|
||||
|
||||
Intent i = new Intent(AVRCP_ACTION_PLAYER_STATUS_CHANGED);
|
||||
i.putExtra("id", 1);
|
||||
i.putExtra("artist", "");
|
||||
i.putExtra("album", media.getFeedTitle());
|
||||
i.putExtra("track", media.getEpisodeTitle());
|
||||
i.putExtra("playing", isPlaying);
|
||||
if (queue != null) {
|
||||
i.putExtra("ListSize", queue.size());
|
||||
if (media != null) {
|
||||
Intent i = new Intent(AVRCP_ACTION_PLAYER_STATUS_CHANGED);
|
||||
i.putExtra("id", 1);
|
||||
i.putExtra("artist", "");
|
||||
i.putExtra("album", media.getFeedTitle());
|
||||
i.putExtra("track", media.getEpisodeTitle());
|
||||
i.putExtra("playing", isPlaying);
|
||||
if (queue != null) {
|
||||
i.putExtra("ListSize", queue.size());
|
||||
}
|
||||
i.putExtra("duration", media.getDuration());
|
||||
i.putExtra("position", media.getPosition());
|
||||
sendBroadcast(i);
|
||||
}
|
||||
i.putExtra("duration", media.getDuration());
|
||||
i.putExtra("position", media.getPosition());
|
||||
sendBroadcast(i);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -80,8 +80,13 @@ public class ExternalMedia implements Playable {
|
|||
.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);
|
||||
feedTitle = mmr
|
||||
.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM);
|
||||
duration = Integer.parseInt(mmr
|
||||
try {
|
||||
duration = Integer.parseInt(mmr
|
||||
.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION));
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
throw new PlayableException("NumberFormatException when reading duration of media file");
|
||||
}
|
||||
ChapterUtils.loadChaptersFromFileUrl(this);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue