亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

directory search
Attributes accesskey (attribute) class (attribute) contenteditable (attribute) contextmenu (attribute) data-* (attribute) dir (attribute) draggable (attribute) dropzone (attribute) Global attributes hidden (attribute) id (attribute) itemid (attribute) itemprop (attribute) itemref (attribute) itemscope (attribute) itemtype (attribute) lang (attribute) slot (attribute) spellcheck (attribute) style (attribute) tabindex (attribute) title (attribute) translate (attribute) Elements a abbr address area article aside audio b base bdi bdo blockquote body br button canvas caption cite code col colgroup data datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 head header hr html i iframe img input input type="button" input type="checkbox" input type="color" input type="date" input type="datetime"-local input type="email" input type="file" input type="hidden" input type="image" input type="month" input type="number" input type="password" input type="radio" input type="range" input type="reset" input type="search" input type="submit" input type="tel" input type="text" input type="time" input type="url" input type="week" ins kbd label legend li link main map mark menu menuitem meta meter nav noscript object ol optgroup option output p param picture pre progress q rp rt rtc ruby s samp script section select slot small source span strong style sub summary sup table tbody td template textarea tfoot th thead time title tr track u ul var video wbr Miscellaneous Attributes Block-level elements CORS enabled image CORS settings attributes Element Inline elements Kinds of HTML content Link types Microdata Optimizing your pages for speculative parsing Preloading content Reference Supported media formats Using the application cache Obsolete acronym applet basefont big blink center command content dir element font frame frameset hgroup image input type="datetime" isindex keygen listing marquee nextid noframes plaintext strike tt xmp
characters

HTML 元素用于嵌入文檔中的聲音內(nèi)容。它可能包含一個(gè)或多個(gè)音頻源,用src<source>屬性或<audio>元素表示:瀏覽器將選擇最合適的一個(gè)。它也可以是流媒體的目的地,使用一個(gè)MediaStream。

內(nèi)容類別

流內(nèi)容,短語(yǔ)內(nèi)容,嵌入式內(nèi)容。如果它具有控件屬性:交互式內(nèi)容和可觸及的內(nèi)容。

允許的內(nèi)容

如果元素具有src屬性:零個(gè)或多個(gè)<track>元素,后跟不包含媒體元素的透明內(nèi)容,即不包含<audio>或<video>元素:零個(gè)或多個(gè)<source>元素,后跟零或更多<track>元素,后面是不包含媒體元素的透明內(nèi)容,即不包含<audio>或<video>。

標(biāo)記遺漏

沒(méi)有,起始和結(jié)束標(biāo)簽都是強(qiáng)制性的。

允許父母

任何接受嵌入內(nèi)容的元素。

允許ARIA角色

應(yīng)用

DOM界面

HTMLAudioElement

屬性

該元素包含 全局屬性。

