Return-Path: X-Original-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8B32D9C15 for ; Wed, 15 Aug 2012 22:11:58 +0000 (UTC) Received: (qmail 85817 invoked by uid 500); 15 Aug 2012 22:11:58 -0000 Delivered-To: apmail-incubator-callback-commits-archive@incubator.apache.org Received: (qmail 85802 invoked by uid 500); 15 Aug 2012 22:11:58 -0000 Mailing-List: contact callback-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-commits@incubator.apache.org Received: (qmail 85794 invoked by uid 99); 15 Aug 2012 22:11:58 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Aug 2012 22:11:58 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 3AE171D7A9; Wed, 15 Aug 2012 22:11:58 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: macdonst@apache.org To: callback-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: js commit: CB-1249: Media.startRecord fires the success callback twice Message-Id: <20120815221158.3AE171D7A9@tyr.zones.apache.org> Date: Wed, 15 Aug 2012 22:11:58 +0000 (UTC) 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 Authored: Wed Aug 15 17:08:22 2012 -0400 Committer: macdonst 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;