How can I force an HTML5 audio element to buffer an entire song?

前端 未结 3 1820
轮回少年
轮回少年 2021-02-01 23:10

I\'m developing a local server that will stream a user\'s audio files so they can access them via web browsers using the HTML5 audio object. Since these files are on the user\'s

3条回答
  •  别跟我提以往
    2021-02-01 23:42

    The solution I found was this:

    function load() {
        a.play();
        setTimeout("a.pause()", 10);
    }
    

    Play the file and pause it 10ms later, then the browser will buffer the entire song.

提交回复
热议问题