You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ma...@apache.org on 2012/08/16 00:11:58 UTC

js commit: CB-1249: Media.startRecord fires the success callback twice

Updated Branches:
  refs/heads/master ed3a8eaf5 -> b4c5682f7


CB-1249: Media.startRecord fires the success callback twice


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

Branch: refs/heads/master
Commit: b4c5682f7654ba01a1de2e6bd565e06acbac456a
Parents: ed3a8ea
Author: macdonst <si...@gmail.com>
Authored: Wed Aug 15 17:08:22 2012 -0400
Committer: macdonst <si...@gmail.com>
Committed: Wed Aug 15 17:08:22 2012 -0400

----------------------------------------------------------------------
 lib/common/plugin/Media.js |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/b4c5682f/lib/common/plugin/Media.js
----------------------------------------------------------------------
diff --git a/lib/common/plugin/Media.js b/lib/common/plugin/Media.js
index f30164b..50b3bfe 100644
--- a/lib/common/plugin/Media.js
+++ b/lib/common/plugin/Media.js
@@ -125,14 +125,14 @@ Media.prototype.getCurrentPosition = function(success, fail) {
  * Start recording audio file.
  */
 Media.prototype.startRecord = function() {
-    exec(this.successCallback, this.errorCallback, "Media", "startRecordingAudio", [this.id, this.src]);
+    exec(null, this.errorCallback, "Media", "startRecordingAudio", [this.id, this.src]);
 };
 
 /**
  * Stop recording audio file.
  */
 Media.prototype.stopRecord = function() {
-    exec(this.successCallback, this.errorCallback, "Media", "stopRecordingAudio", [this.id]);
+    exec(null, this.errorCallback, "Media", "stopRecordingAudio", [this.id]);
 };
 
 /**
@@ -161,14 +161,14 @@ Media.onStatus = function(id, msg, value) {
     var media = mediaObjects[id];
     // If state update
     if (msg === Media.MEDIA_STATE) {
+        if (media.statusCallback) {
+            media.statusCallback(value);
+        }
         if (value === Media.MEDIA_STOPPED) {
             if (media.successCallback) {
                 media.successCallback();
             }
         }
-        if (media.statusCallback) {
-            media.statusCallback(value);
-        }
     }
     else if (msg === Media.MEDIA_DURATION) {
         media._duration = value;