@clappr/hlsjs-playback 1.9.12 → 1.9.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36719,7 +36719,7 @@ class HlsjsPlayback extends HTML5Video {
36719
36719
  }
36720
36720
  get supportedVersion() {
36721
36721
  return {
36722
- min: "0.14.7"
36722
+ min: "0.14.8"
36723
36723
  };
36724
36724
  }
36725
36725
  get levels() {
@@ -22,7 +22,7 @@
22
22
  }
23
23
  get supportedVersion() {
24
24
  return {
25
- min: "0.14.7"
25
+ min: "0.14.8"
26
26
  };
27
27
  }
28
28
  get levels() {
@@ -1,2 +1,2 @@
1
- var HlsjsPlayback=function(t,e){"use strict";const{now:i,listContainsIgnoreCase:s}=t.Utils;t.Events.register("PLAYBACK_FRAGMENT_CHANGED"),t.Events.register("PLAYBACK_FRAGMENT_PARSING_METADATA");class r extends t.HTML5Video{get name(){return"hls"}get supportedVersion(){return{min:"0.14.7"}}get levels(){return this._levels||[]}get currentLevel(){return null===this._currentLevel||void 0===this._currentLevel?-1:this._currentLevel}get isReady(){return this._isReadyState}set currentLevel(e){this._currentLevel=e,this.trigger(t.Events.PLAYBACK_LEVEL_SWITCH_START),this.options.playback.hlsUseNextLevel?this._hls.nextLevel=this._currentLevel:this._hls.currentLevel=this._currentLevel}get latency(){return this._hls.latency}get liveSyncPosition(){return this._hls.liveSyncPosition}get currentProgramDateTime(){return this._hls.playingDate}get _startTime(){return this._playbackType===t.Playback.LIVE&&"EVENT"!==this._playlistType?this._extrapolatedStartTime:this._playableRegionStartTime}get _now(){return i()}get _extrapolatedStartTime(){if(!this._localStartTimeCorrelation)return this._playableRegionStartTime;const t=this._localStartTimeCorrelation,e=this._now-t.local,i=(t.remote+e)/1e3;return Math.min(i,this._playableRegionStartTime+this._extrapolatedWindowDuration)}get _extrapolatedEndTime(){const t=this._playableRegionStartTime+this._playableRegionDuration;if(!this._localEndTimeCorrelation)return t;const e=this._localEndTimeCorrelation,i=this._now-e.local,s=(e.remote+i)/1e3;return Math.max(t-this._extrapolatedWindowDuration,Math.min(s,t))}get _duration(){return this._extrapolatedEndTime-this._startTime}get _extrapolatedWindowDuration(){return null===this._segmentTargetDuration?0:this._extrapolatedWindowNumSegments*this._segmentTargetDuration}get bandwidthEstimate(){return this._hls&&this._hls.bandwidthEstimate}get defaultOptions(){return{preload:!0}}get customListeners(){return this.options.hlsPlayback&&this.options.hlsPlayback.customListeners||[]}get sourceMedia(){return this.options.src}get currentTimestamp(){if(!this._currentFragment)return null;return(this._currentFragment.programDateTime+1e3*(this.el.currentTime-this._currentFragment.start))/1e3}static get HLSJS(){return e}constructor(...t){super(...t),this.options.hlsPlayback={...this.defaultOptions,...this.options.hlsPlayback},this._timeUpdateThrottleDelay=200,this._timeUpdateFiringRate=.2,this._durationChangeMinOffset=.5,this._setInitialState()}_setInitialState(){this._minDvrSize=void 0===this.options.hlsMinimumDvrSize?60:this.options.hlsMinimumDvrSize,this._extrapolatedWindowNumSegments=this.options.playback&&void 0!==this.options.playback.extrapolatedWindowNumSegments?this.options.playback.extrapolatedWindowNumSegments:2,this._playbackType=t.Playback.VOD,this._lastTimeUpdate={current:0,total:0,firstFragDateTime:0},this._lastTimeUpdateFiredTime=0,this._lastDuration=null,this._playableRegionStartTime=0,this._localStartTimeCorrelation=null,this._localEndTimeCorrelation=null,this._playableRegionDuration=0,this._programDateTime=0,this._durationExcludesAfterLiveSyncPoint=!1,this._segmentTargetDuration=null,this._playlistType=null,this._recoverAttemptsRemaining=this.options.hlsRecoverAttempts||16}_setup(){this._destroyHLSInstance(),this._createHLSInstance(),this._listenHLSEvents(),this._attachHLSMedia()}_destroyHLSInstance(){this._hls&&(this._manifestLoading=!1,this._ccIsSetup=!1,this._ccTracksUpdated=!1,this._setInitialState(),this._hls.destroy(),this._hls=null)}_createHLSInstance(){const t={...this.options.playback.hlsjsConfig};this._hls=new e(t)}_attachHLSMedia(){this._hls&&this._hls.attachMedia(this.el)}_listenHLSEvents(){this._hls&&(this._hls.once(e.Events.MEDIA_ATTACHED,(()=>{this.options.hlsPlayback.preload&&this._hls.loadSource(this.options.src)})),this._hls.on(e.Events.MANIFEST_LOADING,(()=>{this._manifestLoading=!0})),this._hls.on(e.Events.LEVEL_LOADED,((t,e)=>this._updatePlaybackType(t,e))),this._hls.on(e.Events.LEVEL_UPDATED,((t,e)=>this._onLevelUpdated(t,e))),this._hls.on(e.Events.LEVEL_SWITCHED,((t,e)=>this._onLevelSwitch(t,e))),this._hls.on(e.Events.FRAG_CHANGED,((t,e)=>this._onFragmentChanged(t,e))),this._hls.on(e.Events.FRAG_LOADED,((t,e)=>this._onFragmentLoaded(t,e))),this._hls.on(e.Events.FRAG_BUFFERED,((t,e)=>this._onFragmentBuffered(t,e))),this._hls.on(e.Events.FRAG_PARSING_METADATA,((t,e)=>this._onFragmentParsingMetadata(t,e))),this._hls.on(e.Events.ERROR,((t,e)=>this._onHLSJSError(t,e))),this._hls.on(e.Events.SUBTITLE_TRACK_LOADED,((t,e)=>this._onSubtitleLoaded(t,e))),this._hls.on(e.Events.SUBTITLE_TRACKS_UPDATED,(()=>this._ccTracksUpdated=!0)),this.bindCustomListeners())}bindCustomListeners(){this.customListeners.forEach((t=>{const e=t.eventName,i=t.once?"once":"on";e&&this._hls[`${i}`](e,t.callback)}))}unbindCustomListeners(){this.customListeners.forEach((t=>{const e=t.eventName;e&&this._hls.off(e,t.callback)}))}_onFragmentParsingMetadata(e,i){this.trigger(t.Events.Custom.PLAYBACK_FRAGMENT_PARSING_METADATA,{evt:e,data:i})}render(){return this._ready(),super.render()}_ready(){this._isReadyState||(!this._hls&&this._setup(),this._isReadyState=!0,this.trigger(t.Events.PLAYBACK_READY,this.name))}_recover(e,i,s){if(this._recoveredDecodingError)if(this._recoveredAudioCodecError){t.Log.error("hlsjs: failed to recover",{evt:e,data:i}),s.level=t.PlayerError.Levels.FATAL;const r=this.createError(s);this.trigger(t.Events.PLAYBACK_ERROR,r),this.stop()}else this._recoveredAudioCodecError=!0,this._hls.swapAudioCodec(),this._hls.recoverMediaError(),this.play();else this._recoveredDecodingError=!0,this._hls.recoverMediaError(),this.play()}_setupSrc(t){}_startTimeUpdateTimer(){this._timeUpdateTimer||(this._timeUpdateTimer=setInterval((()=>{this._onDurationChange(),this._onTimeUpdate()}),100))}_stopTimeUpdateTimer(){this._timeUpdateTimer&&(clearInterval(this._timeUpdateTimer),this._timeUpdateTimer=null)}getProgramDateTime(){return this._programDateTime}getDuration(){return this._duration}getFrameRate(){if(this._hls&&this._hls.levels&&this._hls.currentLevel>=0){const t=this._hls.levels[this._hls.currentLevel];return t&&t.frameRate?t.frameRate:null}return null}getCurrentTime(){return Math.max(0,this.el.currentTime-this._startTime)}getStartTimeOffset(){return this._startTime}seekPercentage(t){const e=t>0?this._duration*(t/100):this._duration;this.seek(e)}seek(e){e<0&&(t.Log.warn("Attempt to seek to a negative time. Resetting to live point. Use seekToLivePoint() to seek to the live point."),e=this.getDuration()),e+=this._startTime,this.el.currentTime=e}seekToLivePoint(){this.seek(this.getDuration())}_updateSettings(){this._playbackType===t.Playback.VOD?this.settings.left=["playpause","position","duration"]:this.dvrEnabled?this.settings.left=["playpause"]:this.settings.left=["playstop"],this.settings.seekEnabled=this.isSeekEnabled(),this.trigger(t.Events.PLAYBACK_SETTINGSUPDATE)}_onHLSJSError(i,s){const r={code:`${s.type}_${s.details}`,description:`${this.name} error: type: ${s.type}, details: ${s.details}`,raw:s};let a;if(s.response&&(r.description+=`, response: ${JSON.stringify(s.response)}`),s.fatal)if(this._recoverAttemptsRemaining>0)switch(this._recoverAttemptsRemaining-=1,s.type){case e.ErrorTypes.NETWORK_ERROR:switch(s.details){case e.ErrorDetails.MANIFEST_LOAD_ERROR:case e.ErrorDetails.MANIFEST_LOAD_TIMEOUT:case e.ErrorDetails.MANIFEST_PARSING_ERROR:case e.ErrorDetails.LEVEL_LOAD_ERROR:case e.ErrorDetails.LEVEL_LOAD_TIMEOUT:t.Log.error("hlsjs: unrecoverable network fatal error.",{evt:i,data:s}),a=this.createError(r),this.trigger(t.Events.PLAYBACK_ERROR,a),this.stop();break;default:t.Log.warn("hlsjs: trying to recover from network error.",{evt:i,data:s}),r.level=t.PlayerError.Levels.WARN,this._hls.startLoad()}break;case e.ErrorTypes.MEDIA_ERROR:t.Log.warn("hlsjs: trying to recover from media error.",{evt:i,data:s}),r.level=t.PlayerError.Levels.WARN,this._recover(i,s,r);break;default:t.Log.error("hlsjs: could not recover from error.",{evt:i,data:s}),a=this.createError(r),this.trigger(t.Events.PLAYBACK_ERROR,a),this.stop()}else t.Log.error("hlsjs: could not recover from error after maximum number of attempts.",{evt:i,data:s}),a=this.createError(r),this.trigger(t.Events.PLAYBACK_ERROR,a),this.stop();else{if(this.options.playback.triggerFatalErrorOnResourceDenied&&this._keyIsDenied(s))return t.Log.error("hlsjs: could not load decrypt key.",{evt:i,data:s}),a=this.createError(r),this.trigger(t.Events.PLAYBACK_ERROR,a),void this.stop();r.level=t.PlayerError.Levels.WARN,t.Log.warn("hlsjs: non-fatal error occurred",{evt:i,data:s})}}_keyIsDenied(t){return t.type===e.ErrorTypes.NETWORK_ERROR&&t.details===e.ErrorDetails.KEY_LOAD_ERROR&&t.response&&t.response.code>=400}_onTimeUpdate(){const e={current:this.getCurrentTime(),total:this.getDuration(),firstFragDateTime:this.getProgramDateTime()};this._shouldThrottleTimeUpdate(e)||(this._lastTimeUpdate=e,this._lastTimeUpdateFiredTime=this._now,this.trigger(t.Events.PLAYBACK_TIMEUPDATE,e,this.name))}_shouldThrottleTimeUpdate(t){const e=Math.abs(t.current-this._lastTimeUpdate.current)<this._timeUpdateFiringRate,i=Math.abs(t.total-this._lastTimeUpdate.total)<this._durationChangeMinOffset,s=t.firstFragDateTime===this._lastTimeUpdate.firstFragDateTime,r=e&&i&&s,a=this._now-this._lastTimeUpdateFiredTime<this._timeUpdateThrottleDelay;return r&&a}_onDurationChange(){const t=this.getDuration();Math.abs(this._lastDuration-t)<this._durationChangeMinOffset||(this._lastDuration=t,super._onDurationChange())}_onProgress(){if(!this.el.buffered.length)return;let e=[],i=0;for(let t=0;t<this.el.buffered.length;t++)e=[...e,{start:Math.max(0,this.el.buffered.start(t)-this._playableRegionStartTime),end:Math.max(0,this.el.buffered.end(t)-this._playableRegionStartTime)}],this.el.currentTime>=e[t].start&&this.el.currentTime<=e[t].end&&(i=t);const s={start:e[i].start,current:e[i].end,total:this.getDuration()};this.trigger(t.Events.PLAYBACK_PROGRESS,s,e)}load(t){this._stopTimeUpdateTimer(),this.options.src=t,this._setup()}play(){!this._hls&&this._setup(),!this._manifestLoading&&!this.options.hlsPlayback.preload&&this._hls.loadSource(this.options.src),super.play(),this._startTimeUpdateTimer()}pause(){this._hls&&this.el.pause()}stop(){this._stopTimeUpdateTimer(),this._hls&&super.stop(),this._destroyHLSInstance()}destroy(){this._stopTimeUpdateTimer(),this._destroyHLSInstance(),super.destroy()}_updatePlaybackType(e,i){this._playbackType=i.details.live?t.Playback.LIVE:t.Playback.VOD,this._onLevelUpdated(e,i),this._ccTracksUpdated&&this._playbackType===t.Playback.LIVE&&this.hasClosedCaptionsTracks&&this._onSubtitleLoaded()}_fillLevels(){this._levels=this._hls.levels.map(((t,e)=>({id:e,level:t,label:t.bitrate/1e3+"Kbps"}))),this.trigger(t.Events.PLAYBACK_LEVELS_AVAILABLE,this._levels)}_onLevelUpdated(i,s){this._segmentTargetDuration=s.details.targetduration,this._playlistType=s.details.type||null;let r=!1,a=!1;const n=s.details.fragments,o=this._playableRegionStartTime,l=this._playableRegionDuration;if(0===n.length)return;if(n[0].rawProgramDateTime&&(this._programDateTime=n[0].rawProgramDateTime),this._playableRegionStartTime!==n[0].start&&(r=!0,this._playableRegionStartTime=n[0].start),r)if(this._localStartTimeCorrelation){const t=this._localStartTimeCorrelation,e=this._now-t.local,i=(t.remote+e)/1e3;i<n[0].start?this._localStartTimeCorrelation={local:this._now,remote:1e3*n[0].start}:i>o+this._extrapolatedWindowDuration&&(this._localStartTimeCorrelation={local:this._now,remote:1e3*Math.max(n[0].start,o+this._extrapolatedWindowDuration)})}else this._localStartTimeCorrelation={local:this._now,remote:1e3*(n[0].start+this._extrapolatedWindowDuration/2)};let h=s.details.totalduration;if(this._playbackType===t.Playback.LIVE){const t=s.details.targetduration*((this.options.playback.hlsjsConfig||{}).liveSyncDurationCount||e.DefaultConfig.liveSyncDurationCount);t<=h?(h-=t,this._durationExcludesAfterLiveSyncPoint=!0):this._durationExcludesAfterLiveSyncPoint=!1}h!==this._playableRegionDuration&&(a=!0,this._playableRegionDuration=h);const _=n[0].start+h,d=o+l;if(_!==d)if(this._localEndTimeCorrelation){const t=this._localEndTimeCorrelation,e=this._now-t.local,i=(t.remote+e)/1e3;i>_?this._localEndTimeCorrelation={local:this._now,remote:1e3*_}:i<_-this._extrapolatedWindowDuration?this._localEndTimeCorrelation={local:this._now,remote:1e3*(_-this._extrapolatedWindowDuration)}:i>d&&(this._localEndTimeCorrelation={local:this._now,remote:1e3*d})}else this._localEndTimeCorrelation={local:this._now,remote:1e3*_};a&&this._onDurationChange(),r&&this._onProgress()}_onFragmentChanged(e,i){this._currentFragment=i.frag,this.trigger(t.Events.Custom.PLAYBACK_FRAGMENT_CHANGED,i)}_onFragmentLoaded(e,i){this.trigger(t.Events.PLAYBACK_FRAGMENT_LOADED,i)}_onFragmentBuffered(e,i){this.trigger(t.Events.PLAYBACK_FRAGMENT_BUFFERED,i)}_onSubtitleLoaded(){if(!this._ccIsSetup){this.trigger(t.Events.PLAYBACK_SUBTITLE_AVAILABLE);const e=this._playbackType===t.Playback.LIVE?-1:this.closedCaptionsTrackId;this.closedCaptionsTrackId=e,this._ccIsSetup=!0}}_onLevelSwitch(e,i){this.levels.length||this._fillLevels(),this.trigger(t.Events.PLAYBACK_LEVEL_SWITCH_END),this.trigger(t.Events.PLAYBACK_LEVEL_SWITCH,i);const s=this._hls.levels[i.level];s&&(this.highDefinition=s.height>=720||s.bitrate/1e3>=2e3,this.trigger(t.Events.PLAYBACK_HIGHDEFINITIONUPDATE,this.highDefinition),this.trigger(t.Events.PLAYBACK_BITRATE,{height:s.height,width:s.width,bandwidth:s.bitrate,bitrate:s.bitrate,level:i.level}))}get dvrEnabled(){return this._durationExcludesAfterLiveSyncPoint&&this._duration>=this._minDvrSize&&this.getPlaybackType()===t.Playback.LIVE}getPlaybackType(){return this._playbackType}isSeekEnabled(){return this._playbackType===t.Playback.VOD||this.dvrEnabled}}return r.canPlay=function(t,i){const r=t.split("?")[0].match(/.*\.(.*)$/)||[],a=r.length>1&&"m3u8"===r[1].toLowerCase()||s(i,["application/vnd.apple.mpegurl","application/x-mpegURL"]);return!(!e.isSupported()||!a)},r}(Clappr,Hls);
1
+ var HlsjsPlayback=function(t,e){"use strict";const{now:i,listContainsIgnoreCase:s}=t.Utils;t.Events.register("PLAYBACK_FRAGMENT_CHANGED"),t.Events.register("PLAYBACK_FRAGMENT_PARSING_METADATA");class r extends t.HTML5Video{get name(){return"hls"}get supportedVersion(){return{min:"0.14.8"}}get levels(){return this._levels||[]}get currentLevel(){return null===this._currentLevel||void 0===this._currentLevel?-1:this._currentLevel}get isReady(){return this._isReadyState}set currentLevel(e){this._currentLevel=e,this.trigger(t.Events.PLAYBACK_LEVEL_SWITCH_START),this.options.playback.hlsUseNextLevel?this._hls.nextLevel=this._currentLevel:this._hls.currentLevel=this._currentLevel}get latency(){return this._hls.latency}get liveSyncPosition(){return this._hls.liveSyncPosition}get currentProgramDateTime(){return this._hls.playingDate}get _startTime(){return this._playbackType===t.Playback.LIVE&&"EVENT"!==this._playlistType?this._extrapolatedStartTime:this._playableRegionStartTime}get _now(){return i()}get _extrapolatedStartTime(){if(!this._localStartTimeCorrelation)return this._playableRegionStartTime;const t=this._localStartTimeCorrelation,e=this._now-t.local,i=(t.remote+e)/1e3;return Math.min(i,this._playableRegionStartTime+this._extrapolatedWindowDuration)}get _extrapolatedEndTime(){const t=this._playableRegionStartTime+this._playableRegionDuration;if(!this._localEndTimeCorrelation)return t;const e=this._localEndTimeCorrelation,i=this._now-e.local,s=(e.remote+i)/1e3;return Math.max(t-this._extrapolatedWindowDuration,Math.min(s,t))}get _duration(){return this._extrapolatedEndTime-this._startTime}get _extrapolatedWindowDuration(){return null===this._segmentTargetDuration?0:this._extrapolatedWindowNumSegments*this._segmentTargetDuration}get bandwidthEstimate(){return this._hls&&this._hls.bandwidthEstimate}get defaultOptions(){return{preload:!0}}get customListeners(){return this.options.hlsPlayback&&this.options.hlsPlayback.customListeners||[]}get sourceMedia(){return this.options.src}get currentTimestamp(){if(!this._currentFragment)return null;return(this._currentFragment.programDateTime+1e3*(this.el.currentTime-this._currentFragment.start))/1e3}static get HLSJS(){return e}constructor(...t){super(...t),this.options.hlsPlayback={...this.defaultOptions,...this.options.hlsPlayback},this._timeUpdateThrottleDelay=200,this._timeUpdateFiringRate=.2,this._durationChangeMinOffset=.5,this._setInitialState()}_setInitialState(){this._minDvrSize=void 0===this.options.hlsMinimumDvrSize?60:this.options.hlsMinimumDvrSize,this._extrapolatedWindowNumSegments=this.options.playback&&void 0!==this.options.playback.extrapolatedWindowNumSegments?this.options.playback.extrapolatedWindowNumSegments:2,this._playbackType=t.Playback.VOD,this._lastTimeUpdate={current:0,total:0,firstFragDateTime:0},this._lastTimeUpdateFiredTime=0,this._lastDuration=null,this._playableRegionStartTime=0,this._localStartTimeCorrelation=null,this._localEndTimeCorrelation=null,this._playableRegionDuration=0,this._programDateTime=0,this._durationExcludesAfterLiveSyncPoint=!1,this._segmentTargetDuration=null,this._playlistType=null,this._recoverAttemptsRemaining=this.options.hlsRecoverAttempts||16}_setup(){this._destroyHLSInstance(),this._createHLSInstance(),this._listenHLSEvents(),this._attachHLSMedia()}_destroyHLSInstance(){this._hls&&(this._manifestLoading=!1,this._ccIsSetup=!1,this._ccTracksUpdated=!1,this._setInitialState(),this._hls.destroy(),this._hls=null)}_createHLSInstance(){const t={...this.options.playback.hlsjsConfig};this._hls=new e(t)}_attachHLSMedia(){this._hls&&this._hls.attachMedia(this.el)}_listenHLSEvents(){this._hls&&(this._hls.once(e.Events.MEDIA_ATTACHED,(()=>{this.options.hlsPlayback.preload&&this._hls.loadSource(this.options.src)})),this._hls.on(e.Events.MANIFEST_LOADING,(()=>{this._manifestLoading=!0})),this._hls.on(e.Events.LEVEL_LOADED,((t,e)=>this._updatePlaybackType(t,e))),this._hls.on(e.Events.LEVEL_UPDATED,((t,e)=>this._onLevelUpdated(t,e))),this._hls.on(e.Events.LEVEL_SWITCHED,((t,e)=>this._onLevelSwitch(t,e))),this._hls.on(e.Events.FRAG_CHANGED,((t,e)=>this._onFragmentChanged(t,e))),this._hls.on(e.Events.FRAG_LOADED,((t,e)=>this._onFragmentLoaded(t,e))),this._hls.on(e.Events.FRAG_BUFFERED,((t,e)=>this._onFragmentBuffered(t,e))),this._hls.on(e.Events.FRAG_PARSING_METADATA,((t,e)=>this._onFragmentParsingMetadata(t,e))),this._hls.on(e.Events.ERROR,((t,e)=>this._onHLSJSError(t,e))),this._hls.on(e.Events.SUBTITLE_TRACK_LOADED,((t,e)=>this._onSubtitleLoaded(t,e))),this._hls.on(e.Events.SUBTITLE_TRACKS_UPDATED,(()=>this._ccTracksUpdated=!0)),this.bindCustomListeners())}bindCustomListeners(){this.customListeners.forEach((t=>{const e=t.eventName,i=t.once?"once":"on";e&&this._hls[`${i}`](e,t.callback)}))}unbindCustomListeners(){this.customListeners.forEach((t=>{const e=t.eventName;e&&this._hls.off(e,t.callback)}))}_onFragmentParsingMetadata(e,i){this.trigger(t.Events.Custom.PLAYBACK_FRAGMENT_PARSING_METADATA,{evt:e,data:i})}render(){return this._ready(),super.render()}_ready(){this._isReadyState||(!this._hls&&this._setup(),this._isReadyState=!0,this.trigger(t.Events.PLAYBACK_READY,this.name))}_recover(e,i,s){if(this._recoveredDecodingError)if(this._recoveredAudioCodecError){t.Log.error("hlsjs: failed to recover",{evt:e,data:i}),s.level=t.PlayerError.Levels.FATAL;const r=this.createError(s);this.trigger(t.Events.PLAYBACK_ERROR,r),this.stop()}else this._recoveredAudioCodecError=!0,this._hls.swapAudioCodec(),this._hls.recoverMediaError(),this.play();else this._recoveredDecodingError=!0,this._hls.recoverMediaError(),this.play()}_setupSrc(t){}_startTimeUpdateTimer(){this._timeUpdateTimer||(this._timeUpdateTimer=setInterval((()=>{this._onDurationChange(),this._onTimeUpdate()}),100))}_stopTimeUpdateTimer(){this._timeUpdateTimer&&(clearInterval(this._timeUpdateTimer),this._timeUpdateTimer=null)}getProgramDateTime(){return this._programDateTime}getDuration(){return this._duration}getFrameRate(){if(this._hls&&this._hls.levels&&this._hls.currentLevel>=0){const t=this._hls.levels[this._hls.currentLevel];return t&&t.frameRate?t.frameRate:null}return null}getCurrentTime(){return Math.max(0,this.el.currentTime-this._startTime)}getStartTimeOffset(){return this._startTime}seekPercentage(t){const e=t>0?this._duration*(t/100):this._duration;this.seek(e)}seek(e){e<0&&(t.Log.warn("Attempt to seek to a negative time. Resetting to live point. Use seekToLivePoint() to seek to the live point."),e=this.getDuration()),e+=this._startTime,this.el.currentTime=e}seekToLivePoint(){this.seek(this.getDuration())}_updateSettings(){this._playbackType===t.Playback.VOD?this.settings.left=["playpause","position","duration"]:this.dvrEnabled?this.settings.left=["playpause"]:this.settings.left=["playstop"],this.settings.seekEnabled=this.isSeekEnabled(),this.trigger(t.Events.PLAYBACK_SETTINGSUPDATE)}_onHLSJSError(i,s){const r={code:`${s.type}_${s.details}`,description:`${this.name} error: type: ${s.type}, details: ${s.details}`,raw:s};let a;if(s.response&&(r.description+=`, response: ${JSON.stringify(s.response)}`),s.fatal)if(this._recoverAttemptsRemaining>0)switch(this._recoverAttemptsRemaining-=1,s.type){case e.ErrorTypes.NETWORK_ERROR:switch(s.details){case e.ErrorDetails.MANIFEST_LOAD_ERROR:case e.ErrorDetails.MANIFEST_LOAD_TIMEOUT:case e.ErrorDetails.MANIFEST_PARSING_ERROR:case e.ErrorDetails.LEVEL_LOAD_ERROR:case e.ErrorDetails.LEVEL_LOAD_TIMEOUT:t.Log.error("hlsjs: unrecoverable network fatal error.",{evt:i,data:s}),a=this.createError(r),this.trigger(t.Events.PLAYBACK_ERROR,a),this.stop();break;default:t.Log.warn("hlsjs: trying to recover from network error.",{evt:i,data:s}),r.level=t.PlayerError.Levels.WARN,this._hls.startLoad()}break;case e.ErrorTypes.MEDIA_ERROR:t.Log.warn("hlsjs: trying to recover from media error.",{evt:i,data:s}),r.level=t.PlayerError.Levels.WARN,this._recover(i,s,r);break;default:t.Log.error("hlsjs: could not recover from error.",{evt:i,data:s}),a=this.createError(r),this.trigger(t.Events.PLAYBACK_ERROR,a),this.stop()}else t.Log.error("hlsjs: could not recover from error after maximum number of attempts.",{evt:i,data:s}),a=this.createError(r),this.trigger(t.Events.PLAYBACK_ERROR,a),this.stop();else{if(this.options.playback.triggerFatalErrorOnResourceDenied&&this._keyIsDenied(s))return t.Log.error("hlsjs: could not load decrypt key.",{evt:i,data:s}),a=this.createError(r),this.trigger(t.Events.PLAYBACK_ERROR,a),void this.stop();r.level=t.PlayerError.Levels.WARN,t.Log.warn("hlsjs: non-fatal error occurred",{evt:i,data:s})}}_keyIsDenied(t){return t.type===e.ErrorTypes.NETWORK_ERROR&&t.details===e.ErrorDetails.KEY_LOAD_ERROR&&t.response&&t.response.code>=400}_onTimeUpdate(){const e={current:this.getCurrentTime(),total:this.getDuration(),firstFragDateTime:this.getProgramDateTime()};this._shouldThrottleTimeUpdate(e)||(this._lastTimeUpdate=e,this._lastTimeUpdateFiredTime=this._now,this.trigger(t.Events.PLAYBACK_TIMEUPDATE,e,this.name))}_shouldThrottleTimeUpdate(t){const e=Math.abs(t.current-this._lastTimeUpdate.current)<this._timeUpdateFiringRate,i=Math.abs(t.total-this._lastTimeUpdate.total)<this._durationChangeMinOffset,s=t.firstFragDateTime===this._lastTimeUpdate.firstFragDateTime,r=e&&i&&s,a=this._now-this._lastTimeUpdateFiredTime<this._timeUpdateThrottleDelay;return r&&a}_onDurationChange(){const t=this.getDuration();Math.abs(this._lastDuration-t)<this._durationChangeMinOffset||(this._lastDuration=t,super._onDurationChange())}_onProgress(){if(!this.el.buffered.length)return;let e=[],i=0;for(let t=0;t<this.el.buffered.length;t++)e=[...e,{start:Math.max(0,this.el.buffered.start(t)-this._playableRegionStartTime),end:Math.max(0,this.el.buffered.end(t)-this._playableRegionStartTime)}],this.el.currentTime>=e[t].start&&this.el.currentTime<=e[t].end&&(i=t);const s={start:e[i].start,current:e[i].end,total:this.getDuration()};this.trigger(t.Events.PLAYBACK_PROGRESS,s,e)}load(t){this._stopTimeUpdateTimer(),this.options.src=t,this._setup()}play(){!this._hls&&this._setup(),!this._manifestLoading&&!this.options.hlsPlayback.preload&&this._hls.loadSource(this.options.src),super.play(),this._startTimeUpdateTimer()}pause(){this._hls&&this.el.pause()}stop(){this._stopTimeUpdateTimer(),this._hls&&super.stop(),this._destroyHLSInstance()}destroy(){this._stopTimeUpdateTimer(),this._destroyHLSInstance(),super.destroy()}_updatePlaybackType(e,i){this._playbackType=i.details.live?t.Playback.LIVE:t.Playback.VOD,this._onLevelUpdated(e,i),this._ccTracksUpdated&&this._playbackType===t.Playback.LIVE&&this.hasClosedCaptionsTracks&&this._onSubtitleLoaded()}_fillLevels(){this._levels=this._hls.levels.map(((t,e)=>({id:e,level:t,label:t.bitrate/1e3+"Kbps"}))),this.trigger(t.Events.PLAYBACK_LEVELS_AVAILABLE,this._levels)}_onLevelUpdated(i,s){this._segmentTargetDuration=s.details.targetduration,this._playlistType=s.details.type||null;let r=!1,a=!1;const n=s.details.fragments,o=this._playableRegionStartTime,l=this._playableRegionDuration;if(0===n.length)return;if(n[0].rawProgramDateTime&&(this._programDateTime=n[0].rawProgramDateTime),this._playableRegionStartTime!==n[0].start&&(r=!0,this._playableRegionStartTime=n[0].start),r)if(this._localStartTimeCorrelation){const t=this._localStartTimeCorrelation,e=this._now-t.local,i=(t.remote+e)/1e3;i<n[0].start?this._localStartTimeCorrelation={local:this._now,remote:1e3*n[0].start}:i>o+this._extrapolatedWindowDuration&&(this._localStartTimeCorrelation={local:this._now,remote:1e3*Math.max(n[0].start,o+this._extrapolatedWindowDuration)})}else this._localStartTimeCorrelation={local:this._now,remote:1e3*(n[0].start+this._extrapolatedWindowDuration/2)};let h=s.details.totalduration;if(this._playbackType===t.Playback.LIVE){const t=s.details.targetduration*((this.options.playback.hlsjsConfig||{}).liveSyncDurationCount||e.DefaultConfig.liveSyncDurationCount);t<=h?(h-=t,this._durationExcludesAfterLiveSyncPoint=!0):this._durationExcludesAfterLiveSyncPoint=!1}h!==this._playableRegionDuration&&(a=!0,this._playableRegionDuration=h);const _=n[0].start+h,d=o+l;if(_!==d)if(this._localEndTimeCorrelation){const t=this._localEndTimeCorrelation,e=this._now-t.local,i=(t.remote+e)/1e3;i>_?this._localEndTimeCorrelation={local:this._now,remote:1e3*_}:i<_-this._extrapolatedWindowDuration?this._localEndTimeCorrelation={local:this._now,remote:1e3*(_-this._extrapolatedWindowDuration)}:i>d&&(this._localEndTimeCorrelation={local:this._now,remote:1e3*d})}else this._localEndTimeCorrelation={local:this._now,remote:1e3*_};a&&this._onDurationChange(),r&&this._onProgress()}_onFragmentChanged(e,i){this._currentFragment=i.frag,this.trigger(t.Events.Custom.PLAYBACK_FRAGMENT_CHANGED,i)}_onFragmentLoaded(e,i){this.trigger(t.Events.PLAYBACK_FRAGMENT_LOADED,i)}_onFragmentBuffered(e,i){this.trigger(t.Events.PLAYBACK_FRAGMENT_BUFFERED,i)}_onSubtitleLoaded(){if(!this._ccIsSetup){this.trigger(t.Events.PLAYBACK_SUBTITLE_AVAILABLE);const e=this._playbackType===t.Playback.LIVE?-1:this.closedCaptionsTrackId;this.closedCaptionsTrackId=e,this._ccIsSetup=!0}}_onLevelSwitch(e,i){this.levels.length||this._fillLevels(),this.trigger(t.Events.PLAYBACK_LEVEL_SWITCH_END),this.trigger(t.Events.PLAYBACK_LEVEL_SWITCH,i);const s=this._hls.levels[i.level];s&&(this.highDefinition=s.height>=720||s.bitrate/1e3>=2e3,this.trigger(t.Events.PLAYBACK_HIGHDEFINITIONUPDATE,this.highDefinition),this.trigger(t.Events.PLAYBACK_BITRATE,{height:s.height,width:s.width,bandwidth:s.bitrate,bitrate:s.bitrate,level:i.level}))}get dvrEnabled(){return this._durationExcludesAfterLiveSyncPoint&&this._duration>=this._minDvrSize&&this.getPlaybackType()===t.Playback.LIVE}getPlaybackType(){return this._playbackType}isSeekEnabled(){return this._playbackType===t.Playback.VOD||this.dvrEnabled}}return r.canPlay=function(t,i){const r=t.split("?")[0].match(/.*\.(.*)$/)||[],a=r.length>1&&"m3u8"===r[1].toLowerCase()||s(i,["application/vnd.apple.mpegurl","application/x-mpegURL"]);return!(!e.isSupported()||!a)},r}(Clappr,Hls);
2
2
  //# sourceMappingURL=hlsjs-playback.external.min.js.map
@@ -36723,7 +36723,7 @@ Schedule: ${scheduleItems.map(seg => segmentToString(seg))} pos: ${this.timeline
36723
36723
  }
36724
36724
  get supportedVersion() {
36725
36725
  return {
36726
- min: "0.14.7"
36726
+ min: "0.14.8"
36727
36727
  };
36728
36728
  }
36729
36729
  get levels() {