Finiashed adding overlay that displays title (#789)

This commit is contained in:
TDDR 2020-11-15 14:13:18 -05:00 committed by GitHub
parent fe5b4321e8
commit 79a1555e2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 2 deletions

9
package-lock.json generated
View File

@ -16375,6 +16375,15 @@
"es5-shim": "^4.5.1" "es5-shim": "^4.5.1"
} }
}, },
"videojs-overlay": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/videojs-overlay/-/videojs-overlay-2.1.4.tgz",
"integrity": "sha512-eonf+la2WHZJUvaZXtX1UtpwNRe8Zq5HUkBXgDX9zKOFQ9ppMio7LbYMBVKpei6BcqOOgdNVit1h7NGe6ySe3w==",
"requires": {
"global": "^4.3.2",
"video.js": "^6 || ^7"
}
},
"videojs-replay": { "videojs-replay": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/videojs-replay/-/videojs-replay-1.1.0.tgz", "resolved": "https://registry.npmjs.org/videojs-replay/-/videojs-replay-1.1.0.tgz",

View File

@ -30,6 +30,7 @@
"videojs-abloop": "^1.2.0", "videojs-abloop": "^1.2.0",
"videojs-contrib-quality-levels": "^2.0.9", "videojs-contrib-quality-levels": "^2.0.9",
"videojs-http-source-selector": "^1.1.6", "videojs-http-source-selector": "^1.1.6",
"videojs-overlay": "^2.1.4",
"videojs-replay": "^1.1.0", "videojs-replay": "^1.1.0",
"videojs-vtt-thumbnails-freetube": "0.0.15", "videojs-vtt-thumbnails-freetube": "0.0.15",
"vue": "^2.6.12", "vue": "^2.6.12",

View File

@ -5,6 +5,8 @@ import $ from 'jquery'
import videojs from 'video.js' import videojs from 'video.js'
import qualitySelector from '@silvermine/videojs-quality-selector' import qualitySelector from '@silvermine/videojs-quality-selector'
import fs from 'fs' import fs from 'fs'
import 'videojs-overlay/dist/videojs-overlay'
import 'videojs-overlay/dist/videojs-overlay.css'
import 'videojs-vtt-thumbnails-freetube' import 'videojs-vtt-thumbnails-freetube'
import 'videojs-contrib-quality-levels' import 'videojs-contrib-quality-levels'
import 'videojs-http-source-selector' import 'videojs-http-source-selector'
@ -206,6 +208,8 @@ export default Vue.extend({
this.player.on('volumechange', this.updateVolume) this.player.on('volumechange', this.updateVolume)
this.player.controlBar.getChild('volumePanel').on('mousewheel', this.mouseScrollVolume) this.player.controlBar.getChild('volumePanel').on('mousewheel', this.mouseScrollVolume)
this.player.on('fullscreenchange', this.fullscreenOverlay)
const v = this const v = this
this.player.on('ready', function () { this.player.on('ready', function () {
@ -526,6 +530,35 @@ export default Vue.extend({
} }
}, },
fullscreenOverlay: function () {
const v = this
const title = document.title.replace('- FreeTube', '')
if (this.player.isFullscreen()) {
this.player.ready(function () {
v.player.overlay({
overlays: [{
showBackground: false,
content: title,
start: 'mousemove',
end: 'userinactive'
}]
})
})
} else {
this.player.ready(function () {
v.player.overlay({
overlays: [{
showBackground: false,
content: ' ',
start: 'play',
end: 'loadstart'
}]
})
})
}
},
keyboardShortcutHandler: function (event) { keyboardShortcutHandler: function (event) {
const activeInputs = $('.ft-input') const activeInputs = $('.ft-input')
@ -599,7 +632,7 @@ export default Vue.extend({
break break
case 40: case 40:
// Down Arrow Key // Down Arrow Key
// Descrease Volume // Decrease Volume
event.preventDefault() event.preventDefault()
this.changeVolume(-0.05) this.changeVolume(-0.05)
break break
@ -611,7 +644,7 @@ export default Vue.extend({
break break
case 39: case 39:
// Right Arrow Key // Right Arrow Key
// Fast Foward by 5 seconds // Fast Forward by 5 seconds
event.preventDefault() event.preventDefault()
this.changeDurationBySeconds(5) this.changeDurationBySeconds(5)
break break

View File

@ -2020,3 +2020,8 @@ video::-webkit-media-text-track-display {
position: relative; position: relative;
top: -1px; top: -1px;
} }
.vjs-overlay {
font-size: xx-large;
max-width: 100% !important;
}