I'm working on a website with a music playlist. The code is very straightforward, I use one <audio>
tag with preload="true"
, then whenever a track is clicked on the playlist I use JS to change the source, then I load and play the track with audio.load()
and audio.play()
. This works fine on all browsers except for Safari (on Desktop). With a fast internet connection, there is a 2-3s delay before the audio starts playing. With a slower connection it takes up to 60 seconds before the music starts playing. It seems to me that Safari loads the full mp3 file before it starts the playback, while the other browsers can stream it flawlessly even with a very slow internet.
The mp3s are as small as they can be (128kbsp), the file sizes are around 1-2MB.
Is there a way to change Safari's behaviour and stream the audio file?