Skip to content

Respect video scaling in VideoRenderer#321

Open
zhs852 wants to merge 1 commit into
GetStream:mainfrom
zhs852:compose-scale
Open

Respect video scaling in VideoRenderer#321
zhs852 wants to merge 1 commit into
GetStream:mainfrom
zhs852:compose-scale

Conversation

@zhs852
Copy link
Copy Markdown

@zhs852 zhs852 commented May 30, 2026

🎯 Goal

Fix VideoRenderer in the Compose artifact so videoScalingType is respected when the composable is measured with fixed or fill constraints, such as Modifier.fillMaxSize().

Previously, VideoRenderer passed the scaling type to VideoTextureViewRenderer, but Compose AndroidView constraints could still force the renderer to occupy the full parent size. In that case SCALE_ASPECT_FIT behaved like a filled or cropped render instead of preserving the video aspect ratio with letterboxing.

🛠 Implementation details

VideoRenderer now wraps the underlying AndroidView in BoxWithConstraints, tracks the latest rendered frame size from RendererEvents.onFrameResolutionChanged, and computes the renderer view size with RendererCommon.getDisplaySize(...) using the requested VideoScalingType.

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