Hide Mouse when on top of video player
This commit is contained in:
parent
9e1b1cbdd8
commit
ed8a74625c
|
@ -50,6 +50,7 @@ export default Vue.extend({
|
||||||
useDash: false,
|
useDash: false,
|
||||||
useHls: false,
|
useHls: false,
|
||||||
activeSourceList: [],
|
activeSourceList: [],
|
||||||
|
mouseTimeout: null,
|
||||||
dataSetup: {
|
dataSetup: {
|
||||||
aspectRatio: '16:9',
|
aspectRatio: '16:9',
|
||||||
nativeTextTracks: false,
|
nativeTextTracks: false,
|
||||||
|
@ -115,6 +116,7 @@ export default Vue.extend({
|
||||||
if (this.player !== null && !this.player.isInPictureInPicture()) {
|
if (this.player !== null && !this.player.isInPictureInPicture()) {
|
||||||
this.player.dispose()
|
this.player.dispose()
|
||||||
this.player = null
|
this.player = null
|
||||||
|
clearTimeout(this.mouseTimeout)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -147,6 +149,15 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('keydown', this.keyboardShortcutHandler)
|
$(document).on('keydown', this.keyboardShortcutHandler)
|
||||||
|
|
||||||
|
this.player.on('mousemove', this.hideMouseTimeout)
|
||||||
|
this.player.on('mouseleave', this.removeMouseTimeout)
|
||||||
|
|
||||||
|
const v = this
|
||||||
|
|
||||||
|
this.player.on('error', function (error, message) {
|
||||||
|
v.$emit('error', error.target.player.error_)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -261,6 +272,27 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
hideMouseTimeout: function () {
|
||||||
|
if (this.id === '') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const videoPlayer = $(`#${this.id} video`).get(0)
|
||||||
|
if (typeof (videoPlayer) !== 'undefined') {
|
||||||
|
videoPlayer.style.cursor = 'default'
|
||||||
|
clearTimeout(this.mouseTimeout)
|
||||||
|
this.mouseTimeout = window.setTimeout(function () {
|
||||||
|
videoPlayer.style.cursor = 'none'
|
||||||
|
}, 2650)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
removeMouseTimeout: function () {
|
||||||
|
if (this.mouseTimeout !== null) {
|
||||||
|
clearTimeout(this.mouseTimeout)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
keyboardShortcutHandler: function (event) {
|
keyboardShortcutHandler: function (event) {
|
||||||
const activeInputs = $('.ft-input')
|
const activeInputs = $('.ft-input')
|
||||||
|
|
||||||
|
@ -396,6 +428,7 @@ export default Vue.extend({
|
||||||
if (this.player !== null && !this.player.isInPictureInPicture()) {
|
if (this.player !== null && !this.player.isInPictureInPicture()) {
|
||||||
this.player.dispose()
|
this.player.dispose()
|
||||||
this.player = null
|
this.player = null
|
||||||
|
clearTimeout(this.mouseTimeout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
.videoTitle {
|
.videoTitle {
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
max-width: 60%;
|
max-width: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.channelInformation {
|
.channelInformation {
|
||||||
|
|
|
@ -258,6 +258,18 @@ export default Vue.extend({
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.hidePlayer = false
|
this.hidePlayer = false
|
||||||
}, 100)
|
}, 100)
|
||||||
|
},
|
||||||
|
|
||||||
|
handleVideoError: function (error) {
|
||||||
|
console.log(error)
|
||||||
|
if (error.code === 4) {
|
||||||
|
if (this.activeFormat === 'dash') {
|
||||||
|
console.log('Unable to play dash formats. Reverting to legacy formats...')
|
||||||
|
this.enableLegacyFormat()
|
||||||
|
} else {
|
||||||
|
this.enableDashFormat()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
class="videoPlayer"
|
class="videoPlayer"
|
||||||
:class="{ theatrePlayer: useTheatreMode }"
|
:class="{ theatrePlayer: useTheatreMode }"
|
||||||
ref="videoPlayer"
|
ref="videoPlayer"
|
||||||
|
@error="handleVideoError"
|
||||||
/>
|
/>
|
||||||
<watch-video-info
|
<watch-video-info
|
||||||
v-if="!isLoading"
|
v-if="!isLoading"
|
||||||
|
|
Loading…
Reference in New Issue