[Webkit-unassigned] [Bug 259925] New: HTMLMediaElement.play() doesn't work if gesture/event handler is asynchronous
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Aug 8 03:23:17 PDT 2023
https://bugs.webkit.org/show_bug.cgi?id=259925
Bug ID: 259925
Summary: HTMLMediaElement.play() doesn't work if gesture/event
handler is asynchronous
Product: WebKit
Version: WebKit Nightly Build
Hardware: All
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: Media
Assignee: webkit-unassigned at lists.webkit.org
Reporter: jamiew at broadcastradio.com
Like other browsers, Safari uses gesture-tracking to determine whether or not a call to HTMLMediaElement.play() should be allowed, if the website is not permitted to autoplay.
However, unlike other browser engines, Safari will only permit the play() call from the synchronous scope of an event handler.
Consequently it is not possible to implement asynchronous handling of playback.
I would say that most websites with unwanted autoplay videos already use the first gesture on the page to trigger playback - so implementing this in Safari wouldn't lead to a more 'annoying' internet experience.
Although many developers are working around this bug by calling .play() synchronously from the gesture event handler, then changing its 'src' attribute as a result of some asynchronous action, this doesn't seem to work when using MediaSource extensions, as attaching a new MediaSource seems to reset its autoplay state. Indeed there are many legitimate use cases on the web where this sort of behaviour is desired, so I would be grateful if you could consider adopting the same behaviour as other browsers.
This bug in particular is preventing us from being able to support Mobile Safari in our multi-track editor - where multiple audio files are loaded from a remote location and triggered in sequence from a single "Play" button.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230808/f4086f5f/attachment-0001.htm>
More information about the webkit-unassigned
mailing list