Skip to content

Commit

Permalink
REGRESSION (iOS 17.4.1?): <video> tag fails to adjust its size accord…
Browse files Browse the repository at this point in the history
…ing to changes in the parent element

https://bugs.webkit.org/show_bug.cgi?id=272078
rdar://125881482

Reviewed by Jer Noble.

When layout changes the size of a remote-hosted video element with a MediaStream
source, the order of calls to `VideoPresentationManagerProxy` and
`VideoPresentationModelContext` isn't always the same. If
`VideoPresentationManagerProxy::createViewWithID` is called before the model's
view has been created, it creates and configures a WebAVPlayerLayerView and
a WKVideoView. It did not set the model's video dimensions, which sometimes
caused WebAVPlayerLayer to be resized incorrectly when layout changed the
size of the video element very quickly.

* Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.mm:
(WebKit::VideoPresentationManagerProxy::createViewWithID): Call model->setVideoDimensions
with the video's native dimensions.

Canonical link: https://commits.webkit.org/278350@main
  • Loading branch information
eric-carlson committed May 4, 2024
1 parent 603edf0 commit 0470d0f
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -819,8 +819,9 @@ - (BOOL)prefersStatusBarHidden
auto initialFrame = CGRectMake(0, 0, initialSize.width(), initialSize.height());
auto playerView = adoptNS([allocWebAVPlayerLayerViewInstance() initWithFrame:initialFrame]);

RetainPtr playerLayer { (WebAVPlayerLayer *)[playerView layer] };
model->setVideoDimensions(nativeSize);

RetainPtr playerLayer { (WebAVPlayerLayer *)[playerView layer] };
[playerLayer setVideoDimensions:nativeSize];
[playerLayer setPresentationModel:model.get()];
[playerLayer setVideoSublayer:[view layer]];
Expand Down

0 comments on commit 0470d0f

Please sign in to comment.