aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/p2p-media-loader
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-08-06 16:41:08 +0200
committerChocobozzz <me@florianbigard.com>2021-08-11 11:49:01 +0200
commit134006b0d4528c07f0022c6e75257bf9fedbfebb (patch)
tree8c977db89b10984896f7e96c92109d5b4ab345b6 /client/src/assets/player/p2p-media-loader
parent31aa391d13f78743bb552bc8c337964afb3b5817 (diff)
downloadPeerTube-134006b0d4528c07f0022c6e75257bf9fedbfebb.tar.gz
PeerTube-134006b0d4528c07f0022c6e75257bf9fedbfebb.tar.zst
PeerTube-134006b0d4528c07f0022c6e75257bf9fedbfebb.zip
Update client dependencies
Diffstat (limited to 'client/src/assets/player/p2p-media-loader')
-rw-r--r--client/src/assets/player/p2p-media-loader/hls-plugin.ts16
-rw-r--r--client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts2
2 files changed, 8 insertions, 10 deletions
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 3050110cd..78f0944ef 100644
--- a/client/src/assets/player/p2p-media-loader/hls-plugin.ts
+++ b/client/src/assets/player/p2p-media-loader/hls-plugin.ts
@@ -1,7 +1,7 @@
1// Thanks https://github.com/streamroot/videojs-hlsjs-plugin 1// Thanks https://github.com/streamroot/videojs-hlsjs-plugin
2// We duplicated this plugin to choose the hls.js version we want, because streamroot only provide a bundled file 2// We duplicated this plugin to choose the hls.js version we want, because streamroot only provide a bundled file
3 3
4import * as Hlsjs from 'hls.js/dist/hls.light.js' 4import Hlsjs, { ErrorData, HlsConfig, Level, ManifestLoadedData } from 'hls.js'
5import videojs from 'video.js' 5import videojs from 'video.js'
6import { HlsjsConfigHandlerOptions, QualityLevelRepresentation, QualityLevels, VideoJSTechHLS } from '../peertube-videojs-typings' 6import { HlsjsConfigHandlerOptions, QualityLevelRepresentation, QualityLevels, VideoJSTechHLS } from '../peertube-videojs-typings'
7 7
@@ -10,11 +10,9 @@ type ErrorCounts = {
10} 10}
11 11
12type Metadata = { 12type Metadata = {
13 levels: Hlsjs.Level[] 13 levels: Level[]
14} 14}
15 15
16type CustomAudioTrack = Hlsjs.HlsAudioTrack & { name?: string, lang?: string }
17
18const registerSourceHandler = function (vjs: typeof videojs) { 16const registerSourceHandler = function (vjs: typeof videojs) {
19 if (!Hlsjs.isSupported()) { 17 if (!Hlsjs.isSupported()) {
20 console.warn('Hls.js is not supported in this browser!') 18 console.warn('Hls.js is not supported in this browser!')
@@ -93,8 +91,8 @@ class Html5Hlsjs {
93 private readonly source: videojs.Tech.SourceObject 91 private readonly source: videojs.Tech.SourceObject
94 private readonly vjs: typeof videojs 92 private readonly vjs: typeof videojs
95 93
96 private hls: Hlsjs & { manualLevel?: number, audioTrack?: any, audioTracks?: CustomAudioTrack[] } // FIXME: typings 94 private hls: Hlsjs
97 private hlsjsConfig: Partial<Hlsjs.Config & { cueHandler: any }> = null 95 private hlsjsConfig: Partial<HlsConfig & { cueHandler: any }> = null
98 96
99 private _duration: number = null 97 private _duration: number = null
100 private metadata: Metadata = null 98 private metadata: Metadata = null
@@ -255,7 +253,7 @@ class Html5Hlsjs {
255 this.tech.trigger('error') 253 this.tech.trigger('error')
256 } 254 }
257 255
258 private _onError (_event: any, data: Hlsjs.errorData) { 256 private _onError (_event: any, data: ErrorData) {
259 const error: { message: string, code?: number } = { 257 const error: { message: string, code?: number } = {
260 message: `HLS.js error: ${data.type} - fatal: ${data.fatal} - ${data.details}` 258 message: `HLS.js error: ${data.type} - fatal: ${data.fatal} - ${data.details}`
261 } 259 }
@@ -285,7 +283,7 @@ class Html5Hlsjs {
285 this.hls.currentLevel = qualityId 283 this.hls.currentLevel = qualityId
286 } 284 }
287 285
288 private _levelLabel (level: Hlsjs.Level) { 286 private _levelLabel (level: Level) {
289 if (this.player.srOptions_.levelLabelHandler) { 287 if (this.player.srOptions_.levelLabelHandler) {
290 return this.player.srOptions_.levelLabelHandler(level as any) 288 return this.player.srOptions_.levelLabelHandler(level as any)
291 } 289 }
@@ -523,7 +521,7 @@ class Html5Hlsjs {
523 } 521 }
524 } 522 }
525 523
526 private _onMetaData (_event: any, data: Hlsjs.manifestLoadedData) { 524 private _onMetaData (_event: any, data: ManifestLoadedData) {
527 // This could arrive before 'loadedqualitydata' handlers is registered, remember it so we can raise it later 525 // This could arrive before 'loadedqualitydata' handlers is registered, remember it so we can raise it later
528 this.metadata = data as any 526 this.metadata = data as any
529 this._handleQualityLevels() 527 this._handleQualityLevels()
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 093795e48..acd40636e 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,4 +1,4 @@
1import * as Hlsjs from 'hls.js/dist/hls.light.js' 1import Hlsjs from 'hls.js'
2import videojs from 'video.js' 2import videojs from 'video.js'
3import { Events, Segment } from '@peertube/p2p-media-loader-core' 3import { Events, Segment } from '@peertube/p2p-media-loader-core'
4import { Engine, initHlsJsPlayer, initVideoJsContribHlsJsPlayer } from '@peertube/p2p-media-loader-hlsjs' 4import { Engine, initHlsJsPlayer, initVideoJsContribHlsJsPlayer } from '@peertube/p2p-media-loader-hlsjs'