]>
Commit | Line | Data |
---|---|---|
f1a0555a C |
1 | import videojs from 'video.js' |
2 | ||
3 | import debug from 'debug' | |
4 | ||
5 | const logger = debug('peertube:player:mobile') | |
6 | ||
7 | const Component = videojs.getComponent('Component') | |
8 | class PeerTubeMobileButtons extends Component { | |
9 | ||
10 | createEl () { | |
11 | const container = super.createEl('div', { | |
12 | className: 'vjs-mobile-buttons-overlay' | |
13 | }) as HTMLDivElement | |
14 | ||
15 | container.addEventListener('click', () => { | |
16 | logger('Set user as inactive') | |
17 | ||
18 | this.player_.userActive(false) | |
19 | }) | |
20 | ||
21 | const mainButton = super.createEl('div', { | |
22 | className: 'main-button' | |
23 | }) as HTMLDivElement | |
24 | ||
25 | mainButton.addEventListener('click', e => { | |
26 | e.stopPropagation() | |
27 | ||
28 | if (this.player_.paused() || this.player_.ended()) { | |
29 | this.player_.play() | |
30 | return | |
31 | } | |
32 | ||
33 | this.player_.pause() | |
34 | }) | |
35 | ||
36 | container.appendChild(mainButton) | |
37 | ||
38 | return container | |
39 | } | |
40 | } | |
41 | ||
42 | videojs.registerComponent('PeerTubeMobileButtons', PeerTubeMobileButtons) |