Skip to content

Instantly share code, notes, and snippets.

@evilpie
Created March 14, 2011 20:06
Show Gist options
  • Save evilpie/869766 to your computer and use it in GitHub Desktop.
Save evilpie/869766 to your computer and use it in GitHub Desktop.
var video = document.getElementsByTagName('video')[0];
var audio = new Audio();
function saveMeta(event) {
audio.mozSetup(video.mozChannels, video.mozSampleRate);
}
function saveAudio(event) {
audio.mozWriteAudio(event.frameBuffer);
console.log(audio.duration, video.duration);
}
video.addEventListener('MozAudioAvailable', saveAudio, false);
video.addEventListener('loadedmetadata', saveMeta, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment