aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/mobile/peertube-mobile-buttons.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/assets/player/mobile/peertube-mobile-buttons.ts')
-rw-r--r--client/src/assets/player/mobile/peertube-mobile-buttons.ts42
1 files changed, 42 insertions, 0 deletions
diff --git a/client/src/assets/player/mobile/peertube-mobile-buttons.ts b/client/src/assets/player/mobile/peertube-mobile-buttons.ts
new file mode 100644
index 000000000..d6f8f35e3
--- /dev/null
+++ b/client/src/assets/player/mobile/peertube-mobile-buttons.ts
@@ -0,0 +1,42 @@
1import videojs from 'video.js'
2
3import debug from 'debug'
4
5const logger = debug('peertube:player:mobile')
6
7const Component = videojs.getComponent('Component')
8class 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
42videojs.registerComponent('PeerTubeMobileButtons', PeerTubeMobileButtons)