diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/de/danoeh/antennapod/service/download/DownloadService.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/de/danoeh/antennapod/service/download/DownloadService.java b/src/de/danoeh/antennapod/service/download/DownloadService.java index c84a6f913..8b090981c 100644 --- a/src/de/danoeh/antennapod/service/download/DownloadService.java +++ b/src/de/danoeh/antennapod/service/download/DownloadService.java @@ -828,8 +828,9 @@ public class DownloadService extends Service { media.setFile_url(request.getDestination()); // Get duration - MediaPlayer mediaplayer = new MediaPlayer(); + MediaPlayer mediaplayer = null; try { + mediaplayer = new MediaPlayer(); mediaplayer.setDataSource(media.getFile_url()); mediaplayer.prepare(); media.setDuration(mediaplayer.getDuration()); @@ -838,8 +839,13 @@ public class DownloadService extends Service { mediaplayer.reset(); } catch (IOException e) { e.printStackTrace(); + } catch (RuntimeException e) { + // Thrown by MediaPlayer initialization on some devices + e.printStackTrace(); } finally { - mediaplayer.release(); + if (mediaplayer != null) { + mediaplayer.release(); + } } if (media.getItem().getChapters() == null) { |