diff options
author | Chocobozzz <me@florianbigard.com> | 2019-01-23 15:36:45 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-02-11 09:13:02 +0100 |
commit | 2adfc7ea9a1f858db874df9fe322e7ae833db77c (patch) | |
tree | e27c6ebe01b7c96ea0e053839a38fc1f824d1284 /client/src/assets/player/peertube-link-button.ts | |
parent | 7eeb6a0ba4028d0e20847b846332dd0b7747c7f8 (diff) | |
download | PeerTube-2adfc7ea9a1f858db874df9fe322e7ae833db77c.tar.gz PeerTube-2adfc7ea9a1f858db874df9fe322e7ae833db77c.tar.zst PeerTube-2adfc7ea9a1f858db874df9fe322e7ae833db77c.zip |
Refractor videojs player
Add fake p2p-media-loader plugin
Diffstat (limited to 'client/src/assets/player/peertube-link-button.ts')
-rw-r--r-- | client/src/assets/player/peertube-link-button.ts | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/client/src/assets/player/peertube-link-button.ts b/client/src/assets/player/peertube-link-button.ts deleted file mode 100644 index de9a49de9..000000000 --- a/client/src/assets/player/peertube-link-button.ts +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' | ||
2 | import { buildVideoLink } from './utils' | ||
3 | // FIXME: something weird with our path definition in tsconfig and typings | ||
4 | // @ts-ignore | ||
5 | import { Player } from 'video.js' | ||
6 | |||
7 | const Button: VideoJSComponentInterface = videojsUntyped.getComponent('Button') | ||
8 | class PeerTubeLinkButton extends Button { | ||
9 | |||
10 | constructor (player: Player, options: any) { | ||
11 | super(player, options) | ||
12 | } | ||
13 | |||
14 | createEl () { | ||
15 | return this.buildElement() | ||
16 | } | ||
17 | |||
18 | updateHref () { | ||
19 | this.el().setAttribute('href', buildVideoLink(this.player().currentTime())) | ||
20 | } | ||
21 | |||
22 | handleClick () { | ||
23 | this.player_.pause() | ||
24 | } | ||
25 | |||
26 | private buildElement () { | ||
27 | const el = videojsUntyped.dom.createEl('a', { | ||
28 | href: buildVideoLink(), | ||
29 | innerHTML: 'PeerTube', | ||
30 | title: this.player_.localize('Go to the video page'), | ||
31 | className: 'vjs-peertube-link', | ||
32 | target: '_blank' | ||
33 | }) | ||
34 | |||
35 | el.addEventListener('mouseenter', () => this.updateHref()) | ||
36 | |||
37 | return el | ||
38 | } | ||
39 | } | ||
40 | Button.registerComponent('PeerTubeLinkButton', PeerTubeLinkButton) | ||