WebKit icon indicating copy to clipboard operation
WebKit copied to clipboard

Switch to alternate <source> element for AirPlay when necessary

Open eric-carlson opened this issue 2 years ago โ€ข 3 comments

662a2f3918e0096b869ec62ada964c08e0a0c222

Switch to alternate <source> element for AirPlay when necessary
https://bugs.webkit.org/show_bug.cgi?id=246466
<rdar://101136233>

Reviewed by NOBODY (OOPS!).

* LayoutTests/media/media-source/remoteplayback-from-source-element-expected.txt: Added.
* LayoutTests/media/media-source/remoteplayback-from-source-element.html: Added.

* Source/WebCore/Modules/remoteplayback/RemotePlayback.cpp:
(WebCore::RemotePlayback::watchAvailability): Add runtime logging.
(WebCore::RemotePlayback::cancelWatchAvailability): Ditto.
(WebCore::RemotePlayback::prompt): Ditto.
(WebCore::RemotePlayback::shouldPlayToRemoteTargetChanged): Ditto.
(WebCore::RemotePlayback::setState): Ditto.
(WebCore::RemotePlayback::disconnect): Ditto.
(WebCore::RemotePlayback::availabilityChanged): Ditto.
(WebCore::RemotePlayback::setLogger):  Ditto.
(WebCore::RemotePlayback::logChannel const): Ditto.
* Source/WebCore/Modules/remoteplayback/RemotePlayback.h:

* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement): Set remote logger.
(WebCore::HTMLMediaElement::checkPlaybackTargetCompatibility): If loaded from a <source>
element and is another <source> uses a media engine that supports remote playback, try
loading that.
(WebCore::HTMLMediaElement::loadResource): Don't bother trying MSE, MediaStream, or blob
if the load requires remote playback.
(WebCore::HTMLMediaElement::applyConfiguration): Apply the stored configuration.
(WebCore::HTMLMediaElement::setReadyState): Apply the remote configuration once
HAVE_FUTURE_DATA is reached.
(WebCore::HTMLMediaElement::selectNextSourceChild): Set parameter `requiresRemotePlayback`
field.
(WebCore::HTMLMediaElement::clearMediaPlayer): Force a target availability event.
(WebCore::HTMLMediaElement::wirelessRoutesAvailableDidChange): Only post availability event
when availability actually changes.
(WebCore::HTMLMediaElement::setIsPlayingToWirelessTarget):
(WebCore::HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent): Add parameter
so we don't necessarily post events when availability doesn't change.
(WebCore::HTMLMediaElement::addEventListener): Force a target availability event.
* Source/WebCore/html/HTMLMediaElement.h:

* Source/WebCore/html/MediaElementSession.cpp:
(WebCore::MediaElementSession::showPlaybackTargetPicker): Always log.

* Source/WebCore/platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::load): Add `requiresRemotePlayback` parameter.
* Source/WebCore/platform/graphics/MediaPlayer.h:
(WebCore::MediaEngineSupportParameters::encode const):
(WebCore::MediaEngineSupportParameters::decode):

* Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::supportsType): Consider new support field.

* Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.mm:
(WebCore::MediaPlayerPrivateWebM::supportsType): Ditto.

* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::setMockMediaPlaybackTargetPickerEnabled): NULL-check frame and page.
(WebCore::Internals::setMockMediaPlaybackTargetPickerState): Ditto.
(WebCore::Internals::mockMediaPlaybackTargetPickerDismissPopup): Ditto.

* Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::load): Add "requires remote playback" parameter.
* Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h:
* Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.messages.in: Ditto.

* Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::load): Ditto.

* Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerMIMETypeCache.cpp:
(WebKit::RemoteMediaPlayerMIMETypeCache::supportsTypeAndCodecs): Ditto.
* Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerMIMETypeCache.h:

https://github.com/WebKit/WebKit/commit/4870c571f3585509f79e00acf1655f10dd01c2ad

Misc iOS, tvOS & watchOS macOS Linux Windows
โŒ ๐Ÿงช style โœ… ๐Ÿ›  ios โœ… ๐Ÿ›  mac โœ… ๐Ÿ›  wpe โœ… ๐Ÿ›  ๐Ÿงช win
โœ… ๐Ÿงช bindings โœ… ๐Ÿ›  ios-sim โœ… ๐Ÿ›  mac-debug โœ… ๐Ÿ›  gtk โœ… ๐Ÿ›  wincairo
โœ… ๐Ÿงช webkitperl โœ… ๐Ÿงช ios-wk2 โœ… ๐Ÿ›  mac-AS-debug โœ… ๐Ÿงช gtk-wk2
โœ… ๐Ÿงช api-ios โœ… ๐Ÿงช api-mac โœ… ๐Ÿงช api-gtk
โœ… ๐Ÿ›  tv โœ… ๐Ÿงช mac-wk1
โœ… ๐Ÿ›  tv-sim โœ… ๐Ÿงช mac-wk2
โœ… ๐Ÿ›  watch โœ… ๐Ÿงช mac-AS-debug-wk2
โœ… ๐Ÿ›  watch-sim โœ… ๐Ÿงช mac-wk2-stress

eric-carlson avatar Oct 14 '22 16:10 eric-carlson

Committed 255624@main (4ec10f6ab820): https://commits.webkit.org/255624@main

Reviewed commits have been landed. Closing PR #5380 and removing active labels.

webkit-commit-queue avatar Oct 17 '22 13:10 webkit-commit-queue