草庐IT

canplaythrough

全部标签

javascript - js/html5 音频 : Why is canplaythrough not fired on iOS safari?

我使用下面的代码预加载一组音频文件(在用户与启动该过程的按钮交互之后)。在所有音频文件触发“canplaythrough”后,代码继续:varloaded=0;functionloadedAudio(){//thiswillbecalledeverytimeanaudiofileisloaded//wekeeptrackoftheloadedfilesvstherequestedfilesloaded++;console.log(loaded+"audiofilesloaded!");if(loaded==audioFiles.length){//allhaveloadedmain()

JavaScript 音频对象 addEventListener canplaythrough 不适用于 IPAD Chrome

我在JavaScript中有两个函数。它在Windows7Chrome上运行良好,但loadedAudio_chrome功能未在IPAD上触发。functionpreloadAudio_chrome(url){try{varaudio=newAudio();audio.addEventListener('canplaythrough',loadedAudio_chrome,false);//audio.src=filePath;}catch(e){alert(e.message);}}functionloadedAudio_chrome(){//alert('notfiringthis