【发布时间】:2017-07-27 17:20:52
【问题描述】:
看着previous answer我萌生了重试播放声音的想法:
soundBG.pause();
soundBG.currentTime = 0;
var soundPromise = soundBG.play();
if (soundPromise !== undefined) {
soundPromise.then(function() {
console.log('Sound!');
}).catch(function(error) {
console.error('Failed to start your sound, retrying.');
setTimeout(function(){
soundEffects();
}, 2000);
});
}
但它仍然不工作,当声音不工作时,我不断收到错误:
DOMException: 加载失败,因为找不到支持的源
有办法解决吗?
【问题讨论】:
-
找不到任何答案,这就是我在这里问的原因。
-
郑重声明,chrome 和 firefox 似乎不支持 .m4a 文件。
标签: javascript html audio