aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
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
parente8bffe9690307f2686ed5573cae2b86ee5f57789 (diff)
downloadPeerTube-077a413ff826c3bf2db01bb4b0cda04af47aeef7.tar.gz
PeerTube-077a413ff826c3bf2db01bb4b0cda04af47aeef7.tar.zst
PeerTube-077a413ff826c3bf2db01bb4b0cda04af47aeef7.zip
Automatically restart live on server/live restart
Diffstat (limited to 'client')
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.component.ts3
-rw-r--r--client/src/assets/player/p2p-media-loader/hls-plugin.ts7
2 files changed, 6 insertions, 4 deletions
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts
index 5fd095c36..1ee18f52f 100644
--- a/client/src/app/+videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/+videos/+video-watch/video-watch.component.ts
@@ -688,9 +688,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
688 private handleLiveStateChange (newState: VideoState) { 688 private handleLiveStateChange (newState: VideoState) {
689 if (newState !== VideoState.PUBLISHED) return 689 if (newState !== VideoState.PUBLISHED) return
690 690
691 const videoState = this.video.state.id
692 if (videoState !== VideoState.WAITING_FOR_LIVE && videoState !== VideoState.LIVE_ENDED) return
693
694 console.log('Loading video after live update.') 691 console.log('Loading video after live update.')
695 692
696 const videoUUID = this.video.uuid 693 const videoUUID = this.video.uuid
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, () => {