diff options
author | Scott Jackson <daneren2005@gmail.com> | 2016-10-31 16:59:14 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2016-10-31 16:59:14 -0700 |
commit | c53feba5ff570adf80d3971d91ab70958e4b6f14 (patch) | |
tree | bea1e4508e5c155a8d74a33fcce7248838a7c60e | |
parent | ed010a2188f58e0581a95506cf7eecc1cac35d9c (diff) | |
download | dsub-c53feba5ff570adf80d3971d91ab70958e4b6f14.tar.gz dsub-c53feba5ff570adf80d3971d91ab70958e4b6f14.tar.bz2 dsub-c53feba5ff570adf80d3971d91ab70958e4b6f14.zip |
Wrap applyMediaPlabackParams in try/catch block
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/service/DownloadService.java | 12 |
1 files 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); } } } |