人妻无码中文字幕永久在线,99RE6这里有精品热视频,国产成人综合色就色综合 ,蜜臀av在线观看

新聞建站cms系統(tǒng)、政府cms系統(tǒng)定制開發(fā)

廣州網(wǎng)站建設(shè)公司-閱速公司

asp.net新聞發(fā)布系統(tǒng)、報(bào)紙數(shù)字報(bào)系統(tǒng)方案
/
http://www.jdki.com.cn/
廣州網(wǎng)站建設(shè)公司
您當(dāng)前位置:首頁>網(wǎng)站技術(shù)

網(wǎng)站技術(shù)

Uncaught (in promise) DOMException: play() failed

發(fā)布時(shí)間:2018/11/6 22:49:22  作者:Admin  閱讀:1491  

廣告:

Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD

function playOrPaused() {

console.log(typeof audio);

console.log(typeof audio.paused);

if (audio.paused) {

audio.play(); //ERROR:Uncaught (in promise) DOMException: The element has no supported sources.

}

}

原來的插入audio的源碼如下, 播放音頻的時(shí)候在瀏覽器和調(diào)試器的debug環(huán)境會(huì)報(bào)如上錯(cuò)誤,但是不影響iPhone等手機(jī)的使用

查閱相關(guān)資料發(fā)現(xiàn)audio可以支持兩種方式設(shè)置src,如下:

1. Permitted content: If the element has a src attribute: zero or more <track> elements, followed by transparent content that contains no media elements — that is, no <audio> or <video> elements.

2. Else: zero or more <source> elements, followed by zero or more <track> elements, followed by transparent content that contains no media elements, that is no <audio> or <video> elements.

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

于是改成第二種方案,解決問題,如下:

<audio id="audio">

<source src="http://ossweb-img.qq.com/images/lol/m/act/a20160315live/shake_sound_male.mp3" type="audio/mpeg">

Your browser does not support the audio tag.

</audio>

廣告:

相關(guān)文章
DOMException
cms新聞系統(tǒng)購(gòu)買咨詢
掃描關(guān)注 廣州閱速軟件科技有限公司
掃描關(guān)注 廣州閱速科技