Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access binary data of <audio> src

For some small hacking project I would like to load the raw data of an MP3 into an ArrayBuffer.

<audio src="http://xyz.com/test.mp3">

I know that there are some basic functions exposed by an <audio> element but I was not able to find what I'm looking for. It is very likely that if there is such thing it is part of the Web Audio API and only works in Chrome by now.

like image 672
Martin Klepsch Avatar asked Jan 30 '13 23:01

Martin Klepsch


1 Answers

You cannot access raw data of HTML5 <audio> element.

What you can do is

  • Load data via AJAX

  • Grab raw data from the result for your internal purposes

  • Pass data forward to audio element (probably need to do data-uri here)

But for this kind on manipulation I recommend using Web Audio API instead of <audio>:

http://www.html5rocks.com/en/tutorials/webaudio/intro/

Firefox support should land in few iterations.

like image 100
Mikko Ohtamaa Avatar answered Oct 19 '22 22:10

Mikko Ohtamaa