Skip to content

Fix player flickering in VOD mode when height is set to auto - #86

Open
Andgoncharov wants to merge 1 commit into
Softvelum:mainfrom
Andgoncharov:fix/vod-auto-height-flicker
Open

Fix player flickering in VOD mode when height is set to auto#86
Andgoncharov wants to merge 1 commit into
Softvelum:mainfrom
Andgoncharov:fix/vod-auto-height-flicker

Conversation

@Andgoncharov

Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant