-
Notifications
You must be signed in to change notification settings - Fork 159
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
Updated video dimensions to fit view horizontal/vertical #10101
Conversation
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes. |
methods: { | ||
updateDimensions() { | ||
this.resizeVideoDimensions() | ||
window.addEventListener('resize', this.resizeVideoDimensions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each time this method gets called you register an event listener, is this done intentionally? Wouldn't it make more sense to register the event listener once on mount?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh.. my bad, you are right. At first I was working with the videoWidth and videoHeight, then change it to setting max dimensions and didn't update this. Yeah, thats completely reasonable to set in onMounted
beforeUnmount() { | ||
window.removeEventListener('resize', this.resizeVideoDimensions) | ||
}, | ||
methods: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the composition API by adding the methods and onBeforeUnmount
in setup
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a bugfix changelog item.
@@ -18,6 +24,30 @@ export default defineComponent({ | |||
type: Boolean, | |||
default: true | |||
} | |||
}, | |||
setup() { | |||
const video = ref<Ref<HTMLVideoElement | null>>(null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue with the type:
packages/web-app-preview/src/components/Sources/MediaVideo.vue(31,65): error TS2339: Property 'offsetHeight' does not exist on type 'Element'.
packages/web-app-preview/src/components/Sources/MediaVideo.vue(32,64): error TS2339: Property 'offsetWidth' does not exist on type 'Element'.
Kudos, SonarCloud Quality Gate passed! |
Description
Video preview is automatically settings dimensions to eliminate cropping for video, mostly benefical for vertical videos.
Dimensions are updated once video metadata are loaded and further on window resize
Related Issue
Screenshots (if appropriate):
Before:
Horizontal
Vertical
Now:
Horizontal
Vertical
Types of changes
Checklist: