From c53feba5ff570adf80d3971d91ab70958e4b6f14 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Mon, 31 Oct 2016 16:59:14 -0700 Subject: Wrap applyMediaPlabackParams in try/catch block --- .../github/daneren2005/dsub/service/DownloadService.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java index a99613b4..6d85d128 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java +++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java @@ -2690,10 +2690,14 @@ public class DownloadService extends Service { if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { float playbackSpeed = getPlaybackSpeed(); - if(Math.abs(playbackSpeed - 1.0) > 0.01 || mediaPlayer.getPlaybackParams() != null) { - PlaybackParams playbackParams = new PlaybackParams(); - playbackParams.setSpeed(playbackSpeed); - mediaPlayer.setPlaybackParams(playbackParams); + try { + if (Math.abs(playbackSpeed - 1.0) > 0.01 || mediaPlayer.getPlaybackParams() != null) { + PlaybackParams playbackParams = new PlaybackParams(); + playbackParams.setSpeed(playbackSpeed); + mediaPlayer.setPlaybackParams(playbackParams); + } + } catch(Exception e) { + Log.e(TAG, "Error while applying media player params", e); } } } -- cgit v1.2.3