Caching sounds on Mobile Safari

两盒软妹~` 提交于 2019-12-11 16:27:46

问题


I have to play very short sounds on UI events (pressing a button, showing a popup) in my iOS web-app. I do it the following way:

// Standard HTML5 implementation of PlaySound.
function Html5PlaySound(sound)
{
    var player = document.getElementById('soundPlayer');
    player.pause();
    player.setAttribute('src', 'sound/' + sound + '.mp3');
    player.play();
}

Unfortunately, it's being reloaded every time (I see 'waiting circle' in the title bar). Is it possible to force somehow iPhone to cache the sounds and not reload them every time?

Regards,


回答1:


i am using html5 manifest for caching stuff its working fine, however it seems the sounds only cache after i play them at least once in safari. (if i play them in safari and on webapp, go to airplane mode, it works)

you might be interessted in this thread Offline iOS web app: loads my manifest, but doesn't work offline



来源:https://stackoverflow.com/questions/11094414/caching-sounds-on-mobile-safari

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!