From facb752cc7a43d83354026ab4cb6f6501a433fbf Mon Sep 17 00:00:00 2001 From: macdonst Date: Fri, 26 Aug 2011 00:14:50 +0800 Subject: [PATCH] Fix for Issue #208: Media.release() accidentally makes a call to the Media error callback --- framework/src/com/phonegap/AudioPlayer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/framework/src/com/phonegap/AudioPlayer.java b/framework/src/com/phonegap/AudioPlayer.java index df90795a..0f8c0606 100755 --- a/framework/src/com/phonegap/AudioPlayer.java +++ b/framework/src/com/phonegap/AudioPlayer.java @@ -86,7 +86,10 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On // Stop any play or record if (this.mPlayer != null) { - this.stopPlaying(); + if ((this.state == MEDIA_RUNNING) || (this.state == MEDIA_PAUSED)) { + this.mPlayer.stop(); + this.setState(MEDIA_STOPPED); + } this.mPlayer.release(); this.mPlayer = null; }