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

Resize aspect-ratio / padding to fix video overflow #641

Merged
merged 8 commits into from
Sep 8, 2022

Conversation

LittorWired
Copy link
Contributor

@LittorWired LittorWired commented Sep 6, 2022

When the browser viewport is at an aspect ratio where a vertical scrollbar is introduced, the bottom bar is positioned at the bottom of the viewport. Upon scrolling down, the footer keeps that position, which is now in the middle of the content.

@changeset-bot
Copy link

changeset-bot bot commented Sep 6, 2022

🦋 Changeset detected

Latest commit: 75b5ba4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@sw-internal/playground-js Patch
@signalwire/core Patch
@signalwire/realtime-api Patch
@signalwire/js Patch
@sw-internal/e2e-js Patch
@signalwire/react-native Patch
@signalwire/web-api Patch
@signalwire/webrtc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@edolix edolix changed the title WIP: Resize aspect-ratio / padding to fix video overflow Resize aspect-ratio / padding to fix video overflow Sep 8, 2022
Comment on lines +181 to +189
const getWX = () => {
const nativeVideoRatio = video.videoWidth / video.videoHeight
const clientSideRatio = rootElement.clientWidth / rootElement.clientHeight
if (nativeVideoRatio > clientSideRatio) {
return { width: '100%' }
} else {
return { width: `${rootElement.clientHeight * nativeVideoRatio}px` }
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here we calculate a proportion of the native video element (resolution) to the parent container and use this to calculate the width need to move the mcuLayers to correct position i.e overlay the user's local video onto the video from the stream.

@edolix edolix merged commit 569213c into main Sep 8, 2022
@edolix edolix deleted the tl/cp-issue-4476-resize-video-aspect-ratio branch September 8, 2022 16:09
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.

3 participants