第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

使用createjs系列的preload.js調(diào)用函數(shù)后音頻沒(méi)有播放

使用createjs系列的preload.js調(diào)用函數(shù)后音頻沒(méi)有播放

慕田峪4524236 2021-09-17 21:02:34
我在做一個(gè) HTML5 游戲。我使用createjs來(lái)預(yù)加載圖像。圖像預(yù)加載完成后,需要自動(dòng)播放背景音樂(lè)。我知道 chrome 的新音頻政策。我很困惑我使用函數(shù)handleComplete來(lái)觸發(fā)音頻。為什么它仍然不起作用?我應(yīng)該如何使它工作?這是我的代碼:function Sound (id_str){ this.id = id_str; }Sound.prototype.play = function () {    //there are other logics, but can simply like below    let audio = document.getElementById(this.id);    audio.play().catch(e =>console.log(e));};var audio_bg = new Sound('bgm_id');windows.onload = function preload (handleFileProgress,handleComplete){    let manifest = [...];    loader = new createjs.LoadQueue(false);    loader.setMaxConnections(100);    loader.maintainScriptOrder=true;    loader.installPlugin(createjs.Sound);    loader.loadManifest(manifest);    loader.addEventListener('progress', handleFileProgress);     loader.addEventListener('complete', handleComplete);};function handleFileProgress(){...}function handleComplete(){    //...    audio_bg.play();}我發(fā)現(xiàn)的錯(cuò)誤是:NotAllowedError: play() failed because the user didn't interact with the document first.
查看完整描述

目前暫無(wú)任何回答

  • 0 回答
  • 0 關(guān)注
  • 287 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)