diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-03 11:51:49 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-08-05 10:57:49 +0200 |
commit | 3e254de8bef59e4e25b74d1b0fde07de29654ada (patch) | |
tree | 9496e386f499701e53b531f92994045f0eea93da /client | |
parent | ff4de38385049bf8f6e1d76d8511854fcfabc71c (diff) | |
download | PeerTube-3e254de8bef59e4e25b74d1b0fde07de29654ada.tar.gz PeerTube-3e254de8bef59e4e25b74d1b0fde07de29654ada.tar.zst PeerTube-3e254de8bef59e4e25b74d1b0fde07de29654ada.zip |
HLS v1 support
Diffstat (limited to 'client')
-rw-r--r-- | client/package.json | 5 | ||||
-rw-r--r-- | client/src/assets/player/p2p-media-loader/hls-plugin.ts | 16 | ||||
-rw-r--r-- | client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts | 34 | ||||
-rw-r--r-- | client/src/assets/player/p2p-media-loader/segment-url-builder.ts | 2 | ||||
-rw-r--r-- | client/src/assets/player/p2p-media-loader/segment-validator.ts | 2 | ||||
-rw-r--r-- | client/src/assets/player/peertube-player-manager.ts | 45 | ||||
-rw-r--r-- | client/src/assets/player/peertube-plugin.ts | 1 | ||||
-rw-r--r-- | client/src/assets/player/peertube-videojs-typings.ts | 4 | ||||
-rw-r--r-- | client/yarn.lock | 96 |
9 files changed, 122 insertions, 83 deletions
diff --git a/client/package.json b/client/package.json index 30cb3a188..c93af4aa7 100644 --- a/client/package.json +++ b/client/package.json | |||
@@ -48,6 +48,8 @@ | |||
48 | "@ngx-loading-bar/core": "^5.0.0", | 48 | "@ngx-loading-bar/core": "^5.0.0", |
49 | "@ngx-loading-bar/http-client": "^5.0.0", | 49 | "@ngx-loading-bar/http-client": "^5.0.0", |
50 | "@ngx-loading-bar/router": "^5.0.0", | 50 | "@ngx-loading-bar/router": "^5.0.0", |
51 | "@peertube/p2p-media-loader-core": "^1.0.2", | ||
52 | "@peertube/p2p-media-loader-hlsjs": "^1.0.4", | ||
51 | "@types/chart.js": "^2.9.16", | 53 | "@types/chart.js": "^2.9.16", |
52 | "@types/core-js": "^2.5.2", | 54 | "@types/core-js": "^2.5.2", |
53 | "@types/debug": "^4.1.5", | 55 | "@types/debug": "^4.1.5", |
@@ -76,7 +78,7 @@ | |||
76 | "dexie": "^3.0.0", | 78 | "dexie": "^3.0.0", |
77 | "file-loader": "^6.0.0", | 79 | "file-loader": "^6.0.0", |
78 | "focus-visible": "^5.0.2", | 80 | "focus-visible": "^5.0.2", |
79 | "hls.js": "^0.14.16", | 81 | "hls.js": "^1.0.7", |
80 | "html-loader": "^2.1.2", | 82 | "html-loader": "^2.1.2", |
81 | "html-webpack-plugin": "^5.3.1", | 83 | "html-webpack-plugin": "^5.3.1", |
82 | "https-browserify": "^1.0.0", | 84 | "https-browserify": "^1.0.0", |
@@ -93,7 +95,6 @@ | |||
93 | "markdown-it": "12.0.6", | 95 | "markdown-it": "12.0.6", |
94 | "mini-css-extract-plugin": "^1.6.0", | 96 | "mini-css-extract-plugin": "^1.6.0", |
95 | "ngx-uploadx": "^4.1.0", | 97 | "ngx-uploadx": "^4.1.0", |
96 | "p2p-media-loader-hlsjs": "^0.6.2", | ||
97 | "path-browserify": "^1.0.0", | 98 | "path-browserify": "^1.0.0", |
98 | "primeng": "^12.0.0-rc.1", | 99 | "primeng": "^12.0.0-rc.1", |
99 | "process": "^0.11.10", | 100 | "process": "^0.11.10", |
diff --git a/client/src/assets/player/p2p-media-loader/hls-plugin.ts b/client/src/assets/player/p2p-media-loader/hls-plugin.ts index 53969a5a5..3050110cd 100644 --- a/client/src/assets/player/p2p-media-loader/hls-plugin.ts +++ b/client/src/assets/player/p2p-media-loader/hls-plugin.ts | |||
@@ -264,20 +264,16 @@ class Html5Hlsjs { | |||
264 | if (this.errorCounts[ data.type ]) this.errorCounts[ data.type ] += 1 | 264 | if (this.errorCounts[ data.type ]) this.errorCounts[ data.type ] += 1 |
265 | else this.errorCounts[ data.type ] = 1 | 265 | else this.errorCounts[ data.type ] = 1 |
266 | 266 | ||
267 | if (!data.fatal) { | 267 | if (data.fatal) console.warn(error.message) |
268 | console.warn(error.message) | 268 | else console.error(error.message, data) |
269 | return | ||
270 | } | ||
271 | |||
272 | console.error(error.message) | ||
273 | 269 | ||
274 | if (data.type === Hlsjs.ErrorTypes.NETWORK_ERROR) { | 270 | if (data.type === Hlsjs.ErrorTypes.NETWORK_ERROR) { |
275 | error.code = 2 | 271 | error.code = 2 |
276 | this._handleNetworkError(error) | 272 | this._handleNetworkError(error) |
277 | } else if (data.type === Hlsjs.ErrorTypes.MEDIA_ERROR && data.details !== 'manifestIncompatibleCodecsError') { | 273 | } else if (data.fatal && data.type === Hlsjs.ErrorTypes.MEDIA_ERROR && data.details !== 'manifestIncompatibleCodecsError') { |
278 | error.code = 3 | 274 | error.code = 3 |
279 | this._handleMediaError(error) | 275 | this._handleMediaError(error) |
280 | } else { | 276 | } else if (data.fatal) { |
281 | this.hls.destroy() | 277 | this.hls.destroy() |
282 | console.info('bubbling error up to VIDEOJS') | 278 | console.info('bubbling error up to VIDEOJS') |
283 | this.tech.error = () => error as any | 279 | this.tech.error = () => error as any |
@@ -286,12 +282,12 @@ class Html5Hlsjs { | |||
286 | } | 282 | } |
287 | 283 | ||
288 | private switchQuality (qualityId: number) { | 284 | private switchQuality (qualityId: number) { |
289 | this.hls.nextLevel = qualityId | 285 | this.hls.currentLevel = qualityId |
290 | } | 286 | } |
291 | 287 | ||
292 | private _levelLabel (level: Hlsjs.Level) { | 288 | private _levelLabel (level: Hlsjs.Level) { |
293 | if (this.player.srOptions_.levelLabelHandler) { | 289 | if (this.player.srOptions_.levelLabelHandler) { |
294 | return this.player.srOptions_.levelLabelHandler(level) | 290 | return this.player.srOptions_.levelLabelHandler(level as any) |
295 | } | 291 | } |
296 | 292 | ||
297 | if (level.height) return level.height + 'p' | 293 | if (level.height) return level.height + 'p' |
diff --git a/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts b/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts index 2eb849d2b..093795e48 100644 --- a/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts +++ b/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import * as Hlsjs from 'hls.js/dist/hls.light.js' | 1 | import * as Hlsjs from 'hls.js/dist/hls.light.js' |
2 | import { Events, Segment } from 'p2p-media-loader-core' | ||
3 | import { Engine, initHlsJsPlayer, initVideoJsContribHlsJsPlayer } from 'p2p-media-loader-hlsjs' | ||
4 | import videojs from 'video.js' | 2 | import videojs from 'video.js' |
3 | import { Events, Segment } from '@peertube/p2p-media-loader-core' | ||
4 | import { Engine, initHlsJsPlayer, initVideoJsContribHlsJsPlayer } from '@peertube/p2p-media-loader-hlsjs' | ||
5 | import { timeToInt } from '@shared/core-utils' | 5 | import { timeToInt } from '@shared/core-utils' |
6 | import { P2PMediaLoaderPluginOptions, PlayerNetworkInfo } from '../peertube-videojs-typings' | 6 | import { P2PMediaLoaderPluginOptions, PlayerNetworkInfo } from '../peertube-videojs-typings' |
7 | import { registerConfigPlugin, registerSourceHandler } from './hls-plugin' | 7 | import { registerConfigPlugin, registerSourceHandler } from './hls-plugin' |
@@ -36,9 +36,6 @@ class P2pMediaLoaderPlugin extends Plugin { | |||
36 | 36 | ||
37 | private networkInfoInterval: any | 37 | private networkInfoInterval: any |
38 | 38 | ||
39 | private hlsjsCurrentLevel: number | ||
40 | private hlsjsLevels: Hlsjs.Level[] | ||
41 | |||
42 | constructor (player: videojs.Player, options?: P2PMediaLoaderPluginOptions) { | 39 | constructor (player: videojs.Player, options?: P2PMediaLoaderPluginOptions) { |
43 | super(player) | 40 | super(player) |
44 | 41 | ||
@@ -88,13 +85,12 @@ class P2pMediaLoaderPlugin extends Plugin { | |||
88 | } | 85 | } |
89 | 86 | ||
90 | getCurrentLevel () { | 87 | getCurrentLevel () { |
91 | return this.hlsjsLevels.find(l => l.level === this.hlsjsCurrentLevel) | 88 | return this.hlsjs.levels[this.hlsjs.currentLevel] |
92 | } | 89 | } |
93 | 90 | ||
94 | getLiveLatency () { | 91 | getLiveLatency () { |
95 | return undefined as number | 92 | // FIXME: typings |
96 | // FIXME: Use latency when hls >= V1 | 93 | return Math.round((this.hlsjs as any).latency) |
97 | // return this.hlsjs.latency | ||
98 | } | 94 | } |
99 | 95 | ||
100 | getHLSJS () { | 96 | getHLSJS () { |
@@ -140,31 +136,23 @@ class P2pMediaLoaderPlugin extends Plugin { | |||
140 | } | 136 | } |
141 | 137 | ||
142 | private runStats () { | 138 | private runStats () { |
143 | this.p2pEngine.on(Events.PieceBytesDownloaded, (method: string, size: number) => { | 139 | this.p2pEngine.on(Events.PieceBytesDownloaded, (method: string, _segment, bytes: number) => { |
144 | const elem = method === 'p2p' ? this.statsP2PBytes : this.statsHTTPBytes | 140 | const elem = method === 'p2p' ? this.statsP2PBytes : this.statsHTTPBytes |
145 | 141 | ||
146 | elem.pendingDownload.push(size) | 142 | elem.pendingDownload.push(bytes) |
147 | elem.totalDownload += size | 143 | elem.totalDownload += bytes |
148 | }) | 144 | }) |
149 | 145 | ||
150 | this.p2pEngine.on(Events.PieceBytesUploaded, (method: string, size: number) => { | 146 | this.p2pEngine.on(Events.PieceBytesUploaded, (method: string, _segment, bytes: number) => { |
151 | const elem = method === 'p2p' ? this.statsP2PBytes : this.statsHTTPBytes | 147 | const elem = method === 'p2p' ? this.statsP2PBytes : this.statsHTTPBytes |
152 | 148 | ||
153 | elem.pendingUpload.push(size) | 149 | elem.pendingUpload.push(bytes) |
154 | elem.totalUpload += size | 150 | elem.totalUpload += bytes |
155 | }) | 151 | }) |
156 | 152 | ||
157 | this.p2pEngine.on(Events.PeerConnect, () => this.statsP2PBytes.numPeers++) | 153 | this.p2pEngine.on(Events.PeerConnect, () => this.statsP2PBytes.numPeers++) |
158 | this.p2pEngine.on(Events.PeerClose, () => this.statsP2PBytes.numPeers--) | 154 | this.p2pEngine.on(Events.PeerClose, () => this.statsP2PBytes.numPeers--) |
159 | 155 | ||
160 | this.hlsjs.on(Hlsjs.Events.MANIFEST_PARSED, (_e, manifest) => { | ||
161 | this.hlsjsCurrentLevel = manifest.firstLevel | ||
162 | this.hlsjsLevels = manifest.levels | ||
163 | }) | ||
164 | this.hlsjs.on(Hlsjs.Events.LEVEL_LOADED, (_e, level) => { | ||
165 | this.hlsjsCurrentLevel = level.levelId || (level as any).id | ||
166 | }) | ||
167 | |||
168 | this.networkInfoInterval = setInterval(() => { | 156 | this.networkInfoInterval = setInterval(() => { |
169 | const p2pDownloadSpeed = this.arraySum(this.statsP2PBytes.pendingDownload) | 157 | const p2pDownloadSpeed = this.arraySum(this.statsP2PBytes.pendingDownload) |
170 | const p2pUploadSpeed = this.arraySum(this.statsP2PBytes.pendingUpload) | 158 | const p2pUploadSpeed = this.arraySum(this.statsP2PBytes.pendingUpload) |
diff --git a/client/src/assets/player/p2p-media-loader/segment-url-builder.ts b/client/src/assets/player/p2p-media-loader/segment-url-builder.ts index 039777cea..ad0e460ae 100644 --- a/client/src/assets/player/p2p-media-loader/segment-url-builder.ts +++ b/client/src/assets/player/p2p-media-loader/segment-url-builder.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Segment } from 'p2p-media-loader-core' | 1 | import { Segment } from '@peertube/p2p-media-loader-core' |
2 | import { RedundancyUrlManager } from './redundancy-url-manager' | 2 | import { RedundancyUrlManager } from './redundancy-url-manager' |
3 | 3 | ||
4 | function segmentUrlBuilderFactory (redundancyUrlManager: RedundancyUrlManager) { | 4 | function segmentUrlBuilderFactory (redundancyUrlManager: RedundancyUrlManager) { |
diff --git a/client/src/assets/player/p2p-media-loader/segment-validator.ts b/client/src/assets/player/p2p-media-loader/segment-validator.ts index 4a0caec5e..a28474793 100644 --- a/client/src/assets/player/p2p-media-loader/segment-validator.ts +++ b/client/src/assets/player/p2p-media-loader/segment-validator.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { wait } from '@root-helpers/utils' | 1 | import { wait } from '@root-helpers/utils' |
2 | import { Segment } from 'p2p-media-loader-core' | 2 | import { Segment } from '@peertube/p2p-media-loader-core' |
3 | import { basename } from 'path' | 3 | import { basename } from 'path' |
4 | 4 | ||
5 | type SegmentsJSON = { [filename: string]: string | { [byterange: string]: string } } | 5 | type SegmentsJSON = { [filename: string]: string | { [byterange: string]: string } } |
diff --git a/client/src/assets/player/peertube-player-manager.ts b/client/src/assets/player/peertube-player-manager.ts index 766ad203e..c45e8f53e 100644 --- a/client/src/assets/player/peertube-player-manager.ts +++ b/client/src/assets/player/peertube-player-manager.ts | |||
@@ -22,6 +22,7 @@ import './videojs-components/settings-panel-child' | |||
22 | import './videojs-components/theater-button' | 22 | import './videojs-components/theater-button' |
23 | import './playlist/playlist-plugin' | 23 | import './playlist/playlist-plugin' |
24 | import videojs from 'video.js' | 24 | import videojs from 'video.js' |
25 | import { HlsJsEngineSettings } from '@peertube/p2p-media-loader-hlsjs' | ||
25 | import { PluginsManager } from '@root-helpers/plugins-manager' | 26 | import { PluginsManager } from '@root-helpers/plugins-manager' |
26 | import { buildVideoLink, decorateVideoLink } from '@shared/core-utils' | 27 | import { buildVideoLink, decorateVideoLink } from '@shared/core-utils' |
27 | import { isDefaultLocale } from '@shared/core-utils/i18n' | 28 | import { isDefaultLocale } from '@shared/core-utils/i18n' |
@@ -30,11 +31,12 @@ import { copyToClipboard } from '../../root-helpers/utils' | |||
30 | import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager' | 31 | import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager' |
31 | import { segmentUrlBuilderFactory } from './p2p-media-loader/segment-url-builder' | 32 | import { segmentUrlBuilderFactory } from './p2p-media-loader/segment-url-builder' |
32 | import { segmentValidatorFactory } from './p2p-media-loader/segment-validator' | 33 | import { segmentValidatorFactory } from './p2p-media-loader/segment-validator' |
33 | import { getStoredP2PEnabled } from './peertube-player-local-storage' | 34 | import { getAverageBandwidthInStore, getStoredP2PEnabled, saveAverageBandwidth } from './peertube-player-local-storage' |
34 | import { | 35 | import { |
35 | NextPreviousVideoButtonOptions, | 36 | NextPreviousVideoButtonOptions, |
36 | P2PMediaLoaderPluginOptions, | 37 | P2PMediaLoaderPluginOptions, |
37 | PeerTubeLinkButtonOptions, | 38 | PeerTubeLinkButtonOptions, |
39 | PlayerNetworkInfo, | ||
38 | PlaylistPluginOptions, | 40 | PlaylistPluginOptions, |
39 | UserWatching, | 41 | UserWatching, |
40 | VideoJSCaption, | 42 | VideoJSCaption, |
@@ -148,7 +150,7 @@ export class PeertubePlayerManager { | |||
148 | if (mode === 'webtorrent') await import('./webtorrent/webtorrent-plugin') | 150 | if (mode === 'webtorrent') await import('./webtorrent/webtorrent-plugin') |
149 | if (mode === 'p2p-media-loader') { | 151 | if (mode === 'p2p-media-loader') { |
150 | [ p2pMediaLoader ] = await Promise.all([ | 152 | [ p2pMediaLoader ] = await Promise.all([ |
151 | import('p2p-media-loader-hlsjs'), | 153 | import('@peertube/p2p-media-loader-hlsjs'), |
152 | import('./p2p-media-loader/p2p-media-loader-plugin') | 154 | import('./p2p-media-loader/p2p-media-loader-plugin') |
153 | ]) | 155 | ]) |
154 | } | 156 | } |
@@ -193,6 +195,12 @@ export class PeertubePlayerManager { | |||
193 | mode | 195 | mode |
194 | }) | 196 | }) |
195 | 197 | ||
198 | player.on('p2pInfo', (_, data: PlayerNetworkInfo) => { | ||
199 | if (data.source !== 'p2p-media-loader' || isNaN(data.bandwidthEstimate)) return | ||
200 | |||
201 | saveAverageBandwidth(data.bandwidthEstimate) | ||
202 | }) | ||
203 | |||
196 | return res(player) | 204 | return res(player) |
197 | }) | 205 | }) |
198 | }) | 206 | }) |
@@ -359,12 +367,13 @@ export class PeertubePlayerManager { | |||
359 | consumeOnly = true | 367 | consumeOnly = true |
360 | } | 368 | } |
361 | 369 | ||
362 | const p2pMediaLoaderConfig = { | 370 | const p2pMediaLoaderConfig: HlsJsEngineSettings = { |
363 | loader: { | 371 | loader: { |
364 | trackerAnnounce, | 372 | trackerAnnounce, |
365 | segmentValidator: segmentValidatorFactory(options.p2pMediaLoader.segmentsSha256Url, options.common.isLive), | 373 | segmentValidator: segmentValidatorFactory(options.p2pMediaLoader.segmentsSha256Url, options.common.isLive), |
366 | rtcConfig: getRtcConfig(), | 374 | rtcConfig: getRtcConfig(), |
367 | requiredSegmentsPriority: 1, | 375 | requiredSegmentsPriority: 1, |
376 | simultaneousHttpDownloads: 1, | ||
368 | segmentUrlBuilder: segmentUrlBuilderFactory(redundancyUrlManager), | 377 | segmentUrlBuilder: segmentUrlBuilderFactory(redundancyUrlManager), |
369 | useP2P: getStoredP2PEnabled(), | 378 | useP2P: getStoredP2PEnabled(), |
370 | consumeOnly | 379 | consumeOnly |
@@ -373,6 +382,7 @@ export class PeertubePlayerManager { | |||
373 | swarmId: p2pMediaLoaderOptions.playlistUrl | 382 | swarmId: p2pMediaLoaderOptions.playlistUrl |
374 | } | 383 | } |
375 | } | 384 | } |
385 | |||
376 | const hlsjs = { | 386 | const hlsjs = { |
377 | levelLabelHandler: (level: { height: number, width: number }) => { | 387 | levelLabelHandler: (level: { height: number, width: number }) => { |
378 | const resolution = Math.min(level.height || 0, level.width || 0) | 388 | const resolution = Math.min(level.height || 0, level.width || 0) |
@@ -387,12 +397,7 @@ export class PeertubePlayerManager { | |||
387 | return label | 397 | return label |
388 | }, | 398 | }, |
389 | html5: { | 399 | html5: { |
390 | hlsjsConfig: { | 400 | hlsjsConfig: this.getHLSOptions(p2pMediaLoaderModule, p2pMediaLoaderConfig) |
391 | capLevelToPlayerSize: true, | ||
392 | autoStartLoad: false, | ||
393 | liveSyncDurationCount: 5, | ||
394 | loader: new p2pMediaLoaderModule.Engine(p2pMediaLoaderConfig).createLoaderClass() | ||
395 | } | ||
396 | } | 401 | } |
397 | } | 402 | } |
398 | 403 | ||
@@ -402,6 +407,28 @@ export class PeertubePlayerManager { | |||
402 | return toAssign | 407 | return toAssign |
403 | } | 408 | } |
404 | 409 | ||
410 | private static getHLSOptions (p2pMediaLoaderModule: any, p2pMediaLoaderConfig: HlsJsEngineSettings) { | ||
411 | const base = { | ||
412 | capLevelToPlayerSize: true, | ||
413 | autoStartLoad: false, | ||
414 | liveSyncDurationCount: 5, | ||
415 | |||
416 | loader: new p2pMediaLoaderModule.Engine(p2pMediaLoaderConfig).createLoaderClass() | ||
417 | } | ||
418 | |||
419 | const averageBandwidth = getAverageBandwidthInStore() | ||
420 | if (!averageBandwidth) return base | ||
421 | |||
422 | return { | ||
423 | ...base, | ||
424 | |||
425 | abrEwmaDefaultEstimate: averageBandwidth * 8, // We want bit/s | ||
426 | startLevel: -1, | ||
427 | testBandwidth: false, | ||
428 | debug: false | ||
429 | } | ||
430 | } | ||
431 | |||
405 | private static addWebTorrentOptions (plugins: VideoJSPluginOptions, options: PeertubePlayerManagerOptions) { | 432 | private static addWebTorrentOptions (plugins: VideoJSPluginOptions, options: PeertubePlayerManagerOptions) { |
406 | const commonOptions = options.common | 433 | const commonOptions = options.common |
407 | const webtorrentOptions = options.webtorrent | 434 | const webtorrentOptions = options.webtorrent |
diff --git a/client/src/assets/player/peertube-plugin.ts b/client/src/assets/player/peertube-plugin.ts index 919b7c239..ade8e2ee4 100644 --- a/client/src/assets/player/peertube-plugin.ts +++ b/client/src/assets/player/peertube-plugin.ts | |||
@@ -228,6 +228,7 @@ class PeerTubePlugin extends Plugin { | |||
228 | } | 228 | } |
229 | } | 229 | } |
230 | 230 | ||
231 | console.log('Resolution changed.', data) | ||
231 | this.trigger('resolutionChange', data) | 232 | this.trigger('resolutionChange', data) |
232 | } | 233 | } |
233 | 234 | ||
diff --git a/client/src/assets/player/peertube-videojs-typings.ts b/client/src/assets/player/peertube-videojs-typings.ts index d3c75990b..f0eb129d4 100644 --- a/client/src/assets/player/peertube-videojs-typings.ts +++ b/client/src/assets/player/peertube-videojs-typings.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Config, Level } from 'hls.js' | 1 | import { HlsConfig, Level } from 'hls.js' |
2 | import videojs from 'video.js' | 2 | import videojs from 'video.js' |
3 | import { VideoFile, VideoPlaylist, VideoPlaylistElement } from '@shared/models' | 3 | import { VideoFile, VideoPlaylist, VideoPlaylistElement } from '@shared/models' |
4 | import { P2pMediaLoaderPlugin } from './p2p-media-loader/p2p-media-loader-plugin' | 4 | import { P2pMediaLoaderPlugin } from './p2p-media-loader/p2p-media-loader-plugin' |
@@ -60,7 +60,7 @@ export interface VideoJSTechHLS extends videojs.Tech { | |||
60 | } | 60 | } |
61 | 61 | ||
62 | export interface HlsjsConfigHandlerOptions { | 62 | export interface HlsjsConfigHandlerOptions { |
63 | hlsjsConfig?: Config & { cueHandler: any }// FIXME: typings | 63 | hlsjsConfig?: HlsConfig & { cueHandler: any }// FIXME: typings |
64 | captionConfig?: any // FIXME: typings | 64 | captionConfig?: any // FIXME: typings |
65 | 65 | ||
66 | levelLabelHandler?: (level: Level) => string | 66 | levelLabelHandler?: (level: Level) => string |
diff --git a/client/yarn.lock b/client/yarn.lock index 9242cd219..44166a868 100644 --- a/client/yarn.lock +++ b/client/yarn.lock | |||
@@ -1333,6 +1333,26 @@ | |||
1333 | node-gyp "^7.1.0" | 1333 | node-gyp "^7.1.0" |
1334 | read-package-json-fast "^2.0.1" | 1334 | read-package-json-fast "^2.0.1" |
1335 | 1335 | ||
1336 | "@peertube/p2p-media-loader-core@^1.0.2": | ||
1337 | version "1.0.2" | ||
1338 | resolved "https://registry.yarnpkg.com/@peertube/p2p-media-loader-core/-/p2p-media-loader-core-1.0.2.tgz#ef36a23df5a5393cc5d180a45dfb70d2c3ecff87" | ||
1339 | integrity sha512-2F6Cx2ncXe+ySaaGiAWf7jJ8snJpyd7WNCxYbJ5Zadst1mNSQlxUqH4/qEl/bai4DiuzzhudlzXS8U3SX9c9Jw== | ||
1340 | dependencies: | ||
1341 | bittorrent-tracker "^9.16.1" | ||
1342 | debug "^4.3.1" | ||
1343 | events "^3.3.0" | ||
1344 | sha.js "^2.4.11" | ||
1345 | simple-peer "^9.10.0" | ||
1346 | |||
1347 | "@peertube/p2p-media-loader-hlsjs@^1.0.4": | ||
1348 | version "1.0.4" | ||
1349 | resolved "https://registry.yarnpkg.com/@peertube/p2p-media-loader-hlsjs/-/p2p-media-loader-hlsjs-1.0.4.tgz#849809067886e41bf2ba7e71a2da33478863bc66" | ||
1350 | integrity sha512-FFFlYPFwTGxB3CPChqlzPqJw65ajIjCCxCn4IQRNuagYpo0fdaxrgepMHNPW3Zl5DmvEppv+ohUfYyr98U1wiw== | ||
1351 | dependencies: | ||
1352 | "@peertube/p2p-media-loader-core" "^1.0.2" | ||
1353 | events "^3.3.0" | ||
1354 | m3u8-parser "^4.6.0" | ||
1355 | |||
1336 | "@polka/url@^1.0.0-next.15": | 1356 | "@polka/url@^1.0.0-next.15": |
1337 | version "1.0.0-next.15" | 1357 | version "1.0.0-next.15" |
1338 | resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.15.tgz#6a9d143f7f4f49db2d782f9e1c8839a29b43ae23" | 1358 | resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.15.tgz#6a9d143f7f4f49db2d782f9e1c8839a29b43ae23" |
@@ -2445,7 +2465,7 @@ bittorrent-protocol@^3.2.0: | |||
2445 | speedometer "^1.1.0" | 2465 | speedometer "^1.1.0" |
2446 | unordered-array-remove "^1.0.2" | 2466 | unordered-array-remove "^1.0.2" |
2447 | 2467 | ||
2448 | bittorrent-tracker@^9.0.0, bittorrent-tracker@^9.14.4: | 2468 | bittorrent-tracker@^9.0.0: |
2449 | version "9.17.2" | 2469 | version "9.17.2" |
2450 | resolved "https://registry.yarnpkg.com/bittorrent-tracker/-/bittorrent-tracker-9.17.2.tgz#1afb02d3d2fb474c13389c45e8a2b6919bff40bd" | 2470 | resolved "https://registry.yarnpkg.com/bittorrent-tracker/-/bittorrent-tracker-9.17.2.tgz#1afb02d3d2fb474c13389c45e8a2b6919bff40bd" |
2451 | integrity sha512-hXjed0OnB16da+ScJUZnrAZbf9gMgSLKqh5rJebtYnTRgN4o1mX0DOPH3Nf5RFCs935ibhSmZN5nwbkh+3MdEA== | 2471 | integrity sha512-hXjed0OnB16da+ScJUZnrAZbf9gMgSLKqh5rJebtYnTRgN4o1mX0DOPH3Nf5RFCs935ibhSmZN5nwbkh+3MdEA== |
@@ -2475,6 +2495,36 @@ bittorrent-tracker@^9.0.0, bittorrent-tracker@^9.14.4: | |||
2475 | bufferutil "^4.0.3" | 2495 | bufferutil "^4.0.3" |
2476 | utf-8-validate "^5.0.5" | 2496 | utf-8-validate "^5.0.5" |
2477 | 2497 | ||
2498 | bittorrent-tracker@^9.16.1: | ||
2499 | version "9.17.4" | ||
2500 | resolved "https://registry.yarnpkg.com/bittorrent-tracker/-/bittorrent-tracker-9.17.4.tgz#663f51064a924e945cb6ca19a0c293aca258128b" | ||
2501 | integrity sha512-ykhdVQHtLfn4DYSJUQD/zFAbP8YwnF6nGlj2SBnCY4xkW5bhwXPeFZUhryAtdITl0qNL/FpmFOamBZfxIwkbxg== | ||
2502 | dependencies: | ||
2503 | bencode "^2.0.1" | ||
2504 | bittorrent-peerid "^1.3.3" | ||
2505 | bn.js "^5.2.0" | ||
2506 | chrome-dgram "^3.0.6" | ||
2507 | compact2string "^1.4.1" | ||
2508 | debug "^4.1.1" | ||
2509 | ip "^1.1.5" | ||
2510 | lru "^3.1.0" | ||
2511 | minimist "^1.2.5" | ||
2512 | once "^1.4.0" | ||
2513 | queue-microtask "^1.2.3" | ||
2514 | random-iterate "^1.0.1" | ||
2515 | randombytes "^2.1.0" | ||
2516 | run-parallel "^1.2.0" | ||
2517 | run-series "^1.1.9" | ||
2518 | simple-get "^4.0.0" | ||
2519 | simple-peer "^9.11.0" | ||
2520 | simple-websocket "^9.1.0" | ||
2521 | string2compact "^1.3.0" | ||
2522 | unordered-array-remove "^1.0.2" | ||
2523 | ws "^7.4.5" | ||
2524 | optionalDependencies: | ||
2525 | bufferutil "^4.0.3" | ||
2526 | utf-8-validate "^5.0.5" | ||
2527 | |||
2478 | bl@^4.1.0: | 2528 | bl@^4.1.0: |
2479 | version "4.1.0" | 2529 | version "4.1.0" |
2480 | resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" | 2530 | resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" |
@@ -4179,12 +4229,12 @@ etag@~1.8.1: | |||
4179 | resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" | 4229 | resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" |
4180 | integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= | 4230 | integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= |
4181 | 4231 | ||
4182 | eventemitter3@^4.0.0, eventemitter3@^4.0.3: | 4232 | eventemitter3@^4.0.0: |
4183 | version "4.0.7" | 4233 | version "4.0.7" |
4184 | resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" | 4234 | resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" |
4185 | integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== | 4235 | integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== |
4186 | 4236 | ||
4187 | events@^3.0.0, events@^3.2.0: | 4237 | events@^3.2.0, events@^3.3.0: |
4188 | version "3.3.0" | 4238 | version "3.3.0" |
4189 | resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" | 4239 | resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" |
4190 | integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== | 4240 | integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== |
@@ -4642,7 +4692,7 @@ gensync@^1.0.0-beta.1, gensync@^1.0.0-beta.2: | |||
4642 | resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" | 4692 | resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" |
4643 | integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== | 4693 | integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== |
4644 | 4694 | ||
4645 | get-browser-rtc@^1.0.2, get-browser-rtc@^1.1.0: | 4695 | get-browser-rtc@^1.1.0: |
4646 | version "1.1.0" | 4696 | version "1.1.0" |
4647 | resolved "https://registry.yarnpkg.com/get-browser-rtc/-/get-browser-rtc-1.1.0.tgz#d1494e299b00f33fc8e9d6d3343ba4ba99711a2c" | 4697 | resolved "https://registry.yarnpkg.com/get-browser-rtc/-/get-browser-rtc-1.1.0.tgz#d1494e299b00f33fc8e9d6d3343ba4ba99711a2c" |
4648 | integrity sha512-MghbMJ61EJrRsDe7w1Bvqt3ZsBuqhce5nrn/XAwgwOXhcsz53/ltdxOse1h/8eKXj5slzxdsz56g5rzOFSGwfQ== | 4698 | integrity sha512-MghbMJ61EJrRsDe7w1Bvqt3ZsBuqhce5nrn/XAwgwOXhcsz53/ltdxOse1h/8eKXj5slzxdsz56g5rzOFSGwfQ== |
@@ -4930,13 +4980,10 @@ hex-color-regex@^1.1.0: | |||
4930 | resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e" | 4980 | resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e" |
4931 | integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ== | 4981 | integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ== |
4932 | 4982 | ||
4933 | hls.js@^0.14.16: | 4983 | hls.js@^1.0.7: |
4934 | version "0.14.17" | 4984 | version "1.0.7" |
4935 | resolved "https://registry.yarnpkg.com/hls.js/-/hls.js-0.14.17.tgz#0127cff2ec2f994a54eb955fe669ef6153a8e317" | 4985 | resolved "https://registry.yarnpkg.com/hls.js/-/hls.js-1.0.7.tgz#b4ab75e7a46650d02245a1da091efd15f07d16eb" |
4936 | integrity sha512-25A7+m6qqp6UVkuzUQ//VVh2EEOPYlOBg32ypr34bcPO7liBMOkKFvbjbCBfiPAOTA/7BSx1Dujft3Th57WyFg== | 4986 | integrity sha512-NsGaksvOuYNyTmu/w239EtYFMadFzIoDkmStc1FDRcrGmvxOfMGKad/hLj4NHoE8H1S+Q8dT7HufMJJ6yiht7g== |
4937 | dependencies: | ||
4938 | eventemitter3 "^4.0.3" | ||
4939 | url-toolkit "^2.1.6" | ||
4940 | 4987 | ||
4941 | hosted-git-info@^2.1.4: | 4988 | hosted-git-info@^2.1.4: |
4942 | version "2.8.9" | 4989 | version "2.8.9" |
@@ -6341,7 +6388,7 @@ lru@^3.1.0: | |||
6341 | dependencies: | 6388 | dependencies: |
6342 | inherits "^2.0.1" | 6389 | inherits "^2.0.1" |
6343 | 6390 | ||
6344 | m3u8-parser@4.7.0, m3u8-parser@^4.4.0: | 6391 | m3u8-parser@4.7.0, m3u8-parser@^4.6.0: |
6345 | version "4.7.0" | 6392 | version "4.7.0" |
6346 | resolved "https://registry.yarnpkg.com/m3u8-parser/-/m3u8-parser-4.7.0.tgz#e01e8ce136098ade1b14ee691ea20fc4dc60abf6" | 6393 | resolved "https://registry.yarnpkg.com/m3u8-parser/-/m3u8-parser-4.7.0.tgz#e01e8ce136098ade1b14ee691ea20fc4dc60abf6" |
6347 | integrity sha512-48l/OwRyjBm+QhNNigEEcRcgbRvnUjL7rxs597HmW9QSNbyNvt+RcZ9T/d9vxi9A9z7EZrB1POtZYhdRlwYQkQ== | 6394 | integrity sha512-48l/OwRyjBm+QhNNigEEcRcgbRvnUjL7rxs597HmW9QSNbyNvt+RcZ9T/d9vxi9A9z7EZrB1POtZYhdRlwYQkQ== |
@@ -7374,27 +7421,6 @@ p-try@^2.0.0: | |||
7374 | resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" | 7421 | resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" |
7375 | integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== | 7422 | integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== |
7376 | 7423 | ||
7377 | p2p-media-loader-core@^0.6.2: | ||
7378 | version "0.6.2" | ||
7379 | resolved "https://registry.yarnpkg.com/p2p-media-loader-core/-/p2p-media-loader-core-0.6.2.tgz#7e46cf8fc4357596f389e106bee850908cc974ef" | ||
7380 | integrity sha512-yspgCOrVVYitVNece5CA6W/kcVA0UybvbD4kyBE5ooyhCAXQK5/q6JsIpXiVQ3VkQw8Qs4mfZjU39Vt6vEk6aw== | ||
7381 | dependencies: | ||
7382 | bittorrent-tracker "^9.14.4" | ||
7383 | debug "^4.1.1" | ||
7384 | events "^3.0.0" | ||
7385 | get-browser-rtc "^1.0.2" | ||
7386 | sha.js "^2.4.11" | ||
7387 | simple-peer "^9.5.0" | ||
7388 | |||
7389 | p2p-media-loader-hlsjs@^0.6.2: | ||
7390 | version "0.6.2" | ||
7391 | resolved "https://registry.yarnpkg.com/p2p-media-loader-hlsjs/-/p2p-media-loader-hlsjs-0.6.2.tgz#b66f977a5d28986c8f6e62d2ffa297aec3c05186" | ||
7392 | integrity sha512-5LgqWPDsgyST9rxoHGDpExZU1rIDZIT0qft2wAnlg8Cb8aVeaBxUsmF4Sj692Qb5/GBDsi8vLE03LW8gpvlh1g== | ||
7393 | dependencies: | ||
7394 | events "^3.0.0" | ||
7395 | m3u8-parser "^4.4.0" | ||
7396 | p2p-media-loader-core "^0.6.2" | ||
7397 | |||
7398 | package-json-versionify@^1.0.4: | 7424 | package-json-versionify@^1.0.4: |
7399 | version "1.0.4" | 7425 | version "1.0.4" |
7400 | resolved "https://registry.yarnpkg.com/package-json-versionify/-/package-json-versionify-1.0.4.tgz#5860587a944873a6b7e6d26e8e51ffb22315bf17" | 7426 | resolved "https://registry.yarnpkg.com/package-json-versionify/-/package-json-versionify-1.0.4.tgz#5860587a944873a6b7e6d26e8e51ffb22315bf17" |
@@ -9313,7 +9339,7 @@ simple-get@^4.0.0: | |||
9313 | once "^1.3.1" | 9339 | once "^1.3.1" |
9314 | simple-concat "^1.0.0" | 9340 | simple-concat "^1.0.0" |
9315 | 9341 | ||
9316 | simple-peer@^9.11.0, simple-peer@^9.5.0, simple-peer@^9.9.3: | 9342 | simple-peer@^9.10.0, simple-peer@^9.11.0, simple-peer@^9.9.3: |
9317 | version "9.11.0" | 9343 | version "9.11.0" |
9318 | resolved "https://registry.yarnpkg.com/simple-peer/-/simple-peer-9.11.0.tgz#e8d27609c7a610c3ddd75767da868e8daab67571" | 9344 | resolved "https://registry.yarnpkg.com/simple-peer/-/simple-peer-9.11.0.tgz#e8d27609c7a610c3ddd75767da868e8daab67571" |
9319 | integrity sha512-qvdNu/dGMHBm2uQ7oLhQBMhYlrOZC1ywXNCH/i8I4etxR1vrjCnU6ZSQBptndB1gcakjo2+w4OHo7Sjza1SHxg== | 9345 | integrity sha512-qvdNu/dGMHBm2uQ7oLhQBMhYlrOZC1ywXNCH/i8I4etxR1vrjCnU6ZSQBptndB1gcakjo2+w4OHo7Sjza1SHxg== |
@@ -10538,7 +10564,7 @@ url-parse@^1.4.3, url-parse@^1.5.1: | |||
10538 | querystringify "^2.1.1" | 10564 | querystringify "^2.1.1" |
10539 | requires-port "^1.0.0" | 10565 | requires-port "^1.0.0" |
10540 | 10566 | ||
10541 | url-toolkit@^2.1.6, url-toolkit@^2.2.1: | 10567 | url-toolkit@^2.2.1: |
10542 | version "2.2.2" | 10568 | version "2.2.2" |
10543 | resolved "https://registry.yarnpkg.com/url-toolkit/-/url-toolkit-2.2.2.tgz#51ef27b56d3187185f9ecf4a8ac7e8f55203c89d" | 10569 | resolved "https://registry.yarnpkg.com/url-toolkit/-/url-toolkit-2.2.2.tgz#51ef27b56d3187185f9ecf4a8ac7e8f55203c89d" |
10544 | integrity sha512-l25w6Sy+Iy3/IbogunxhWwljPaDnqpiKvrQRoLBm6DfISco7NyRIS7Zf6+Oxhy1T8kHxWdwLND7ZZba6NjXMug== | 10570 | integrity sha512-l25w6Sy+Iy3/IbogunxhWwljPaDnqpiKvrQRoLBm6DfISco7NyRIS7Zf6+Oxhy1T8kHxWdwLND7ZZba6NjXMug== |