From 4f45881ebf156f7f3f3888421c639dcf75c35b1d Mon Sep 17 00:00:00 2001 From: Brian Wernick Date: Wed, 17 Feb 2016 17:41:05 -0700 Subject: [PATCH] Fixed an issue where the stopPlayback methods wouldn't call the stop function for the ExoPlayer --- .../java/com/devbrackets/android/exomedia/EMAudioPlayer.java | 2 +- .../java/com/devbrackets/android/exomedia/EMVideoView.java | 2 +- .../devbrackets/android/exomedia/exoplayer/EMExoPlayer.java | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/devbrackets/android/exomedia/EMAudioPlayer.java b/library/src/main/java/com/devbrackets/android/exomedia/EMAudioPlayer.java index ba3474b1..2134f810 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/EMAudioPlayer.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/EMAudioPlayer.java @@ -473,7 +473,7 @@ public void stopPlayback() { if (!useExo) { mediaPlayer.stop(); } else { - emExoPlayer.setPlayWhenReady(false); + emExoPlayer.stop(); } stopProgressPoll(); diff --git a/library/src/main/java/com/devbrackets/android/exomedia/EMVideoView.java b/library/src/main/java/com/devbrackets/android/exomedia/EMVideoView.java index 27379777..f73d3359 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/EMVideoView.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/EMVideoView.java @@ -962,7 +962,7 @@ public void stopPlayback() { if (!useExo) { videoView.stopPlayback(); } else { - emExoPlayer.setPlayWhenReady(false); + emExoPlayer.stop(); } if (defaultControls != null) { diff --git a/library/src/main/java/com/devbrackets/android/exomedia/exoplayer/EMExoPlayer.java b/library/src/main/java/com/devbrackets/android/exomedia/exoplayer/EMExoPlayer.java index f22ff605..db544bd6 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/exoplayer/EMExoPlayer.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/exoplayer/EMExoPlayer.java @@ -260,6 +260,11 @@ public void seekTo(long positionMs) { player.seekTo(positionMs); } + public void stop() { + player.setPlayWhenReady(false); + player.stop(); + } + public void release() { if (rendererBuilder != null) { rendererBuilder.cancel();