I'm working on a personal website, and one of the things on there is my music. But, on chrome, seeking to any point in the audio file except the start will just jump back to the current point. Also, the displayed length of the song is too short and increases to the full length as playback nears the end.
After playing the song to the end and reloading the page, the seeking starts working, but it breaks again when I clear my cache. Neither issue occurs on Firefox, or when I access the audio file URL directly.
I think this problem is because seeking in Chrome requires the server to respond with partial clips from the audio file, in something called a 'range request'. After playing the whole file and reloading, the whole file is buffered in the cache, and Chrome must have a special case for this where the user can seek to anywhere.
In the issue https://www.pythonanywhere.com/forums/topic/3083/ (which I would have responded to, but I don't think I can since the EU forum is separate), you say that the PythonAnywhere server doesn't support range requests. You suggest creating a custom audio player element that limits seeking to the buffered audio. Based on the article https://developer.mozilla.org/en-US/docs/Web/Media/Guides/Audio_and_video_delivery/buffering_seeking_time_ranges I think I would be able to do this, but I'm hesitant to spend time on that, because:
- wouldn't that mean the user is still unable to seek to later parts of the song?
- if Chrome allowed seeking to any buffered audio, surely the user would be able to seek to previously played parts of the song without having to play the whole thing and reload first?
- would a custom element that is explicitly able to seek to buffered audio get around this?
I think it would work if I buffered the entire audio file beforehand when using Chrome: is that possible? Or is there a response configuration the PythonAnywhere server uses when accessing the URL directly, which I could apply to my endpoint? Please advise.