You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by br...@apache.org on 2012/09/25 22:14:00 UTC

[3/8] ios commit: Add onReset to CDVSound.

Add onReset to CDVSound.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/8fd987ef
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/8fd987ef
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/8fd987ef

Branch: refs/heads/master
Commit: 8fd987efe9710b21d57d921eb4b07acb40ff0b33
Parents: 17930ab
Author: Braden Shepherdson <br...@chromium.org>
Authored: Tue Sep 25 15:41:34 2012 -0400
Committer: Braden Shepherdson <br...@chromium.org>
Committed: Tue Sep 25 15:41:34 2012 -0400

----------------------------------------------------------------------
 CordovaLib/Classes/CDVSound.m |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/8fd987ef/CordovaLib/Classes/CDVSound.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVSound.m b/CordovaLib/Classes/CDVSound.m
index ccff3e3..37579bd 100644
--- a/CordovaLib/Classes/CDVSound.m
+++ b/CordovaLib/Classes/CDVSound.m
@@ -632,6 +632,22 @@
     [[self soundCache] removeAllObjects];
 }
 
+- (void)onReset
+{
+    for (CDVAudioFile* audioFile in [[self soundCache] allValues]) {
+        if (audioFile != nil) {
+            if (audioFile.player != nil) {
+                [audioFile.player stop];
+                audioFile.player.currentTime = 0;
+            }
+            if (audioFile.recorder != nil) {
+                [audioFile.recorder stop];
+            }
+        }
+    }
+    [[self soundCache] removeAllObjects];
+}
+
 @end
 
 @implementation CDVAudioFile