Add touch controls to video player (Hold to pause, doubel tap to fullscreen)
This commit is contained in:
parent
aeeb911f0f
commit
aa6b2925ed
|
@ -76,6 +76,8 @@ export default Vue.extend({
|
||||||
maxFramerate: 0,
|
maxFramerate: 0,
|
||||||
activeSourceList: [],
|
activeSourceList: [],
|
||||||
mouseTimeout: null,
|
mouseTimeout: null,
|
||||||
|
touchTimeout: null,
|
||||||
|
lastTouchTime: null,
|
||||||
dataSetup: {
|
dataSetup: {
|
||||||
fluid: true,
|
fluid: true,
|
||||||
nativeTextTracks: false,
|
nativeTextTracks: false,
|
||||||
|
@ -719,6 +721,25 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleTouchStart: function (event) {
|
||||||
|
const v = this
|
||||||
|
this.touchPauseTimeout = setTimeout(() => {
|
||||||
|
v.togglePlayPause()
|
||||||
|
}, 1000)
|
||||||
|
|
||||||
|
const touchTime = new Date()
|
||||||
|
|
||||||
|
if (this.lastTouchTime !== null && (touchTime.getTime() - this.lastTouchTime.getTime()) < 250) {
|
||||||
|
this.toggleFullscreen()
|
||||||
|
}
|
||||||
|
|
||||||
|
this.lastTouchTime = touchTime
|
||||||
|
},
|
||||||
|
|
||||||
|
handleTouchEnd: function (event) {
|
||||||
|
clearTimeout(this.touchPauseTimeout)
|
||||||
|
},
|
||||||
|
|
||||||
keyboardShortcutHandler: function (event) {
|
keyboardShortcutHandler: function (event) {
|
||||||
const activeInputs = $('.ft-input')
|
const activeInputs = $('.ft-input')
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
:poster="thumbnail"
|
:poster="thumbnail"
|
||||||
controls
|
controls
|
||||||
preload="auto"
|
preload="auto"
|
||||||
|
@touchstart="handleTouchStart"
|
||||||
|
@touchend="handleTouchEnd"
|
||||||
:data-setup="JSON.stringify(dataSetup)"
|
:data-setup="JSON.stringify(dataSetup)"
|
||||||
>
|
>
|
||||||
<source
|
<source
|
||||||
|
|
Loading…
Reference in New Issue