Automatically restart live on server/live restart
This commit is contained in:
parent
e8bffe9690
commit
077a413ff8
|
@ -688,9 +688,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
|
||||||
private handleLiveStateChange (newState: VideoState) {
|
private handleLiveStateChange (newState: VideoState) {
|
||||||
if (newState !== VideoState.PUBLISHED) return
|
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.')
|
console.log('Loading video after live update.')
|
||||||
|
|
||||||
const videoUUID = this.video.uuid
|
const videoUUID = this.video.uuid
|
||||||
|
|
|
@ -89,6 +89,8 @@ class Html5Hlsjs {
|
||||||
private readonly source: videojs.Tech.SourceObject
|
private readonly source: videojs.Tech.SourceObject
|
||||||
private readonly vjs: typeof videojs
|
private readonly vjs: typeof videojs
|
||||||
|
|
||||||
|
private maxNetworkErrorRecovery = 5
|
||||||
|
|
||||||
private hls: Hlsjs
|
private hls: Hlsjs
|
||||||
private hlsjsConfig: Partial<HlsConfig & { cueHandler: any }> = null
|
private hlsjsConfig: Partial<HlsConfig & { cueHandler: any }> = null
|
||||||
|
|
||||||
|
@ -225,7 +227,7 @@ class Html5Hlsjs {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _handleNetworkError (error: any) {
|
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')
|
console.info('trying to recover network error')
|
||||||
|
|
||||||
// Wait 1 second and retry
|
// Wait 1 second and retry
|
||||||
|
@ -371,6 +373,9 @@ class Html5Hlsjs {
|
||||||
this.dvrDuration = data.details.totalduration
|
this.dvrDuration = data.details.totalduration
|
||||||
|
|
||||||
this._duration = this.isLive ? Infinity : 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, () => {
|
this.hls.once(Hlsjs.Events.FRAG_LOADED, () => {
|
||||||
|
|
Loading…
Reference in New Issue