Search code examples
audio-streamingaudiojs

HTML5 audio to start playing from anywhere even when the whole file is not loaded


I'm using audio.js on my page to play mp3s.
Some of the mp3s are over 100MB in size.
For example : I have a 124 MB mp3 file which doesn't load fully - the loader is loading the file slowly due to a slow internet connection. But when I click on the player-bar in the middle, I want it to start playing from there. Is that possible in HTML5 / audiojs ?


Solution

  • Your server needs to support range requests, which allows the client to specify specific content ranges that it needs. Once you have configured your server, any client-side code that is built to take advantage of this feature will start working.

    You can find an example here: https://stackoverflow.com/a/8507991/362536