autoplay布爾屬性;如果指定(默認(rèn)值為"false"?。?;指定后,音頻會(huì)馬上自動(dòng)開(kāi)始播放,不會(huì)停下來(lái)等著數(shù)據(jù)載入結(jié)束。

自動(dòng)播放音頻(或帶音軌的視頻)的站點(diǎn)對(duì)于用戶來(lái)說(shuō)可能是一個(gè)不愉快的體驗(yàn),所以應(yīng)盡可能避免。如果您必須提供自動(dòng)播放功能,您應(yīng)該選擇啟用(要求用戶專門啟用它)。但是,在用戶控制下創(chuàng)建媒體元素的源將在稍后設(shè)置時(shí),這可能是有用的。

buffered你可以通過(guò)該屬性獲取已緩沖的資源的時(shí)間段信息。該屬性包含一個(gè) TimeRanges對(duì)象。

controls如果設(shè)置了該屬性,瀏覽器將提供一個(gè)包含聲音,播放進(jìn)度,播放暫停的控制面板,讓用戶可以控制音頻的播放。

loop布爾屬性;如果指定,將循環(huán)播放音頻。

mozCurrentSampleOffset在音頻播放時(shí),表示相對(duì)于音頻開(kāi)始處的偏移量的一個(gè)數(shù)值。

muted表示是否靜音的布爾值。默認(rèn)值為false,表示有聲音。

played一個(gè)TimeRanges對(duì)象,表示所有已播放的音頻片段。

preload枚舉屬性,讓開(kāi)發(fā)者自行思考來(lái)示意瀏覽器使用何種加載方式以達(dá)到最好的用戶體驗(yàn)??梢允且韵聦傩灾唬?/p>

  • none: 示意用戶可能不會(huì)播放該音頻,或者服務(wù)器希望節(jié)省帶寬;換句話說(shuō),該音頻不會(huì)被緩存;

  • metadata: 示意即使用戶可能不會(huì)播放該音頻,但獲取元數(shù)據(jù) (例如音頻長(zhǎng)度) 還是有必要的。

  • auto: 示意用戶可能會(huì)播放音頻;換句話說(shuō),如果有必要,整個(gè)音頻都將被加載,即使用戶不期望使用。

  • 空字符串 : 等效于auto屬性。

假如不設(shè)置,默認(rèn)值就是瀏覽器定義的了(不同瀏覽器會(huì)選擇自己的默認(rèn)值), 即使規(guī)范建議設(shè)置為 metadata.

使用備注:

  • autoplay 屬性優(yōu)先于 preload 假如用戶想自動(dòng)播放視頻,那么很明顯瀏覽器需要下載視頻。同時(shí)設(shè)置autoplay 和 preload屬性在規(guī)范里是允許的。

  • 規(guī)范沒(méi)有強(qiáng)制瀏覽器去遵循該屬性的值;這僅僅只是個(gè)提示。

src嵌入的音頻的URL。 該URL應(yīng)遵從 HTTP access controls. 這是一個(gè)可選屬性;你可以在audio元素中使用 <source>元素來(lái)替代該屬性指定嵌入的音頻。

volume音頻播放的音量。值從0.0 (無(wú)聲) 到 1.0 (最大聲).

時(shí)間偏移量目前是指定為float類型的值,表示偏移的秒數(shù)。

備注: HTML 5 規(guī)范中,時(shí)間偏移量值的定義還沒(méi)有完成,有可能會(huì)變更。

事件

audio元素支持的事件

例子

基本用法

不支持<audio>元素的瀏覽器的其他內(nèi)容可以添加到開(kāi)始和結(jié)束<audio></audio>標(biāo)記中。

最基本的播放功能可以使用該controls屬性(見(jiàn)下面的示例); 對(duì)于更高級(jí)的用法,可以使用HTML Media API操作音頻播放和控件,更具體地說(shuō),可以使用HTMLAudioElement界面中定義的功能。

音頻流/網(wǎng)絡(luò)音頻API

您也可以使用Web Audio API來(lái)直接生成和處理來(lái)自JavaScript代碼的音頻流。

<audio>和字幕

雖然HTML5 <video>可以通過(guò)<track>添加字幕(請(qǐng)參閱將標(biāo)題和字幕添加到HTML5視頻),但<audio>元素不能 : 忽略標(biāo)簽<track>內(nèi)包含的任何<audio></audio>元素。請(qǐng)參閱Ian Devlin的WebVTT和Audio獲取更多有用的信息和解決方法。

示例

基本用法

<!-- Simple audio playback --><audio
  src="http://developer.mozilla.org/@api/deki/files/2926/=AudioTest_(1).ogg"
  autoplay>
  Your browser does not support the <code>audio</code> element.</audio>

使用source元素的audio元素

<audio controls="controls">
  Your browser does not support the <code>audio</code> element.  <source src="foo.wav" type="audio/wav"></audio>

規(guī)范

規(guī)范

狀態(tài)

評(píng)論

HTML Living Standard該規(guī)范中'<audio>'的定義。

生活水平


HTML5該規(guī)范中'<audio>'的定義。

建議


瀏覽器兼容性

Feature

Chrome

Edge

Firefox (Gecko)

Internet Explorer

Opera

Safari

Basic support

3.0

(Yes)

3.5 (1.9.1) 1

9.0

10.5

3.1

autoplay attribute

3.0

(Yes)

3.5 (1.9.1)

9.0

10.5

3.1

buffered attribute

?

(Yes)

4.0 (2.0)

?

?

?

controls attribute

3.0

(Yes)

3.5 (1.9.1)

9.0

10.5

3.1

loop attribute

3.0

(Yes)

11.0 (11.0)

9.0

10.5

3.1

muted attribute

?

(Yes)

11.0 (11.0)

?

?

?

played property

49

14

15.0 (15.0)

11

46

9.1

preload attribute

3.0

(Yes)

4.0 (2.0)

9.0

(Yes) 2

3.1

src attribute

3.0

(Yes)

3.5 (1.9.1)

9.0

10.5

3.1

volume attribute


(Yes)





Feature

Android

Edge

Firefox Mobile (Gecko)

IE Mobile

Opera Mobile

Safari Mobile

Basic support

?

(Yes)

1.0 (1.0) 1

?

?

?

autoplay attribute

?

(Yes)

1.0 (1.0)

?

?

?

buffered attribute

?

(Yes)

4.0 (2.0)

?

?

?

controls attribute

?

(Yes)

1.0 (1.0)

?

?

?

loop attribute

?

(Yes)

11.0 (11.0)

?

?

?

muted attribute

?

(Yes)

11.0 (11.0)

?

?

?

played property

?

(Yes)

15.0 (15.0)

?

?

?

preload attribute

?

(Yes)

4.0 (2.0)

?

?

?

src attribute

?

(Yes)

1.0 (1.0)

?

?

?

volume attribute


(Yes)





Previous article: Next article: