The nsIDOMHTMLAudioElement interface is used to implement the HTML5 <audio> element.

dom/interfaces/html/nsIDOMHTMLAudioElement.idlScriptable
Please add a summary to this article.
  Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)

Inherits from: nsIDOMHTMLMediaElement

Method overview

unsigned long long mozCurrentSampleOffset();
void mozSetup(in PRUint32 channels, in PRUint32 rate);
[implicit_jscontext] unsigned long mozWriteAudio(in jsval data);

Methods

mozCurrentSampleOffset()

Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

Returns the current offset of the audio stream, specified as the number of samples that have played since the beginning of the stream.

unsigned long long mozCurrentSampleOffset();
Parameters

None.

Return value

An unsigned 64-bit value indicating how many audio samples have been played since the stream began playing.

mozSetup()

Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

Sets up the audio stream for writing.

void mozSetup(
  in PRUint32 channels,
  in PRUint32 rate
);
Parameters
channels
The number of audio channels the audio stream should use. Specify 1 for mono or 2 for stereo.
rate
The sampling rate to use on the stream, in samples per second. For example, specify 44100 for 44.1kHz.

mozWriteAudio()

Writes samples to the audio stream.

unsigned long mozWriteAudio(
  in jsval data
);
Parameters
data
The samples to write into the audio stream, specified either as a JavaScript Array or as a numeric typed array.
Return value

The actual number of bytes written to the stream.

Exceptions thrown
NS_ERROR_DOM_INVALID_STATE_ERR
The stream has not been initialized for writing by a call to mozSetup().
NS_ERROR_DOM_TYPE_MISMATCH_ERR
The data isn't a valid data type (an array or typed array of numeric values).
NS_ERROR_DOM_INDEX_SIZE_ERR
The number of samples specified doesn't divide evenly across the number of channels; you must provide exactly the same number of samples for all channels.

See also