// @ts-ignore import * as videojs from 'video.js' import { VideoJSComponentInterface } from '../peertube-videojs-typings' 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() }) } 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) this.player.ready(() => { player.addClass('vjs-bezels') }) player.addChild('PauseBezel', options) } } videojs.registerPlugin('bezels', BezelsPlugin) export { BezelsPlugin }