added a util function to play an audio file via url using the HTML5 <audio> element...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 22 Nov 2009 19:49:18 +0000 (19:49 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 22 Nov 2009 19:49:18 +0000 (19:49 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@14998 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/Util.js

index 9d16036..b9e4a49 100644 (file)
@@ -251,5 +251,17 @@ if(!dojo._hasResource["openils.Util"]) {
         node.appendChild(child);
     };
 
+    /**
+     * Plays a sound file via URL.  Only works with browsers
+     * that support HTML 5 <audio> element.  E.g. Firefox 3.5
+     */
+    openils.Util.playAudioUrl = function(urlString) {
+        var audio = document.createElement('audio');
+        audio.setAttribute('src', urlString);
+        audio.setAttribute('autoplay', 'true');
+        document.body.appendChild(audio);
+        document.body.removeChild(audio);
+    }
+
 }