diff options
Diffstat (limited to 'client/src/assets')
-rw-r--r-- | client/src/assets/player/peertube-chunk-store.ts | 12 | ||||
-rw-r--r-- | client/src/assets/player/peertube-link-button.ts | 5 | ||||
-rw-r--r-- | client/src/assets/player/peertube-load-progress-bar.ts | 5 | ||||
-rw-r--r-- | client/src/assets/player/peertube-player.ts | 20 | ||||
-rw-r--r-- | client/src/assets/player/peertube-videojs-plugin.ts | 20 | ||||
-rw-r--r-- | client/src/assets/player/peertube-videojs-typings.ts | 5 | ||||
-rw-r--r-- | client/src/assets/player/resolution-menu-button.ts | 6 | ||||
-rw-r--r-- | client/src/assets/player/resolution-menu-item.ts | 6 | ||||
-rw-r--r-- | client/src/assets/player/settings-menu-button.ts | 17 | ||||
-rw-r--r-- | client/src/assets/player/settings-menu-item.ts | 8 | ||||
-rw-r--r-- | client/src/assets/player/theater-button.ts | 6 | ||||
-rw-r--r-- | client/src/assets/player/utils.ts | 2 | ||||
-rw-r--r-- | client/src/assets/player/webtorrent-info-button.ts | 2 |
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 @@ | |||
1 | import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' | 1 | import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' |
2 | import { buildVideoLink } from './utils' | 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' | ||
3 | 6 | ||
4 | const Button: VideoJSComponentInterface = videojsUntyped.getComponent('Button') | 7 | const Button: VideoJSComponentInterface = videojsUntyped.getComponent('Button') |
5 | class PeerTubeLinkButton extends Button { | 8 | class 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 @@ | |||
1 | import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' | 1 | import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' |
2 | // FIXME: something weird with our path definition in tsconfig and typings | ||
3 | // @ts-ignore | ||
4 | import { Player } from 'video.js' | ||
2 | 5 | ||
3 | const Component: VideoJSComponentInterface = videojsUntyped.getComponent('Component') | 6 | const Component: VideoJSComponentInterface = videojsUntyped.getComponent('Component') |
4 | 7 | ||
5 | class PeerTubeLoadProgressBar extends Component { | 8 | class 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 | |||
14 | import { buildVideoEmbed, buildVideoLink, copyToClipboard } from './utils' | 14 | import { buildVideoEmbed, buildVideoLink, copyToClipboard } from './utils' |
15 | import { getCompleteLocale, getShortLocale, is18nLocale, isDefaultLocale } from '../../../../shared/models/i18n/i18n' | 15 | import { 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 | ||
19 | import { 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) |
18 | videojsUntyped.getComponent('PlaybackRateMenuButton').prototype.controlText_ = 'Speed' | 22 | videojsUntyped.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 @@ | |||
1 | const videojs = require('video.js') | 1 | // FIXME: something weird with our path definition in tsconfig and typings |
2 | // @ts-ignore | ||
3 | import * as videojs from 'video.js' | ||
4 | |||
2 | import * as WebTorrent from 'webtorrent' | 5 | import * as WebTorrent from 'webtorrent' |
3 | import { VideoFile } from '../../../../shared/models/videos/video.model' | 6 | import { VideoFile } from '../../../../shared/models/videos/video.model' |
4 | import { renderVideo } from './video-renderer' | 7 | import { renderVideo } from './video-renderer' |
5 | import './settings-menu-button' | 8 | import './settings-menu-button' |
6 | import { PeertubePluginOptions, UserWatching, VideoJSCaption, VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' | 9 | import { PeertubePluginOptions, UserWatching, VideoJSCaption, VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' |
7 | import { isMobile, timeToInt, videoFileMaxByResolution, videoFileMinByResolution } from './utils' | 10 | import { isMobile, timeToInt, videoFileMaxByResolution, videoFileMinByResolution } from './utils' |
8 | const CacheChunkStore = require('cache-chunk-store') | ||
9 | import { PeertubeChunkStore } from './peertube-chunk-store' | 11 | import { PeertubeChunkStore } from './peertube-chunk-store' |
10 | import { | 12 | import { |
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 | ||
22 | const CacheChunkStore = require('cache-chunk-store') | ||
23 | |||
20 | type PlayOptions = { | 24 | type 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 @@ | |||
1 | const videojs = require('video.js') | 1 | // FIXME: something weird with our path definition in tsconfig and typings |
2 | // @ts-ignore | ||
3 | import * as videojs from 'video.js' | ||
4 | |||
2 | import { VideoFile } from '../../../../shared/models/videos/video.model' | 5 | import { VideoFile } from '../../../../shared/models/videos/video.model' |
3 | import { PeerTubePlugin } from './peertube-videojs-plugin' | 6 | import { 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 | ||
3 | import { Player } from 'video.js' | ||
4 | |||
1 | import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' | 5 | import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' |
2 | import { ResolutionMenuItem } from './resolution-menu-item' | 6 | import { ResolutionMenuItem } from './resolution-menu-item' |
3 | 7 | ||
@@ -6,7 +10,7 @@ const MenuButton: VideoJSComponentInterface = videojsUntyped.getComponent('MenuB | |||
6 | class ResolutionMenuButton extends MenuButton { | 10 | class 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 | ||
3 | import { Player } from 'video.js' | ||
4 | |||
1 | import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' | 5 | import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' |
2 | 6 | ||
3 | const MenuItem: VideoJSComponentInterface = videojsUntyped.getComponent('MenuItem') | 7 | const MenuItem: VideoJSComponentInterface = videojsUntyped.getComponent('MenuItem') |
4 | class ResolutionMenuItem extends MenuItem { | 8 | class 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 | ||
4 | const videojs = require('video.js') | 4 | // FIXME: something weird with our path definition in tsconfig and typings |
5 | // @ts-ignore | ||
6 | import * as videojs from 'video.js' | ||
7 | |||
5 | import { SettingsMenuItem } from './settings-menu-item' | 8 | import { SettingsMenuItem } from './settings-menu-item' |
6 | import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' | 9 | import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' |
7 | import { toTitleCase } from './utils' | 10 | import { toTitleCase } from './utils' |
@@ -11,7 +14,7 @@ const Menu: VideoJSComponentInterface = videojsUntyped.getComponent('Menu') | |||
11 | const Component: VideoJSComponentInterface = videojsUntyped.getComponent('Component') | 14 | const Component: VideoJSComponentInterface = videojsUntyped.getComponent('Component') |
12 | 15 | ||
13 | class SettingsButton extends Button { | 16 | class 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 | ||
220 | class SettingsPanel extends Component { | 223 | class 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 | ||
234 | class SettingsPanelChild extends Component { | 237 | class 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 | ||
248 | class SettingsDialog extends Component { | 251 | class 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 | ||
6 | import * as videojs from 'video.js' | ||
7 | |||
4 | import { toTitleCase } from './utils' | 8 | import { toTitleCase } from './utils' |
5 | import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' | 9 | import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' |
6 | 10 | ||
@@ -9,7 +13,7 @@ const component: VideoJSComponentInterface = videojsUntyped.getComponent('Compon | |||
9 | 13 | ||
10 | class SettingsMenuItem extends MenuItem { | 14 | class 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 | ||
3 | import * as videojs from 'video.js' | ||
4 | |||
1 | import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' | 5 | import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' |
2 | import { saveTheaterInStore, getStoredTheater } from './peertube-player-local-storage' | 6 | import { 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 | ] |
15 | function bytes (value: any) { | 15 | function 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' |