Fix player flickering in VOD mode when height is set to auto - #86
Open
Andgoncharov wants to merge 1 commit into
Open
Fix player flickering in VOD mode when height is set to auto#86Andgoncharov wants to merge 1 commit into
Andgoncharov wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug: With width: "100%" and height: "auto", the player flickered in VOD mode, endlessly resizing.
Root cause: UILayoutManager.fullLayout() sized the video element from the container rect measured by a ResizeObserver. With height: auto, the container's height derives from the video itself, so the measurement fed back: the aspect comparison alternated between {height: 100%, width: auto} and {width: 100%, height: auto} — and since height: 100% against an auto-height parent resolves to intrinsic sizing, each choice changed the container height and flipped the comparison on the next observer tick. A two-state oscillation, visible as flicker.
Fix: When the container height is auto, skip the rect-based fit and use rect-independent styles — width: 100% (or auto if width is auto too), height: auto, with aspect-ratio keeping the shape — giving the layout a single fixed point. The rect-based fit is kept when only the width is auto: on a block container that resolves to the parent's width, which is definite and feedback-free, preserving letterboxing for fixed-height configs. All other paths (definite sizes, fullscreen, PiP, frame-sized) are unchanged.
Tests: pin the fixed-point property (the oscillation's own output rect must map back to identical styles), the preserved rect fit for width-auto-only including the narrow-parent letterboxing case, intrinsic sizing for both-auto, and the media-element mode variant.