Skip to content

Instantly share code, notes, and snippets.

@radzikowski
radzikowski / audiosprite.js
Created May 7, 2012 18:36 — forked from remy/audiosprite.js
An example of how an audio sprite can be used (includes fixes for iOS)
function Track(src, spriteLength, audioLead) {
var track = this,
audio = document.createElement('audio');
audio.src = src;
audio.autobuffer = true;
audio.load();
audio.muted = true; // makes no difference on iOS :(
/* This is the magic. Since we can't preload, and loading requires a user's
input. So we bind a touch event to the body, and fingers crossed, the