Page MenuHomePhabricator

Playing audio for the second time always stutters
Open, Needs TriagePublic

Description

Wikimedia’s audio playback widget sometimes stutters. To reproduce, go to any audio page such as https://en.wikipedia.org/wiki/File:Rm-sursilv-p%C3%A8r.flac and press the play button on that page. Then, press the same button again; you’ll likely hear stuttering audio. Initially, I had assumed this was a browser bug and reported it to Chrome. However, the Chrome developers said it’s likely a bug in Wikipedia’s JavaScript. The JavaScript bug only shows when the file is served from cache (eg. on the second press of the play button), or possibly when the user is on a very fast network connection.

See https://bugs.chromium.org/p/chromium/issues/detail?id=927782#c2:

I think it's a player bug in the Wikipedia page [...] It seems like it's creating a new tag each time the play button is clicked which may be leading to some of a previous tag playing depending on if they're using WebAudio for playback.

and https://bugs.chromium.org/p/chromium/issues/detail?id=927782#c3:

I see in devtools they’re using audioElement.play() and a redundant audioElement.currentTime = 0 in [apparently] setTimeout which produces the glitch so indeed it seems like the player is doing the wrong thing.

As you’ll see in that Chrome bug, Chrome 19 and older didn't stutter, but https://bugs.chromium.org/p/chromium/issues/detail?id=927782#c4 concludes:

Possibly we're queuing audio buffers more quickly now, so the seek occurred before we played out a buffer on older versions.

Event Timeline

Sascha created this task.Feb 2 2019, 9:06 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 2 2019, 9:06 AM
Aklapper renamed this task from Audio playback widget stutters to Playing audio for the second time always stutters.Feb 2 2019, 6:07 PM
Base added a subscriber: Base.Feb 2 2019, 6:49 PM