cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhigg...@apache.org
Subject git commit: CB-6411 [BlackBerry10] Work around Audio playback issue
Date Tue, 08 Apr 2014 17:52:22 GMT
Repository: cordova-plugin-dialogs
Updated Branches:
  refs/heads/dev 47751e8b0 -> 1e7a12293


CB-6411 [BlackBerry10] Work around Audio playback issue


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/commit/1e7a1229
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/tree/1e7a1229
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/diff/1e7a1229

Branch: refs/heads/dev
Commit: 1e7a122937b23eb19167a92b0c8c7a0fb6cd2a33
Parents: 47751e8
Author: Bryan Higgins <bhiggins@blackberry.com>
Authored: Tue Apr 8 11:17:55 2014 -0400
Committer: Bryan Higgins <bhiggins@blackberry.com>
Committed: Tue Apr 8 11:17:55 2014 -0400

----------------------------------------------------------------------
 www/blackberry10/beep.js | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/1e7a1229/www/blackberry10/beep.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/beep.js b/www/blackberry10/beep.js
index 1b1dedc..6605107 100644
--- a/www/blackberry10/beep.js
+++ b/www/blackberry10/beep.js
@@ -21,19 +21,22 @@
 
 module.exports = function (quantity) {
     var count = 0,
-        beepObj = new Audio('local:///chrome/plugin/org.apache.cordova.dialogs/notification-beep.wav'),
+        beepObj,
+        play = function () { 
+            //create new object every time due to strage playback behaviour
+            beepObj = new Audio('local:///chrome/plugin/org.apache.cordova.dialogs/notification-beep.wav');
+            beepObj.addEventListener("ended", callback);
+            beepObj.play();
+        },
         callback = function () {
             if (--count > 0) {
-                beepObj.play();
+                play();
             } else {
-                beepObj.removeEventListener("ended", callback);
                 delete beepObj;
             }
         };
-
     count += quantity || 1;
     if (count > 0) {
-        beepObj.addEventListener("ended", callback);
-        beepObj.play();
+        play();
     }
 };


Mime
View raw message