diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2016-12-19 18:18:50 +0100 |
---|---|---|
committer | Martin Fietz <Martin.Fietz@gmail.com> | 2016-12-19 18:18:50 +0100 |
commit | b24201696213fb9baf1d34b593d376d717a31c9f (patch) | |
tree | d22ab381e445096c631582c230c57b7240e7c47f /core | |
parent | e7c69534ddbb0acbb587d607cd5aa724e35e585b (diff) | |
download | AntennaPod-b24201696213fb9baf1d34b593d376d717a31c9f.zip |
Assume media type is audio when mime type is unknown
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java index dd7bba964..f395dfb32 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java @@ -852,27 +852,24 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer { } private IPlayer setMediaPlayerListeners(IPlayer mp) { - if (mp != null && media != null) { - if (media.getMediaType() == MediaType.AUDIO) { - ((AudioPlayer) mp) - .setOnCompletionListener(audioCompletionListener); - ((AudioPlayer) mp) - .setOnSeekCompleteListener(audioSeekCompleteListener); - ((AudioPlayer) mp).setOnErrorListener(audioErrorListener); - ((AudioPlayer) mp) - .setOnBufferingUpdateListener(audioBufferingUpdateListener); - ((AudioPlayer) mp).setOnInfoListener(audioInfoListener); - ((AudioPlayer) mp).setOnSpeedAdjustmentAvailableChangedListener(audioSetSpeedAbilityListener); - } else { - ((VideoPlayer) mp) - .setOnCompletionListener(videoCompletionListener); - ((VideoPlayer) mp) - .setOnSeekCompleteListener(videoSeekCompleteListener); - ((VideoPlayer) mp).setOnErrorListener(videoErrorListener); - ((VideoPlayer) mp) - .setOnBufferingUpdateListener(videoBufferingUpdateListener); - ((VideoPlayer) mp).setOnInfoListener(videoInfoListener); - } + if (mp == null || media == null) { + return mp; + } + if (media.getMediaType() == MediaType.VIDEO) { + VideoPlayer vp = (VideoPlayer) mp; + vp.setOnCompletionListener(videoCompletionListener); + vp.setOnSeekCompleteListener(videoSeekCompleteListener); + vp.setOnErrorListener(videoErrorListener); + vp.setOnBufferingUpdateListener(videoBufferingUpdateListener); + vp.setOnInfoListener(videoInfoListener); + } else { + AudioPlayer ap = (AudioPlayer) mp; + ap.setOnCompletionListener(audioCompletionListener); + ap.setOnSeekCompleteListener(audioSeekCompleteListener); + ap.setOnErrorListener(audioErrorListener); + ap.setOnBufferingUpdateListener(audioBufferingUpdateListener); + ap.setOnInfoListener(audioInfoListener); + ap.setOnSpeedAdjustmentAvailableChangedListener(audioSetSpeedAbilityListener); } return mp; } |