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

Updated video dimensions to fit view horizontal/vertical #10101

Merged
merged 8 commits into from
Dec 8, 2023

Conversation

jacob-nv
Copy link
Contributor

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
Screenshot from 2023-11-30 20-26-42
Vertical
Screenshot from 2023-11-30 20-26-56

Now:
Horizontal
Screenshot from 2023-11-30 20-25-32

Vertical
Screenshot from 2023-11-30 20-25-24

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

@jacob-nv jacob-nv self-assigned this Nov 30, 2023
Copy link

update-docs bot commented Nov 30, 2023

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)
Copy link
Contributor

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?

Copy link
Contributor Author

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

Comment on lines 29 to 32
beforeUnmount() {
window.removeEventListener('resize', this.resizeVideoDimensions)
},
methods: {
Copy link
Contributor

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.

@jacob-nv jacob-nv requested a review from JammingBen December 1, 2023 14:18
Copy link
Member

@kulmann kulmann left a 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)
Copy link
Member

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'.

@jacob-nv jacob-nv requested a review from kulmann December 5, 2023 15:12
changelog/unreleased/bugfix-video-dimensions Outdated Show resolved Hide resolved
changelog/unreleased/bugfix-video-dimensions Outdated Show resolved Hide resolved
@kulmann kulmann enabled auto-merge (squash) December 8, 2023 21:59
Copy link

sonarcloud bot commented Dec 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

10.0% 10.0% Coverage
0.0% 0.0% Duplication

@kulmann kulmann merged commit 861adc2 into owncloud:master Dec 8, 2023
4 checks passed
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.

Bug while playing vertical videos
4 participants