Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 0 additions & 3 deletions js/viewer-components.js

This file was deleted.

1 change: 0 additions & 1 deletion js/viewer-components.js.map

This file was deleted.

3 changes: 0 additions & 3 deletions js/viewer-filerobot.js

This file was deleted.

1 change: 0 additions & 1 deletion js/viewer-filerobot.js.map

This file was deleted.

4 changes: 2 additions & 2 deletions js/viewer-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer-main.js.map

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions js/viewer-plyr.js

This file was deleted.

1 change: 0 additions & 1 deletion js/viewer-plyr.js.map

This file was deleted.

52 changes: 44 additions & 8 deletions src/components/Videos.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
- @copyright Copyright (c) 2019 John Molakvoæ <[email protected]>
-
- @author John Molakvoæ <[email protected]>
- @author Richard Steinmetz <[email protected]>
-
- @license AGPL-3.0-or-later
-
Expand Down Expand Up @@ -53,21 +54,29 @@
</template>

<script>
import Vue from 'vue'
import VuePlyr from '@skjnldsv/vue-plyr'
// eslint-disable-next-line n/no-missing-import
import '@skjnldsv/vue-plyr/dist/vue-plyr.css'
import logger from '../services/logger.js'
import { imagePath } from '@nextcloud/router'

const VuePlyr = () => import(/* webpackChunkName: 'plyr' */'@skjnldsv/vue-plyr')

const liveExt = ['jpg', 'jpeg', 'png']
const liveExtRegex = new RegExp(`\\.(${liveExt.join('|')})$`, 'i')
const blankVideo = imagePath('viewer', 'blank.mp4')

Vue.use(VuePlyr)

export default {
name: 'Videos',

components: {
VuePlyr,
},
data() {
return {
isFullscreenButtonVisible: false,
}
},

computed: {
livePhoto() {
return this.fileList.find(file => {
Expand Down Expand Up @@ -106,10 +115,15 @@ export default {
}
},
},
// for some reason the video controls don't get mounted to the dom until after the component (Videos) is mounted,
// using the mounted() hook will leave us with an empty array

mounted() {
updated() {
// Prevent swiping to the next/previous item when scrubbing the timeline or changing volume
[...this.$el.querySelectorAll('.plyr__controls__item')].forEach(control => {
if (control.getAttribute('data-plyr') === 'fullscreen') {
control.addEventListener('click', this.hideHeaderAndFooter)
}
if (!control?.addEventListener) {
return
}
Expand All @@ -127,6 +141,17 @@ export default {
},

methods: {
hideHeaderAndFooter(e) {
// work arround to get the state of the fullscreen button, aria-selected attribute is not reliable
this.isFullscreenButtonVisible = !this.isFullscreenButtonVisible
if (this.isFullscreenButtonVisible) {
document.body.querySelector('main').classList.add('viewer__hidden-fullscreen')
document.body.querySelector('footer').classList.add('viewer__hidden-fullscreen')
} else {
document.body.querySelector('main').classList.remove('viewer__hidden-fullscreen')
document.body.querySelector('footer').classList.remove('viewer__hidden-fullscreen')
}
},
// Updates the dimensions of the modal
updateVideoSize() {
this.naturalHeight = this.$refs.video?.videoHeight
Expand Down Expand Up @@ -157,13 +182,13 @@ video {
z-index: 20050;
align-self: center;
max-width: 100%;
max-height: 100%;
max-height: calc(100% - 65px) !important;
background-color: black;

justify-self: center;
}

::v-deep {
:deep() {
.plyr:-webkit-full-screen video {
width: 100% !important;
height: 100% !important;
Expand All @@ -185,11 +210,22 @@ video {

&:hover,
&:focus {
color: var(--color-primary-text);
color: var(--color-primary-element-text);
background-color: var(--color-primary-element);
}
}
}
}
</style>

<style lang="scss">
main.viewer__hidden-fullscreen {
height: 100vh !important;
width: 100vw !important;
margin: 0 !important;
}

footer.viewer__hidden-fullscreen {
display: none !important;
}
</style>