X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fassets%2Fplayer%2Fbezels%2Fbezels-plugin.ts;h=49917752622b45c458a4cd415fa3016221ea5a90;hb=d5692d4088cdd9fde3be6ff34be8ce2816dab0cf;hp=c2c2519617846acfcdf730b00f2a6d6ac8981c7a;hpb=96f6278f3e5b35d6e812176c799088f88729a0b0;p=github%2FChocobozzz%2FPeerTube.git
diff --git a/client/src/assets/player/bezels/bezels-plugin.ts b/client/src/assets/player/bezels/bezels-plugin.ts
index c2c251961..499177526 100644
--- a/client/src/assets/player/bezels/bezels-plugin.ts
+++ b/client/src/assets/player/bezels/bezels-plugin.ts
@@ -1,85 +1,12 @@
-// @ts-ignore
-import * as videojs from 'video.js'
-import { VideoJSComponentInterface } from '../peertube-videojs-typings'
+import videojs, { VideoJsPlayer } from 'video.js'
+import './pause-bezel'
-function getPauseBezel () {
- return `
-
- `
-}
-
-function getPlayBezel () {
- return `
-
- `
-}
-
-// @ts-ignore-start
-const Component = videojs.getComponent('Component')
-class PauseBezel extends Component {
- options_: any
- container: HTMLBodyElement
-
- constructor (player: videojs.Player, options: any) {
- super(player, options)
- this.options_ = options
-
- player.on('pause', (_: any) => {
- if (player.seeking() || player.ended()) return
- this.container.innerHTML = getPauseBezel()
- this.showBezel()
- })
-
- player.on('play', (_: any) => {
- if (player.seeking()) return
- this.container.innerHTML = getPlayBezel()
- this.showBezel()
- })
- }
+const Plugin = videojs.getPlugin('plugin')
- createEl () {
- const container = super.createEl('div', {
- className: 'vjs-bezels-content'
- })
- this.container = container
- container.style.display = 'none'
-
- return container
- }
-
- showBezel () {
- this.container.style.display = 'inherit'
- setTimeout(() => {
- this.container.style.display = 'none'
- }, 500) // matching the animation duration
- }
-}
-// @ts-ignore-end
-
-videojs.registerComponent('PauseBezel', PauseBezel)
-
-const Plugin: VideoJSComponentInterface = videojs.getPlugin('plugin')
class BezelsPlugin extends Plugin {
- constructor (player: videojs.Player, options: any = {}) {
- super(player, options)
+
+ constructor (player: VideoJsPlayer, options?: videojs.ComponentOptions) {
+ super(player)
this.player.ready(() => {
player.addClass('vjs-bezels')
@@ -90,4 +17,5 @@ class BezelsPlugin extends Plugin {
}
videojs.registerPlugin('bezels', BezelsPlugin)
+
export { BezelsPlugin }