[webkit-changes] [WebKit/WebKit] 0a9b7c: Managed Media Source should only be available if a...

Jean-Yves Avenard noreply at github.com
Fri May 19 12:13:46 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0a9b7c59e3fa9131c40823fa108c5c9818269b08
      https://github.com/WebKit/WebKit/commit/0a9b7c59e3fa9131c40823fa108c5c9818269b08
  Author: Jean-Yves Avenard <jya at apple.com>
  Date:   2023-05-19 (Fri, 19 May 2023)

  Changed paths:
    A LayoutTests/media/media-source/media-managedmse-airplay-expected.txt
    A LayoutTests/media/media-source/media-managedmse-airplay.html
    M LayoutTests/media/media-source/media-managedmse-bufferedchange.html
    M LayoutTests/media/media-source/media-managedmse-memorypressure-inactive.html
    M LayoutTests/media/media-source/media-managedmse-memorypressure.html
    M LayoutTests/media/media-source/media-managedmse-streaming-atend.html
    M LayoutTests/media/media-source/media-managedmse-streaming.html
    M LayoutTests/media/media-source/media-managedmse.html
    M LayoutTests/platform/glib/TestExpectations
    M LayoutTests/platform/ios/TestExpectations
    M LayoutTests/platform/ipad/TestExpectations
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WebCore/Modules/mediasource/ManagedMediaSource.cpp
    M Source/WebCore/Modules/mediasource/ManagedMediaSource.h
    M Source/WebCore/Modules/mediasource/MediaSource.cpp
    M Source/WebCore/Modules/mediasource/MediaSource.h
    M Source/WebCore/Modules/remoteplayback/RemotePlayback.cpp
    M Source/WebCore/html/HTMLMediaElement.cpp
    M Source/WebCore/html/HTMLMediaElement.h
    M Source/WebCore/html/HTMLVideoElement.cpp
    M Source/WebKit/Shared/WebPreferencesDefaultValues.cpp
    M Source/WebKit/Shared/WebPreferencesDefaultValues.h
    M Tools/TestWebKitAPI/Tests/WebKit/file-with-managedmse.html

  Log Message:
  -----------
  Managed Media Source should only be available if airplay source alternative is present
https://bugs.webkit.org/show_bug.cgi?id=256570
rdar://109130836

Reviewed by Jer Noble.

When we add a Managed Media Source to a media element, it should per
MSE spec changed the MSE's readyState to "open" and fire the `sourceopen` event.
We want to make sure that the developer hasn't left anything unchecked,
it is expected that either an alternative source is set and compatible with
remote playback, or by explicitly disabling remote playback
(either by using an attribute or using Remote Playback API).

To achieve this, we do not move the MSE's readyState to "open" until
all those conditions have been achieved. And the readyState will remain
at `closed` until then. Should one of the condition become fullfilled
after the Managed Media Source has been created, it will be unblocked and
can be used as usual.

The behaviour is placed behind a preference.

Fly-by fix: There were three different ways to disable AirPlay, each
working independently from the other. We combine them all together that
should one method be used to disable AirPlay, it will be disabled regardless
of what the other methods are doing.

* LayoutTests/TestExpectations:
* LayoutTests/media/media-source/media-managedmse-airplay-expected.txt: Added.
* LayoutTests/media/media-source/media-managedmse-airplay.html: Added.
* LayoutTests/media/media-source/media-managedmse-bufferedchange.html: Amended to explicitly disable AirPlay
* LayoutTests/media/media-source/media-managedmse-memorypressure-inactive.html: Amended to explicitly disable AirPlay
* LayoutTests/media/media-source/media-managedmse-memorypressure.html: Amended to explicitly disable AirPlay
* LayoutTests/media/media-source/media-managedmse-streaming-atend.html: Amended to explicitly disable AirPlay
* LayoutTests/media/media-source/media-managedmse-streaming.html: Amended to explicitly disable AirPlay
* LayoutTests/media/media-source/media-managedmse.html: Amended to explicitly disable AirPlay
* LayoutTests/platform/glib/TestExpectations:
* LayoutTests/platform/ios/TestExpectations:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/Modules/mediasource/ManagedMediaSource.cpp:
(WebCore::ManagedMediaSource::isOpen const):
* Source/WebCore/Modules/mediasource/ManagedMediaSource.h:
* Source/WebCore/Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::setPrivateAndOpen):
(WebCore::MediaSource::isOpen const):
(WebCore::MediaSource::isClosed const):
(WebCore::MediaSource::isEnded const):
(WebCore::MediaSource::openIfDeferredOpen):
(WebCore::MediaSource::readyState const):
(WebCore::MediaSource::onReadyStateChange):
* Source/WebCore/Modules/mediasource/MediaSource.h:
(WebCore::MediaSource::readyState const): Deleted.
* Source/WebCore/Modules/remoteplayback/RemotePlayback.cpp:
(WebCore::RemotePlayback::watchAvailability): Use utility method on mediaElement
(WebCore::RemotePlayback::cancelWatchAvailability): ditto
(WebCore::RemotePlayback::prompt): ditto
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::attributeChanged): If remote playback gets
disabled, move the Managed Media Source state to open if needed
(WebCore::isAllowedToLoadMediaURL): make it take a const element
(WebCore::HTMLMediaElement::isSafeToLoadURL const): make method const and make logging conditional
(WebCore::HTMLMediaElement::sourceWasAdded): if a playable alternative source is added
move the Managed Media Source state to open if needed
(WebCore::HTMLMediaElement::hasWirelessPlaybackTargetAlternative const):
(WebCore::HTMLMediaElement::isWirelessPlaybackTargetDisabled const):
* Source/WebCore/html/HTMLMediaElement.h:
* Source/WebCore/html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::attributeChanged):
* Source/WebKit/Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultManagedMediaSourceNeedsAirPlay):
* Source/WebKit/Shared/WebPreferencesDefaultValues.h:

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




More information about the webkit-changes mailing list