46 lines
619 KiB
JavaScript
46 lines
619 KiB
JavaScript
|
/**
|
||
|
* @license
|
||
|
* Video.js 8.10.0 <http://videojs.com/>
|
||
|
* Copyright Brightcove, Inc. <https://www.brightcove.com/>
|
||
|
* Available under Apache License Version 2.0
|
||
|
* <https://github.com/videojs/video.js/blob/main/LICENSE>
|
||
|
*
|
||
|
* Includes vtt.js <https://github.com/mozilla/vtt.js>
|
||
|
* Available under Apache License Version 2.0
|
||
|
* <https://github.com/mozilla/vtt.js/blob/main/LICENSE>
|
||
|
*/
|
||
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).videojs=t()}(this,function(){"use strict";var M="8.10.0";const U={},B=function(e,t){return U[e]=U[e]||[],t&&(U[e]=U[e].concat(t)),U[e]};function F(e,t){return!((t=B(e).indexOf(t))<=-1||(U[e]=U[e].slice(),U[e].splice(t,1),0))}const q={prefixed:!0};var j=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],H=j[0];let V;for(let e=0;e<j.length;e++)if(j[e][1]in document){V=j[e];break}if(V){for(let e=0;e<V.length;e++)q[H[e]]=V[e];q.prefixed=V[0]!==H[0]}let u=[];function $(e){return K(e)?Object.keys(e):[]}const l=function s(r,n=":",a=""){let t="info",i;function o(...e){i("log",t,e)}var l,d,h;return i=(l=r,d=o,h=a,(t,i,s)=>{var e,i=d.levels[i],r=new RegExp(`^(${i})$`);let n=l;if("log"!==t&&s.unshift(t.toUpperCase()+":"),h&&(n="%c"+l,s.unshift(h)),s.unshift(n+":"),u&&(u.push([].concat(s)),e=u.length-1e3,u.splice(0,0<e?e:0)),window.console){let e=window.console[t];(e=e||"debug"!==t?e:window.console.info||window.console.log)&&i&&r.test(t)&&e[Array.isArray(s)?"apply":"call"](window.console,s)}}),o.createLogger=(e,t,i)=>s(r+` ${t=void 0!==t?t:n} `+e,t,void 0!==i?i:a),o.createNewLogger=(e,t,i)=>s(e,t,i),o.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:t},o.level=e=>{if("string"==typeof e){if(!o.levels.hasOwnProperty(e))throw new Error(`"${e}" in not a valid log level`);t=e}return t},o.history=()=>u?[].concat(u):[],o.history.filter=t=>(u||[]).filter(e=>new RegExp(`.*${t}.*`).test(e[0])),o.history.clear=()=>{u&&(u.length=0)},o.history.disable=()=>{null!==u&&(u.length=0,u=null)},o.history.enable=()=>{null===u&&(u=[])},o.error=(...e)=>i("error",t,e),o.warn=(...e)=>i("warn",t,e),o.debug=(...e)=>i("debug",t,e),o}("VIDEOJS"),z=l.createLogger,W=Object.prototype.toString;function G(t,i){$(t).forEach(e=>i(t[e],e))}function X(i,s,e=0){return $(i).reduce((e,t)=>s(e,i[t],t),e)}function K(e){return!!e&&"object"==typeof e}function Y(e){return K(e)&&"[object Object]"===W.call(e)&&e.constructor===Object}function d(...e){const i={};return e.forEach(e=>{e&&G(e,(e,t)=>{Y(e)?(Y(i[t])||(i[t]={}),i[t]=d(i[t],e)):i[t]=e})}),i}function Q(e={}){var t,i=[];for(const s in e)e.hasOwnProperty(s)&&(t=e[s],i.push(t));return i}function J(t,i,s,e=!0){const r=e=>Object.defineProperty(t,i,{value:e,enumerable:!0,writable:!0});var n={configurable:!0,enumerable:!0,get(){var e=s();return r(e),e}};return e&&(n.set=r),Object.defineProperty(t,i,n)}var Z=Object.freeze({__proto__:null,each:G,reduce:X,isObject:K,isPlain:Y,merge:d,values:Q,defineLazyProperty:J});let ee=!1,te=null,ie=!1,se,re=!1,ne=!1,ae=!1,oe=!1,le=null,de=null,he=null,ue=!1,ce=!1,pe=!1,me=!1;const ge=Boolean(ve()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch));var fe,e=window.navigator&&window.navigator.userAgentData;if(e&&e.platform&&e.brands&&(ie="Android"===e.platform,ne=Boolean(e.brands.find(e=>"Microsoft Edge"===e.brand)),ae=Boolean(e.brands.find(e=>"Chromium"===e.brand)),oe=!ne&&ae,le=de=(e.brands.find(e=>"Chromium"===e.brand)||{}).version||null,ce="Windows"===e.platform),!ae){const R=window.navigator&&window.navigator.userAgent||"";ee=/iPod/i.test(R),te=(e=R.match(/OS (\d+)_/i))&&e[1]?e[1]:null,ie=/Android/i.test(R),se=(e=R.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i))?(ft=e[1]&&parseFloat(e[1]),fe=e[2]&&parseFloat(e[2]),ft&&fe?parseFloat(e[1]+"."+e[2]):ft||null):null,re=/Firefox/i.test(R),ne=/Edg/i.test(R),ae=/Chrome/i.test(R)||/CriOS/i.test(R),oe=!ne&&ae,le=de=(fe=R.match(/(Chrome|CriOS)\/(\d+)/))&&fe[2]?parseFloat(fe[2]):null,he=function(){var e=/MSIE\s(\d+)\.\d/.exec(R);let t=e&&parseFloat(e[1]);ret
|
||
|
.${s} {
|
||
|
width: ${e}px;
|
||
|
height: ${t}px;
|
||
|
}
|
||
|
|
||
|
.${s}.vjs-fluid:not(.vjs-audio-only-mode) {
|
||
|
padding-top: ${100*r}%;
|
||
|
}
|
||
|
`)}}loadTech_(e,t){this.tech_&&this.unloadTech_();var i=g(e),s=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==i&&this.tag&&(_.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,this.isReady_=!1;let r=this.autoplay();const n={source:t,autoplay:r="string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay?!1:r,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+`_${s}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};a.names.forEach(e=>{e=a[e];n[e.getterName]=this[e.privateName]}),Object.assign(n,this.options_[i]),Object.assign(n,this.options_[s]),Object.assign(n,this.options_[e.toLowerCase()]),this.tag&&(n.tag=this.tag),t&&t.src===this.cache_.src&&0<this.cache_.currentTime&&(n.startTime=this.cache_.currentTime);s=_.getTech(e);if(!s)throw new Error(`No Tech named '${i}' exists! '${i}' should be registered using videojs.registerTech()'`);this.tech_=new s(n),this.tech_.ready(m(this,this.handleTechReady_),!0),Yt(this.textTracksJson_||[],this.tech_),tn.forEach(t=>{this.on(this.tech_,t,e=>this[`handleTech${g(t)}_`](e))}),Object.keys(sn).forEach(t=>{this.on(this.tech_,t,e=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${sn[t]}_`].bind(this),event:e}):this[`handleTech${sn[t]}_`](e)})}),this.on(this.tech_,"loadstart",e=>this.handleTechLoadStart_(e)),this.on(this.tech_,"sourceset",e=>this.handleTechSourceset_(e)),this.on(this.tech_,"waiting",e=>this.handleTechWaiting_(e)),this.on(this.tech_,"ended",e=>this.handleTechEnded_(e)),this.on(this.tech_,"seeking",e=>this.handleTechSeeking_(e)),this.on(this.tech_,"play",e=>this.handleTechPlay_(e)),this.on(this.tech_,"pause",e=>this.handleTechPause_(e)),this.on(this.tech_,"durationchange",e=>this.handleTechDurationChange_(e)),this.on(this.tech_,"fullscreenchange",(e,t)=>this.handleTechFullscreenChange_(e,t)),this.on(this.tech_,"fullscreenerror",(e,t)=>this.handleTechFullscreenError_(e,t)),this.on(this.tech_,"enterpictureinpicture",e=>this.handleTechEnterPictureInPicture_(e)),this.on(this.tech_,"leavepictureinpicture",e=>this.handleTechLeavePictureInPicture_(e)),this.on(this.tech_,"error",e=>this.handleTechError_(e)),this.on(this.tech_,"posterchange",e=>this.handleTechPosterChange_(e)),this.on(this.tech_,"textdata",e=>this.handleTechTextData_(e)),this.on(this.tech_,"ratechange",e=>this.handleTechRateChange_(e)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===i&&this.tag||Ee(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){a.names.forEach(e=>{e=a[e];this[e.privateName]=this[e.getterName]()}),this.textTracksJson_=Kt(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return void 0===e&&l.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_}version(){return{"video.js":M}}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsList
|
||
|
.video-js {
|
||
|
width: 300px;
|
||
|
height: 150px;
|
||
|
}
|
||
|
|
||
|
.vjs-fluid:not(.vjs-audio-only-mode) {
|
||
|
padding-top: 56.25%
|
||
|
}
|
||
|
`)),Ze(1,T),T.VERSION=M,T.options=b.prototype.options_,T.getPlayers=()=>b.players,T.getPlayer=e=>{var t=b.players;let i;if("string"==typeof e){var s=_n(e),r=t[s];if(r)return r;i=ze("#"+s)}else i=e;if(be(i)){var{player:r,playerId:s}=i;if(r||t[s])return r||t[s]}},T.getAllPlayers=()=>Object.keys(b.players).map(e=>b.players[e]).filter(Boolean),T.players=b.players,T.getComponent=f.getComponent,T.registerComponent=(e,t)=>(_.isTech(t)&&l.warn(`The ${e} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),f.registerComponent.call(f,e,t)),T.getTech=_.getTech,T.registerTech=_.registerTech,T.use=function(e,t){us[e]=us[e]||[],us[e].push(t)},Object.defineProperty(T,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(T.middleware,"TERMINATOR",{value:ps,writeable:!1,enumerable:!0}),T.browser=e,T.obj=Z,T.mergeOptions=yn(9,"videojs.mergeOptions","videojs.obj.merge",d),T.defineLazyProperty=yn(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",J),T.bind=yn(9,"videojs.bind","native Function.prototype.bind",m),T.registerPlugin=fn.registerPlugin,T.deregisterPlugin=fn.deregisterPlugin,T.plugin=(e,t)=>(l.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),fn.registerPlugin(e,t)),T.getPlugins=fn.getPlugins,T.getPlugin=fn.getPlugin,T.getPluginVersion=fn.getPluginVersion,T.addLanguage=function(e,t){return e=(""+e).toLowerCase(),T.options.languages=d(T.options.languages,{[e]:t}),T.options.languages[e]},T.log=l,T.createLogger=z,T.time=Vt,T.createTimeRange=yn(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Ut),T.createTimeRanges=yn(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Ut),T.formatTime=yn(9,"videojs.formatTime","videojs.time.formatTime",Ht),T.setFormatTime=yn(9,"videojs.setFormatTime","videojs.time.setFormatTime",qt),T.resetFormatTime=yn(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",jt),T.parseUrl=yn(9,"videojs.parseUrl","videojs.url.parseUrl",di),T.isCrossOrigin=yn(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",ui),T.EventTarget=_t,T.any=ct,T.on=dt,T.one=ut,T.off=p,T.trigger=ht,T.xhr=Ti,T.TextTrack=Di,T.AudioTrack=Li,T.VideoTrack=Pi,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(e=>{T[e]=function(){return l.warn(`videojs.${e}() is deprecated; use videojs.dom.${e}() instead`),Ke[e].apply(null,arguments)}}),T.computedStyle=yn(9,"videojs.computedStyle","videojs.dom.computedStyle",Ge),T.dom=Ke,T.fn=ft,T.num=mi,T.str=Ot,T.url=pi,Nt(function(e,t){
|
||
|
/*! @name videojs-contrib-quality-levels @version 4.0.0 @license Apache-2.0 */
|
||
|
e.exports=function(e){function t(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var i=t(e);class s{constructor(e){let t=this;t.id=e.id;t.label=t.id;t.width=e.width;t.height=e.height;t.bitrate=e.bandwidth;t.frameRate=e.frameRate;t.enabled_=e.enabled;Object.defineProperty(t,"enabled",{get(){return t.enabled_()},set(e){t.enabled_(e)}});return t}}class n extends i["default"].EventTarget{constructor(){super();let e=this;e.levels_=[];e.selectedIndex_=-1;Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}});Object.defineProperty(e,"length",{get(){return e.levels_.length}});e[Symbol.iterator]=()=>e.levels_.values();return e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const i=this.levels_.length;t=new s(e);if(!(""+i in this))Object.defineProperty(this,i,{get(){return this.levels_[i]}});this.levels_.push(t);this.trigger({qualityLevel:t,type:"addqualitylevel"});return t}removeQualityLevel(i){let s=null;for(let e=0,t=this.length;e<t;e++)if(this[e]===i){s=this.levels_.splice(e,1)[0];if(this.selectedIndex_===e)this.selectedIndex_=-1;else if(this.selectedIndex_>e)this.selectedIndex_--;break}if(s)this.trigger({qualityLevel:i,type:"removequalitylevel"});return s}getQualityLevelById(i){for(let e=0,t=this.length;e<t;e++){const s=this[e];if(s.id===i)return s}return null}dispose(){this.selectedIndex_=-1;this.levels_.length=0}}n.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const l in n.prototype.allowedEvents_)n.prototype["on"+l]=null;var a="4.0.0";const r=function(e,t){const i=e.qualityLevels;const s=new n;const r=function(){s.dispose();e.qualityLevels=i;e.off("dispose",r)};e.on("dispose",r);e.qualityLevels=()=>s;e.qualityLevels.VERSION=a;return s},o=function(e){return r(this,i["default"].obj.merge({},e))};return i["default"].registerPlugin("qualityLevels",o),o.VERSION=a,o}(T)});function vn(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=window.location&&window.location.href||"");var i="function"==typeof window.URL,s=/^\/\//.test(e),r=!window.location&&!/\/\//i.test(e);return i?e=new window.URL(e,window.location||Tn):/\/\//i.test(e)||(e=bn.buildAbsoluteURL(window.location&&window.location.href||"",e)),i?(i=new URL(t,e),r?i.href.slice(Tn.length):s?i.href.slice(i.protocol.length):i.href):bn.buildAbsoluteURL(e,t)}var bn=Nt(function(e,t){var i,n,s,r,a;i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,n=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var s=a.parseURL(e);if(s)return s.path=a.normalizePath(s.path),a.buildURLFromParts(s);throw new Error("Error trying to parse base URL.")}s=a.parseURL(t);if(!s)throw new Error("Error trying to parse relative URL.");if(s.scheme)return i.alwaysNormalize?(s.path=a.normalizePath(s.path),a.buildURLFromParts(s)):t;t=a.parseURL(e);if(!t)throw new Error("Error trying to parse base URL.");!t.netLoc&&t.path&&"/"!==t.path[0]&&(e=n.exec(t.path),t.netLoc=e[1],t.path=e[2]),t.netLoc&&!t.path&&(t.path="/");var r,e={scheme:t.scheme,netLoc:s.netLoc,path:null,params:s.params,query:s.query,fragment:s.fragment};return s.netLoc||(e.netLoc=t.netLoc,"/"!==s.path[0]&&(s.path?(r=(r=t.path).substring(0,r.lastIndexOf("/")+1)+s.path,e.path=a.normalizePath(r)):(e.path=t.path,s.params||(e.params=t.params,s.query)||(e.query=t.query)))),null===e.path&&(e.path=i.alwaysNormalize?a.normalizePath(s.path):s.path),a.buildURLFromParts(e)},parseURL:function(e){e=i.exec(e);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(s,"");e.length!==(e=e.replace(r,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=a}),Tn="http://example.com",Rr=functio
|
||
|
/*! @name m3u8-parser @version 7.1.0 @license Apache-2.0 */class wn extends Rr{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf("\n");-1<t;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}function En(e){var e=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""),t={};return e[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t}function Cn(t){var i={};if(t){var s,r=t.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))'));let e=r.length;for(;e--;)""!==r[e]&&((s=/([^=]*)=(.*)/.exec(r[e]).slice(1))[0]=s[0].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^['"](.*)['"]$/g,"$1"),i[s[0]]=s[1])}return i}const kn=String.fromCharCode(9);class xn extends Rr{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(i){let o,l;0!==(i=i.trim()).length&&("#"!==i[0]?this.trigger("data",{type:"uri",uri:i}):this.tagMappers.reduce((e,t)=>{t=t(i);return t===i?e:e.concat([t])},[i]).forEach(t=>{for(let e=0;e<this.customParsers.length;e++)if(this.customParsers[e].call(this,t))return;var e,i;if(0!==t.indexOf("#EXT"))this.trigger("data",{type:"comment",text:t.slice(1)});else if(t=t.replace("\r",""),o=/^#EXTM3U/.exec(t))this.trigger("data",{type:"tag",tagType:"m3u"});else if(o=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(t))l={type:"tag",tagType:"inf"},o[1]&&(l.duration=parseFloat(o[1])),o[2]&&(l.title=o[2]),this.trigger("data",l);else if(o=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(t))l={type:"tag",tagType:"targetduration"},o[1]&&(l.duration=parseInt(o[1],10)),this.trigger("data",l);else if(o=/^#EXT-X-VERSION:([0-9.]*)?/.exec(t))l={type:"tag",tagType:"version"},o[1]&&(l.version=parseInt(o[1],10)),this.trigger("data",l);else if(o=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(t))l={type:"tag",tagType:"media-sequence"},o[1]&&(l.number=parseInt(o[1],10)),this.trigger("data",l);else if(o=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(t))l={type:"tag",tagType:"discontinuity-sequence"},o[1]&&(l.number=parseInt(o[1],10)),this.trigger("data",l);else if(o=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(t))l={type:"tag",tagType:"playlist-type"},o[1]&&(l.playlistType=o[1]),this.trigger("data",l);else if(o=/^#EXT-X-BYTERANGE:(.*)?$/.exec(t))l=yi(En(o[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",l);else if(o=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(t))l={type:"tag",tagType:"allow-cache"},o[1]&&(l.allowed=!/NO/.test(o[1])),this.trigger("data",l);else if(o=/^#EXT-X-MAP:(.*)$/.exec(t))l={type:"tag",tagType:"map"},o[1]&&((i=Cn(o[1])).URI&&(l.uri=i.URI),i.BYTERANGE)&&(l.byterange=En(i.BYTERANGE)),this.trigger("data",l);else if(o=/^#EXT-X-STREAM-INF:(.*)$/.exec(t))l={type:"tag",tagType:"stream-inf"},o[1]&&(l.attributes=Cn(o[1]),l.attributes.RESOLUTION&&(i={},(e=l.attributes.RESOLUTION.split("x"))[0]&&(i.width=parseInt(e[0],10)),e[1]&&(i.height=parseInt(e[1],10)),l.attributes.RESOLUTION=i),l.attributes.BANDWIDTH&&(l.attributes.BANDWIDTH=parseInt(l.attributes.BANDWIDTH,10)),l.attributes["FRAME-RATE"]&&(l.attributes["FRAME-RATE"]=parseFloat(l.attributes["FRAME-RATE"])),l.attributes["PROGRAM-ID"])&&(l.attributes["PROGRAM-ID"]=parseInt(l.attributes["PROGRAM-ID"],10)),this.trigger("data",l);else if(o=/^#EXT-X-MEDIA:(.*)$/.exec(t))l={type:"tag",tagType:"media"},o[1]&&(l.attributes=Cn(o[1])),this.trigger("data",l);else if(o=/^#EXT-X-ENDLIST/.exec(t))this.trigger("data",{type:"tag",tagType:"endlist"});else if(o=/^#EXT-X-DISCONTINUITY/.exec(t))this.trigger("data",{type:"tag",tagType:"discontinuity"});else if(o=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(t))l={type:"tag",tagType:"program-date-time"},o[1]&&(l.dateTimeString=o[1],l.dateTimeObject=new Date(o[1])),this.trigger("data",l);else if(o=/^#EXT-X-KEY:(.*)$/.exec(t))l={type:"tag",tagType:"key"},o[1]&&(l.attributes=Cn(o[1]),l.attributes.IV)&&("0x"===l.attributes.IV.substring(0,2).toLowerCase()&&(l.attributes.IV=l.attributes.IV.substring(2)),l.attributes.IV=l.attributes.IV.match(/.{8}/g),l.attributes.IV[0]=parseInt(l.attributes.IV[0],16),l.attributes.IV[1]=parseInt(l.attributes.IV[1],16)
|
||
|
/*! @name mpd-parser @version 1.3.0 @license Apache-2.0 */
|
||
|
const ko=e=>!!e&&"object"==typeof e,I=(...e)=>e.reduce((t,i)=>("object"==typeof i&&Object.keys(i).forEach(e=>{Array.isArray(t[e])&&Array.isArray(i[e])?t[e]=t[e].concat(i[e]):ko(t[e])&&ko(i[e])?t[e]=I(t[e],i[e]):t[e]=i[e]}),t),{}),xo=t=>Object.keys(t).map(e=>t[e]),Io=e=>e.reduce((e,t)=>e.concat(t),[]),Ao=t=>{if(!t.length)return[];var i=[];for(let e=0;e<t.length;e++)i.push(t[e]);return i};var Do={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",INVALID_NUMBER_OF_CONTENT_STEERING:"INVALID_NUMBER_OF_CONTENT_STEERING",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const Lo=({baseUrl:s="",source:r="",range:n="",indexRange:a=""})=>{s={uri:r,resolvedUri:vn(s||"",r)};if(n||a){r=(n||a).split("-");let e=window.BigInt?window.BigInt(r[0]):parseInt(r[0],10),t=window.BigInt?window.BigInt(r[1]):parseInt(r[1],10);e<Number.MAX_SAFE_INTEGER&&"bigint"==typeof e&&(e=Number(e)),t<Number.MAX_SAFE_INTEGER&&"bigint"==typeof t&&(t=Number(t));let i;"bigint"==typeof(i="bigint"==typeof t||"bigint"==typeof e?window.BigInt(t)-window.BigInt(e)+window.BigInt(1):t-e+1)&&i<Number.MAX_SAFE_INTEGER&&(i=Number(i)),s.byterange={length:i,offset:e}}return s},Po=e=>(e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e),Oo={static(e){var{duration:t,timescale:i=1,sourceDuration:s,periodDuration:r}=e,e=Po(e.endNumber),t=t/i;return"number"==typeof e?{start:0,end:e}:"number"==typeof r?{start:0,end:r/t}:{start:0,end:s/t}},dynamic(e){var{NOW:t,clientOffset:i,availabilityStartTime:s,timescale:r=1,duration:n,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:l=1/0}=e,e=Po(e.endNumber),t=(t+i)/1e3,i=s+a,s=Math.ceil((t+o-i)*r/n),a=Math.floor((t-i-l)*r/n),o=Math.floor((t-i)*r/n);return{start:Math.max(0,a),end:"number"==typeof e?e:Math.min(s,o)}}},No=e=>{var n,{type:t,duration:i,timescale:s=1,periodDuration:r,sourceDuration:a}=e,{start:o,end:l}=Oo[t](e),o=((t,i)=>{var s=[];for(let e=t;e<i;e++)s.push(e);return s})(o,l).map((n=e,e=>{var{duration:t,timescale:i=1,periodStart:s,startNumber:r=1}=n;return{number:r+e,duration:t/i,timeline:s,time:e*t}}));return"static"===t&&(o[l=o.length-1].duration=("number"==typeof r?r:a)-i/s*l),o},Ro=e=>{var{baseUrl:t,initialization:i={},sourceDuration:s,indexRange:r="",periodStart:n,presentationTime:a,number:o=0,duration:l}=e;if(t)return i=Lo({baseUrl:t,source:i.sourceURL,range:i.range}),(t=Lo({baseUrl:t,source:t,indexRange:r})).map=i,l?(r=No(e)).length&&(t.duration=r[0].duration,t.timeline=r[0].timeline):s&&(t.duration=s,t.timeline=n),t.presentationTime=a||n,t.number=o,[t];throw new Error(Do.NO_BASE_URL)},Mo=(e,i,s)=>{var r=e.sidx.map||null,n=e.sidx.duration,a=e.timeline||0,t=e.sidx.byterange,t=t.offset+t.length,o=i.timescale,l=i.references.filter(e=>1!==e.referenceType),d=[],h=e.endList?"static":"dynamic",u=e.sidx.timeline;let c=u,p=e.mediaSequence||0,m;m="bigint"==typeof i.firstOffset?window.BigInt(t)+i.firstOffset:t+i.firstOffset;for(let t=0;t<l.length;t++){var g=i.references[t],f=g.referencedSize,g=g.subsegmentDuration;let e;e="bigint"==typeof m?m+window.BigInt(f)-window.BigInt(1):m+f-1;var y=m+"-"+e,y={baseUrl:s,timescale:o,timeline:a,periodStart:u,presentationTime:c,number:p,duration:g,sourceDuration:n,indexRange:y,type:h},y=Ro(y)[0];r&&(y.map=r),d.push(y),"bigint"==typeof m?m+=window.BigInt(f):m+=f,c+=g/o,p++}return e.segments=d,e},Uo=["AUDIO","SUBTITLES"],Bo=e=>{return e=e,i=({timeline:e})=>e,xo(e.reduce((t,e)=>(e.forEach(e=>{t[i(e)]=e}),t),{})).sort((e,t)=>e.timeline>t.timeline?1:-1);var i},Fo=e=>{let r=[];var n,a;return n=e,e=Uo,a=(e,t,i,s)=>{r=r.concat(e.playlists||[])},e.forEach(function(e){for(var t in n.mediaGroups[e])for(var i in n.mediaGroups[e][t]){var s=n.mediaGroups[e][t][i];a(s,e,t,i)}}),r},qo=({playlist:i,mediaSequence:e})=>{i.mediaSequence=e,i.segments.forEach((e,t)=>{e.number=i.mediaSequence+t})},jo=({oldManifest:e,newManifest:t})=>{var r,n,i=e.playlists.concat(Fo(e)),s=t.playli
|
||
|
/*! @name @videojs/http-streaming @version 3.10.0 @license Apache-2.0 */
|
||
|
const ql=vn,jl=(e,t)=>t&&t.responseURL&&e!==t.responseURL?t.responseURL:e,Hl=e=>T.log.debug?T.log.debug.bind(T,"VHS:",e+" >"):function(){};function P(...e){var t=T.obj||T;return(t.merge||t.mergeOptions).apply(t,e)}function Vl(...e){var t=T.time||T;return(t.createTimeRanges||t.createTimeRanges).apply(t,e)}function $l(e,i){return Jl(e,function(e,t){return e-Ql<=i&&t+Ql>=i})}function zl(e,t){return Jl(e,function(e){return e-Yl>=t})}function Wl(e){if(e&&e.length&&e.end)return e.end(e.length-1)}function Gl(t,i){let s=0;if(t&&t.length)for(let e=0;e<t.length;e++){var r=t.start(e),n=t.end(e);n<i||(s+=r<i&&i<=n?n-i:n-r)}return s}function Xl({defaultDuration:t,durationList:i,startIndex:s,endIndex:r}){let n=0;if(r<s&&([s,r]=[r,s]),s<0){for(let e=s;e<Math.min(0,r);e++)n+=t;s=0}for(let e=s;e<r;e++)n+=i[e].duration;return n}function Kl(e,t,i,s){if(!e||!e.segments)return null;if(e.endList)return dd(e);if(null===t)return null;t=t||0;let r=ld(e,e.mediaSequence+e.segments.length,t);return i&&(s="number"==typeof s?s:nd(null,e),r-=s),Math.max(0,r)}const Yl=1/30,Ql=3*Yl,Jl=function(e,t){var i=[];let s;if(e&&e.length)for(s=0;s<e.length;s++)t(e.start(s),e.end(s))&&i.push([e.start(s),e.end(s)]);return Vl(i)},Zl=t=>{var i=[];if(!t||!t.length)return"";for(let e=0;e<t.length;e++)i.push(t.start(e)+" => "+t.end(e));return i.join(", ")},ed=t=>{var i=[];for(let e=0;e<t.length;e++)i.push({start:t.start(e),end:t.end(e)});return i},td=(t,e)=>{if(!e.preload)return e.duration;let i=0;return(e.parts||[]).forEach(function(e){i+=e.duration}),(e.preloadHints||[]).forEach(function(e){"PART"===e.type&&(i+=t.partTargetDuration)}),i},id=e=>(e.segments||[]).reduce((i,s,r)=>(s.parts?s.parts.forEach(function(e,t){i.push({duration:e.duration,segmentIndex:r,partIndex:t,part:e,segment:s})}):i.push({duration:s.duration,segmentIndex:r,partIndex:null,segment:s,part:null}),i),[]),sd=e=>{e=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return e&&e.parts||[]},rd=({preloadSegment:e})=>{var t;if(e)return{parts:e,preloadHints:t}=e,(t||[]).reduce((e,t)=>e+("PART"===t.type?1:0),0)+(e&&e.length?e.length:0)},nd=(e,t)=>{return t.endList?0:e&&e.suggestedPresentationDelay?e.suggestedPresentationDelay:(e=0<sd(t).length)&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:e&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},ad=function(e,t){let i=0,s=t-e.mediaSequence,r=e.segments[s];if(r){if("undefined"!=typeof r.start)return{result:r.start,precise:!0};if("undefined"!=typeof r.end)return{result:r.end-r.duration,precise:!0}}for(;s--;){if("undefined"!=typeof(r=e.segments[s]).end)return{result:i+r.end,precise:!0};if(i+=td(e,r),"undefined"!=typeof r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}},od=function(e,t){let i=0;var s;let r=t-e.mediaSequence;for(;r<e.segments.length;r++){if("undefined"!=typeof(s=e.segments[r]).start)return{result:s.start-i,precise:!0};if(i+=td(e,s),"undefined"!=typeof s.end)return{result:s.end-i,precise:!0}}return{result:-1,precise:!1}},ld=function(e,t,i){var s;return(t="undefined"==typeof t?e.mediaSequence+e.segments.length:t)<e.mediaSequence?0:(s=ad(e,t)).precise?s.result:(e=od(e,t)).precise?e.result:s.result+i},dd=function(e,t,i){if(!e)return 0;if("number"!=typeof i&&(i=0),"undefined"==typeof t){if(e.totalDuration)return e.totalDuration;if(!e.endList)return window.Infinity}return ld(e,t,i)};function hd(e){return e.excludeUntil&&e.excludeUntil>Date.now()}function ud(e){return e.excludeUntil&&e.excludeUntil===1/0}function cd(e){var t=hd(e);return!e.disabled&&!t}function pd(e,t){return t.attributes&&t.attributes[e]}function md(e,t){var i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{};let s=!1;for(const r in i){for(const n in i[r])if(s=t(i[r][n]))break;if(s)break}return!!s}const gd=(e,t)=>{if(1===e.playlists.length)return!0;const i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter(e=>!!cd(e)&&(e.attributes.BANDWIDTH||0)<i).length},fd=(e,t)=>!(!e&&!t||!e&&t||e&&!t||e!==t&&(!e.id||!t.id||e.i
|
||
|
`+"browserWorkerPolyFill(self);\n"+e}function ah(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)}var oh=rh(nh(ah(function(){function e(){this.init=function(){var n={};this.on=function(e,t){n[e]||(n[e]=[]),n[e]=n[e].concat(t)},this.off=function(e,t){return!!n[e]&&(t=n[e].indexOf(t),n[e]=n[e].slice(),n[e].splice(t,1),-1<t)},this.trigger=function(e){var t,i,s,r=n[e];if(r)if(2===arguments.length)for(i=r.length,t=0;t<i;++t)r[t].call(this,arguments[1]);else{for(s=[],t=arguments.length,t=1;t<arguments.length;++t)s.push(arguments[t]);for(i=r.length,t=0;t<i;++t)r[t].apply(this,s)}},this.dispose=function(){n={}}}}var l,M,U,B,F,q,j,H,V,$,z,W,G,X,K,Y,Q,J,Z,ee,d,te,ie,se,re,ne,ae,oe,t,le,de,he,ue,ce,pe,me,ge,fe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},i=(e.prototype.pipe=function(t){return this.on("data",function(e){t.push(e)}),this.on("done",function(e){t.flush(e)}),this.on("partialdone",function(e){t.partialFlush(e)}),this.on("endedtimeline",function(e){t.endTimeline(e)}),this.on("reset",function(e){t.reset(e)}),t},e.prototype.push=function(e){this.trigger("data",e)},e.prototype.flush=function(e){this.trigger("done",e)},e.prototype.partialFlush=function(e){this.trigger("partialdone",e)},e.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)},e.prototype.reset=function(e){this.trigger("reset",e)},e),ye=Math.pow(2,32),s={getUint64:function(e){var t,e=new DataView(e.buffer,e.byteOffset,e.byteLength);return e.getBigUint64?(t=e.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(t):t:e.getUint32(0)*ye+e.getUint32(4)},MAX_UINT32:ye},_e=s.MAX_UINT32;if(d={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(var r in d)d.hasOwnProperty(r)&&(d[r]=[r.charCodeAt(0),r.charCodeAt(1),r.charCodeAt(2),r.charCodeAt(3)]);te=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),se=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),ie=new Uint8Array([0,0,0,1]),ke=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),Ie=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),re={video:ke,audio:Ie},oe=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),ae=new Uint8Array([0,0,0,0,0,0,0,0]),t=new Uint8Array([0,0,0,0,0,0,0,0]),le=t,de=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),he=t,ne=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}l=function(e){for(var t,i=[],s=0,r=1;r<arguments.length;r++)i.push(arguments[r]);for(r=i.length;r--;)s+=i[r].byteLength;for(t=new Uint8Array(s+8),new DataView(t.buffer,t.byteOffset,t.byteLength).setUint32(0,t.byteLength),t.set(e,4),r=0,s=8;r<i.length;r++)t.set(i[r],s),s+=i[r].byteLength;return t},M=function(){return l(d.dinf,l(d.dref,oe))},U=function(e){return l(d.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,e.audioobjecttype<<3|e.samplingfrequencyindex>>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},X=function(e){return l(d.hdlr,re[e])},G=function(e){var t=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]);return e.samplerate&&(t[12]=e.samplerate>>>24&255,t[13]=e.samplerate>>>16&255,t[14]=e.samplerate>>>8&255,t[15]=255&e.samplerate),l(d.mdhd,t)},W=function(e){return l(d.mdia,G(e),X(e.type),q(e))},F=function(e){return l(d.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},q=function(e){return l(d.minf,"video"===e.type?l(d.vmhd,ne):l(d.smhd,ae),M(),Y(e))},H=function(e){for(var t=e.length,i=[];t--;)i[t]=Z(e[t]);return l.apply(null,[d.mvex].concat(i))},V=fun
|
||
|
Fallback base time to: ${t}.
|
||
|
Received media sequence: ${i}.
|
||
|
Current map: `,n),t):0,this.logger_(`MediaSequence sync for ${r} segment loader.
|
||
|
Received media sequence: ${i}.
|
||
|
base time is ${s}
|
||
|
Current map: `,n),e.segments.forEach(e=>{var t=s,e=t+e.duration,t={start:t,end:e};a.set(i,t),i++,s=e}),this.mediaSequenceStorage_.set(r,a)}}getSyncPoint(e,t,i,s,r){if(t!==1/0)return fu.find(({name:e})=>"VOD"===e).run(this,e,t);t=this.runStrategies_(e,t,i,s,r);if(!t.length)return null;for(const h of t){var{syncPoint:n,strategy:a}=h,{segmentIndex:o,time:l}=n;if(!(o<0)){var d=l+e.segments[o].duration;if(this.logger_(`Strategy: ${a}. Current time: ${s}. selected segment: ${o}. Time: [${l} -> ${d}]}`),l<=s&&s<d)return this.logger_("Found sync point with exact match: ",n),n}}return this.selectSyncPoint_(t,{key:"time",value:s})}getExpiredTime(e,t){return e&&e.segments&&(t=this.runStrategies_(e,t,e.discontinuitySequence,0,"main")).length?(0<(t=this.selectSyncPoint_(t,{key:"segmentIndex",value:0})).segmentIndex&&(t.time*=-1),Math.abs(t.time+Xl({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:t.segmentIndex,endIndex:0}))):null}runStrategies_(t,i,s,r,n){var a=[];for(let e=0;e<fu.length;e++){var o=fu[e],l=o.run(this,t,i,s,r,n);l&&(l.strategy=o.name,a.push({strategy:o.name,syncPoint:l}))}return a}selectSyncPoint_(t,i){let s=t[0].syncPoint,r=Math.abs(t[0].syncPoint[i.key]-i.value),n=t[0].strategy;for(let e=1;e<t.length;e++){var a=Math.abs(t[e].syncPoint[i.key]-i.value);a<r&&(r=a,s=t[e].syncPoint,n=t[e].strategy)}return this.logger_(`syncPoint for [${i.key}: ${i.value}] chosen with strategy`+` [${n}]: [time:${s.time},`+" segmentIndex:"+s.segmentIndex+("number"==typeof s.partIndex?",partIndex:"+s.partIndex:"")+"]"),s}saveExpiredSegmentInfo(t,i){var s=i.mediaSequence-t.mediaSequence;if(86400<s)T.log.warn(`Not saving expired segment info. Media sequence gap ${s} is too large.`);else for(let e=s-1;0<=e;e--){var r=t.segments[e];if(r&&"undefined"!=typeof r.start){i.syncInfo={mediaSequence:t.mediaSequence+e,time:r.start},this.logger_(`playlist refresh sync: [time:${i.syncInfo.time},`+` mediaSequence: ${i.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){var t;this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject&&(t=(e=e.segments[0]).dateTimeObject.getTime()/1e3,this.timelineToDatetimeMappings[e.timeline]=-t)}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){var i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),s=e.segment,i=(i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:s.start})),s.dateTimeObject);s.discontinuity&&t&&i&&(this.timelineToDatetimeMappings[s.timeline]=-i.getTime()/1e3)}timestampOffsetForTimeline(e){return"undefined"==typeof this.timelines[e]?null:this.timelines[e].time}mappingForTimeline(e){return"undefined"==typeof this.timelines[e]?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,i){var s=e.segment,r=e.part;let n=this.timelines[e.timeline],a,o;if("number"==typeof e.timestampOffset)n={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=n,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: `+`[time: ${n.time}] [mapping: ${n.mapping}]`)),a=e.startOfSegment;else{if(!n)return!1;a=t.start+n.mapping}return o=t.end+n.mapping,r&&(r.start=a,r.end=o),(!s.start||a<s.start)&&(s.start=a),s.end=o,!0}saveDiscontinuitySyncInfo_(t){var i=t.playlist,s=t.segment;if(s.discontinuity)this.discontinuities[s.timeline]={time:s.start,accuracy:0};else if(i.discontinuityStarts&&i.discontinuityStarts.length)for(let e=0;e<i.discontinuityStarts.length;e++){var r=i.discontinuityStarts[e],n=i.discontinuitySequence+e+1,a=r-t.mediaIndex,o=Math.abs(a);if(!this.discontinuities[n]||this.discontinuities[n].accuracy>o){let e;e=a<0?s.start-Xl({defaultDuration:i.targetDuration,durationList:i.segments,startIndex:t.mediaIndex,endIndex:r}):s.end+Xl({defaultDuration:i.targetDuration,durationList:i.segments,startIndex:t.mediaIndex+1,endIndex:r}),this.discontinuities[n]={time:e,accuracy:o}}}}dispose(){this.trigger("dispose"),this.off()}}class _u extends T.EventTarget{const
|
||
|
/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */let h=null;class g{constructor(e){h=h||function(){var e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],i=e[1],s=t[4],r=i[4];let n,a,o;var l,d,h,u,c=[],p=[];let m,g;for(n=0;n<256;n++)p[(c[n]=n<<1^283*(n>>7))^n]=n;for(a=o=0;!s[a];a^=l||1,o=p[o]||1)for(u=(u=o^o<<1^o<<2^o<<3^o<<4)>>8^255&u^99,h=c[d=c[l=c[r[s[a]=u]=a]]],g=16843009*h^65537*d^257*l^16843008*a,m=257*c[u]^16843008*u,n=0;n<4;n++)t[n][a]=m=m<<24^m>>>8,i[n][u]=g=g<<24^g>>>8;for(n=0;n<5;n++)t[n]=t[n].slice(0),i[n]=i[n].slice(0);return e}(),this._tables=[[h[0][0].slice(),h[0][1].slice(),h[0][2].slice(),h[0][3].slice(),h[0][4].slice()],[h[1][0].slice(),h[1][1].slice(),h[1][2].slice(),h[1][3].slice(),h[1][4].slice()]];let t,i,s;var r=this._tables[0][4],n=this._tables[1],a=e.length;let o=1;if(4!==a&&6!==a&&8!==a)throw new Error("Invalid aes key size");var l=e.slice(0),d=[];for(this._key=[l,d],t=a;t<4*a+28;t++)s=l[t-1],(t%a==0||8===a&&t%a==4)&&(s=r[s>>>24]<<24^r[s>>16&255]<<16^r[s>>8&255]<<8^r[255&s],t%a==0)&&(s=s<<8^s>>>24^o<<24,o=o<<1^283*(o>>7)),l[t]=l[t-a]^s;for(i=0;t;i++,t--)s=l[3&i?t:t-4],t<=4||i<4?d[i]=s:d[i]=n[0][r[s>>>24]]^n[1][r[s>>16&255]]^n[2][r[s>>8&255]]^n[3][r[255&s]]}decrypt(e,t,i,s,r,n){var a,o,l=this._key[1];let d=e^l[0],h=s^l[1],u=i^l[2],c=t^l[3],p;var m=l.length/4-2;let g,f=4;var e=this._tables[1],y=e[0],_=e[1],v=e[2],b=e[3],T=e[4];for(g=0;g<m;g++)p=y[d>>>24]^_[h>>16&255]^v[u>>8&255]^b[255&c]^l[f],a=y[h>>>24]^_[u>>16&255]^v[c>>8&255]^b[255&d]^l[f+1],o=y[u>>>24]^_[c>>16&255]^v[d>>8&255]^b[255&h]^l[f+2],c=y[c>>>24]^_[d>>16&255]^v[h>>8&255]^b[255&u]^l[f+3],f+=4,d=p,h=a,u=o;for(g=0;g<4;g++)r[(3&-g)+n]=T[d>>>24]<<24^T[h>>16&255]<<16^T[u>>8&255]<<8^T[255&c]^l[f++],p=d,d=h,h=u,u=c,c=p}}class l extends e{constructor(){super(e),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}function f(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}class d{constructor(e,t,i,s){var r=d.STEP,n=new Int32Array(e.buffer);const a=new Uint8Array(e.byteLength);let o=0;for(this.asyncStream_=new l,this.asyncStream_.push(this.decryptChunk_(n.subarray(o,o+r),t,i,a)),o=r;o<n.length;o+=r)i=new Uint32Array([f(n[o-4]),f(n[o-3]),f(n[o-2]),f(n[o-1])]),this.asyncStream_.push(this.decryptChunk_(n.subarray(o,o+r),t,i,a));this.asyncStream_.push(function(){var e;
|
||
|
/*! @name aes-decrypter @version 4.0.1 @license Apache-2.0 */s(null,(e=a).subarray(0,e.byteLength-e[e.byteLength-1]))})}static get STEP(){return 32e3}decryptChunk_(t,i,s,r){return function(){var e=function(e,t,i){var s,r,n,a,o=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),l=new g(Array.prototype.slice.call(t)),t=new Uint8Array(e.byteLength),d=new Int32Array(t.buffer);let h,u,c,p,m;for(h=i[0],u=i[1],c=i[2],p=i[3],m=0;m<o.length;m+=4)s=f(o[m]),r=f(o[m+1]),n=f(o[m+2]),a=f(o[m+3]),l.decrypt(s,r,n,a,d,m),d[m]=f(d[m]^h),d[m+1]=f(d[m+1]^u),d[m+2]=f(d[m+2]^c),d[m+3]=f(d[m+3]^p),h=s,u=r,c=n,p=a;return t}(t,i,s);r.set(e,t.byteOffset)}}}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t="undefined"!=typeof window?window:"undefined"!=typeof t?t:"undefined"!=typeof self?self:{},t=t.BigInt||Number;t("0x1"),t("0x100"),t("0x10000"),t("0x1000000"),t("0x100000000"),t("0x10000000000"),t("0x1000000000000"),t("0x100000000000000"),t("0x10000000000000000"),t=new Uint16Array([65484]),255!==(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))[0]&&t[0];function r(s){const r={};return Object.keys(s).forEach(e=>{var t,i=s[e];t=i,("function"===ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer)?r[e]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:r[e]=i}),r}self.onmessage=function(e){const i=e.data;var e=new Uint8Array(i.encrypted.bytes,i.encrypted.byteOffset,i.encrypted.byteLength),t=new Uint32Array(i.key.bytes,i.key.byteOffset,i.key.byteLength/4),s=new Uint32Array(i.iv.bytes,i.iv.byteOffset,i.iv.byteLength/4);new d(e,t,s,function(e,t){self.postMessage(r({source:i.source,decrypted:t}),[t.buffer])})}})));const bu=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},Tu=(e,t)=>{(t.activePlaylistLoader=e).load()},Su={AUDIO:(a,o)=>()=>{var{mediaTypes:{[a]:e},excludePlaylist:t}=o,i=e.activeTrack(),s=e.activeGroup(),s=(s.filter(e=>e.default)[0]||s[0]).id,r=e.tracks[s];if(i===r)t({error:{message:"Problem encountered loading the default audio track."}});else{T.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const n in e.tracks)e.tracks[n].enabled=e.tracks[n]===r;e.onTrackChanged()}},SUBTITLES:(i,s)=>()=>{var{[i]:e}=s["mediaTypes"],t=(T.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),e.activeTrack());t&&(t.mode="disabled"),e.onTrackChanged()}},wu={AUDIO:(e,t,i)=>{if(!t)return;const{tech:s,requestOptions:r,segmentLoaders:{[e]:n}}=i;t.on("loadedmetadata",()=>{var e=t.media();n.playlist(e,r),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),r),s.paused()||n.load()}),t.on("error",Su[e](e,i))},SUBTITLES:(e,t,i)=>{const{tech:s,requestOptions:r,segmentLoaders:{[e]:n},mediaTypes:{[e]:a}}=i;t.on("loadedmetadata",()=>{var e=t.media();n.playlist(e,r),n.track(a.activeTrack()),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),r),s.paused()||n.load()}),t.on("error",Su[e](e,i))}},Eu={AUDIO:(i,s)=>{var r,{vhs:n,sourceType:a,segmentLoaders:{[i]:e},requestOptions:o,main:{mediaGroups:l},mediaTypes:{[i]:{groups:d,tracks:h,logger_:u}},mainPlaylistLoader:c}=s,p=yd(c.main);l[i]&&0!==Object.keys(l[i]).length||(l[i]={main:{default:{default:!0}}},p&&(l[i].main.default.playlists=c.main.playlists));for(const m in l[i]){d[m]||(d[m]=[]);for(const g in l[i][m]){let e=l[i][m][g],t;t=p?(u(`AUDIO group '${m}' label '${g}' is a main playlist`),e.isMainPlaylist=!0,null):"vhs-json"===a&&e.playlists?new Pd(e.playlists[0],n,o):e.resolvedUri?new Pd(e.resolvedUri,n,o):e.playlists&&"dash"===a?new th(e.playlists[0],n,o,c):null,e=P({id:g,playlistLoader:t},e),wu[i](i,e.playlistLoader,s),d[m].push(e),"undefined"==typeof h[g]&&(r=new T.AudioTrack({id:g,kind:(e=>{let t=e.default?"main":"alternative";return t=e.characteristics&&0<=e.characteristics.indexOf("public.accessibility.describes-video")?"
|