Skip to content

Commit

Permalink
Updated video dimensions to fit view horizontal/vertical (#10101)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-nv authored and AlexAndBear committed Dec 13, 2023
1 parent a36bde4 commit 5bed852
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
7 changes: 7 additions & 0 deletions changelog/unreleased/bugfix-video-dimensions
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: Displaying full video in their dimensions

We've fixed a bug which set the video width and height to 100% of the screen size instead of the actual video size.
This bug made it impossible to see the full video in 1080x1920, while 1920x1080 might have been slightly cropped.

https://github.com/owncloud/web/issues/10010
https://github.com/owncloud/web/pull/10101
31 changes: 29 additions & 2 deletions packages/web-app-preview/src/components/Sources/MediaVideo.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<template>
<video :key="`media-video-${file.id}`" controls preload="preload" :autoplay="isAutoPlayEnabled">
<video
ref="video"
:key="`media-video-${file.id}`"
controls
preload="preload"
:autoplay="isAutoPlayEnabled"
>
<source :src="file.url" :type="file.mimeType" />
</video>
</template>
<script lang="ts">
import { defineComponent, PropType } from 'vue'
import { defineComponent, onBeforeUnmount, onMounted, PropType, ref } from 'vue'
import { CachedFile } from '../../helpers/types'
export default defineComponent({
Expand All @@ -18,6 +24,27 @@ export default defineComponent({
type: Boolean,
default: true
}
},
setup() {
const video = ref(null)
const resizeVideoDimensions = () => {
const stageMedia: HTMLElement = document.querySelector('.stage_media')
video.value.style.maxHeight = `${stageMedia.offsetHeight - 10}px`
video.value.style.maxWidth = `${stageMedia.offsetWidth - 10}px`
}
onMounted(() => {
resizeVideoDimensions()
window.addEventListener('resize', resizeVideoDimensions)
})
onBeforeUnmount(() => {
window.removeEventListener('resize', resizeVideoDimensions)
})
return {
video
}
}
})
</script>

0 comments on commit 5bed852

Please sign in to comment.