preload="none"
autoplay="autoplay"
loop="loop"
It uses native <audio> where available and an invisible flash player to emulate <audio> for other browsers. It provides a consistent html player UI to all browsers which can be styled used standard css.
Put audio.js
, player-graphics.gif
& audiojs.swf
in the same folder.
Include the audio.js
file:
<script src="/audiojs/audio.min.js"></script>
Initialise audio.js:
<script>
audiojs.events.ready(function() {
var as = audiojs.createAll();
});
</script>
Then you can use <audio>
wherever you like in your HTML:
<audio src="/mp3/juicy.mp3" preload="auto" />
A series of API tests & examples for using and extending audio.js
Example 1 Test multiple load types
Example 2 Custom markup/css
Example 3 Multiple players, testing preload
, loop
& autoplay
attributes
Example 4 Customised player
Example 5 Customised playlist player
With Flash as a fallback, it should work pretty much anywhere.
It has been verified to work across:
ogg
audio.js focuses on playing mp3s. It doesn’t currently support the ogg format. As mp3 is the current defacto music transfer format, ogg support is lower on our list of priorities.