Automatically restart live on server/live restart

pull/4736/head
Chocobozzz 2022-01-19 10:44:12 +01:00
parent e8bffe9690
commit 077a413ff8
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 6 additions and 4 deletions

View File

@ -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

View File

@ -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, () => {