[open-ils-commits] r14998 - trunk/Open-ILS/web/js/dojo/openils (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Nov 22 14:49:22 EST 2009
Author: erickson
Date: 2009-11-22 14:49:18 -0500 (Sun, 22 Nov 2009)
New Revision: 14998
Modified:
trunk/Open-ILS/web/js/dojo/openils/Util.js
Log:
added a util function to play an audio file via url using the HTML5 <audio> element. no attempt was made to support browsers that don't yet support <audio>
Modified: trunk/Open-ILS/web/js/dojo/openils/Util.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/Util.js 2009-11-22 00:37:42 UTC (rev 14997)
+++ trunk/Open-ILS/web/js/dojo/openils/Util.js 2009-11-22 19:49:18 UTC (rev 14998)
@@ -251,5 +251,17 @@
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);
+ }
+
}
More information about the open-ils-commits
mailing list