aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-01-19 10:44:12 +0100
committerChocobozzz <me@florianbigard.com>2022-01-19 10:44:12 +0100
commit077a413ff826c3bf2db01bb4b0cda04af47aeef7 (patch)
treed4e40d4d7a238878e9bfc00e48aef7d15186b692 /client/src/assets/player
parente8bffe9690307f2686ed5573cae2b86ee5f57789 (diff)
downloadPeerTube-077a413ff826c3bf2db01bb4b0cda04af47aeef7.tar.gz
PeerTube-077a413ff826c3bf2db01bb4b0cda04af47aeef7.tar.zst
PeerTube-077a413ff826c3bf2db01bb4b0cda04af47aeef7.zip
Automatically restart live on server/live restart
Diffstat (limited to 'client/src/assets/player')
-rw-r--r--client/src/assets/player/p2p-media-loader/hls-plugin.ts7
1 files changed, 6 insertions, 1 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 421ce4934..640858025 100644
--- a/client/src/assets/player/p2p-media-loader/hls-plugin.ts
+++ b/client/src/assets/player/p2p-media-loader/hls-plugin.ts
@@ -89,6 +89,8 @@ class Html5Hlsjs {
89 private readonly source: videojs.Tech.SourceObject 89 private readonly source: videojs.Tech.SourceObject
90 private readonly vjs: typeof videojs 90 private readonly vjs: typeof videojs
91 91
92 private maxNetworkErrorRecovery = 5
93
92 private hls: Hlsjs 94 private hls: Hlsjs
93 private hlsjsConfig: Partial<HlsConfig & { cueHandler: any }> = null 95 private hlsjsConfig: Partial<HlsConfig & { cueHandler: any }> = null
94 96
@@ -225,7 +227,7 @@ class Html5Hlsjs {
225 } 227 }
226 228
227 private _handleNetworkError (error: any) { 229 private _handleNetworkError (error: any) {
228 if (this.errorCounts[Hlsjs.ErrorTypes.NETWORK_ERROR] <= 5) { 230 if (this.errorCounts[Hlsjs.ErrorTypes.NETWORK_ERROR] <= this.maxNetworkErrorRecovery) {
229 console.info('trying to recover network error') 231 console.info('trying to recover network error')
230 232
231 // Wait 1 second and retry 233 // Wait 1 second and retry
@@ -371,6 +373,9 @@ class Html5Hlsjs {
371 this.dvrDuration = data.details.totalduration 373 this.dvrDuration = data.details.totalduration
372 374
373 this._duration = this.isLive ? Infinity : data.details.totalduration 375 this._duration = this.isLive ? Infinity : data.details.totalduration
376
377 // Increase network error recovery for lives since they can be broken (server restart, stream interruption etc)
378 if (this.isLive) this.maxNetworkErrorRecovery = 300
374 }) 379 })
375 380
376 this.hls.once(Hlsjs.Events.FRAG_LOADED, () => { 381 this.hls.once(Hlsjs.Events.FRAG_LOADED, () => {