Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Automatically restart live on server/live restart

Chocobozzz077a413ff826
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 5fd095c36c..1ee18f52f0 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 {
private handleLiveStateChange (newState: VideoState) {
if (newState !== VideoState.PUBLISHED) return
- const videoState = this.video.state.id
- if (videoState !== VideoState.WAITING_FOR_LIVE && videoState !== VideoState.LIVE_ENDED) return
-
console.log('Loading video after live update.')
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 421ce4934d..640858025c 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 {
private readonly source: videojs.Tech.SourceObject
private readonly vjs: typeof videojs
+ private maxNetworkErrorRecovery = 5
+
private hls: Hlsjs
private hlsjsConfig: Partial<HlsConfig & { cueHandler: any }> = null
@@ -225,7 +227,7 @@ class Html5Hlsjs {
}
private _handleNetworkError (error: any) {
- if (this.errorCounts[Hlsjs.ErrorTypes.NETWORK_ERROR] <= 5) {
+ if (this.errorCounts[Hlsjs.ErrorTypes.NETWORK_ERROR] <= this.maxNetworkErrorRecovery) {
console.info('trying to recover network error')
// Wait 1 second and retry
@@ -371,6 +373,9 @@ class Html5Hlsjs {
this.dvrDuration = data.details.totalduration
this._duration = this.isLive ? Infinity : data.details.totalduration
+
+ // Increase network error recovery for lives since they can be broken (server restart, stream interruption etc)
+ if (this.isLive) this.maxNetworkErrorRecovery = 300
})
this.hls.once(Hlsjs.Events.FRAG_LOADED, () => {