return an object in beforesetup hooks")})) var a=Bs.getComponent("Player") n=new a(r,t,i) xr("setup").forEach((function(e){return e(n)})) return n}ql.hooks_=Pr ql.hooks=xr ql.hook=function(e,t){xr(e,t)} ql.hookOnce=function(e,t){xr(e,[].concat(t).map((function(t){return function i(){Ar(e,i) return t.apply(void 0,arguments)}})))} ql.removeHook=Ar if(!0!==x.VIDEOJS_NO_DYNAMIC_STYLE&&ga()){var Wl=Wa(".vjs-styles-defaults") if(!Wl){Wl=Ja("vjs-styles-defaults") var Gl=Wa("head") Gl&&Gl.insertBefore(Wl,Gl.firstChild) Za(Wl,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid {\n padding-top: 56.25%\n }\n ")}}Ya(1,ql) ql.VERSION=Ir ql.options=Ol.prototype.options_ ql.getPlayers=function(){return Ol.players} ql.getPlayer=function(e){var t,i=Ol.players if("string"==typeof e){var n=Hl(e),r=i[n] if(r)return r t=Wa("#"+n)}else t=e if(va(t)){var a=t,s=a.player,o=a.playerId if(s||i[o])return s||i[o]}} ql.getAllPlayers=function(){return Object.keys(Ol.players).map((function(e){return Ol.players[e]})).filter(Boolean)} ql.players=Ol.players ql.getComponent=Bs.getComponent ql.registerComponent=function(e,t){Io.isTech(t)&&Ur.warn("The "+e+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)") Bs.registerComponent.call(Bs,e,t)} ql.getTech=Io.getTech ql.registerTech=Io.registerTech ql.use=function(e,t){Po[e]=Po[e]||[] Po[e].push(t)} Object.defineProperty(ql,"middleware",{value:{},writeable:!1,enumerable:!0}) Object.defineProperty(ql.middleware,"TERMINATOR",{value:Ao,writeable:!1,enumerable:!0}) ql.browser=pa ql.TOUCH_ENABLED=ua ql.extend=function(e,t){void 0===t&&(t={}) var i=function(){e.apply(this,arguments)},n={} if("object"==typeof t){t.constructor!==Object.prototype.constructor&&(i=t.constructor) n=t}else"function"==typeof t&&(i=t) Pe(i,e) e&&(i.super_=e) for(var r in n)n.hasOwnProperty(r)&&(i.prototype[r]=n[r]) return i} ql.mergeOptions=Ds ql.bind=gs ql.registerPlugin=Vl.registerPlugin ql.deregisterPlugin=Vl.deregisterPlugin ql.plugin=function(e,t){Ur.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead") return Vl.registerPlugin(e,t)} ql.getPlugins=Vl.getPlugins ql.getPlugin=Vl.getPlugin ql.getPluginVersion=Vl.getPluginVersion ql.addLanguage=function(e,t){var i e=(""+e).toLowerCase() ql.options.languages=Ds(ql.options.languages,((i={})[e]=t,i)) return ql.options.languages[e]} ql.log=Ur ql.createLogger=Br ql.createTimeRange=ql.createTimeRanges=Vs ql.formatTime=nu ql.setFormatTime=function(e){iu=e} ql.resetFormatTime=function(){iu=tu} ql.parseUrl=po ql.isCrossOrigin=go ql.EventTarget=ys ql.on=us ql.one=ds ql.off=ls ql.trigger=cs ql.xhr=W ql.TextTrack=bo ql.AudioTrack=To ql.VideoTrack=ko;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach((function(e){ql[e]=function(){Ur.warn("videojs."+e+"() is deprecated; use videojs.dom."+e+"() instead") return za[e].apply(null,arguments)}})) ql.computedStyle=Gr ql.dom=za ql.url=vo ql.defineLazyProperty=El ql.addLanguage("en",{"Non-Fullscreen":"Exit Fullscreen"}) ;/*! @name @videojs/http-streaming @version 2.14.0 @license Apache-2.0 */var zl=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=x.location&&x.location.href||"") var i="function"==typeof x.URL,n=/^\/\//.test(e),r=!x.location&&!/\/\//i.test(e) i?e=new x.URL(e,x.location||Ae):/\/\//i.test(e)||(e=xe.buildAbsoluteURL(x.location&&x.location.href||"",e)) if(i){var a=new URL(t,e) return r?a.href.slice(18):n?a.href.slice(a.protocol.length):a.href}return xe.buildAbsoluteURL(e,t)},Kl=function(e,t,i){return e&&i&&i.responseURL&&t!==i.responseURL?i.responseURL:t},Xl=function(e){return ql.log.debug?ql.log.debug.bind(ql,"VHS:",e+" >"):function(){}},Yl=1/30,Ql=.1,$l=function(e,t){var i,n=[] if(e&&e.length)for(i=0;i=t}))},Zl=function(e,t){return $l(e,(function(e){return e-Yl>=t}))},ec=function(e){var t=[] if(!e||!e.length)return"" for(var i=0;i "+e.end(i)) return t.join(", ")},tc=function(e){for(var t=[],i=0;ia||(i+=t>r&&t<=a?a-t:a-r)}return i},rc=ql.createTimeRange,ac=function(e,t){if(!t.preload)return t.duration var i=0;(t.parts||[]).forEach((function(e){i+=e.duration}));(t.preloadHints||[]).forEach((function(t){"PART"===t.type&&(i+=e.partTargetDuration)})) return i},sc=function(e){return(e.segments||[]).reduce((function(e,t,i){t.parts?t.parts.forEach((function(n,r){e.push({duration:n.duration,segmentIndex:i,partIndex:r,part:n,segment:t})})):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}) return e}),[])},oc=function(e){var t=e.segments&&e.segments.length&&e.segments[e.segments.length-1] return t&&t.parts||[]},uc=function(e){var t=e.preloadSegment if(t){var i=t.parts,n=(t.preloadHints||[]).reduce((function(e,t){return e+("PART"===t.type?1:0)}),0) return n+=i&&i.length?i.length:0}},lc=function(e,t){if(t.endList)return 0 if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay var i=oc(t).length>0 return i&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:i&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},cc=function(e,t,i){void 0===t&&(t=e.mediaSequence+e.segments.length) if(tr){var s=[r,n] n=s[0] r=s[1]}if(n<0){for(var o=n;oDate.now()},mc=function(e){return e.excludeUntil&&e.excludeUntil===1/0},gc=function(e){var t=fc(e) return!e.disabled&&!t},vc=function(e,t){return t.attributes&&t.attributes[e]},yc=function(e,t){if(1===e.playlists.length)return!0 var i=t.attributes.BANDWIDTH||Number.MAX_VALUE return 0===e.playlists.filter((function(e){return!!gc(e)&&(e.attributes.BANDWIDTH||0)0)for(var h=l-1;h>=0;h--){var p=u[h] o+=p.duration if(s){if(o<0)continue}else if(o+Yl<=0)continue return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:a-hc({defaultDuration:t.targetDuration,durationList:u,startIndex:l,endIndex:h})}}return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:i}}if(l<0){for(var f=l;f<0;f++)if((o-=t.targetDuration)<0)return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:i} l=0}for(var m=l;m0)continue}else if(o-Yl>=0)continue return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:a+hc({defaultDuration:t.targetDuration,durationList:u,startIndex:l,endIndex:m})}}return{segmentIndex:u[u.length-1].segmentIndex,partIndex:u[u.length-1].partIndex,startTime:i}},isEnabled:gc,isDisabled:function(e){return e.disabled},isBlacklisted:fc,isIncompatible:mc,playlistEnd:pc,isAes:function(e){for(var t=0;t-1&&s!==a.length-1&&(i._HLS_part=s);(s>-1||a.length)&&r--}i._HLS_msn=r}t.serverControl&&t.serverControl.canSkipUntil&&(i._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES") if(Object.keys(i).length){var o=new x.URL(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach((function(e){i.hasOwnProperty(e)&&o.searchParams.set(e,i[e])})) e=o.toString()}return e}(i,t)) this.state="HAVE_CURRENT_METADATA" this.request=this.vhs_.xhr({uri:i,withCredentials:this.withCredentials},(function(t,i){if(e.request){if(t)return e.playlistRequestError(e.request,e.media(),"HAVE_METADATA") e.haveMetadata({playlistString:e.request.responseText,url:e.media().uri,id:e.media().id})}}))}} i.playlistRequestError=function(e,t,i){var n=t.uri,r=t.id this.request=null i&&(this.state=i) this.error={playlist:this.master.playlists[r],status:e.status,message:"HLS playlist request error at URL: "+n+".",responseText:e.responseText,code:e.status>=500?4:2} this.trigger("error")} i.parseManifest_=function(e){var t=this,i=e.url return function(e){var t=e.onwarn,i=e.oninfo,n=e.manifestString,r=e.customTagParsers,a=void 0===r?[]:r,s=e.customTagMappers,o=void 0===s?[]:s,u=e.experimentalLLHLS,l=new je t&&l.on("warn",t) i&&l.on("info",i) a.forEach((function(e){return l.addParser(e)})) o.forEach((function(e){return l.addTagMapper(e)})) l.push(n) l.end() var c=l.manifest if(!u){["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach((function(e){c.hasOwnProperty(e)&&delete c[e]})) c.segments&&c.segments.forEach((function(e){["parts","preloadHints"].forEach((function(t){e.hasOwnProperty(t)&&delete e[t]}))}))}if(!c.targetDuration){var d=10 c.segments&&c.segments.length&&(d=c.segments.reduce((function(e,t){return Math.max(e,t.duration)}),0)) t&&t("manifest has no targetDuration defaulting to "+d) c.targetDuration=d}var h=oc(c) if(h.length&&!c.partTargetDuration){var p=h.reduce((function(e,t){return Math.max(e,t.duration)}),0) if(t){t("manifest has no partTargetDuration defaulting to "+p) Sc.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")}c.partTargetDuration=p}return c}({onwarn:function(e){var n=e.message return t.logger_("m3u8-parser warn for "+i+": "+n)},oninfo:function(e){var n=e.message return t.logger_("m3u8-parser info for "+i+": "+n)},manifestString:e.manifestString,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,experimentalLLHLS:this.experimentalLLHLS})} i.haveMetadata=function(e){var t=e.playlistString,i=e.playlistObject,n=e.url,r=e.id this.request=null this.state="HAVE_METADATA" var a=i||this.parseManifest_({url:n,manifestString:t}) a.lastRequest=Date.now() wc({playlist:a,uri:n,id:r}) var s=Rc(this.master,a) this.targetDuration=a.partTargetDuration||a.targetDuration this.pendingMedia_=null if(s){this.master=s this.media_=this.master.playlists[r]}else this.trigger("playlistunchanged") this.updateMediaUpdateTimeout_(Mc(this.media(),!!s)) this.trigger("loadedplaylist")} i.dispose=function(){this.trigger("dispose") this.stopRequest() x.clearTimeout(this.mediaUpdateTimeout) x.clearTimeout(this.finalRenditionTimeout) this.off()} i.stopRequest=function(){if(this.request){var e=this.request this.request=null e.onreadystatechange=null e.abort()}} i.media=function(e,t){var i=this if(!e)return this.media_ if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state) if("string"==typeof e){if(!this.master.playlists[e])throw new Error("Unknown playlist URI: "+e) e=this.master.playlists[e]}x.clearTimeout(this.finalRenditionTimeout) if(t){var n=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3 this.finalRenditionTimeout=x.setTimeout(this.media.bind(this,e,!1),n)}else{var r=this.state,a=!this.media_||e.id!==this.media_.id,s=this.master.playlists[e.id] if(s&&s.endList||e.endList&&e.segments.length){if(this.request){this.request.onreadystatechange=null this.request.abort() this.request=null}this.state="HAVE_METADATA" this.media_=e if(a){this.trigger("mediachanging") "HAVE_MASTER"===r?this.trigger("loadedmetadata"):this.trigger("mediachange")}}else{this.updateMediaUpdateTimeout_(Mc(e,!0)) if(a){this.state="SWITCHING_MEDIA" if(this.request){if(e.resolvedUri===this.request.url)return this.request.onreadystatechange=null this.request.abort() this.request=null}this.media_&&this.trigger("mediachanging") this.pendingMedia_=e this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials},(function(t,n){if(i.request){e.lastRequest=Date.now() e.resolvedUri=Kl(i.handleManifestRedirects,e.resolvedUri,n) if(t)return i.playlistRequestError(i.request,e,r) i.haveMetadata({playlistString:n.responseText,url:e.uri,id:e.id}) "HAVE_MASTER"===r?i.trigger("loadedmetadata"):i.trigger("mediachange")}}))}}}} i.pause=function(){if(this.mediaUpdateTimeout){x.clearTimeout(this.mediaUpdateTimeout) this.mediaUpdateTimeout=null}this.stopRequest() "HAVE_NOTHING"===this.state&&(this.started=!1) "SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MASTER":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")} i.load=function(e){var t=this if(this.mediaUpdateTimeout){x.clearTimeout(this.mediaUpdateTimeout) this.mediaUpdateTimeout=null}var i=this.media() if(e){var n=i?(i.partTargetDuration||i.targetDuration)/2*1e3:5e3 this.mediaUpdateTimeout=x.setTimeout((function(){t.mediaUpdateTimeout=null t.load()}),n)}else this.started?i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()} i.updateMediaUpdateTimeout_=function(e){var t=this if(this.mediaUpdateTimeout){x.clearTimeout(this.mediaUpdateTimeout) this.mediaUpdateTimeout=null}this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=x.setTimeout((function(){t.mediaUpdateTimeout=null t.trigger("mediaupdatetimeout") t.updateMediaUpdateTimeout_(e)}),e))} i.start=function(){var e=this this.started=!0 if("object"!=typeof this.src)this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},(function(t,i){if(e.request){e.request=null if(t){e.error={status:i.status,message:"HLS playlist request error at URL: "+e.src+".",responseText:i.responseText,code:2} "HAVE_NOTHING"===e.state&&(e.started=!1) return e.trigger("error")}e.src=Kl(e.handleManifestRedirects,e.src,i) var n=e.parseManifest_({manifestString:i.responseText,url:e.src}) e.setupInitialPlaylist(n)}})) else{this.src.uri||(this.src.uri=x.location.href) this.src.resolvedUri=this.src.uri setTimeout((function(){e.setupInitialPlaylist(e.src)}),0)}} i.srcUri=function(){return"string"==typeof this.src?this.src:this.src.uri} i.setupInitialPlaylist=function(e){this.state="HAVE_MASTER" if(e.playlists){this.master=e Ic(this.master,this.srcUri()) e.playlists.forEach((function(e){e.segments=Lc(e) e.segments.forEach((function(t){Oc(t,e.resolvedUri)}))})) this.trigger("loadedplaylist") this.request||this.media(this.master.playlists[0])}else{var t=this.srcUri()||x.location.href this.master=function(e,t){var i=Ec(0,t),n={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:x.location.href,resolvedUri:x.location.href,playlists:[{uri:t,id:i,resolvedUri:t,attributes:{}}]} n.playlists[i]=n.playlists[0] n.playlists[t]=n.playlists[0] return n}(0,t) this.haveMetadata({playlistObject:e,url:t,id:this.master.playlists[0].id}) this.trigger("loadedmetadata")}} return t}(xc),Uc=ql.xhr,Bc=ql.mergeOptions,Fc=function(e,t,i,n){var r="arraybuffer"===e.responseType?e.response:e.responseText if(!t&&r){e.responseTime=Date.now() e.roundTripTime=e.responseTime-e.requestTime e.bytesReceived=r.byteLength||r.length e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))}i.headers&&(e.responseHeaders=i.headers) t&&"ETIMEDOUT"===t.code&&(e.timedout=!0) t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode||(t=new Error("XHR Failed with a response of: "+(e&&(r||e.responseText)))) n(t,e)},jc=function(){var e=function e(t,i){t=Bc({timeout:45e3},t) var n=e.beforeRequest||ql.Vhs.xhr.beforeRequest if(n&&"function"==typeof n){var r=n(t) r&&(t=r)}var a=(!0===ql.Vhs.xhr.original?Uc:ql.Vhs.xhr)(t,(function(e,t){return Fc(a,e,t,i)})),s=a.abort a.abort=function(){a.aborted=!0 return s.apply(a,arguments)} a.uri=t.uri a.requestTime=Date.now() return a} e.original=!0 return e},Vc=function(e){var t,i={} e.byterange&&(i.Range="bytes="+(t=e.byterange).offset+"-"+("bigint"==typeof t.offset||"bigint"==typeof t.length?x.BigInt(t.offset)+x.BigInt(t.length)-x.BigInt(1):t.offset+t.length-1)) return i},Hc=function(e,t){return e.start(t)+"-"+e.end(t)},qc=function(e,t){var i=e.toString(16) return"00".substring(0,2-i.length)+i+(t%2?" ":"")},Wc=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},Gc=function(e){var t={} Object.keys(e).forEach((function(i){var n=e[i] ArrayBuffer.isView(n)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n})) return t},zc=function(e){var t=e.byterange||{length:1/0,offset:0} return[t.length,t.offset,e.resolvedUri].join(",")},Kc=function(e){return e.resolvedUri},Xc=function(e){for(var t=Array.prototype.slice.call(e),i=16,n="",r=0;rn){if(e>n+.25*a.duration)return null i=a}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:n-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}}(n,t) if(!a)return r({message:"valid programTime was not found"}) if("estimate"===a.type)return r({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:a.estimatedStart}) var s={mediaSeconds:n},o=function(e,t){if(!t.dateTimeObject)return null var i=t.videoTimingInfo.transmuxerPrependedSeconds,n=e-(t.videoTimingInfo.transmuxedPresentationStart+i) return new Date(t.dateTimeObject.getTime()+1e3*n)}(n,a.segment) o&&(s.programDateTime=o.toISOString()) return r(null,s)},$c=function e(t){var i=t.programTime,n=t.playlist,r=t.retryCount,a=void 0===r?2:r,s=t.seekTo,o=t.pauseAfterSeek,u=void 0===o||o,l=t.tech,c=t.callback if(!c)throw new Error("seekToProgramTime: callback must be provided") if(void 0===i||!n||!s)return c({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"}) if(!n.endList&&!l.hasStarted_)return c({message:"player must be playing a live stream to start buffering"}) if(!function(e){if(!e.segments||0===e.segments.length)return!1 for(var t=0;tnew Date(o.getTime()+1e3*u))return null i>o&&(n=s) return{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:kc.duration(t,t.mediaSequence+t.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"}}(i,n) if(!d)return c({message:i+" was not found in the stream"}) var h=d.segment,p=function(e,t){var i,n try{i=new Date(e) n=new Date(t)}catch(e){}var r=i.getTime() return(n.getTime()-r)/1e3}(h.dateTimeObject,i) if("estimate"!==d.type){var f=h.start+p l.one("seeked",(function(){return c(null,l.currentTime())})) u&&l.pause() s(f)}else{if(0===a)return c({message:i+" is not buffered yet. Try again"}) s(d.estimatedStart+p) l.one("seeked",(function(){e({programTime:i,playlist:n,retryCount:a-1,seekTo:s,pauseAfterSeek:u,tech:l,callback:c})}))}},Jc=function(e,t){if(4===e.readyState)return t()},Zc=function(e,t,i){var n,r=[],a=!1,s=function(e,t,n,r){t.abort() a=!0 return i(e,t,n,r)},o=function(e,t){if(!a){if(e)return s(e,t,"",r) var i=t.responseText.substring(r&&r.byteLength||0,t.responseText.length) r=function(){for(var e=arguments.length,t=new Array(e),i=0;i=c+l)return s(t,{response:o.subarray(l,l+c),status:i.status,uri:i.uri}) n.request=n.vhs_.xhr({uri:a,responseType:"arraybuffer",headers:Vc({byterange:e.sidx.byterange})},s)}))}else this.mediaRequest_=x.setTimeout((function(){return i(!1)}),0)} i.dispose=function(){this.trigger("dispose") this.stopRequest() this.loadedPlaylists_={} x.clearTimeout(this.minimumUpdatePeriodTimeout_) x.clearTimeout(this.mediaRequest_) x.clearTimeout(this.mediaUpdateTimeout) this.mediaUpdateTimeout=null this.mediaRequest_=null this.minimumUpdatePeriodTimeout_=null if(this.masterPlaylistLoader_.createMupOnMedia_){this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_) this.masterPlaylistLoader_.createMupOnMedia_=null}this.off()} i.hasPendingRequest=function(){return this.request||this.mediaRequest_} i.stopRequest=function(){if(this.request){var e=this.request this.request=null e.onreadystatechange=null e.abort()}} i.media=function(e){var t=this if(!e)return this.media_ if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state) var i=this.state if("string"==typeof e){if(!this.masterPlaylistLoader_.master.playlists[e])throw new Error("Unknown playlist URI: "+e) e=this.masterPlaylistLoader_.master.playlists[e]}var n=!this.media_||e.id!==this.media_.id if(n&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA" this.media_=e if(n){this.trigger("mediachanging") this.trigger("mediachange")}}else if(n){this.media_&&this.trigger("mediachanging") this.addSidxSegments_(e,i,(function(n){t.haveMetadata({startingState:i,playlist:e})}))}} i.haveMetadata=function(e){var t=e.startingState,i=e.playlist this.state="HAVE_METADATA" this.loadedPlaylists_[i.id]=i this.mediaRequest_=null this.refreshMedia_(i.id) "HAVE_MASTER"===t?this.trigger("loadedmetadata"):this.trigger("mediachange")} i.pause=function(){if(this.masterPlaylistLoader_.createMupOnMedia_){this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_) this.masterPlaylistLoader_.createMupOnMedia_=null}this.stopRequest() x.clearTimeout(this.mediaUpdateTimeout) this.mediaUpdateTimeout=null if(this.isMaster_){x.clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_) this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_=null}"HAVE_NOTHING"===this.state&&(this.started=!1)} i.load=function(e){var t=this x.clearTimeout(this.mediaUpdateTimeout) this.mediaUpdateTimeout=null var i=this.media() if(e){var n=i?i.targetDuration/2*1e3:5e3 this.mediaUpdateTimeout=x.setTimeout((function(){return t.load()}),n)}else if(this.started)if(i&&!i.endList){if(this.isMaster_&&!this.minimumUpdatePeriodTimeout_){this.trigger("minimumUpdatePeriod") this.updateMinimumUpdatePeriodTimeout_()}this.trigger("mediaupdatetimeout")}else this.trigger("loadedplaylist") else this.start()} i.start=function(){var e=this this.started=!0 this.isMaster_?this.requestMaster_((function(t,i){e.haveMaster_() e.hasPendingRequest()||e.media_||e.media(e.masterPlaylistLoader_.master.playlists[0])})):this.mediaRequest_=x.setTimeout((function(){return e.haveMaster_()}),0)} i.requestMaster_=function(e){var t=this this.request=this.vhs_.xhr({uri:this.masterPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},(function(i,n){if(t.requestErrored_(i,n))"HAVE_NOTHING"===t.state&&(t.started=!1) else{var r=n.responseText!==t.masterPlaylistLoader_.masterXml_ t.masterPlaylistLoader_.masterXml_=n.responseText n.responseHeaders&&n.responseHeaders.date?t.masterLoaded_=Date.parse(n.responseHeaders.date):t.masterLoaded_=Date.now() t.masterPlaylistLoader_.srcUrl=Kl(t.handleManifestRedirects,t.masterPlaylistLoader_.srcUrl,n) if(!r)return e(n,r) t.handleMaster_() t.syncClientServerClock_((function(){return e(n,r)}))}}))} i.syncClientServerClock_=function(e){var t=this,i=Hn(this.masterPlaylistLoader_.masterXml_) if(null===i){this.masterPlaylistLoader_.clientOffset_=this.masterLoaded_-Date.now() return e()}if("DIRECT"===i.method){this.masterPlaylistLoader_.clientOffset_=i.value-Date.now() return e()}this.request=this.vhs_.xhr({uri:zl(this.masterPlaylistLoader_.srcUrl,i.value),method:i.method,withCredentials:this.withCredentials},(function(n,r){if(t.request){if(n){t.masterPlaylistLoader_.clientOffset_=t.masterLoaded_-Date.now() return e()}var a a="HEAD"===i.method?r.responseHeaders&&r.responseHeaders.date?Date.parse(r.responseHeaders.date):t.masterLoaded_:Date.parse(r.responseText) t.masterPlaylistLoader_.clientOffset_=a-Date.now() e()}}))} i.haveMaster_=function(){this.state="HAVE_MASTER" this.isMaster_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)} i.handleMaster_=function(){this.mediaRequest_=null var e=this.masterPlaylistLoader_.master,t=function(e){var t=e.masterXml,i=e.srcUrl,n=e.clientOffset,r=e.sidxMapping,a=e.previousManifest,s=Vn(t,{manifestUri:i,clientOffset:n,sidxMapping:r,previousManifest:a}) Ic(s,i) return s}({masterXml:this.masterPlaylistLoader_.masterXml_,srcUrl:this.masterPlaylistLoader_.srcUrl,clientOffset:this.masterPlaylistLoader_.clientOffset_,sidxMapping:this.masterPlaylistLoader_.sidxMapping_,previousManifest:e}) e&&(t=function(e,t,i){for(var n=!0,r=td(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts}),a=0;a-1} this.trigger=function(t){var i,n,r,a if(i=e[t])if(2===arguments.length){r=i.length for(n=0;n>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))} r=function(){return t(S.ftyp,E,C,E,w)} g=function(e){return t(S.hdlr,x[e])} a=function(e){return t(S.mdat,e)} m=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]) if(e.samplerate){i[12]=e.samplerate>>>24&255 i[13]=e.samplerate>>>16&255 i[14]=e.samplerate>>>8&255 i[15]=255&e.samplerate}return t(S.mdhd,i)} f=function(e){return t(S.mdia,m(e),g(e.type),o(e))} s=function(e){return t(S.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))} o=function(e){return t(S.minf,"video"===e.type?t(S.vmhd,A):t(S.smhd,O),i(),y(e))} u=function(e,i){for(var n=[],r=i.length;r--;)n[r]=b(i[r]) return t.apply(null,[S.moof,s(e)].concat(n))} l=function(e){for(var i=e.length,n=[];i--;)n[i]=h(e[i]) return t.apply(null,[S.moov,d(4294967295)].concat(n).concat(c(e)))} c=function(e){for(var i=e.length,n=[];i--;)n[i]=T(e[i]) return t.apply(null,[S.mvex].concat(n))} d=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]) return t(S.mvhd,i)} v=function(e){var i,n,r=e.samples||[],a=new Uint8Array(4+r.length) for(n=0;n>>8) s.push(255&r[i].byteLength) s=s.concat(Array.prototype.slice.call(r[i]))}for(i=0;i>>8) o.push(255&a[i].byteLength) o=o.concat(Array.prototype.slice.call(a[i]))}n=[S.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),t(S.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([r.length],s,[a.length],o))),t(S.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))] if(e.sarRatio){var u=e.sarRatio[0],l=e.sarRatio[1] n.push(t(S.pasp,new Uint8Array([(4278190080&u)>>24,(16711680&u)>>16,(65280&u)>>8,255&u,(4278190080&l)>>24,(16711680&l)>>16,(65280&l)>>8,255&l])))}return t.apply(null,n)} i=function(e){return t(S.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),n(e))}}() p=function(e){var i=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]) return t(S.tkhd,i)} b=function(e){var i,n,r,a,s,o i=t(S.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])) s=Math.floor(e.baseMediaDecodeTime/j) o=Math.floor(e.baseMediaDecodeTime%j) n=t(S.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o])) 0 if("audio"===e.type){r=k(e,92) return t(S.traf,i,n,r)}a=v(e) r=k(e,a.length+92) return t(S.traf,i,n,r,a)} h=function(e){e.duration=e.duration||4294967295 return t(S.trak,p(e),f(e))} T=function(e){var i=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]) "video"!==e.type&&(i[i.length-1]=0) return t(S.trex,i)} !function(){var e,i,n n=function(e,t){var i=0,n=0,r=0,a=0 if(e.length){void 0!==e[0].duration&&(i=1) void 0!==e[0].size&&(n=2) void 0!==e[0].flags&&(r=4) void 0!==e[0].compositionTimeOffset&&(a=8)}return[0,0,i|n|r|a,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]} i=function(e,i){var r,a,s,o,u,l i+=20+16*(o=e.samples||[]).length s=n(o,i);(a=new Uint8Array(s.length+16*o.length)).set(s) r=s.length for(l=0;l>>24 a[r++]=(16711680&u.duration)>>>16 a[r++]=(65280&u.duration)>>>8 a[r++]=255&u.duration a[r++]=(4278190080&u.size)>>>24 a[r++]=(16711680&u.size)>>>16 a[r++]=(65280&u.size)>>>8 a[r++]=255&u.size a[r++]=u.flags.isLeading<<2|u.flags.dependsOn a[r++]=u.flags.isDependedOn<<6|u.flags.hasRedundancy<<4|u.flags.paddingValue<<1|u.flags.isNonSyncSample a[r++]=61440&u.flags.degradationPriority a[r++]=15&u.flags.degradationPriority a[r++]=(4278190080&u.compositionTimeOffset)>>>24 a[r++]=(16711680&u.compositionTimeOffset)>>>16 a[r++]=(65280&u.compositionTimeOffset)>>>8 a[r++]=255&u.compositionTimeOffset}return t(S.trun,a)} e=function(e,i){var r,a,s,o,u,l i+=20+8*(o=e.samples||[]).length s=n(o,i);(r=new Uint8Array(s.length+8*o.length)).set(s) a=s.length for(l=0;l>>24 r[a++]=(16711680&u.duration)>>>16 r[a++]=(65280&u.duration)>>>8 r[a++]=255&u.duration r[a++]=(4278190080&u.size)>>>24 r[a++]=(16711680&u.size)>>>16 r[a++]=(65280&u.size)>>>8 r[a++]=255&u.size}return t(S.trun,r)} k=function(t,n){return"audio"===t.type?e(t,n):i(t,n)}}() var V,H,q,W,G,z,K,X,Y=a,Q=u,$=function(e){var t,i=r(),n=l(e);(t=new Uint8Array(i.byteLength+n.byteLength)).set(i) t.set(n,i.byteLength) return t},J=function(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}} i.dataOffset=t i.compositionTimeOffset=e.pts-e.dts i.duration=e.duration i.size=4*e.length i.size+=e.byteLength if(e.keyFrame){i.flags.dependsOn=2 i.flags.isNonSyncSample=0}return i},Z=function(e){var t,i,n=[],r=[] r.byteLength=0 r.nalCount=0 r.duration=0 n.byteLength=0 for(t=0;t1){t=e.shift() e.byteLength-=t.byteLength e.nalCount-=t.nalCount e[0][0].dts=t.dts e[0][0].pts=t.pts e[0][0].duration+=t.duration}return e},ie=function(e,t){var i,n,r,a,s,o=t||0,u=[] for(i=0;ile/2)){(s=oe()[e.samplerate])||(s=t[0].data) for(o=0;o=i)return e t.minSegmentDts=1/0 return e.filter((function(e){if(e.dts>=i){t.minSegmentDts=Math.min(t.minSegmentDts,e.dts) t.minSegmentPts=t.minSegmentDts return!0}return!1}))},ve=function(e){var t,i,n=[] for(t=0;t=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e) if(this.rows.length>0){this.rows.push("") this.rowIdx++}for(;this.rows.length>this.virtualRowCount;){this.rows.shift() this.rowIdx--}} Oe.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]} Oe.prototype.addText=function(e){this.rows[this.rowIdx]+=e} Oe.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx] this.rows[this.rowIdx]=e.substr(0,e.length-1)}} var Le=function(e,t,i){this.serviceNum=e this.text="" this.currentWindow=new Oe(-1) this.windows=[] this.stream=i "string"==typeof t&&this.createTextDecoder(t)} Le.prototype.init=function(e,t){this.startPts=e for(var i=0;i<8;i++){this.windows[i]=new Oe(i) "function"==typeof t&&(this.windows[i].beforeRowOverflow=t)}} Le.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]} Le.prototype.createTextDecoder=function(e){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"}) else try{this.textDecoder_=new TextDecoder(e)}catch(t){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+e+" encoding. "+t})}} var De=function e(t){t=t||{} e.prototype.init.call(this) var i,n=this,r=t.captionServices||{},a={} Object.keys(r).forEach((function(e){i=r[e];/^SERVICE/.test(e)&&(a[e]=i.encoding)})) this.serviceEncodings=a this.current708Packet=null this.services={} this.push=function(e){if(3===e.type){n.new708Packet() n.add708Bytes(e)}else{null===n.current708Packet&&n.new708Packet() n.add708Bytes(e)}}} De.prototype=new U De.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet() this.current708Packet={data:[],ptsVals:[]}} De.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,n=255&t this.current708Packet.ptsVals.push(e.pts) this.current708Packet.data.push(i) this.current708Packet.data.push(n)} De.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,i=null,n=null,r=0,a=t[r++] e.seq=a>>6 e.sizeCode=63&a for(;r>5)&&n>0&&(i=a=t[r++]) this.pushServiceBlock(i,r,n) n>0&&(r+=n-1)}} De.prototype.pushServiceBlock=function(e,t,i){var n,r=t,a=this.current708Packet.data,s=this.services[e] s||(s=this.initService(e,r)) for(;r