diff options
author | Chocobozzz <me@florianbigard.com> | 2018-03-01 19:02:51 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-03-01 19:02:51 +0100 |
commit | 3ec8dc096276ac3c7e5d8dca5f100017516f62ec (patch) | |
tree | efeab8056224d54f44dc498a110fba54d831d4f0 /client/src/assets/player/peertube-videojs-plugin.ts | |
parent | c7bfd4532ea5783be525525c8260159497cb0f64 (diff) | |
download | PeerTube-3ec8dc096276ac3c7e5d8dca5f100017516f62ec.tar.gz PeerTube-3ec8dc096276ac3c7e5d8dca5f100017516f62ec.tar.zst PeerTube-3ec8dc096276ac3c7e5d8dca5f100017516f62ec.zip |
Cleaner videojs control bar implementation
Diffstat (limited to 'client/src/assets/player/peertube-videojs-plugin.ts')
-rw-r--r-- | client/src/assets/player/peertube-videojs-plugin.ts | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts index 3b366ec9b..86cb858e2 100644 --- a/client/src/assets/player/peertube-videojs-plugin.ts +++ b/client/src/assets/player/peertube-videojs-plugin.ts | |||
@@ -22,7 +22,6 @@ interface VideoJSComponentInterface { | |||
22 | type PeertubePluginOptions = { | 22 | type PeertubePluginOptions = { |
23 | videoFiles: VideoFile[] | 23 | videoFiles: VideoFile[] |
24 | playerElement: HTMLVideoElement | 24 | playerElement: HTMLVideoElement |
25 | peerTubeLink: boolean | ||
26 | videoViewUrl: string | 25 | videoViewUrl: string |
27 | videoDuration: number | 26 | videoDuration: number |
28 | } | 27 | } |
@@ -120,7 +119,7 @@ class ResolutionMenuButton extends MenuButton { | |||
120 | MenuButton.registerComponent('ResolutionMenuButton', ResolutionMenuButton) | 119 | MenuButton.registerComponent('ResolutionMenuButton', ResolutionMenuButton) |
121 | 120 | ||
122 | const Button: VideoJSComponentInterface = videojsUntyped.getComponent('Button') | 121 | const Button: VideoJSComponentInterface = videojsUntyped.getComponent('Button') |
123 | class PeertubeLinkButton extends Button { | 122 | class PeerTubeLinkButton extends Button { |
124 | 123 | ||
125 | createEl () { | 124 | createEl () { |
126 | const link = document.createElement('a') | 125 | const link = document.createElement('a') |
@@ -141,7 +140,7 @@ class PeertubeLinkButton extends Button { | |||
141 | this.parentNode.removeChild(this) | 140 | this.parentNode.removeChild(this) |
142 | } | 141 | } |
143 | } | 142 | } |
144 | Button.registerComponent('PeerTubeLinkButton', PeertubeLinkButton) | 143 | Button.registerComponent('PeerTubeLinkButton', PeerTubeLinkButton) |
145 | 144 | ||
146 | class WebTorrentButton extends Button { | 145 | class WebTorrentButton extends Button { |
147 | createEl () { | 146 | createEl () { |
@@ -392,20 +391,6 @@ class PeerTubePlugin extends Plugin { | |||
392 | } | 391 | } |
393 | 392 | ||
394 | private initializePlayer (options: PeertubePluginOptions) { | 393 | private initializePlayer (options: PeertubePluginOptions) { |
395 | const controlBar = this.player.controlBar | ||
396 | |||
397 | const menuButton = new ResolutionMenuButton(this.player, options) | ||
398 | const fullscreenElement = controlBar.fullscreenToggle.el() | ||
399 | controlBar.resolutionSwitcher = controlBar.el().insertBefore(menuButton.el(), fullscreenElement) | ||
400 | |||
401 | if (options.peerTubeLink === true) { | ||
402 | const peerTubeLinkButton = new PeertubeLinkButton(this.player) | ||
403 | controlBar.peerTubeLink = controlBar.el().insertBefore(peerTubeLinkButton.el(), fullscreenElement) | ||
404 | } | ||
405 | |||
406 | const webTorrentButton = new WebTorrentButton(this.player) | ||
407 | controlBar.webTorrent = controlBar.el().insertBefore(webTorrentButton.el(), controlBar.progressControl.el()) | ||
408 | |||
409 | if (this.autoplay === true) { | 394 | if (this.autoplay === true) { |
410 | this.updateVideoFile(undefined, () => this.player.play()) | 395 | this.updateVideoFile(undefined, () => this.player.play()) |
411 | } else { | 396 | } else { |