Skip to content

Commit e5b4b05

Browse files
hamza221st3iny
authored andcommitted
Fix: video player unusable on ios
Signed-off-by: hamza221 <hamzamahjoubi221@gmail.com> Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
1 parent 6f0f8f2 commit e5b4b05

File tree

5 files changed

+42
-8
lines changed

5 files changed

+42
-8
lines changed

js/viewer-filerobot.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/viewer-filerobot.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/viewer-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/viewer-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Videos.vue

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
- @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>
33
-
44
- @author John Molakvoæ <skjnldsv@protonmail.com>
5+
- @author Richard Steinmetz <richard@steinmetz.cloud>
56
-
67
- @license AGPL-3.0-or-later
78
-
@@ -70,6 +71,11 @@ export default {
7071
components: {
7172
VuePlyr,
7273
},
74+
data() {
75+
return {
76+
isFullscreenButtonVisible: false,
77+
}
78+
},
7379
7480
computed: {
7581
livePhoto() {
@@ -109,10 +115,15 @@ export default {
109115
}
110116
},
111117
},
118+
// for some reason the video controls don't get mounted to the dom until after the component (Videos) is mounted,
119+
// using the mounted() hook will leave us with an empty array
112120
113-
mounted() {
121+
updated() {
114122
// Prevent swiping to the next/previous item when scrubbing the timeline or changing volume
115123
[...this.$el.querySelectorAll('.plyr__controls__item')].forEach(control => {
124+
if(control.getAttribute('data-plyr') === 'fullscreen') {
125+
control.addEventListener('click',this.hideHeaderAndFooter)
126+
}
116127
if (!control?.addEventListener) {
117128
return
118129
}
@@ -130,6 +141,17 @@ export default {
130141
},
131142
132143
methods: {
144+
hideHeaderAndFooter(e){
145+
// work arround to get the state of the fullscreen button, aria-selected attribute is not reliable
146+
this.isFullscreenButtonVisible = !this.isFullscreenButtonVisible
147+
if (this.isFullscreenButtonVisible) {
148+
document.body.querySelector('main').classList.add('viewer__hidden-fullscreen')
149+
document.body.querySelector('footer').classList.add('viewer__hidden-fullscreen')
150+
} else {
151+
document.body.querySelector('main').classList.remove('viewer__hidden-fullscreen')
152+
document.body.querySelector('footer').classList.remove('viewer__hidden-fullscreen')
153+
}
154+
},
133155
// Updates the dimensions of the modal
134156
updateVideoSize() {
135157
this.naturalHeight = this.$refs.video?.videoHeight
@@ -160,7 +182,7 @@ video {
160182
z-index: 20050;
161183
align-self: center;
162184
max-width: 100%;
163-
max-height: 100%;
185+
max-height: calc(100% - 65px) !important;
164186
background-color: black;
165187
166188
justify-self: center;
@@ -179,6 +201,7 @@ video {
179201
flex: 1 1;
180202
}
181203
204+
182205
.plyr {
183206
@import '../mixins/Plyr';
184207
@@ -194,5 +217,16 @@ video {
194217
}
195218
}
196219
}
220+
</style>
197221
222+
<style lang="scss">
223+
main.viewer__hidden-fullscreen {
224+
height: 100vh !important;
225+
width: 100vw !important;
226+
margin: 0 !important;
227+
}
228+
229+
footer.viewer__hidden-fullscreen {
230+
display: none !important;
231+
}
198232
</style>

0 commit comments

Comments
 (0)