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
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

Fixed bug which set video width and height to 100% of the screen size instead of the video size.
kulmann marked this conversation as resolved.
Show resolved Hide resolved
This bug made unable to see full video in 1080x1920, while 1920x1080 might have been slightly copped.
kulmann marked this conversation as resolved.
Show resolved Hide resolved

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>