Bug 277265 - HTMLAudioElement play event fires a little before the audio actually starts playing
Summary: HTMLAudioElement play event fires a little before the audio actually starts p...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Safari 18
Hardware: Mac (Apple Silicon) macOS 14
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2024-07-29 09:46 PDT by ayagawap
Modified: 2024-08-19 20:25 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ayagawap 2024-07-29 09:46:08 PDT
The HTMLAudioElement `play` event fires a little before the audio actually starts playing (maybe about 0.3 seconds?).
The URL below [1] is a test for this phenomenon.
The spec[2] explains the play event as "Fired when : The element is no longer paused. Fired after the `play()` method has returned, or when the autoplay attribute has caused playback to begin."
Isn't it a bug that the play event fires hundreds of milliseconds before the audio actually starts playing?
[1] : https://axt-ayakoto.github.io/web-playground/htmlmediaelement-play-event/
[2] : https://html.spec.whatwg.org/multipage/media.html#event-media-play

(This is my first time making a report, am I doing it correctly?)
Comment 1 ayagawap 2024-07-29 09:51:26 PDT
This phenomenon occurs in the following environments:

- MacBook Air M2, 2022 / macOS Sonoma 14.5 / Safari Technology Preview Release 199 (Safari 18.0, WebKit 19619.1.22.5)
- MacBook Air M2, 2022 / macOS Sonoma 14.5 / Safari 17.5 (19618.2.12.11.6)
- 10.9-inch iPad (10th generation) / iPadOS 17.5.1 / Safari 17.5

Note: This phenomenon does not occur in the following environments:
- MacBook Air M2, 2022 / macOS Sonoma 14.5 / Google Chrome Dev 129.0.6614.3
Comment 2 Ahmad Saleem 2024-07-29 17:03:15 PDT
*** Safari 18 Beta ***

The logs will be output here.
The "currentTime" of "play" and "playing" should be very close to 1.0000.
play :
  currentTime : 0.7783
playing :
  currentTime : 0.7809
play().then() : 
  currentTime : 0.7815
timeupdate :
  currentTime : 1.0293
  fired at    : 0.1320
  diff        : 0.8973

*** Chrome Canary 129 ***

The logs will be output here.
The "currentTime" of "play" and "playing" should be very close to 1.0000.
play :
  currentTime : 0.6938
playing :
  currentTime : 0.6941
play().then() : 
  currentTime : 0.6945
timeupdate :
  currentTime : 0.9589
  fired at    : 0.0427
  diff        : 0.9163

*** Firefox Nightly 130 ***

The logs will be output here.
The "currentTime" of "play" and "playing" should be very close to 1.0000.
play :
  currentTime : 0.7319
playing :
  currentTime : 0.7319
play().then() : 
  currentTime : 0.7319
timeupdate :
  currentTime : 0.9949
  fired at    : 0.0285
  diff        : 0.9664
Comment 3 Radar WebKit Bug Importer 2024-07-29 17:04:27 PDT
<rdar://problem/132764953>