Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No videos play if opened in full screen on first play #12422

Conversation

pvollan
Copy link
Contributor

@pvollan pvollan commented Apr 5, 2023

62b9ab7

No videos play if opened in full screen on first play
https://bugs.webkit.org/show_bug.cgi?id=255048
rdar://107540521

Reviewed by Eric Carlson and Jean-Yves Avenard.

When CA layers are not remotely hosted in both the GPU process and the WebContent process, it is not
guaranteed that the remote context ID will be set in the HTML media element when entering fullscreen.
This patch works around that by delaying setting up the fullscreen until the video dimensions are set.
At this point, the remote context ID should be available.

* Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.h:
* Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm:
(WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement):
(WebKit::VideoFullscreenManager::videoDimensionsChanged):

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

4c6e1cb

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ›  gtk
❌ πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk1 ❌ πŸ§ͺ gtk-wk2
βœ… πŸ›  tv βœ… πŸ§ͺ mac-wk2 βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv-sim   πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  watch βœ… πŸ§ͺ mac-wk2-stress
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch-sim

@pvollan pvollan requested a review from cdumez as a code owner April 5, 2023 20:45
@pvollan pvollan self-assigned this Apr 5, 2023
@pvollan pvollan added the WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore). label Apr 5, 2023
@pvollan pvollan force-pushed the eng/No-videos-play-if-opened-in-full-screen-on-first-play branch from 2c4b031 to 977c100 Compare April 5, 2023 21:08
@@ -190,6 +192,7 @@ class VideoFullscreenManager : public RefCounted<VideoFullscreenManager>, privat
HashMap<PlaybackSessionContextIdentifier, int> m_clientCounts;
WeakPtr<WebCore::HTMLVideoElement, WebCore::WeakPtrImplWithEventTargetData> m_videoElementInPictureInPicture;
bool m_currentlyInFullscreen { false };
WTF::Function<void(LayerHostingContextID)> m_setupFullscreen;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I'm not wild about this name, maybe m_setupFullscreenHandler?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in latest patch.

Thanks for reviewing!

Copy link
Member

@jyavenard jyavenard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in the commit log:
s/guranteed/guaranteed

some comments

@@ -190,6 +192,7 @@ class VideoFullscreenManager : public RefCounted<VideoFullscreenManager>, privat
HashMap<PlaybackSessionContextIdentifier, int> m_clientCounts;
WeakPtr<WebCore::HTMLVideoElement, WebCore::WeakPtrImplWithEventTargetData> m_videoElementInPictureInPicture;
bool m_currentlyInFullscreen { false };
WTF::Function<void(LayerHostingContextID)> m_setupFullscreen;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be a CompletionHandler?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be a CompletionHandler?

Yes, I think it could. I have kept is as Function, though, since I think both make sense in this context.


if (m_setupFullscreen) {
auto [model, interface] = ensureModelAndInterface(contextId);
RefPtr<HTMLVideoElement> videoElement = model->videoElement();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auto videoElement

need null check

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Fixed in latest patch.

Thanks for reviewing!

@pvollan pvollan force-pushed the eng/No-videos-play-if-opened-in-full-screen-on-first-play branch from 977c100 to 413c282 Compare April 5, 2023 22:07
@pvollan pvollan force-pushed the eng/No-videos-play-if-opened-in-full-screen-on-first-play branch from 413c282 to ab15958 Compare April 5, 2023 22:43
@pvollan pvollan force-pushed the eng/No-videos-play-if-opened-in-full-screen-on-first-play branch from ab15958 to 4c6e1cb Compare April 5, 2023 22:48
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Apr 6, 2023
@pvollan pvollan added merge-queue Applied to send a pull request to merge-queue and removed merging-blocked Applied to prevent a change from being merged labels Apr 6, 2023
https://bugs.webkit.org/show_bug.cgi?id=255048
rdar://107540521

Reviewed by Eric Carlson and Jean-Yves Avenard.

When CA layers are not remotely hosted in both the GPU process and the WebContent process, it is not
guaranteed that the remote context ID will be set in the HTML media element when entering fullscreen.
This patch works around that by delaying setting up the fullscreen until the video dimensions are set.
At this point, the remote context ID should be available.

* Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.h:
* Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm:
(WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement):
(WebKit::VideoFullscreenManager::videoDimensionsChanged):

Canonical link: https://commits.webkit.org/262654@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/No-videos-play-if-opened-in-full-screen-on-first-play branch from 4c6e1cb to 62b9ab7 Compare April 6, 2023 02:34
@webkit-commit-queue
Copy link
Collaborator

Committed 262654@main (62b9ab7): https://commits.webkit.org/262654@main

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

@webkit-commit-queue webkit-commit-queue merged commit 62b9ab7 into WebKit:main Apr 6, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore).
Projects
None yet
6 participants