Is there a way to determine which source was used when specifying multiple sources to an HTML5 audio element?
E.g. I have this HTML code:
<audio preload="auto">
<source type="audio/ogg;codecs=vorbis" src="http://example.org/sample.ogg"/>
<source type="audio/mpeg;codecs=mp3" src="http://example.org/sample.mp3"/>
</audio>
Now I want to know if the ogg or the mp3 file was used. I tried to register onload and onloadeddata event handlers on the source elements but they where never called. Also src of the audio element is unchanged after load and the source elements don’t have a readyState property.
Can this be found out in any other way?
Register a function for
onloadeddataof theaudioelement, in that look at thecurrentSrc.