Confirmed users
656
edits
| Line 45: | Line 45: | ||
===== Reading Audio ===== | ===== Reading Audio ===== | ||
Audio data is made available via an event-based API. As the audio is played, and therefore decoded, | Audio data is made available via an event-based API. As the audio is played, and therefore decoded, sample data is is passed to content scripts in a framebuffer for processing after being written to the audio layer--hence the name, '''AudioWritten'''. These samples may or may not have been played yet at the time of the event. The audio samples returned are in the event are raw, and have not been adjusted for mute/volume settings on the media attribute. Playing and pausing the audio all affect the streaming of this raw audio data as well. | ||
Users of this API can register two callbacks on the <audio> or <video> element in order to consume this data: | Users of this API can register two callbacks on the <audio> or <video> element in order to consume this data: | ||
| Line 51: | Line 51: | ||
<pre> | <pre> | ||
<audio src="song.ogg" | <audio src="song.ogg" | ||
onloadedmetadata="audioInfo( | onloadedmetadata="audioInfo();" | ||
onaudiowritten="audioWritten(event);"> | onaudiowritten="audioWritten(event);"> | ||
</audio> | </audio> | ||