Reputation: 319
I am using the Audio class to play a sound in an AJAX chat when there's a new message. My code:
if ( ! $.browser.msie || ( $.browser.msie && parseFloat(jQuery.browser.version) >= 9 ) )
{
//var notif = new Audio('http://cycle1500.com/sounds/infbego.wav');
var notif = new Audio('/media/sounds/drip.wav');
notif.play();
}
var notif = new
Audio('http://cycle1500.com/sounds/infbego.wav');
works
var notif = new Audio('/media/sounds/drip.wav');
doesn't workUpvotes: 0
Views: 2390
Reputation: 20419
You can use HTML5
<audio>
tag in you application, this will be supported in recent browser version and to support older version you can create fallback.
Clear and beautiful documentation is here.Have a look .
http://html5doctor.com/native-audio-in-the-browser/
Upvotes: 2