Currently I'm using soundmanager2 to power sounds in my web app. SoundManager uses Flash, which sometimes crashes, killing sounds. Is there a reliable plugin available in jQuery that powers sounds using HTML5 rather than with Flash?
My Settings:
soundManager.url = '/misc/soundmanager2/v20111220/'; // SoundManager fails if the SWF is loaded from the CDN
soundManager.debugMode = true;
soundManager.flashVersion = 9;
soundManager.useFlashBlock = false;
soundManager.useHTML5Audio = true;
SoundManager can also play pure HTML5 sound.
SoundManager 2 gives you a single, powerful API that supports both new and old, using HTML5 audio where supported and optional Flash-based fallback where needed. Ideally when using SoundManager 2, audio "just works."
Flash is only (optionally) used as fallback. Or for some nifty stuff which isn't (very well) supported (yet) by all browsers. Like a spectrum analyzer etc.
To 'force' SoundManager2 to use HTML5 audio you can add the following parameter:
soundManager.preferFlash = false;
overrides useHTML5audio. if true and flash support present, will try to use flash for MP3/MP4 as needed since HTML5 audio support is still quirky in browsers.
From the official docs.
I suggest jPlayer.
jPlayer is the completely free and open source (GPL/MIT) media library written in JavaScript. A jQuery plugin, jPlayer allows you to rapidly weave cross platform audio and video into your web pages. jPlayer's comprehensive API allows you to create innovative media solutions while support and encouragement is provided by jPlayer's active and growing community.
$(document).ready(function(){
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
m4a: "/media/mysound.mp4",
oga: "/media/mysound.ogg"
});
},
swfPath: "/js",
supplied: "m4a, oga"
});
});
Use the HTML5 Audio tag as shown in this link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With