nsIDOMHTMLAudioElement 编辑

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:113 次

字数:5398

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文