audioclip
v0.2.0
Published
Easily load and play all or part of short audio files in the browser.
Downloads
10
Readme
Audioclip
Easily load and play (over and over again if you like) all or part of short(ish) audio files in the browser.
Uses the Web Audio API when available (which supports precise play length and multiple instances of the same sound playing at once), otherwise falls back to HTML5 <audio> tags. If those aren't available either (Internet Explorer 8 and below, basically), a graceful degradation to silence occurs.
API
var clip = new AudioClip(url); // Load the clip
clip.play(); // Play entire clip
clip.play(start_time_in_seconds); // Play clip from start time to end
clip.play(start_time_in_seconds, duration_in_seconds); // Play clip from start time to start time + duration
Licence
MIT