Continuous HTML5 audio/video playback in iOS?

本小妞迷上赌 提交于 2019-12-05 16:53:07

This code (jQuery) works for me in iPhone Safari iOS7 for continuous playback. Even if I have my screen locked/other tab it changes track when the first has ended (given a bit of patience for the new track to load)

<audio id="audio1" src="song1.mp3" controls></audio>
<script type="text/javascript">
$('#audio1').on('ended',function(){
    $(this).attr('src','song2.mp3');
    $(this)[0].play();
    });
</script>

I've read has suggested that Safari prevents audio from playing unless it's initiated by a user.

=> That is true and is by design - no work around known as of today (well ... I have seen ugly attempt to make it work).

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