Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e59e5a3f448911f6f7eb31402640a5ec93d8358c
      
https://github.com/WebKit/WebKit/commit/e59e5a3f448911f6f7eb31402640a5ec93d8358c
  Author: Jean-Yves Avenard <[email protected]>
  Date:   2026-06-24 (Wed, 24 Jun 2026)

  Changed paths:
    M Source/WebCore/html/HTMLMediaElement.cpp
    M Source/WebCore/page/Quirks.cpp
    M Source/WebCore/page/Quirks.h
    M Source/WebCore/platform/graphics/MediaPlayer.h
    M 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h
    M 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
    M Source/WebKit/Shared/WebCoreArgumentCodersMedia.serialization.in

  Log Message:
  -----------
  unifi.ui.com: Security camera video playback not working in Safari, works in 
Chrome
https://bugs.webkit.org/show_bug.cgi?id=317742
rdar://180411019

Reviewed by Eric Carlson.

Per spec, the `stalled`, `progress`, `suspend` events are controlled
by the  resource fetch algorithm (#1) when the mode is `remote`.
The Media Source Extension override the resource fetch algorithm and set the
mode as `local` (#2) in the resource fetch algorithm.
As such those media events can't be fired with MSE. MediaSource spec however
do mention that is is possible for an implementation to fire those events (#3)
in a 10 years old note stating:
"An attached MediaSource does not use the remote mode steps in the resource
fetch algorithm, so the media element will not fire "suspend" events.
Though future versions of this specification will likely remove "progress"
and "stalled" events from a media element with an attached MediaSource,
user agents conforming to this version of the specification may still fire
these two events as these [HTML] references changed after implementations
of this specification stabilized."

Some media-source web-platform-tests do test that no stalled or progress
event are fired (which both Firefox and Chrome pass indicating that they
do not fire the `progress` event either).

A bug in the MediaPlayerPrivateRemote made it always fire the `progress`
event at regular interval as it never checked the 
MediaPlayerPrivate::supportsProgressMonitoring
and so Safari used to fire this event at regular interval when using MSE.
When MediaContainment was enabled, supportsProgressMonitoring override became
functional again and 
MediaPlayerPrivateMediaSourceAVFObjC::supportsProgressMonitoring
returned false.

Unifi.ui.com web player listen to the `progress` event to determine when
to call `play()`, as no progress event is fired with MSE, play() wasn't called
and so playback never started and only the first video frame was shown.

We add a quirk for ui.com that forces the `progress`, `suspend`, `stalled`
event to be fired. Note that `stalled` is fired often in this mode as
it is fired if nothing has been downloaded for 3s. With MSE it is not uncommon
to have the JS player only enqueue new content every 10s or so and media
is progressing properly.

1)https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource
2)https://www.w3.org/TR/media-source-2/#mediasource-attach

Manually tested.

* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::loadResource):
* Source/WebCore/page/Quirks.cpp:
* Source/WebCore/page/Quirks.h:
* Source/WebCore/platform/graphics/MediaPlayer.h:
* 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
* 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::supportsProgressMonitoring 
const):
* Source/WebKit/Shared/WebCoreArgumentCodersMedia.serialization.in:

Canonical link: https://commits.webkit.org/315774@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to