Bug 181537 - Long delay before audio starts playing in Safari 11
Summary: Long delay before audio starts playing in Safari 11
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Safari 11
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Keywords: InRadar
Depends on:
Reported: 2018-01-11 08:17 PST by Ernst
Modified: 2019-12-03 06:33 PST (History)
7 users (show)

See Also:

demo (1.27 KB, text/html)
2018-01-11 08:17 PST, Ernst
no flags Details
Safari (left) and Chrome (right) playing a demo from the popular SoundManager audio library (1.20 MB, image/png)
2018-05-07 16:25 PDT, Dunstan Orchard
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ernst 2018-01-11 08:17:08 PST
Created attachment 331055 [details]

In Safari 11 on both macOS and iOS, it often takes a long time until an audio (e.g. MP3) starts playing after starting it (especially on slower mobile connections).
Safari 11 buffers very much until it starts playing. In the demo I've attached, after you click the button, Safari buffers around 100 seconds of the audio before it starts playing, which seems way too much for me (also notice that the "playing" event is triggered and the loudspeaker icon shown in the URL bar and tab before it is really playing, i.e. it is audible and currentTime is increasing). (The effect is more obvious if you use Network Link Conditioner and throttle your connection to average 3G.)

In other browsers, the audio also starts way earlier, see this video comparing with Chrome and Firefox: http://www.yourfilelink.com/get.php?fid=1464049

This regression seems to have been introduced with Safari 10 on macOS and iOS 10; on iOS 9, audios start playing almost immediately. Here is an image comparing iOS 9 and iOS 10: http://i66.tinypic.com/25ppeoi.png

Thank you!
Comment 1 Radar WebKit Bug Importer 2018-01-11 10:31:12 PST
Comment 2 Dunstan Orchard 2018-05-07 16:25:24 PDT
Created attachment 339764 [details]
Safari (left) and Chrome (right) playing a demo from the popular SoundManager audio library
Comment 3 Dunstan Orchard 2018-05-07 16:26:50 PDT
Came here to file the same bug. As the reporter notes, Safari fires the `play` and `playing` events and then seems to download a large amount of data before it decides to fire `canplaythrough` and actually start outputting sound.

With my cache cleared I loaded this 2.6mb mp3 http://freshly-ground.com/data/audio/sm2/Figub%20Brazlevič%20-%20Bosnian%20Syndicate.mp3 and sound wasn't played until 2.6mb had been downloaded. In comparison Chrome and Firefox start playing sound seemingly immediately.

Here's a video of where I first encountered the problem (I'm sorry this is an external link, but I don't have the original video file any more): https://twitter.com/dunstan/status/991570214541189120

I also saw the problem when using popular sound libraries, such as the SoundManager demo found here http://www.schillmania.com/projects/soundmanager2/demo/bar-ui/ Chrome started playing straight away, while Safari downloaded 2.2mb of the file before playing sound (see attached screenshots).
Comment 4 Daniil Pokrovsky 2019-10-08 01:05:40 PDT
We are also experiencing delay "canplay" and "playing" events are fired, but actual playback only seems to start when Safari buffers the whole track, sometimes it can take 20+ seconds depending on connects. In Chrome and Firefox events are actually fired when playback starts, and playback starts much faster there as they don't wait till entire track will be downloaded.