aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/peertube-load-progress-bar.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-05-31 09:51:51 +0200
committerChocobozzz <me@florianbigard.com>2018-05-31 09:51:51 +0200
commit77728efa627527a9f0f27010a597e8984d7a27f8 (patch)
tree487c4b5e90bba172b2d23499605f72f2cf28f207 /client/src/assets/player/peertube-load-progress-bar.ts
parent0bf1f2652382089c06434a7d297b638aad778b52 (diff)
downloadPeerTube-77728efa627527a9f0f27010a597e8984d7a27f8.tar.gz
PeerTube-77728efa627527a9f0f27010a597e8984d7a27f8.tar.zst
PeerTube-77728efa627527a9f0f27010a597e8984d7a27f8.zip
Fix player progress bar
Diffstat (limited to 'client/src/assets/player/peertube-load-progress-bar.ts')
-rw-r--r--client/src/assets/player/peertube-load-progress-bar.ts36
1 files changed, 36 insertions, 0 deletions
diff --git a/client/src/assets/player/peertube-load-progress-bar.ts b/client/src/assets/player/peertube-load-progress-bar.ts
new file mode 100644
index 000000000..cc861c451
--- /dev/null
+++ b/client/src/assets/player/peertube-load-progress-bar.ts
@@ -0,0 +1,36 @@
1import * as Bitfield from 'bitfield'
2import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
3
4const Component: VideoJSComponentInterface = videojsUntyped.getComponent('Component')
5
6class PeerTubeLoadProgressBar extends Component {
7
8 constructor (player, options) {
9 super(player, options)
10 this.partEls_ = []
11 this.on(player, 'progress', this.update)
12 }
13
14 createEl () {
15 return super.createEl('div', {
16 className: 'vjs-load-progress',
17 innerHTML: `<span class="vjs-control-text"><span>${this.localize('Loaded')}</span>: 0%</span>`
18 })
19 }
20
21 dispose () {
22 this.partEls_ = null
23
24 super.dispose()
25 }
26
27 update () {
28 const torrent = this.player().peertube().getTorrent()
29 if (!torrent) return
30
31 this.el_.style.width = (torrent.progress * 100) + '%'
32 }
33
34}
35
36Component.registerComponent('PeerTubeLoadProgressBar', PeerTubeLoadProgressBar)