cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [11/50] js commit: [CB-2287] - fix for checking that the audio.src are defined in the right places
Date Tue, 12 Feb 2013 19:33:07 GMT
[CB-2287] - fix for checking that the audio.src are defined in the right places


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

Branch: refs/heads/symbolmapping
Commit: d1b4a2002c48cd40aee55fc2ea6335fa5255b905
Parents: a089aa7
Author: Tim Kim <timk@adobe.com>
Authored: Mon Jan 28 18:22:34 2013 -0800
Committer: Tim Kim <timk@adobe.com>
Committed: Fri Feb 1 13:17:36 2013 -0800

----------------------------------------------------------------------
 lib/blackberry/plugin/webworks/media.js |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/d1b4a200/lib/blackberry/plugin/webworks/media.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/webworks/media.js b/lib/blackberry/plugin/webworks/media.js
index 62c2b1c..21c2328 100644
--- a/lib/blackberry/plugin/webworks/media.js
+++ b/lib/blackberry/plugin/webworks/media.js
@@ -30,8 +30,13 @@ module.exports = {
 
         var id = args[0],
             src = args[1];
+        
+        if (typeof src == "undefined"){
+            audioObjects[id] = new Audio();
+        } else {
+            audioObjects[id] = new Audio(src);
+        }
 
-        audioObjects[id] = new Audio(src);
         return {"status" : 1, "message" : "Audio object created" };
     },
     startPlayingAudio: function (args, win, fail) {
@@ -43,7 +48,7 @@ module.exports = {
             audio = audioObjects[id],
             result;
 
-        if (args.length === 1) {
+        if (args.length === 1 || typeof args[1] == "undefined" ) {
             return {"status" : 9, "message" : "Media source argument not found"};
         }
 
@@ -54,7 +59,6 @@ module.exports = {
 
         audio = audioObjects[id] = new Audio(args[1]);
         audio.play();
-
         return {"status" : 1, "message" : "Audio play started" };
     },
     stopPlayingAudio: function (args, win, fail) {
@@ -171,8 +175,10 @@ module.exports = {
             result;
 
         if (audio) {
+            if(audio.src !== ""){
+                audio.src = undefined;
+            }
             audioObjects[id] = undefined;
-            audio.src = undefined;
             //delete audio;
         }
 


Mime
View raw message