Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

HTMLAudioElement

这篇翻译不完整。请帮忙从英语翻译这篇文章

 

The HTMLAudioElement interface provides access to the properties of <audio> elements, as well as methods to manipulate them. It derives from the HTMLMediaElement interface. 

Properties

No specific property; inherits properties from its parent, HTMLMediaElement, and from HTMLElement.

Methods

Inherits methods from its parent, HTMLMediaElement, and from HTMLElement.

Constructor

Syntax

mySound = new Audio([URLString]);

Description

Constructor for audio elements. The preload property of the returned object is set to auto and the src property is set to the argument value. The browser begins asynchronously selecting the resource before returning the object.

Parameters

URLString (expected type: DOMString; optional)
The src property of the constructed HTMLAudioElement.

Regular methods

Name & Arguments Return Description
mozCurrentSampleOffset() unsigned long long Indicates the current offset of the audio stream that was created by a call to mozWriteAudio(). This offset is specified as the number of samples since the beginning of the stream.

mozSetup(in PRUint32 channels, in PRUint32 rate)

void Sets up the audio stream for writing. You specify as parameters the number of channels (1 for mono or 2 for stereo), then the sampling rate (44100 for 44.1kHz, for example).
mozWriteAudio(in jsval data) unsigned long Writes audio into the stream at the current offset. Returns the number of bytes actually written to the stream.

Specifications

Specification Status Comment
WHATWG HTML Living Standard
HTMLAudioElement
Living Standard No change from HTML5
HTML5
HTMLAudioElement
Recommendation Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support (Yes) 3.5 (1.9.1) (Yes) (Yes) (Yes)
mozSetup(), mozCurrentSampleOffset(), mozWriteAudio() 未实现 4.0 (2.0) 未实现 未实现 未实现
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support (Yes) 1.0 (1.9.1) (Yes) (Yes) (Yes)
mozSetup(), mozCurrentSampleOffset(), mozWriteAudio() 未实现 4.0 (2.0) 未实现 未实现 未实现

See also

  • HTML element implementing this interface: <audio>.

文档标签和贡献者

 此页面的贡献者: FredWe
 最后编辑者: FredWe,