Question

I was wondering if there is a way to start downloads of audio files from a start point depending on bytes or time. Right now on my website if I want to start a audio track at the half way point I have to wait for it to download past halfway and then skip to that part. Thanks!

Was it helpful?

Solution

Yes, the server has to support byte range requests and the client would have to make the appropriate request to get the bytes it needs. Most browsers support this already natively; Flash does not.

If you're using the native <audio> element and are unable to set the playback position before the entire song has downloaded then that means the server does not accept byte range requests.

Using SoundManager2 you can pass a from value when creating the sound which will start the playback from said offset (when using Flash, the entire file will still be downloaded):

soundManager.createSound({
  url: 'http://www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/theadamcarollashow/2013.08.07ACS.mp3',
  from: 10*60*1000 // position to start playback within a sound (msec): 10 minutes
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top