aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/assets/player')
-rw-r--r--client/src/assets/player/peertube-chunk-store.ts12
-rw-r--r--client/src/assets/player/peertube-link-button.ts5
-rw-r--r--client/src/assets/player/peertube-load-progress-bar.ts5
-rw-r--r--client/src/assets/player/peertube-player.ts20
-rw-r--r--client/src/assets/player/peertube-videojs-plugin.ts20
-rw-r--r--client/src/assets/player/peertube-videojs-typings.ts5
-rw-r--r--client/src/assets/player/resolution-menu-button.ts6
-rw-r--r--client/src/assets/player/resolution-menu-item.ts6
-rw-r--r--client/src/assets/player/settings-menu-button.ts17
-rw-r--r--client/src/assets/player/settings-menu-item.ts8
-rw-r--r--client/src/assets/player/theater-button.ts6
-rw-r--r--client/src/assets/player/utils.ts2
-rw-r--r--client/src/assets/player/webtorrent-info-button.ts2
13 files changed, 75 insertions, 39 deletions
diff --git a/client/src/assets/player/peertube-chunk-store.ts b/client/src/assets/player/peertube-chunk-store.ts
index ac3f9e654..54cc0ea64 100644
--- a/client/src/assets/player/peertube-chunk-store.ts
+++ b/client/src/assets/player/peertube-chunk-store.ts
@@ -76,7 +76,7 @@ export class PeertubeChunkStore extends EventEmitter {
76 this.runCleaner() 76 this.runCleaner()
77 } 77 }
78 78
79 put (index: number, buf: Buffer, cb: Function) { 79 put (index: number, buf: Buffer, cb: (err?: Error) => void) {
80 const isLastChunk = (index === this.lastChunkIndex) 80 const isLastChunk = (index === this.lastChunkIndex)
81 if (isLastChunk && buf.length !== this.lastChunkLength) { 81 if (isLastChunk && buf.length !== this.lastChunkLength) {
82 return this.nextTick(cb, new Error('Last chunk length must be ' + this.lastChunkLength)) 82 return this.nextTick(cb, new Error('Last chunk length must be ' + this.lastChunkLength))
@@ -113,7 +113,7 @@ export class PeertubeChunkStore extends EventEmitter {
113 }, PeertubeChunkStore.BUFFERING_PUT_MS) 113 }, PeertubeChunkStore.BUFFERING_PUT_MS)
114 } 114 }
115 115
116 get (index: number, opts: any, cb: any): any { 116 get (index: number, opts: any, cb: (err?: Error, buf?: Buffer) => void): void {
117 if (typeof opts === 'function') return this.get(index, null, opts) 117 if (typeof opts === 'function') return this.get(index, null, opts)
118 118
119 // IndexDB could be slow, use our memory index first 119 // IndexDB could be slow, use our memory index first
@@ -146,11 +146,11 @@ export class PeertubeChunkStore extends EventEmitter {
146 }) 146 })
147 } 147 }
148 148
149 close (db: any) { 149 close (cb: (err?: Error) => void) {
150 return this.destroy(db) 150 return this.destroy(cb)
151 } 151 }
152 152
153 async destroy (cb: any) { 153 async destroy (cb: (err?: Error) => void) {
154 try { 154 try {
155 if (this.pendingPut) { 155 if (this.pendingPut) {
156 clearTimeout(this.putBulkTimeout) 156 clearTimeout(this.putBulkTimeout)
@@ -225,7 +225,7 @@ export class PeertubeChunkStore extends EventEmitter {
225 } 225 }
226 } 226 }
227 227
228 private nextTick (cb: any, err: Error, val?: any) { 228 private nextTick <T> (cb: (err?: Error, val?: T) => void, err: Error, val?: T) {
229 process.nextTick(() => cb(err, val), undefined) 229 process.nextTick(() => cb(err, val), undefined)
230 } 230 }
231} 231}
diff --git a/client/src/assets/player/peertube-link-button.ts b/client/src/assets/player/peertube-link-button.ts
index b03952b47..de9a49de9 100644
--- a/client/src/assets/player/peertube-link-button.ts
+++ b/client/src/assets/player/peertube-link-button.ts
@@ -1,10 +1,13 @@
1import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' 1import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
2import { buildVideoLink } from './utils' 2import { buildVideoLink } from './utils'
3// FIXME: something weird with our path definition in tsconfig and typings
4// @ts-ignore
5import { Player } from 'video.js'
3 6
4const Button: VideoJSComponentInterface = videojsUntyped.getComponent('Button') 7const Button: VideoJSComponentInterface = videojsUntyped.getComponent('Button')
5class PeerTubeLinkButton extends Button { 8class PeerTubeLinkButton extends Button {
6 9
7 constructor (player: any, options: any) { 10 constructor (player: Player, options: any) {
8 super(player, options) 11 super(player, options)
9 } 12 }
10 13
diff --git a/client/src/assets/player/peertube-load-progress-bar.ts b/client/src/assets/player/peertube-load-progress-bar.ts
index ee8a6cd81..af276d1b2 100644
--- a/client/src/assets/player/peertube-load-progress-bar.ts
+++ b/client/src/assets/player/peertube-load-progress-bar.ts
@@ -1,10 +1,13 @@
1import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' 1import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
2// FIXME: something weird with our path definition in tsconfig and typings
3// @ts-ignore
4import { Player } from 'video.js'
2 5
3const Component: VideoJSComponentInterface = videojsUntyped.getComponent('Component') 6const Component: VideoJSComponentInterface = videojsUntyped.getComponent('Component')
4 7
5class PeerTubeLoadProgressBar extends Component { 8class PeerTubeLoadProgressBar extends Component {
6 9
7 constructor (player: any, options: any) { 10 constructor (player: Player, options: any) {
8 super(player, options) 11 super(player, options)
9 this.partEls_ = [] 12 this.partEls_ = []
10 this.on(player, 'progress', this.update) 13 this.on(player, 'progress', this.update)
diff --git a/client/src/assets/player/peertube-player.ts b/client/src/assets/player/peertube-player.ts
index ef9e7fcc0..db63071cb 100644
--- a/client/src/assets/player/peertube-player.ts
+++ b/client/src/assets/player/peertube-player.ts
@@ -14,6 +14,10 @@ import { UserWatching, VideoJSCaption, videojsUntyped } from './peertube-videojs
14import { buildVideoEmbed, buildVideoLink, copyToClipboard } from './utils' 14import { buildVideoEmbed, buildVideoLink, copyToClipboard } from './utils'
15import { getCompleteLocale, getShortLocale, is18nLocale, isDefaultLocale } from '../../../../shared/models/i18n/i18n' 15import { getCompleteLocale, getShortLocale, is18nLocale, isDefaultLocale } from '../../../../shared/models/i18n/i18n'
16 16
17// FIXME: something weird with our path definition in tsconfig and typings
18// @ts-ignore
19import { Player } from 'video.js'
20
17// Change 'Playback Rate' to 'Speed' (smaller for our settings menu) 21// Change 'Playback Rate' to 'Speed' (smaller for our settings menu)
18videojsUntyped.getComponent('PlaybackRateMenuButton').prototype.controlText_ = 'Speed' 22videojsUntyped.getComponent('PlaybackRateMenuButton').prototype.controlText_ = 'Speed'
19// Change Captions to Subtitles/CC 23// Change Captions to Subtitles/CC
@@ -75,12 +79,12 @@ function getVideojsOptions (options: {
75 enableVolumeScroll: false, 79 enableVolumeScroll: false,
76 enableModifiersForNumbers: false, 80 enableModifiersForNumbers: false,
77 81
78 fullscreenKey: function (event: any) { 82 fullscreenKey: function (event: KeyboardEvent) {
79 // fullscreen with the f key or Ctrl+Enter 83 // fullscreen with the f key or Ctrl+Enter
80 return event.key === 'f' || (event.ctrlKey && event.key === 'Enter') 84 return event.key === 'f' || (event.ctrlKey && event.key === 'Enter')
81 }, 85 },
82 86
83 seekStep: function (event: any) { 87 seekStep: function (event: KeyboardEvent) {
84 // mimic VLC seek behavior, and default to 5 (original value is 5). 88 // mimic VLC seek behavior, and default to 5 (original value is 5).
85 if (event.ctrlKey && event.altKey) { 89 if (event.ctrlKey && event.altKey) {
86 return 5 * 60 90 return 5 * 60
@@ -95,26 +99,26 @@ function getVideojsOptions (options: {
95 99
96 customKeys: { 100 customKeys: {
97 increasePlaybackRateKey: { 101 increasePlaybackRateKey: {
98 key: function (event: any) { 102 key: function (event: KeyboardEvent) {
99 return event.key === '>' 103 return event.key === '>'
100 }, 104 },
101 handler: function (player: any) { 105 handler: function (player: Player) {
102 player.playbackRate((player.playbackRate() + 0.1).toFixed(2)) 106 player.playbackRate((player.playbackRate() + 0.1).toFixed(2))
103 } 107 }
104 }, 108 },
105 decreasePlaybackRateKey: { 109 decreasePlaybackRateKey: {
106 key: function (event: any) { 110 key: function (event: KeyboardEvent) {
107 return event.key === '<' 111 return event.key === '<'
108 }, 112 },
109 handler: function (player: any) { 113 handler: function (player: Player) {
110 player.playbackRate((player.playbackRate() - 0.1).toFixed(2)) 114 player.playbackRate((player.playbackRate() - 0.1).toFixed(2))
111 } 115 }
112 }, 116 },
113 frameByFrame: { 117 frameByFrame: {
114 key: function (event: any) { 118 key: function (event: KeyboardEvent) {
115 return event.key === '.' 119 return event.key === '.'
116 }, 120 },
117 handler: function (player: any) { 121 handler: function (player: Player) {
118 player.pause() 122 player.pause()
119 // Calculate movement distance (assuming 30 fps) 123 // Calculate movement distance (assuming 30 fps)
120 const dist = 1 / 30 124 const dist = 1 / 30
diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts
index 03def186e..40da5f1f7 100644
--- a/client/src/assets/player/peertube-videojs-plugin.ts
+++ b/client/src/assets/player/peertube-videojs-plugin.ts
@@ -1,11 +1,13 @@
1const videojs = require('video.js') 1// FIXME: something weird with our path definition in tsconfig and typings
2// @ts-ignore
3import * as videojs from 'video.js'
4
2import * as WebTorrent from 'webtorrent' 5import * as WebTorrent from 'webtorrent'
3import { VideoFile } from '../../../../shared/models/videos/video.model' 6import { VideoFile } from '../../../../shared/models/videos/video.model'
4import { renderVideo } from './video-renderer' 7import { renderVideo } from './video-renderer'
5import './settings-menu-button' 8import './settings-menu-button'
6import { PeertubePluginOptions, UserWatching, VideoJSCaption, VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' 9import { PeertubePluginOptions, UserWatching, VideoJSCaption, VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
7import { isMobile, timeToInt, videoFileMaxByResolution, videoFileMinByResolution } from './utils' 10import { isMobile, timeToInt, videoFileMaxByResolution, videoFileMinByResolution } from './utils'
8const CacheChunkStore = require('cache-chunk-store')
9import { PeertubeChunkStore } from './peertube-chunk-store' 11import { PeertubeChunkStore } from './peertube-chunk-store'
10import { 12import {
11 getAverageBandwidthInStore, 13 getAverageBandwidthInStore,
@@ -17,6 +19,8 @@ import {
17 saveVolumeInStore 19 saveVolumeInStore
18} from './peertube-player-local-storage' 20} from './peertube-player-local-storage'
19 21
22const CacheChunkStore = require('cache-chunk-store')
23
20type PlayOptions = { 24type PlayOptions = {
21 forcePlay?: boolean, 25 forcePlay?: boolean,
22 seek?: number, 26 seek?: number,
@@ -61,7 +65,7 @@ class PeerTubePlugin extends Plugin {
61 65
62 private player: any 66 private player: any
63 private currentVideoFile: VideoFile 67 private currentVideoFile: VideoFile
64 private torrent: any 68 private torrent: WebTorrent.Torrent
65 private videoCaptions: VideoJSCaption[] 69 private videoCaptions: VideoJSCaption[]
66 70
67 private renderer: any 71 private renderer: any
@@ -83,7 +87,7 @@ class PeerTubePlugin extends Plugin {
83 87
84 private downloadSpeeds: number[] = [] 88 private downloadSpeeds: number[] = []
85 89
86 constructor (player: any, options: PeertubePluginOptions) { 90 constructor (player: videojs.Player, options: PeertubePluginOptions) {
87 super(player, options) 91 super(player, options)
88 92
89 // Disable auto play on iOS 93 // Disable auto play on iOS
@@ -273,7 +277,7 @@ class PeerTubePlugin extends Plugin {
273 277
274 const oldTorrent = this.torrent 278 const oldTorrent = this.torrent
275 const torrentOptions = { 279 const torrentOptions = {
276 store: (chunkLength: any, storeOpts: any) => new CacheChunkStore(new PeertubeChunkStore(chunkLength, storeOpts), { 280 store: (chunkLength: number, storeOpts: any) => new CacheChunkStore(new PeertubeChunkStore(chunkLength, storeOpts), {
277 max: 100 281 max: 100
278 }) 282 })
279 } 283 }
@@ -304,7 +308,7 @@ class PeerTubePlugin extends Plugin {
304 308
305 if (err) return this.fallbackToHttp(options, done) 309 if (err) return this.fallbackToHttp(options, done)
306 310
307 return this.tryToPlay((err: Error) => { 311 return this.tryToPlay(err => {
308 if (err) return done(err) 312 if (err) return done(err)
309 313
310 if (options.seek) this.seek(options.seek) 314 if (options.seek) this.seek(options.seek)
@@ -344,7 +348,7 @@ class PeerTubePlugin extends Plugin {
344 }) 348 })
345 } 349 }
346 350
347 private tryToPlay (done?: Function) { 351 private tryToPlay (done?: (err?: Error) => void) {
348 if (!done) done = function () { /* empty */ } 352 if (!done) done = function () { /* empty */ }
349 353
350 const playPromise = this.player.play() 354 const playPromise = this.player.play()
@@ -641,7 +645,7 @@ class PeerTubePlugin extends Plugin {
641 return this.videoFiles[Math.floor(this.videoFiles.length / 2)] 645 return this.videoFiles[Math.floor(this.videoFiles.length / 2)]
642 } 646 }
643 647
644 private stopTorrent (torrent: any) { 648 private stopTorrent (torrent: WebTorrent.Torrent) {
645 torrent.pause() 649 torrent.pause()
646 // Pause does not remove actual peers (in particular the webseed peer) 650 // Pause does not remove actual peers (in particular the webseed peer)
647 torrent.removePeer(torrent[ 'ws' ]) 651 torrent.removePeer(torrent[ 'ws' ])
diff --git a/client/src/assets/player/peertube-videojs-typings.ts b/client/src/assets/player/peertube-videojs-typings.ts
index 98a33077d..d127230fa 100644
--- a/client/src/assets/player/peertube-videojs-typings.ts
+++ b/client/src/assets/player/peertube-videojs-typings.ts
@@ -1,4 +1,7 @@
1const videojs = require('video.js') 1// FIXME: something weird with our path definition in tsconfig and typings
2// @ts-ignore
3import * as videojs from 'video.js'
4
2import { VideoFile } from '../../../../shared/models/videos/video.model' 5import { VideoFile } from '../../../../shared/models/videos/video.model'
3import { PeerTubePlugin } from './peertube-videojs-plugin' 6import { PeerTubePlugin } from './peertube-videojs-plugin'
4 7
diff --git a/client/src/assets/player/resolution-menu-button.ts b/client/src/assets/player/resolution-menu-button.ts
index 91818efc9..a3c1108ca 100644
--- a/client/src/assets/player/resolution-menu-button.ts
+++ b/client/src/assets/player/resolution-menu-button.ts
@@ -1,3 +1,7 @@
1// FIXME: something weird with our path definition in tsconfig and typings
2// @ts-ignore
3import { Player } from 'video.js'
4
1import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' 5import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
2import { ResolutionMenuItem } from './resolution-menu-item' 6import { ResolutionMenuItem } from './resolution-menu-item'
3 7
@@ -6,7 +10,7 @@ const MenuButton: VideoJSComponentInterface = videojsUntyped.getComponent('MenuB
6class ResolutionMenuButton extends MenuButton { 10class ResolutionMenuButton extends MenuButton {
7 label: HTMLElement 11 label: HTMLElement
8 12
9 constructor (player: any, options: any) { 13 constructor (player: Player, options: any) {
10 super(player, options) 14 super(player, options)
11 this.player = player 15 this.player = player
12 16
diff --git a/client/src/assets/player/resolution-menu-item.ts b/client/src/assets/player/resolution-menu-item.ts
index afe490abb..b54fd91ef 100644
--- a/client/src/assets/player/resolution-menu-item.ts
+++ b/client/src/assets/player/resolution-menu-item.ts
@@ -1,9 +1,13 @@
1// FIXME: something weird with our path definition in tsconfig and typings
2// @ts-ignore
3import { Player } from 'video.js'
4
1import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' 5import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
2 6
3const MenuItem: VideoJSComponentInterface = videojsUntyped.getComponent('MenuItem') 7const MenuItem: VideoJSComponentInterface = videojsUntyped.getComponent('MenuItem')
4class ResolutionMenuItem extends MenuItem { 8class ResolutionMenuItem extends MenuItem {
5 9
6 constructor (player: any, options: any) { 10 constructor (player: Player, options: any) {
7 const currentResolutionId = player.peertube().getCurrentResolutionId() 11 const currentResolutionId = player.peertube().getCurrentResolutionId()
8 options.selectable = true 12 options.selectable = true
9 options.selected = options.id === currentResolutionId 13 options.selected = options.id === currentResolutionId
diff --git a/client/src/assets/player/settings-menu-button.ts b/client/src/assets/player/settings-menu-button.ts
index f0ccb5862..aa7281727 100644
--- a/client/src/assets/player/settings-menu-button.ts
+++ b/client/src/assets/player/settings-menu-button.ts
@@ -1,7 +1,10 @@
1// Author: Yanko Shterev 1// Author: Yanko Shterev
2// Thanks https://github.com/yshterev/videojs-settings-menu 2// Thanks https://github.com/yshterev/videojs-settings-menu
3 3
4const videojs = require('video.js') 4// FIXME: something weird with our path definition in tsconfig and typings
5// @ts-ignore
6import * as videojs from 'video.js'
7
5import { SettingsMenuItem } from './settings-menu-item' 8import { SettingsMenuItem } from './settings-menu-item'
6import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' 9import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
7import { toTitleCase } from './utils' 10import { toTitleCase } from './utils'
@@ -11,7 +14,7 @@ const Menu: VideoJSComponentInterface = videojsUntyped.getComponent('Menu')
11const Component: VideoJSComponentInterface = videojsUntyped.getComponent('Component') 14const Component: VideoJSComponentInterface = videojsUntyped.getComponent('Component')
12 15
13class SettingsButton extends Button { 16class SettingsButton extends Button {
14 constructor (player: any, options: any) { 17 constructor (player: videojs.Player, options: any) {
15 super(player, options) 18 super(player, options)
16 19
17 this.playerComponent = player 20 this.playerComponent = player
@@ -48,7 +51,7 @@ class SettingsButton extends Button {
48 } 51 }
49 } 52 }
50 53
51 onDisposeSettingsItem (name: string) { 54 onDisposeSettingsItem (event: any, name: string) {
52 if (name === undefined) { 55 if (name === undefined) {
53 let children = this.menu.children() 56 let children = this.menu.children()
54 57
@@ -74,7 +77,7 @@ class SettingsButton extends Button {
74 } 77 }
75 } 78 }
76 79
77 onAddSettingsItem (data: any) { 80 onAddSettingsItem (event: any, data: any) {
78 const [ entry, options ] = data 81 const [ entry, options ] = data
79 82
80 this.addMenuItem(entry, options) 83 this.addMenuItem(entry, options)
@@ -218,7 +221,7 @@ class SettingsButton extends Button {
218} 221}
219 222
220class SettingsPanel extends Component { 223class SettingsPanel extends Component {
221 constructor (player: any, options: any) { 224 constructor (player: videojs.Player, options: any) {
222 super(player, options) 225 super(player, options)
223 } 226 }
224 227
@@ -232,7 +235,7 @@ class SettingsPanel extends Component {
232} 235}
233 236
234class SettingsPanelChild extends Component { 237class SettingsPanelChild extends Component {
235 constructor (player: any, options: any) { 238 constructor (player: videojs.Player, options: any) {
236 super(player, options) 239 super(player, options)
237 } 240 }
238 241
@@ -246,7 +249,7 @@ class SettingsPanelChild extends Component {
246} 249}
247 250
248class SettingsDialog extends Component { 251class SettingsDialog extends Component {
249 constructor (player: any, options: any) { 252 constructor (player: videojs.Player, options: any) {
250 super(player, options) 253 super(player, options)
251 this.hide() 254 this.hide()
252 } 255 }
diff --git a/client/src/assets/player/settings-menu-item.ts b/client/src/assets/player/settings-menu-item.ts
index 2d752b62e..698f4627a 100644
--- a/client/src/assets/player/settings-menu-item.ts
+++ b/client/src/assets/player/settings-menu-item.ts
@@ -1,6 +1,10 @@
1// Author: Yanko Shterev 1// Author: Yanko Shterev
2// Thanks https://github.com/yshterev/videojs-settings-menu 2// Thanks https://github.com/yshterev/videojs-settings-menu
3 3
4// FIXME: something weird with our path definition in tsconfig and typings
5// @ts-ignore
6import * as videojs from 'video.js'
7
4import { toTitleCase } from './utils' 8import { toTitleCase } from './utils'
5import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' 9import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
6 10
@@ -9,7 +13,7 @@ const component: VideoJSComponentInterface = videojsUntyped.getComponent('Compon
9 13
10class SettingsMenuItem extends MenuItem { 14class SettingsMenuItem extends MenuItem {
11 15
12 constructor (player: any, options: any, entry: string, menuButton: VideoJSComponentInterface) { 16 constructor (player: videojs.Player, options: any, entry: string, menuButton: VideoJSComponentInterface) {
13 super(player, options) 17 super(player, options)
14 18
15 this.settingsButton = menuButton 19 this.settingsButton = menuButton
@@ -229,7 +233,7 @@ class SettingsMenuItem extends MenuItem {
229 } 233 }
230 234
231 update (event?: any) { 235 update (event?: any) {
232 let target = null 236 let target: HTMLElement = null
233 let subMenu = this.subMenu.name() 237 let subMenu = this.subMenu.name()
234 238
235 if (event && event.type === 'tap') { 239 if (event && event.type === 'tap') {
diff --git a/client/src/assets/player/theater-button.ts b/client/src/assets/player/theater-button.ts
index b761f6030..4f8fede3d 100644
--- a/client/src/assets/player/theater-button.ts
+++ b/client/src/assets/player/theater-button.ts
@@ -1,3 +1,7 @@
1// FIXME: something weird with our path definition in tsconfig and typings
2// @ts-ignore
3import * as videojs from 'video.js'
4
1import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' 5import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
2import { saveTheaterInStore, getStoredTheater } from './peertube-player-local-storage' 6import { saveTheaterInStore, getStoredTheater } from './peertube-player-local-storage'
3 7
@@ -6,7 +10,7 @@ class TheaterButton extends Button {
6 10
7 private static readonly THEATER_MODE_CLASS = 'vjs-theater-enabled' 11 private static readonly THEATER_MODE_CLASS = 'vjs-theater-enabled'
8 12
9 constructor (player: any, options: any) { 13 constructor (player: videojs.Player, options: any) {
10 super(player, options) 14 super(player, options)
11 15
12 const enabled = getStoredTheater() 16 const enabled = getStoredTheater()
diff --git a/client/src/assets/player/utils.ts b/client/src/assets/player/utils.ts
index 46081c0d2..c87287482 100644
--- a/client/src/assets/player/utils.ts
+++ b/client/src/assets/player/utils.ts
@@ -12,7 +12,7 @@ const dictionaryBytes: Array<{max: number, type: string}> = [
12 { max: 1073741824, type: 'MB' }, 12 { max: 1073741824, type: 'MB' },
13 { max: 1.0995116e12, type: 'GB' } 13 { max: 1.0995116e12, type: 'GB' }
14] 14]
15function bytes (value: any) { 15function bytes (value: number) {
16 const format = dictionaryBytes.find(d => value < d.max) || dictionaryBytes[dictionaryBytes.length - 1] 16 const format = dictionaryBytes.find(d => value < d.max) || dictionaryBytes[dictionaryBytes.length - 1]
17 const calc = Math.floor(value / (format.max / 1024)).toString() 17 const calc = Math.floor(value / (format.max / 1024)).toString()
18 18
diff --git a/client/src/assets/player/webtorrent-info-button.ts b/client/src/assets/player/webtorrent-info-button.ts
index 5b9d0a401..c3c1af951 100644
--- a/client/src/assets/player/webtorrent-info-button.ts
+++ b/client/src/assets/player/webtorrent-info-button.ts
@@ -65,7 +65,7 @@ class WebtorrentInfoButton extends Button {
65 subDivHttp.appendChild(subDivHttpText) 65 subDivHttp.appendChild(subDivHttpText)
66 div.appendChild(subDivHttp) 66 div.appendChild(subDivHttp)
67 67
68 this.player_.peertube().on('torrentInfo', (data: any) => { 68 this.player_.peertube().on('torrentInfo', (event: any, data: any) => {
69 // We are in HTTP fallback 69 // We are in HTTP fallback
70 if (!data) { 70 if (!data) {
71 subDivHttp.className = 'vjs-peertube-displayed' 71 subDivHttp.className = 'vjs-peertube-displayed'