774 lines
2.0 MiB
JavaScript
774 lines
2.0 MiB
JavaScript
|
|
/**
|
||
|
|
* @license
|
||
|
|
* Video.js 8.3.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 R="8.3.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 j={prefixed:!0};var H=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"]],q=H[0];let V;for(let e=0;e<H.length;e++)if(H[e][1]in document){V=H[e];break}if(V){for(let e=0;e<V.length;e++)j[q[e]]=V[e];j.prefixed=V[0]!==q[0]}let l=[];function $(e){return K(e)?Object.keys(e):[]}const d=function t(i){let s="info",r;function n(...e){r("log",s,e)}var a,o;return r=(a=i,(t,i,s)=>{var e,i=o.levels[i],r=new RegExp(`^(${i})$`);if("log"!==t&&s.unshift(t.toUpperCase()+":"),s.unshift(a+":"),l&&(l.push([].concat(s)),e=l.length-1e3,l.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=n).createLogger=e=>t(i+": "+e),n.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:s},n.level=e=>{if("string"==typeof e){if(!n.levels.hasOwnProperty(e))throw new Error(`"${e}" in not a valid log level`);s=e}return s},n.history=()=>l?[].concat(l):[],n.history.filter=t=>(l||[]).filter(e=>new RegExp(`.*${t}.*`).test(e[0])),n.history.clear=()=>{l&&(l.length=0)},n.history.disable=()=>{null!==l&&(l.length=0,l=null)},n.history.enable=()=>{null===l&&(l=[])},n.error=(...e)=>r("error",s,e),n.warn=(...e)=>r("warn",s,e),n.debug=(...e)=>r("debug",s,e),n}("VIDEOJS"),W=d.createLogger,G=Object.prototype.toString;function z(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]"===G.call(e)&&e.constructor===Object}function h(...e){const i={};return e.forEach(e=>{e&&z(e,(e,t)=>{Y(e)?(Y(i[t])||(i[t]={}),i[t]=h(i[t],e)):i[t]=e})}),i}function Q(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 J=Object.freeze({__proto__:null,each:z,reduce:X,isObject:K,isPlain:Y,merge:h,defineLazyProperty:Q});let Z=!1,ee=null,te=!1,ie,se=!1,re=!1,ne=!1,ae=!1,oe=null,le=null,de=null,he=!1,ue=!1,ce=!1,pe=!1;const me=Boolean(_e()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch));var ge,e=window.navigator&&window.navigator.userAgentData;if(e&&(te="Android"===e.platform,re=Boolean(e.brands.find(e=>"Microsoft Edge"===e.brand)),ne=Boolean(e.brands.find(e=>"Chromium"===e.brand)),ae=!re&&ne,oe=le=(e.brands.find(e=>"Chromium"===e.brand)||{}).version||null,ue="Windows"===e.platform),!ne){const M=window.navigator&&window.navigator.userAgent||"";Z=/iPod/i.test(M),ee=(e=M.match(/OS (\d+)_/i))&&e[1]?e[1]:null,te=/Android/i.test(M),ie=(e=M.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i))?(mt=e[1]&&parseFloat(e[1]),ge=e[2]&&parseFloat(e[2]),mt&&ge?parseFloat(e[1]+"."+e[2]):mt||null):null,se=/Firefox/i.test(M),re=/Edg/i.test(M),ne=/Chrome/i.test(M)||/CriOS/i.test(M),ae=!re&&ne,oe=le=(ge=M.match(/(Chrome|CriOS)\/(\d+)/))&&ge[2]?parseFloat(ge[2]):null,de=function(){var e=/MSIE\s(\d+)\
|
||
|
|
.${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),Kt(this.textTracksJson_||[],this.tech_),Qr.forEach(t=>{this.on(this.tech_,t,e=>this[`handleTech${g(t)}_`](e))}),Object.keys(Jr).forEach(t=>{this.on(this.tech_,t,e=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${Jr[t]}_`].bind(this),event:e}):this[`handleTech${Jr[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||we(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_=Xt(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&&d.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_}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_)}removeTechControlsListeners_(){this.off(this.tech_,"t
|
||
|
|
.video-js {
|
||
|
|
width: 300px;
|
||
|
|
height: 150px;
|
||
|
|
}
|
||
|
|
|
||
|
|
.vjs-fluid:not(.vjs-audio-only-mode) {
|
||
|
|
padding-top: 56.25%
|
||
|
|
}
|
||
|
|
`)),Qe(1,T),T.VERSION=R,T.options=b.prototype.options_,T.getPlayers=()=>b.players,T.getPlayer=e=>{var t=b.players;let i;if("string"==typeof e){var s=mn(e),r=t[s];if(r)return r;i=$e("#"+s)}else i=e;if(ve(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)&&d.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){hs[e]=hs[e]||[],hs[e].push(t)},Object.defineProperty(T,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(T.middleware,"TERMINATOR",{value:cs,writeable:!1,enumerable:!0}),T.browser=e,T.obj=J,T.mergeOptions=pn(9,"videojs.mergeOptions","videojs.obj.merge",h),T.defineLazyProperty=pn(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Q),T.bind=pn(9,"videojs.bind","native Function.prototype.bind",m),T.registerPlugin=cn.registerPlugin,T.deregisterPlugin=cn.deregisterPlugin,T.plugin=(e,t)=>(d.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),cn.registerPlugin(e,t)),T.getPlugins=cn.getPlugins,T.getPlugin=cn.getPlugin,T.getPluginVersion=cn.getPluginVersion,T.addLanguage=function(e,t){return e=(""+e).toLowerCase(),T.options.languages=h(T.options.languages,{[e]:t}),T.options.languages[e]},T.log=d,T.createLogger=W,T.time=qt,T.createTimeRange=pn(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Rt),T.createTimeRanges=pn(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Rt),T.formatTime=pn(9,"videojs.formatTime","videojs.time.formatTime",Ht),T.setFormatTime=pn(9,"videojs.setFormatTime","videojs.time.setFormatTime",Ft),T.resetFormatTime=pn(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",jt),T.parseUrl=pn(9,"videojs.parseUrl","videojs.url.parseUrl",li),T.isCrossOrigin=pn(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",hi),T.EventTarget=ft,T.any=ht,T.on=ot,T.one=dt,T.off=p,T.trigger=lt,T.xhr=bi,T.TextTrack=Ai,T.AudioTrack=Pi,T.VideoTrack=Li,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(e=>{T[e]=function(){return d.warn(`videojs.${e}() is deprecated; use videojs.dom.${e}() instead`),ze[e].apply(null,arguments)}}),T.computedStyle=pn(9,"videojs.computedStyle","videojs.dom.computedStyle",Ge),T.dom=ze,T.fn=mt,T.num=pi,T.str=Lt,T.url=ci,Dt(function(e,t){
|
||
|
|
/*! @name videojs-contrib-quality-levels @version 3.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}});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 d in n.prototype.allowedEvents_)n.prototype["on"+d]=null;var a="3.0.0";const r=i["default"].registerPlugin||i["default"].plugin,o=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},l=function(e){return o(this,i["default"].mergeOptions({},e))};return r("qualityLevels",l),l.VERSION=a,l}(T)});var gn=Dt(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}),fn="http://example.com",Lr=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){return!!this.listeners[e]&&(t=this.listeners[e].indexOf(t),this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(t,1),-1<t)},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,s=0;s<i;++s)t[s].call(this,arguments[1]);else for(var r=Array
|
||
|
|
/*! @name m3u8-parser @version 6.0.0 @license Apache-2.0 */class _n extends Lr{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 vn(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 bn(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 Tn=String.fromCharCode(9);class Sn extends Lr{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(i){let s,r;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;0!==t.indexOf("#EXT")?this.trigger("data",{type:"comment",text:t.slice(1)}):(t=t.replace("\r",""),(s=/^#EXTM3U/.exec(t))?this.trigger("data",{type:"tag",tagType:"m3u"}):(s=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(t))?(r={type:"tag",tagType:"inf"},s[1]&&(r.duration=parseFloat(s[1])),s[2]&&(r.title=s[2]),this.trigger("data",r)):(s=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(t))?(r={type:"tag",tagType:"targetduration"},s[1]&&(r.duration=parseInt(s[1],10)),this.trigger("data",r)):(s=/^#EXT-X-VERSION:([0-9.]*)?/.exec(t))?(r={type:"tag",tagType:"version"},s[1]&&(r.version=parseInt(s[1],10)),this.trigger("data",r)):(s=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(t))?(r={type:"tag",tagType:"media-sequence"},s[1]&&(r.number=parseInt(s[1],10)),this.trigger("data",r)):(s=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(t))?(r={type:"tag",tagType:"discontinuity-sequence"},s[1]&&(r.number=parseInt(s[1],10)),this.trigger("data",r)):(s=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(t))?(r={type:"tag",tagType:"playlist-type"},s[1]&&(r.playlistType=s[1]),this.trigger("data",r)):(s=/^#EXT-X-BYTERANGE:(.*)?$/.exec(t))?(r=fi(vn(s[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",r)):(s=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(t))?(r={type:"tag",tagType:"allow-cache"},s[1]&&(r.allowed=!/NO/.test(s[1])),this.trigger("data",r)):(s=/^#EXT-X-MAP:(.*)$/.exec(t))?(r={type:"tag",tagType:"map"},s[1]&&((i=bn(s[1])).URI&&(r.uri=i.URI),i.BYTERANGE)&&(r.byterange=vn(i.BYTERANGE)),this.trigger("data",r)):(s=/^#EXT-X-STREAM-INF:(.*)$/.exec(t))?(r={type:"tag",tagType:"stream-inf"},s[1]&&(r.attributes=bn(s[1]),r.attributes.RESOLUTION&&(i={},(e=r.attributes.RESOLUTION.split("x"))[0]&&(i.width=parseInt(e[0],10)),e[1]&&(i.height=parseInt(e[1],10)),r.attributes.RESOLUTION=i),r.attributes.BANDWIDTH&&(r.attributes.BANDWIDTH=parseInt(r.attributes.BANDWIDTH,10)),r.attributes["FRAME-RATE"]&&(r.attributes["FRAME-RATE"]=parseFloat(r.attributes["FRAME-RATE"])),r.attributes["PROGRAM-ID"])&&(r.attributes["PROGRAM-ID"]=parseInt(r.attributes["PROGRAM-ID"],10)),this.trigger("data",r)):(s=/^#EXT-X-MEDIA:(.*)$/.exec(t))?(r={type:"tag",tagType:"media"},s[1]&&(r.attributes=bn(s[1])),this.trigger("data",r)):(s=/^#EXT-X-ENDLIST/.exec(t))?this.trigger("data",{type:"tag",tagType:"endlist"}):(s=/^#EXT-X-DISCONTINUITY/.exec(t))?this.trigger("data",{type:"tag",tagType:"discontinuity"}):(s=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(t))?(r={type:"tag",tagType:"program-date-time"},s[1]&&(r.dateTimeString=s[1],r.dateTimeObject=new Date(s[1])),this.trigger("data",r)):(s=/^#EXT-X-KEY:(.*)$/.exec(t))?(r={type:"tag",tagType:"key"},s[1]&&(r.attributes=bn(s[1]),r.attributes.IV)&&("0x"===r.attributes.IV.substring(0,2).toLowerCase()&&(r.attributes.IV=r.attributes.IV.substring(2)),r.attributes.IV=r.attributes.IV.match(/.{8}/g),r.attributes.IV[0]=parseInt(r.attributes.IV[0],16),r.attributes.IV[1]=parseInt(r.attributes.IV[1],16),r.attributes.IV[2]=parseInt(r.attributes.IV[2],16),r.attributes.IV[3]=pa
|
||
|
|
/*! @name mpd-parser @version 1.0.1 @license Apache-2.0 */
|
||
|
|
const wo=e=>!!e&&"object"==typeof e,x=(...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]):wo(t[e])&&wo(i[e])?t[e]=x(t[e],i[e]):t[e]=i[e]}),t),{}),Eo=t=>Object.keys(t).map(e=>t[e]),ko=e=>e.reduce((e,t)=>e.concat(t),[]),Co=t=>{if(!t.length)return[];var i=[];for(let e=0;e<t.length;e++)i.push(t[e]);return i};var Io={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",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 xo=({baseUrl:s="",source:r="",range:n="",indexRange:a=""})=>{s={uri:r,resolvedUri:On(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},Ao=e=>(e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e),Po={static(e){var{duration:t,timescale:i=1,sourceDuration:s,periodDuration:r}=e,e=Ao(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=Ao(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)}}},Lo=e=>{var n,{type:t,duration:i,timescale:s=1,periodDuration:r,sourceDuration:a}=e,{start:o,end:l}=Po[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},Oo=e=>{var{baseUrl:t,initialization:i={},sourceDuration:s,indexRange:r="",periodStart:n,presentationTime:a,number:o=0,duration:l}=e;if(t)return i=xo({baseUrl:t,source:i.sourceURL,range:i.range}),(t=xo({baseUrl:t,source:t,indexRange:r})).map=i,l?(r=Lo(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(Io.NO_BASE_URL)},Do=(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=Oo(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},No=["AUDIO","SUBTITLES"],Mo=e=>{return e=e,i=({timeline:e})=>e,Eo(e.reduce((t,e)=>(e.forEach(e=>{t[i(e)]=e}),t),{})).sort((e,t)=>e.timeline>t.timeline?1:-1);var i},Ro=e=>{let r=[];var n,a;return n=e,e=No,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},Uo=({playlist:i,mediaSequence:e})=>{i.mediaSequence=e,i.segments.forEach((e,t)=>{e.number=i.mediaSequence+t})},Bo=({oldManifest:e,newManifest:t})=>{var r,n,i=e.playlists.concat(Ro(e)),s=t.playlists.concat(Ro(t));return t.timelineStarts=Mo([e.timelineStarts,t.timelin
|
||
|
|
/*! @name @videojs/http-streaming @version 3.0.2 @license Apache-2.0 */
|
||
|
|
const Rl=function(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||fn):/\/\//i.test(e)||(e=gn.buildAbsoluteURL(window.location&&window.location.href||"",e)),i?(i=new URL(t,e),r?i.href.slice(fn.length):s?i.href.slice(i.protocol.length):i.href):gn.buildAbsoluteURL(e,t)},Ul=(e,t)=>t&&t.responseURL&&e!==t.responseURL?t.responseURL:e,Bl=e=>T.log.debug?T.log.debug.bind(T,"VHS:",e+" >"):function(){};function O(...e){var t=T.obj||T;return(t.merge||t.mergeOptions).apply(t,e)}function Fl(...e){var t=T.time||T;return(t.createTimeRanges||t.createTimeRanges).apply(t,e)}function jl(e,i){return Xl(e,function(e,t){return e-zl<=i&&t+zl>=i})}function Hl(e,t){return Xl(e,function(e){return e-Gl>=t})}function ql(e){if(e&&e.length&&e.end)return e.end(e.length-1)}function Vl(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 $l({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 Wl(e,t,i,s){if(!e||!e.segments)return null;if(e.endList)return nd(e);if(null===t)return null;t=t||0;let r=rd(e,e.mediaSequence+e.segments.length,t);return i&&(s="number"==typeof s?s:td(null,e),r-=s),Math.max(0,r)}const Gl=1/30,zl=3*Gl,Xl=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 Fl(i)},Kl=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(", ")},Yl=t=>{var i=[];for(let e=0;e<t.length;e++)i.push({start:t.start(e),end:t.end(e)});return i},Ql=(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},Jl=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),[]),Zl=e=>{e=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return e&&e.parts||[]},ed=({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)},td=(e,t)=>{return t.endList?0:e&&e.suggestedPresentationDelay?e.suggestedPresentationDelay:(e=0<Zl(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},id=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+=Ql(e,r),"undefined"!=typeof r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}},sd=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+=Ql(e,s),"undefined"!=typeof s.end)return{result:s.end-i,precise:!0}}return{result:-1,precise:!1}},rd=function(e,t,i){var s;return(t="undefined"==typeof t?e.mediaSequence+e.segments.length:t)<e.mediaSequence?0:(s=id(e,t)).precise?s.result:(e=sd(e,t)).precise?e.result:s.result+i},nd=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 rd(e,t,i)};function ad(e){return e.excludeUntil&&e.excludeUntil>Date.now()}function od(e){return e.excludeUntil&&e.excludeUntil===1/0}function ld(e){var t=ad(e);return!e.disabled&&!t}funct
|
||
|
|
`+"browserWorkerPolyFill(self);\n"+e}function eh(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)}var th=Jd(Zd(eh(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,R,U,B,F,j,H,q,V,$,W,G,z,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),_e={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},ve=_e.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 s in d)d.hasOwnProperty(s)&&(d[s]=[s.charCodeAt(0),s.charCodeAt(1),s.charCodeAt(2),s.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]),Ce=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]),xe=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:Ce,audio:xe},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},R=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])},z=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)},G=function(e){return l(d.mdia,z(e),X(e.type),j(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]))},j=function(e){return l(d.minf,"video"===e.type?l(d.vmhd,ne):l(d.smhd,ae),R(),Y(e))},q=function(e){for(var t=e.length,i=[];t--;)i[t]=Z(e[t]);return l.apply(null,[d.mvex].concat(i))},V=f
|
||
|
|
/*! @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 uu=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},cu=(e,t)=>{(t.activePlaylistLoader=e).load()},pu={AUDIO:(a,o)=>()=>{var{segmentLoaders:{[a]:e},mediaTypes:{[a]:t},excludePlaylist:i}=o,e=(uu(e,t),t.activeTrack()),s=t.activeGroup(),s=(s.filter(e=>e.default)[0]||s[0]).id,r=t.tracks[s];if(e===r)i({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 t.tracks)t.tracks[n].enabled=t.tracks[n]===r;t.onTrackChanged()}},SUBTITLES:(i,s)=>()=>{var{segmentLoaders:{[i]:e},mediaTypes:{[i]:t}}=s,e=(T.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),uu(e,t),t.activeTrack());e&&(e.mode="disabled"),t.onTrackChanged()}},mu={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",pu[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",pu[e](e,i))}},gu={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=pd(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 Cd(e.playlists[0],n,o):e.resolvedUri?new Cd(e.resolvedUri,n,o):e.playlists&&"dash"===a?new Kd(e.playlists[0],n,o,c):null,e=O({id:g,playlistLoader:t},e),mu[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.ch
|
||
|
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.flvjs=t():e.flvjs=t()}(self,(function(){return function(){var e={264:function(e,t,i){
|
||
|
|
e.exports=function(){"use strict";function e(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}function t(e){return"function"==typeof e}var n=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},r=0,s=void 0,o=void 0,a=function(e,t){E[r]=e,E[r+1]=t,2===(r+=2)&&(o?o(b):R())};function h(e){o=e}function u(e){a=e}var d="undefined"!=typeof window?window:void 0,l=d||{},c=l.MutationObserver||l.WebKitMutationObserver,_="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){return function(){return process.nextTick(b)}}function m(){return void 0!==s?function(){s(b)}:y()}function g(){var e=0,t=new c(b),i=document.createTextNode("");return t.observe(i,{characterData:!0}),function(){i.data=e=++e%2}}function v(){var e=new MessageChannel;return e.port1.onmessage=b,function(){return e.port2.postMessage(0)}}function y(){var e=setTimeout;return function(){return e(b,1)}}var E=new Array(1e3);function b(){for(var e=0;e<r;e+=2)(0,E[e])(E[e+1]),E[e]=void 0,E[e+1]=void 0;r=0}function S(){try{var e=Function("return this")().require("vertx");return s=e.runOnLoop||e.runOnContext,m()}catch(e){return y()}}var R=void 0;function A(e,t){var i=this,n=new this.constructor(O);void 0===n[w]&&W(n);var r=i._state;if(r){var s=arguments[r-1];a((function(){return V(r,n,s,i._result)}))}else F(i,n,e,t);return n}function L(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var i=new t(O);return x(i,e),i}R=_?p():c?g():f?v():void 0===d?S():y();var w=Math.random().toString(36).substring(2);function O(){}var T=void 0,C=1,k=2;function D(){return new TypeError("You cannot resolve a promise with itself")}function B(){return new TypeError("A promises callback cannot return that same promise.")}function I(e,t,i,n){try{e.call(t,i,n)}catch(e){return e}}function M(e,t,i){a((function(e){var n=!1,r=I(i,t,(function(i){n||(n=!0,t!==i?x(e,i):G(e,i))}),(function(t){n||(n=!0,Z(e,t))}),"Settle: "+(e._label||" unknown promise"));!n&&r&&(n=!0,Z(e,r))}),e)}function U(e,t){t._state===C?G(e,t._result):t._state===k?Z(e,t._result):F(t,void 0,(function(t){return x(e,t)}),(function(t){return Z(e,t)}))}function P(e,i,n){i.constructor===e.constructor&&n===A&&i.constructor.resolve===L?U(e,i):void 0===n?G(e,i):t(n)?M(e,i,n):G(e,i)}function x(t,i){if(t===i)Z(t,D());else if(e(i)){var n=void 0;try{n=i.then}catch(e){return void Z(t,e)}P(t,i,n)}else G(t,i)}function N(e){e._onerror&&e._onerror(e._result),j(e)}function G(e,t){e._state===T&&(e._result=t,e._state=C,0!==e._subscribers.length&&a(j,e))}function Z(e,t){e._state===T&&(e._state=k,e._result=t,a(N,e))}function F(e,t,i,n){var r=e._subscribers,s=r.length;e._onerror=null,r[s]=t,r[s+C]=i,r[s+k]=n,0===s&&e._state&&a(j,e)}function j(e){var t=e._subscribers,i=e._state;if(0!==t.length){for(var n=void 0,r=void 0,s=e._result,o=0;o<t.length;o+=3)n=t[o],r=t[o+i],n?V(i,n,r,s):r(s);e._subscribers.length=0}}function V(e,i,n,r){var s=t(n),o=void 0,a=void 0,h=!0;if(s){try{o=n(r)}catch(e){h=!1,a=e}if(i===o)return void Z(i,B())}else o=r;i._state!==T||(s&&h?x(i,o):!1===h?Z(i,a):e===C?G(i,o):e===k&&Z(i,o))}function z(e,t){try{t((function(t){x(e,t)}),(function(t){Z(e,t)}))}catch(t){Z(e,t)}}var H=0;function K(){return H++}function W(e){e[w]=H++,e._state=void 0,e._result=void 0,e._subscribers=[]}function q(){return new Error("Array Methods must be provided an Array")}var Y=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(O),this.promise[w]||W(this.promise),n(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?G(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&G(this.promise,this._result))):Z(this.promise,q())}return e.prototype._enumerate=function(e){for(var t=0;this._state===T&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var i=this._instanceConstructor,n=i.resolve;if(n=
|
||
|
|
|
||
|
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.flvjs=t():e.flvjs=t()}(this,(function(){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=230)}([function(e,t,r){"use strict";var i=r(8),n=r.n(i),a=function(){function e(){}return e.e=function(t,r){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var i="["+t+"] > "+r;e.ENABLE_CALLBACK&&e.emitter.emit("log","error",i),e.ENABLE_ERROR&&(console.error?console.error(i):console.warn?console.warn(i):console.log(i))},e.i=function(t,r){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var i="["+t+"] > "+r;e.ENABLE_CALLBACK&&e.emitter.emit("log","info",i),e.ENABLE_INFO&&(console.info?console.info(i):console.log(i))},e.w=function(t,r){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var i="["+t+"] > "+r;e.ENABLE_CALLBACK&&e.emitter.emit("log","warn",i),e.ENABLE_WARN&&(console.warn?console.warn(i):console.log(i))},e.d=function(t,r){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var i="["+t+"] > "+r;e.ENABLE_CALLBACK&&e.emitter.emit("log","debug",i),e.ENABLE_DEBUG&&(console.debug?console.debug(i):console.log(i))},e.v=function(t,r){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var i="["+t+"] > "+r;e.ENABLE_CALLBACK&&e.emitter.emit("log","verbose",i),e.ENABLE_VERBOSE&&console.log(i)},e}();a.GLOBAL_TAG="flv.js",a.FORCE_GLOBAL_TAG=!1,a.ENABLE_ERROR=!0,a.ENABLE_INFO=!1,a.ENABLE_WARN=!1,a.ENABLE_DEBUG=!1,a.ENABLE_VERBOSE=!1,a.ENABLE_CALLBACK=!1,a.emitter=new n.a,t.a=a},function(e,t,r){"use strict";r.d(t,"G",(function(){return i})),r.d(t,"E",(function(){return n})),r.d(t,"F",(function(){return a})),r.d(t,"w",(function(){return o})),r.d(t,"l",(function(){return s})),r.d(t,"q",(function(){return u})),r.d(t,"y",(function(){return d})),r.d(t,"v",(function(){return h})),r.d(t,"k",(function(){return l})),r.d(t,"s",(function(){return f})),r.d(t,"t",(function(){return c})),r.d(t,"m",(function(){return p})),r.d(t,"D",(function(){return m})),r.d(t,"x",(function(){return g})),r.d(t,"A",(function(){return _})),r.d(t,"B",(function(){return y})),r.d(t,"u",(function(){return b})),r.d(t,"r",(function(){return v})),r.d(t,"o",(function(){return w})),r.d(t,"z",(function(){return E})),r.d(t,"n",(function(){return A})),r.d(t,"b",(function(){return S})),r.d(t,"a",(function(){return M})),r.d(t,"f",(function(){return T})),r.d(t,"p",(function(){return R})),r.d(t,"C",(function(){return k})),r.d(t,"i",(function(){return D})),r.d(t,"d",(function(){return x})),r.d(t,"h",(function(){return C})),r.d(t,"c",(function(){return P})),r.d(t,"j",(function(){return N})),r.d(t,"e",(function(){return L})),r.d(t,"g",(function(){return B}));var i=1,n=2,a=3,o=1,s=2,u=3,d=4,h=6,l=7,f=10,c=11,p=12,m=13,g=14,_=15,y=16,b=20,v=21,w=102,E=103,A=200,S=1,M=2,T=3,R=22,k=23,I=!0,O=!0;function D(e){I=e}function x(){return I}function C(e){e}function P(){return O}function N(e){return new Promise((function(t){return setTimeout(t,e)}))}function L(e){var t,r=new Date,i=r.getFullYear(),n=r.getMonth()+1,a=r.getDate();r.getDay();t=i+"-"+n+"-"+a+" "+r.getHours()+":"+r.getMinutes()+":"+r.getSeconds(),console.log("["+t+"]: "+e)}function B(){for(var e=window.location.href.split("/"),t="",r=0;r<3;r++)t+=e[r],t+="/";return
|
||
|
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||
|
|
var i=r(10),n=i.Buffer;function a(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(a(i,t),t.Buffer=o),o.prototype=Object.create(n.prototype),a(n,o),o.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},function(e,t,r){"use strict";var i={};!function(){var e=self.navigator.userAgent.toLowerCase(),t=/(edge)\/([\w.]+)/.exec(e)||/(opr)[\/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(iemobile)[\/]([\w.]+)/.exec(e)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(e)||[],r=/(ipad)/.exec(e)||/(ipod)/.exec(e)||/(windows phone)/.exec(e)||/(iphone)/.exec(e)||/(kindle)/.exec(e)||/(android)/.exec(e)||/(windows)/.exec(e)||/(mac)/.exec(e)||/(linux)/.exec(e)||/(cros)/.exec(e)||[],n={browser:t[5]||t[3]||t[1]||"",version:t[2]||t[4]||"0",majorVersion:t[4]||t[2]||"0",platform:r[0]||""},a={};if(n.browser){a[n.browser]=!0;var o=n.majorVersion.split(".");a.version={major:parseInt(n.majorVersion,10),string:n.version},o.length>1&&(a.version.minor=parseInt(o[1],10)),o.length>2&&(a.version.build=parseInt(o[2],10))}if(n.platform&&(a[n.platform]=!0),(a.chrome||a.opr||a.safari)&&(a.webkit=!0),a.rv||a.iemobile){a.rv&&delete a.rv;n.browser="msie",a.msie=!0}if(a.edge){delete a.edge;n.browser="msedge",a.msedge=!0}if(a.opr){n.browser="opera",a.opera=!0}if(a.safari&&a.android){n.browser="android",a.android=!0}for(var s in a.name=n.browser,a.platform=n.platform,i)i.hasOwnProperty(s)&&delete i[s];Object.assign(i,a)}(),t.a=i},function(e,t,r){"use strict";var i,n="object"==typeof Reflect?Reflect:null,a=n&&"function"==typeof n.apply?n.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};i=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(r,i){function n(r){e.removeListener(t,a),i(r)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}_(e,t,a,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&_(e,"error",t,r)}(e,n,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function d(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function h(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function l(e,t,r,i){var n,a,o,s;if(d(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),o=a[t]),void 0===o)o=a[t]=r,++e._eventsCount;else if("function"==typeof o?o=a[t]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=h(e))>0&&o.length>n&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,s=u,console&&console.warn&&console.warn(s)}return e}function f(){if(!this.
|
||
|
|
/*!
|
||
|
|
* The buffer module from node.js, for the browser.
|
||
|
|
*
|
||
|
|
* @author Feross Aboukhadijeh <http://feross.org>
|
||
|
|
* @license MIT
|
||
|
|
*/
|
||
|
|
var i=r(125),n=r(126),a=r(66);function o(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(o()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return l(this,e)}return d(this,e,t,r)}function d(e,t,r,i){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,i){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===i?new Uint8Array(t):void 0===i?new Uint8Array(t,r):new Uint8Array(t,r,i);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=f(e,t);return e}(e,t,r,i):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var i=0|p(t,r),n=(e=s(e,i)).write(t,r);n!==i&&(e=e.slice(0,n));return e}(e,t,r):function(e,t){if(u.isBuffer(t)){var r=0|c(t.length);return 0===(e=s(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(i=t.length)!=i?s(e,0):f(e,t);if("Buffer"===t.type&&a(t.data))return f(e,t.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function h(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function l(e,t){if(h(t),e=s(e,t<0?0:0|c(t)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function f(e,t){var r=t.length<0?0:0|c(t.length);e=s(e,r);for(var i=0;i<r;i+=1)e[i]=255&t[i];return e}function c(e){if(e>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function p(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(e).length;default:if(i)return j(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,r);case"utf8":case"utf-8":return T(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return k(this,t,r);case"base64":return M(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function g(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function _(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=u.from(t,i)),u.isBuffer(t))return 0===t.length?-1:y(e,t,r,i,n);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,i,n){var a,o=1,s=e.length,u=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"u
|
||
|
|
/*! @name @videojs/vhs-utils @version 1.3.0 @license MIT */var i=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var r=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(r,1),r>-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var r=t.length,i=0;i<r;++i)t[i].call(this,arguments[1]);else for(var n=Array.prototype.slice.call(arguments,1),a=t.length,o=0;o<a;++o)t[o].apply(this,n)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}();e.exports=i},function(e,t,r){"use strict";var i=r(5),n=r(44),a=r(47),o=r(48),s=r(20);function u(e){s.call(this,"digest"),this._hash=e}i(u,s),u.prototype._update=function(e){this._hash.update(e)},u.prototype._final=function(){return this._hash.digest()},e.exports=function(e){return"md5"===(e=e.toLowerCase())?new n:"rmd160"===e||"ripemd160"===e?new a:new u(o(e))}},function(e,t,r){function i(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===i(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===i(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===i(e)},t.isError=function(e){return"[object Error]"===i(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(10).Buffer.isBuffer},function(e,t,r){(function(t){e.exports=function(e,r){for(var i=Math.min(e.length,r.length),n=new t(i),a=0;a<i;++a)n[a]=e[a]^r[a];return n}}).call(this,r(10).Buffer)},function(e,t,r){"use strict";var i=r(18),n=r(14);function a(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=a,a.prototype.update=function(e,t){if(e=i.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=i.join32(e,0,e.length-r,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},a.prototype.digest=function(e){return this.update(this._pad()),n(null===this.pending),this._digest(e)},a.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,i=new Array(r+this.padLength);i[0]=128;for(var n=1;n<r;n++)i[n]=0;if(e<<=3,"big"===this.endian){for(var a=8;a<this.padLength;a++)i[n++]=0;i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=e>>>24&255,i[n++]=e>>>16&255,i[n++]=e>>>8&255,i[n++]=255&e}else for(i[n++]=255&e,i[n++]=e>>>8&255,i[n++]=e>>>16&255,i[n++]=e>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,a=8;a<this.padLength;a++)i[n++]=0;return i}},function(e,t,r){"use strict";var i=r(5),n=r(64).Reporter,a=r(62).Buffer;function o(e,t){n.call(this,t),a.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function s(e,t){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return s.isEncoderBuffer(e)||(e=new s(e,t)),this.length+=e.length,e}),this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==
|
||
|
|
/*!
|
||
|
|
* @overview es6-promise - a tiny implementation of Promises/A+.
|
||
|
|
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
|
||
|
|
* @license Licensed under MIT license
|
||
|
|
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
|
||
|
|
* @version v4.2.8+1e68dce6
|
||
|
|
*/
|
||
|
|
var i;i=function(){"use strict";function e(e){return"function"==typeof e}var i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},n=0,a=void 0,o=void 0,s=function(e,t){p[n]=e,p[n+1]=t,2===(n+=2)&&(o?o(m):_())},u="undefined"!=typeof window?window:void 0,d=u||{},h=d.MutationObserver||d.WebKitMutationObserver,l="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function c(){var e=setTimeout;return function(){return e(m,1)}}var p=new Array(1e3);function m(){for(var e=0;e<n;e+=2)(0,p[e])(p[e+1]),p[e]=void 0,p[e+1]=void 0;n=0}var g,_=void 0;function y(e,t){var r=this,i=new this.constructor(w);void 0===i[v]&&D(i);var n=r._state;if(n){var a=arguments[n-1];s((function(){return I(n,i,a,r._result)}))}else R(r,i,e,t);return i}function b(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(w);return A(t,e),t}l?_=function(){return t.nextTick(m)}:h?_=function(){var e=0,t=new h(m),r=document.createTextNode("");return t.observe(r,{characterData:!0}),function(){r.data=e=++e%2}}():f?((g=new MessageChannel).port1.onmessage=m,_=function(){return g.port2.postMessage(0)}):_=void 0===u?function(){try{var e=Function("return this")().require("vertx");return void 0!==(a=e.runOnLoop||e.runOnContext)?function(){a(m)}:c()}catch(e){return c()}}():c();var v=Math.random().toString(36).substring(2);function w(){}function E(t,r,i){r.constructor===t.constructor&&i===y&&r.constructor.resolve===b?function(e,t){1===t._state?M(e,t._result):2===t._state?T(e,t._result):R(t,void 0,(function(t){return A(e,t)}),(function(t){return T(e,t)}))}(t,r):void 0===i?M(t,r):e(i)?function(e,t,r){s((function(e){var i=!1,n=function(e,t,r,i){try{e.call(t,r,i)}catch(e){return e}}(r,t,(function(r){i||(i=!0,t!==r?A(e,r):M(e,r))}),(function(t){i||(i=!0,T(e,t))}),e._label);!i&&n&&(i=!0,T(e,n))}),e)}(t,r,i):M(t,r)}function A(e,t){if(e===t)T(e,new TypeError("You cannot resolve a promise with itself"));else if(n=typeof(i=t),null===i||"object"!==n&&"function"!==n)M(e,t);else{var r=void 0;try{r=t.then}catch(t){return void T(e,t)}E(e,t,r)}var i,n}function S(e){e._onerror&&e._onerror(e._result),k(e)}function M(e,t){void 0===e._state&&(e._result=t,e._state=1,0!==e._subscribers.length&&s(k,e))}function T(e,t){void 0===e._state&&(e._state=2,e._result=t,s(S,e))}function R(e,t,r,i){var n=e._subscribers,a=n.length;e._onerror=null,n[a]=t,n[a+1]=r,n[a+2]=i,0===a&&e._state&&s(k,e)}function k(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var i=void 0,n=void 0,a=e._result,o=0;o<t.length;o+=3)i=t[o],n=t[o+r],i?I(r,i,n,a):n(a);e._subscribers.length=0}}function I(t,r,i,n){var a=e(i),o=void 0,s=void 0,u=!0;if(a){try{o=i(n)}catch(e){u=!1,s=e}if(r===o)return void T(r,new TypeError("A promises callback cannot return that same promise."))}else o=n;void 0!==r._state||(a&&u?A(r,o):!1===u?T(r,s):1===t?M(r,o):2===t&&T(r,o))}var O=0;function D(e){e[v]=O++,e._state=void 0,e._result=void 0,e._subscribers=[]}var x=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(w),this.promise[v]||D(this.promise),i(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?M(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&M(this.promise,this._result))):T(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;void 0===this._state&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,i=r.resolve;if(i===b){var n=void 0,a=void 0,o=!1;try{n=e.then}catch(e){o=!0,a=e}if(n===y&&void 0!==e._state)this._settledAt(e._state,t,e._result);else if("function"!=typeof n)this._remaining--,this._result[t]=e;else if(r===C){var s=new r(w);o?T(s,a):E(s,e,n),this._willSettleAt(s,t)}else this._willSettleAt(new r((function(t){return t(e)})),t)}else this._willSettleAt(i(e),t)},e.prototype._settledAt=function(e
|
||
|
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||
|
|
t.read=function(e,t,r,i,n){var a,o,s=8*n-i-1,u=(1<<s)-1,d=u>>1,h=-7,l=r?n-1:0,f=r?-1:1,c=e[t+l];for(l+=f,a=c&(1<<-h)-1,c>>=-h,h+=s;h>0;a=256*a+e[t+l],l+=f,h-=8);for(o=a&(1<<-h)-1,a>>=-h,h+=i;h>0;o=256*o+e[t+l],l+=f,h-=8);if(0===a)a=1-d;else{if(a===u)return o?NaN:1/0*(c?-1:1);o+=Math.pow(2,i),a-=d}return(c?-1:1)*o*Math.pow(2,a-i)},t.write=function(e,t,r,i,n,a){var o,s,u,d=8*a-n-1,h=(1<<d)-1,l=h>>1,f=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,c=i?0:a-1,p=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+l>=1?f/u:f*Math.pow(2,1-l))*u>=2&&(o++,u/=2),o+l>=h?(s=0,o=h):o+l>=1?(s=(t*u-1)*Math.pow(2,n),o+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,n),o=0));n>=8;e[r+c]=255&s,c+=p,s/=256,n-=8);for(o=o<<n|s,d+=n;d>0;e[r+c]=255&o,c+=p,o/=256,d-=8);e[r+c-p]|=128*m}},function(e,t,r){(function(t){var r;r="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{},e.exports=r}).call(this,r(13))},function(e,t,r){var i=r(129),n=r(130);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var a={insert:"head",singleton:!1};i(n,a);e.exports=n.locals||{}},function(e,t,r){"use strict";var i,n=function(){return void 0===i&&(i=Boolean(window&&document&&document.all&&!window.atob)),i},a=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}(),o=[];function s(e){for(var t=-1,r=0;r<o.length;r++)if(o[r].identifier===e){t=r;break}return t}function u(e,t){for(var r={},i=[],n=0;n<e.length;n++){var a=e[n],u=t.base?a[0]+t.base:a[0],d=r[u]||0,h="".concat(u," ").concat(d);r[u]=d+1;var l=s(h),f={css:a[1],media:a[2],sourceMap:a[3]};-1!==l?(o[l].references++,o[l].updater(f)):o.push({identifier:h,updater:g(f,t),references:1}),i.push(h)}return i}function d(e){var t=document.createElement("style"),i=e.attributes||{};if(void 0===i.nonce){var n=r.nc;n&&(i.nonce=n)}if(Object.keys(i).forEach((function(e){t.setAttribute(e,i[e])})),"function"==typeof e.insert)e.insert(t);else{var o=a(e.insert||"head");if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(t)}return t}var h,l=(h=[],function(e,t){return h[e]=t,h.filter(Boolean).join("\n")});function f(e,t,r,i){var n=r?"":i.media?"@media ".concat(i.media," {").concat(i.css,"}"):i.css;if(e.styleSheet)e.styleSheet.cssText=l(t,n);else{var a=document.createTextNode(n),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(a,o[t]):e.appendChild(a)}}function c(e,t,r){var i=r.css,n=r.media,a=r.sourceMap;if(n?e.setAttribute("media",n):e.removeAttribute("media"),a&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}var p=null,m=0;function g(e,t){var r,i,n;if(t.singleton){var a=m++;r=p||(p=d(t)),i=f.bind(null,r,a,!1),n=f.bind(null,r,a,!0)}else r=d(t),i=c.bind(null,r,t),n=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(r)};return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else n()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=n());var r=u(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var i=0;i<r.length;i++){var n=s(r[i]);o[n].references--}for(var a=u(e,t),d=0;d<r.length;d++){var h=s(r[d]);0===o[h].references&&(o[h].updater(),o.splice(h,1))}r=a}}}},function(e,t,r){var i=r(131),n=r(132),a=r(133),o=r(134),s=r(135);t=i(!1);var u=n(a),d=n(o),h=n(s);t.push([e.i,'@font-face {\n font-family: "iconfont"; /* Project id 3440216 */\n src: url('+u+") format('woff2'),\n url("+d+") format('woff'),\n url("+h+') format(\'true
|
||
|
|
!function t(e){var r,i;r=this,i=function(){"use strict";function r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function i(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?r(Object(i),!0).forEach((function(e){s(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function n(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,v(i.key),i)}}function a(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e,r){return(e=v(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(){return o=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},o.apply(this,arguments)}function l(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,h(t,e)}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function h(t,e){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},h(t,e)}function d(t,e,r){return d=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct.bind():function(t,e,r){var i=[null];i.push.apply(i,e);var n=new(Function.bind.apply(t,i));return r&&h(n,r.prototype),n},d.apply(null,arguments)}function c(t){var e="function"==typeof Map?new Map:void 0;return c=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,i)}function i(){return d(t,arguments,u(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),h(i,t)},c(t)}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function g(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return f(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function v(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function m(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var p={exports:{}};!function(t,e){var r,i,n,a,s;r=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,s={buildAbsolu
|
||
|
|
//# sourceMappingURL=hls.min.js.map
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @file plugin.js
|
||
|
|
*/
|
||
|
|
|
||
|
|
let flvjs = window.flvjs
|
||
|
|
let flv265 = window.flv265
|
||
|
|
let videojs = window.videojs
|
||
|
|
|
||
|
|
let Html5 = videojs.getTech('Html5');
|
||
|
|
let mergeOptions = videojs.mergeOptions || videojs.util.mergeOptions;
|
||
|
|
let defaults = {
|
||
|
|
mediaDataSource: {},
|
||
|
|
config: {}
|
||
|
|
};
|
||
|
|
|
||
|
|
class Flvjs extends Html5 {
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Create an instance of this Tech.
|
||
|
|
*
|
||
|
|
* @param {Object} [options]
|
||
|
|
* The key/value store of player options.
|
||
|
|
*
|
||
|
|
* @param {Component~ReadyCallback} ready
|
||
|
|
* Callback function to call when the `Flvjs` Tech is ready.
|
||
|
|
*/
|
||
|
|
constructor(options, ready) {
|
||
|
|
options = mergeOptions(defaults, options);
|
||
|
|
super(options, ready);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* A getter/setter for the `Flvjs` Tech's source object.
|
||
|
|
*
|
||
|
|
* @param {Tech~SourceObject} [src]
|
||
|
|
* The source object you want to set on the `Flvjs` techs.
|
||
|
|
*
|
||
|
|
* @return {Tech~SourceObject|undefined}
|
||
|
|
* - The current source object when a source is not passed in.
|
||
|
|
* - undefined when setting
|
||
|
|
*/
|
||
|
|
setSrc(src) {
|
||
|
|
if (this.flvPlayer) {
|
||
|
|
// Is this necessary to change source?
|
||
|
|
this.flvPlayer.detachMediaElement();
|
||
|
|
this.flvPlayer.destroy();
|
||
|
|
}
|
||
|
|
|
||
|
|
const mediaDataSource = this.options_.mediaDataSource;
|
||
|
|
const config = this.options_.config;
|
||
|
|
|
||
|
|
mediaDataSource.type = mediaDataSource.type === undefined ? 'flv' : mediaDataSource.type;
|
||
|
|
mediaDataSource.url = src;
|
||
|
|
// const features = flv265.getFeatureList()
|
||
|
|
// console.log("features = ", features.nativeMP4H265Playback)
|
||
|
|
// if (features.nativeMP4H265Playback) this.flvPlayer = flv265.createPlayer(mediaDataSource, config);
|
||
|
|
// else this.flvPlayer = flvjs.createPlayer(mediaDataSource, config);
|
||
|
|
this.flvPlayer = flvjs.createPlayer(mediaDataSource, config);
|
||
|
|
this.flvPlayer.attachMediaElement(this.el_);
|
||
|
|
this.flvPlayer.load();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Dispose of flvjs.
|
||
|
|
*/
|
||
|
|
dispose() {
|
||
|
|
if (this.flvPlayer) {
|
||
|
|
this.flvPlayer.detachMediaElement();
|
||
|
|
this.flvPlayer.destroy();
|
||
|
|
}
|
||
|
|
super.dispose();
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Check if the Flvjs tech is currently supported.
|
||
|
|
*
|
||
|
|
* @return {boolean}
|
||
|
|
* - True if the Flvjs tech is supported.
|
||
|
|
* - False otherwise.
|
||
|
|
*/
|
||
|
|
Flvjs.isSupported = function () {
|
||
|
|
|
||
|
|
return flvjs && flvjs.isSupported();
|
||
|
|
};
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Flvjs supported mime types.
|
||
|
|
*
|
||
|
|
* @constant {Object}
|
||
|
|
*/
|
||
|
|
Flvjs.formats = {
|
||
|
|
'video/flv': 'FLV',
|
||
|
|
'video/x-flv': 'FLV'
|
||
|
|
};
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Check if the tech can support the given type
|
||
|
|
*
|
||
|
|
* @param {string} type
|
||
|
|
* The mimetype to check
|
||
|
|
* @return {string} 'probably', 'maybe', or '' (empty string)
|
||
|
|
*/
|
||
|
|
Flvjs.canPlayType = function (type) {
|
||
|
|
if (Flvjs.isSupported() && type in Flvjs.formats) {
|
||
|
|
return 'maybe';
|
||
|
|
}
|
||
|
|
|
||
|
|
return '';
|
||
|
|
};
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Check if the tech can support the given source
|
||
|
|
* @param {Object} srcObj
|
||
|
|
* The source object
|
||
|
|
* @param {Object} options
|
||
|
|
* The options passed to the tech
|
||
|
|
* @return {string} 'probably', 'maybe', or '' (empty string)
|
||
|
|
*/
|
||
|
|
Flvjs.canPlaySource = function (srcObj, options) {
|
||
|
|
return Flvjs.canPlayType(srcObj.type);
|
||
|
|
};
|
||
|
|
|
||
|
|
// Include the version number.
|
||
|
|
Flvjs.VERSION = '__VERSION__';
|
||
|
|
|
||
|
|
videojs.registerTech('Flvjs', Flvjs);
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @file plugin.js
|
||
|
|
*/
|
||
|
|
|
||
|
|
const Hls = window.Hls
|
||
|
|
|
||
|
|
class Hlsjs extends Html5 {
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Create an instance of this Tech.
|
||
|
|
*
|
||
|
|
* @param {Object} [options]
|
||
|
|
* The key/value store of player options.
|
||
|
|
*
|
||
|
|
* @param {Component~ReadyCallback} ready
|
||
|
|
* Callback function to call when the `Hlsjs` Tech is ready.
|
||
|
|
*/
|
||
|
|
constructor(options, ready) {
|
||
|
|
options = videojs.obj.merge(defaults, options);
|
||
|
|
super(options, ready);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* A getter/setter for the `Hlsjs` Tech's source object.
|
||
|
|
*
|
||
|
|
* @param {Tech~SourceObject} [src]
|
||
|
|
* The source object you want to set on the `Hlsjs` techs.
|
||
|
|
*
|
||
|
|
* @return {Tech~SourceObject|undefined}
|
||
|
|
* - The current source object when a source is not passed in.
|
||
|
|
* - undefined when setting
|
||
|
|
*/
|
||
|
|
setSrc(src) {
|
||
|
|
if (this.hlsPlayer) {
|
||
|
|
this.hlsPlayer.detachMedia();
|
||
|
|
this.hlsPlayer.destroy();
|
||
|
|
}
|
||
|
|
this.src_ = src
|
||
|
|
this.hlsPlayer = new Hls();
|
||
|
|
this.hlsPlayer.attachMedia(this.el_);
|
||
|
|
this.hlsPlayer.loadSource(this.src_);
|
||
|
|
this.hlsPlayer.once(Hls.Events.LEVEL_PTS_UPDATED, (event, data) => this.isLive_ = data.details.live) // 设置直播状态
|
||
|
|
}
|
||
|
|
|
||
|
|
autoplay() {
|
||
|
|
return this.options_.autoplay;
|
||
|
|
}
|
||
|
|
|
||
|
|
currentSrc() {
|
||
|
|
if (this.hlsPlayer) return this.hlsPlayer.url;
|
||
|
|
return this.el_.currentSrc;
|
||
|
|
}
|
||
|
|
|
||
|
|
setCurrentTime(seconds) {
|
||
|
|
this.el_.currentTime = seconds;
|
||
|
|
}
|
||
|
|
|
||
|
|
play() {
|
||
|
|
this.el_.play();
|
||
|
|
}
|
||
|
|
|
||
|
|
duration() {
|
||
|
|
if (this.isLive_) return Infinity
|
||
|
|
else return this.el_.duration
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Dispose of Hlsjs.
|
||
|
|
*/
|
||
|
|
dispose() {
|
||
|
|
if (this.hlsPlayer) {
|
||
|
|
this.hlsPlayer.detachMedia();
|
||
|
|
this.hlsPlayer.destroy();
|
||
|
|
}
|
||
|
|
super.dispose();
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Check if the Hlsjs tech is currently supported.
|
||
|
|
*
|
||
|
|
* @return {boolean}
|
||
|
|
* - True if the Hlsjs tech is supported.
|
||
|
|
* - False otherwise.
|
||
|
|
*/
|
||
|
|
Hlsjs.isSupported = function () {
|
||
|
|
return Hls && Hls.isSupported();
|
||
|
|
};
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Check if the tech can support the given source
|
||
|
|
* @param {Object} srcObj
|
||
|
|
* The source object
|
||
|
|
* @param {Object} options
|
||
|
|
* The options passed to the tech
|
||
|
|
* @return {string} 'probably', 'maybe', or '' (empty string)
|
||
|
|
*/
|
||
|
|
// Hlsjs.canPlaySource = function (srcObj, options) {
|
||
|
|
// return Hlsjs.canPlayType(srcObj.type);
|
||
|
|
// };
|
||
|
|
|
||
|
|
// Include the version number.
|
||
|
|
Hlsjs.VERSION = '1.0.0';
|
||
|
|
|
||
|
|
videojs.registerTech('Hlsjs', Hlsjs);
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/*! videojs-resolution-switcher - 2015-7-26
|
||
|
|
* Copyright (c) 2016 Kasper Moskwiak
|
||
|
|
* Modified by Pierre Kraft
|
||
|
|
* Licensed under the Apache-2.0 license. */
|
||
|
|
|
||
|
|
(function() {
|
||
|
|
/* jshint eqnull: true*/
|
||
|
|
/* global require */
|
||
|
|
'use strict';
|
||
|
|
var videojs = null;
|
||
|
|
if(typeof window.videojs === 'undefined' && typeof require === 'function') {
|
||
|
|
videojs = require('video.js');
|
||
|
|
} else {
|
||
|
|
videojs = window.videojs;
|
||
|
|
}
|
||
|
|
|
||
|
|
(function(window, videojs) {
|
||
|
|
|
||
|
|
|
||
|
|
var defaults = {},
|
||
|
|
videoJsResolutionSwitcher,
|
||
|
|
currentResolution = {}, // stores current resolution
|
||
|
|
menuItemsHolder = {}; // stores menuItems
|
||
|
|
|
||
|
|
function setSourcesSanitized(player, sources, label, customSourcePicker) {
|
||
|
|
currentResolution = {
|
||
|
|
label: label,
|
||
|
|
sources: sources
|
||
|
|
};
|
||
|
|
if(typeof customSourcePicker === 'function'){
|
||
|
|
return customSourcePicker(player, sources, label);
|
||
|
|
}
|
||
|
|
return player.src(sources.map(function(src) {
|
||
|
|
return {src: src.src, type: src.type, res: src.res};
|
||
|
|
}));
|
||
|
|
}
|
||
|
|
|
||
|
|
/*
|
||
|
|
* Resolution menu item
|
||
|
|
*/
|
||
|
|
var MenuItem = videojs.getComponent('MenuItem');
|
||
|
|
|
||
|
|
// const Component = videojs.getComponent('Component');
|
||
|
|
|
||
|
|
class ResolutionMenuItem extends MenuItem {
|
||
|
|
constructor(player, options, onClickListener, label){
|
||
|
|
super(player, options, onClickListener, label)
|
||
|
|
this.onClickListener = onClickListener;
|
||
|
|
this.label = label;
|
||
|
|
// Sets this.player_, this.options_ and initializes the component
|
||
|
|
MenuItem.call(this, player, options);
|
||
|
|
this.src = options.src;
|
||
|
|
|
||
|
|
this.on('click', this.onClick);
|
||
|
|
this.on('touchstart', this.onClick);
|
||
|
|
|
||
|
|
if (options.initialySelected) {
|
||
|
|
this.showAsLabel();
|
||
|
|
this.selected(true);
|
||
|
|
|
||
|
|
this.addClass('vjs-selected');
|
||
|
|
}
|
||
|
|
}
|
||
|
|
showAsLabel() {
|
||
|
|
// Change menu button label to the label of this item if the menu button label is provided
|
||
|
|
if(this.label) {
|
||
|
|
this.label.innerHTML = this.options_.label;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
onClick(customSourcePicker){
|
||
|
|
this.onClickListener(this);
|
||
|
|
// Remember player state
|
||
|
|
var currentTime = this.player_.currentTime();
|
||
|
|
var isPaused = this.player_.paused();
|
||
|
|
this.showAsLabel();
|
||
|
|
|
||
|
|
// add .current class
|
||
|
|
this.addClass('vjs-selected');
|
||
|
|
|
||
|
|
// Hide bigPlayButton
|
||
|
|
if(!isPaused){
|
||
|
|
this.player_.bigPlayButton.hide();
|
||
|
|
}
|
||
|
|
if(typeof customSourcePicker !== 'function' &&
|
||
|
|
typeof this.options_.customSourcePicker === 'function'){
|
||
|
|
customSourcePicker = this.options_.customSourcePicker;
|
||
|
|
}
|
||
|
|
// Change player source and wait for loadeddata event, then play video
|
||
|
|
// loadedmetadata doesn't work right now for flash.
|
||
|
|
// Probably because of https://github.com/videojs/video-js-swf/issues/124
|
||
|
|
// If player preload is 'none' and then loadeddata not fired. So, we need timeupdate event for seek handle (timeupdate doesn't work properly with flash)
|
||
|
|
var handleSeekEvent = 'loadeddata';
|
||
|
|
if(this.player_.techName_ !== 'Youtube' && this.player_.preload() === 'none' && this.player_.techName_ !== 'Flash') {
|
||
|
|
handleSeekEvent = 'timeupdate';
|
||
|
|
}
|
||
|
|
setSourcesSanitized(this.player_, this.src, this.options_.label, customSourcePicker)
|
||
|
|
this.player_.one(handleSeekEvent, function() {
|
||
|
|
this.player_.currentTime(currentTime);
|
||
|
|
this.player_.handleTechSeeked_();
|
||
|
|
this.player_.trigger('resolutionchange');
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|
||
|
|
videojs.registerComponent('ResolutionMenuItem', ResolutionMenuItem);
|
||
|
|
|
||
|
|
// var ResolutionMenuItem = videojs.extend(MenuItem, {
|
||
|
|
// constructor: function(player, options, onClickListener, label){
|
||
|
|
// this.onClickListener = onClickListener;
|
||
|
|
// this.label = label;
|
||
|
|
// // Sets this.player_, this.options_ and initializes the component
|
||
|
|
// MenuItem.call(this, player, options);
|
||
|
|
// this.src = options.src;
|
||
|
|
//
|
||
|
|
// this.on('click', this.onClick);
|
||
|
|
// this.on('touchstart', this.onClick);
|
||
|
|
//
|
||
|
|
// if (options.initialySelected) {
|
||
|
|
// this.showAsLabel();
|
||
|
|
// this.selected(true);
|
||
|
|
//
|
||
|
|
// this.addClass('vjs-selected');
|
||
|
|
// }
|
||
|
|
// },
|
||
|
|
// showAsLabel: function() {
|
||
|
|
// // Change menu button label to the label of this item if the menu button label is provided
|
||
|
|
// if(this.label) {
|
||
|
|
// this.label.innerHTML = this.options_.label;
|
||
|
|
// }
|
||
|
|
// },
|
||
|
|
// onClick: function(customSourcePicker){
|
||
|
|
// this.onClickListener(this);
|
||
|
|
// // Remember player state
|
||
|
|
// var currentTime = this.player_.currentTime();
|
||
|
|
// var isPaused = this.player_.paused();
|
||
|
|
// this.showAsLabel();
|
||
|
|
//
|
||
|
|
// // add .current class
|
||
|
|
// this.addClass('vjs-selected');
|
||
|
|
//
|
||
|
|
// // Hide bigPlayButton
|
||
|
|
// if(!isPaused){
|
||
|
|
// this.player_.bigPlayButton.hide();
|
||
|
|
// }
|
||
|
|
// if(typeof customSourcePicker !== 'function' &&
|
||
|
|
// typeof this.options_.customSourcePicker === 'function'){
|
||
|
|
// customSourcePicker = this.options_.customSourcePicker;
|
||
|
|
// }
|
||
|
|
// // Change player source and wait for loadeddata event, then play video
|
||
|
|
// // loadedmetadata doesn't work right now for flash.
|
||
|
|
// // Probably because of https://github.com/videojs/video-js-swf/issues/124
|
||
|
|
// // If player preload is 'none' and then loadeddata not fired. So, we need timeupdate event for seek handle (timeupdate doesn't work properly with flash)
|
||
|
|
// var handleSeekEvent = 'loadeddata';
|
||
|
|
// if(this.player_.techName_ !== 'Youtube' && this.player_.preload() === 'none' && this.player_.techName_ !== 'Flash') {
|
||
|
|
// handleSeekEvent = 'timeupdate';
|
||
|
|
// }
|
||
|
|
// setSourcesSanitized(this.player_, this.src, this.options_.label, customSourcePicker)
|
||
|
|
// this.player_.one(handleSeekEvent, function() {
|
||
|
|
// this.player_.currentTime(currentTime);
|
||
|
|
// this.player_.handleTechSeeked_();
|
||
|
|
// this.player_.trigger('resolutionchange');
|
||
|
|
// });
|
||
|
|
// }
|
||
|
|
// });
|
||
|
|
|
||
|
|
|
||
|
|
/*
|
||
|
|
* Resolution menu button
|
||
|
|
*/
|
||
|
|
var MenuButton = videojs.getComponent('MenuButton');
|
||
|
|
class ResolutionMenuButton extends MenuButton {
|
||
|
|
constructor(player, options, settings, label){
|
||
|
|
super(player, options, settings, label)
|
||
|
|
this.sources = options.sources;
|
||
|
|
this.label = label;
|
||
|
|
this.label.innerHTML = options.initialySelectedLabel;
|
||
|
|
// Sets this.player_, this.options_ and initializes the component
|
||
|
|
MenuButton.call(this, player, options, settings);
|
||
|
|
this.controlText('Quality');
|
||
|
|
|
||
|
|
if(settings.dynamicLabel){
|
||
|
|
this.el().appendChild(label);
|
||
|
|
}else{
|
||
|
|
var staticLabel = document.createElement('span');
|
||
|
|
videojs.dom.addClass(staticLabel, 'vjs-resolution-button-staticlabel');
|
||
|
|
this.el().appendChild(staticLabel);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
createItems(){
|
||
|
|
var menuItems = [];
|
||
|
|
var labels = (this.sources && this.sources.label) || {};
|
||
|
|
var onClickUnselectOthers = function(clickedItem) {
|
||
|
|
menuItems.map(function(item) {
|
||
|
|
item.selected(item === clickedItem);
|
||
|
|
item.removeClass('vjs-selected');
|
||
|
|
});
|
||
|
|
};
|
||
|
|
|
||
|
|
for (var key in labels) {
|
||
|
|
if (labels.hasOwnProperty(key)) {
|
||
|
|
menuItems.push(new ResolutionMenuItem(
|
||
|
|
this.player_,
|
||
|
|
{
|
||
|
|
label: key,
|
||
|
|
src: labels[key],
|
||
|
|
initialySelected: key === this.options_.initialySelectedLabel,
|
||
|
|
customSourcePicker: this.options_.customSourcePicker
|
||
|
|
},
|
||
|
|
onClickUnselectOthers,
|
||
|
|
this.label));
|
||
|
|
// Store menu item for API calls
|
||
|
|
menuItemsHolder[key] = menuItems[menuItems.length - 1];
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return menuItems;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
videojs.registerComponent('ResolutionMenuButton', ResolutionMenuButton);
|
||
|
|
// var ResolutionMenuButton = videojs.extend(MenuButton, {
|
||
|
|
// constructor: function(player, options, settings, label){
|
||
|
|
// this.sources = options.sources;
|
||
|
|
// this.label = label;
|
||
|
|
// this.label.innerHTML = options.initialySelectedLabel;
|
||
|
|
// // Sets this.player_, this.options_ and initializes the component
|
||
|
|
// MenuButton.call(this, player, options, settings);
|
||
|
|
// this.controlText('Quality');
|
||
|
|
//
|
||
|
|
// if(settings.dynamicLabel){
|
||
|
|
// this.el().appendChild(label);
|
||
|
|
// }else{
|
||
|
|
// var staticLabel = document.createElement('span');
|
||
|
|
// videojs.dom.addClass(staticLabel, 'vjs-resolution-button-staticlabel');
|
||
|
|
// this.el().appendChild(staticLabel);
|
||
|
|
// }
|
||
|
|
// },
|
||
|
|
// createItems: function(){
|
||
|
|
// var menuItems = [];
|
||
|
|
// var labels = (this.sources && this.sources.label) || {};
|
||
|
|
// var onClickUnselectOthers = function(clickedItem) {
|
||
|
|
// menuItems.map(function(item) {
|
||
|
|
// item.selected(item === clickedItem);
|
||
|
|
// item.removeClass('vjs-selected');
|
||
|
|
// });
|
||
|
|
// };
|
||
|
|
//
|
||
|
|
// for (var key in labels) {
|
||
|
|
// if (labels.hasOwnProperty(key)) {
|
||
|
|
// menuItems.push(new ResolutionMenuItem(
|
||
|
|
// this.player_,
|
||
|
|
// {
|
||
|
|
// label: key,
|
||
|
|
// src: labels[key],
|
||
|
|
// initialySelected: key === this.options_.initialySelectedLabel,
|
||
|
|
// customSourcePicker: this.options_.customSourcePicker
|
||
|
|
// },
|
||
|
|
// onClickUnselectOthers,
|
||
|
|
// this.label));
|
||
|
|
// // Store menu item for API calls
|
||
|
|
// menuItemsHolder[key] = menuItems[menuItems.length - 1];
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
// return menuItems;
|
||
|
|
// }
|
||
|
|
// });
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Initialize the plugin.
|
||
|
|
* @param {object} [options] configuration for the plugin
|
||
|
|
*/
|
||
|
|
videoJsResolutionSwitcher = function(options) {
|
||
|
|
var settings = videojs.mergeOptions(defaults, options),
|
||
|
|
player = this,
|
||
|
|
label = document.createElement('span'),
|
||
|
|
groupedSrc = {};
|
||
|
|
|
||
|
|
videojs.dom.addClass(label, 'vjs-resolution-button-label');
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Updates player sources or returns current source URL
|
||
|
|
* @param {Array} [src] array of sources [{src: '', type: '', label: '', res: ''}]
|
||
|
|
* @returns {Object|String|Array} videojs player object if used as setter or current source URL, object, or array of sources
|
||
|
|
*/
|
||
|
|
player.updateSrc = function(src){
|
||
|
|
//Return current src if src is not given
|
||
|
|
if(!src){ return player.src(); }
|
||
|
|
// Dispose old resolution menu button before adding new sources
|
||
|
|
if(player.controlBar.resolutionSwitcher){
|
||
|
|
player.controlBar.resolutionSwitcher.dispose();
|
||
|
|
delete player.controlBar.resolutionSwitcher;
|
||
|
|
}
|
||
|
|
//Sort sources
|
||
|
|
src = src.sort(compareResolutions);
|
||
|
|
groupedSrc = bucketSources(src);
|
||
|
|
var choosen = chooseSrc(groupedSrc, src);
|
||
|
|
var menuButton = new ResolutionMenuButton(player, { sources: groupedSrc, initialySelectedLabel: choosen.label , initialySelectedRes: choosen.res , customSourcePicker: settings.customSourcePicker}, settings, label);
|
||
|
|
videojs.dom.addClass(menuButton.el(), 'vjs-resolution-button');
|
||
|
|
player.controlBar.resolutionSwitcher = player.controlBar.el_.insertBefore(menuButton.el_, player.controlBar.getChild('fullscreenToggle').el_);
|
||
|
|
player.controlBar.resolutionSwitcher.dispose = function(){
|
||
|
|
this.parentNode.removeChild(this);
|
||
|
|
};
|
||
|
|
return setSourcesSanitized(player, choosen.sources, choosen.label);
|
||
|
|
};
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Returns current resolution or sets one when label is specified
|
||
|
|
* @param {String} [label] label name
|
||
|
|
* @param {Function} [customSourcePicker] custom function to choose source. Takes 3 arguments: player, sources, label. Must return player object.
|
||
|
|
* @returns {Object} current resolution object {label: '', sources: []} if used as getter or player object if used as setter
|
||
|
|
*/
|
||
|
|
player.currentResolution = function(label, customSourcePicker){
|
||
|
|
if(label == null) { return currentResolution; }
|
||
|
|
if(menuItemsHolder[label] != null){
|
||
|
|
menuItemsHolder[label].onClick(customSourcePicker);
|
||
|
|
}
|
||
|
|
return player;
|
||
|
|
};
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Returns grouped sources by label, resolution and type
|
||
|
|
* @returns {Object} grouped sources: { label: { key: [] }, res: { key: [] }, type: { key: [] } }
|
||
|
|
*/
|
||
|
|
player.getGroupedSrc = function(){
|
||
|
|
return groupedSrc;
|
||
|
|
};
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method used for sorting list of sources
|
||
|
|
* @param {Object} a - source object with res property
|
||
|
|
* @param {Object} b - source object with res property
|
||
|
|
* @returns {Number} result of comparation
|
||
|
|
*/
|
||
|
|
function compareResolutions(a, b){
|
||
|
|
if(!a.res || !b.res){ return 0; }
|
||
|
|
return (+b.res)-(+a.res);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Group sources by label, resolution and type
|
||
|
|
* @param {Array} src Array of sources
|
||
|
|
* @returns {Object} grouped sources: { label: { key: [] }, res: { key: [] }, type: { key: [] } }
|
||
|
|
*/
|
||
|
|
function bucketSources(src){
|
||
|
|
var resolutions = {
|
||
|
|
label: {},
|
||
|
|
res: {},
|
||
|
|
type: {}
|
||
|
|
};
|
||
|
|
src.map(function(source) {
|
||
|
|
initResolutionKey(resolutions, 'label', source);
|
||
|
|
initResolutionKey(resolutions, 'res', source);
|
||
|
|
initResolutionKey(resolutions, 'type', source);
|
||
|
|
|
||
|
|
appendSourceToKey(resolutions, 'label', source);
|
||
|
|
appendSourceToKey(resolutions, 'res', source);
|
||
|
|
appendSourceToKey(resolutions, 'type', source);
|
||
|
|
});
|
||
|
|
return resolutions;
|
||
|
|
}
|
||
|
|
|
||
|
|
function initResolutionKey(resolutions, key, source) {
|
||
|
|
if(resolutions[key][source[key]] == null) {
|
||
|
|
resolutions[key][source[key]] = [];
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
function appendSourceToKey(resolutions, key, source) {
|
||
|
|
resolutions[key][source[key]].push(source);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Choose src if option.default is specified
|
||
|
|
* @param {Object} groupedSrc {res: { key: [] }}
|
||
|
|
* @param {Array} src Array of sources sorted by resolution used to find high and low res
|
||
|
|
* @returns {Object} {res: string, sources: []}
|
||
|
|
*/
|
||
|
|
function chooseSrc(groupedSrc, src){
|
||
|
|
var selectedRes = settings['default']; // use array access as default is a reserved keyword
|
||
|
|
var selectedLabel = '';
|
||
|
|
if (selectedRes === 'high') {
|
||
|
|
selectedRes = src[0].res;
|
||
|
|
selectedLabel = src[0].label;
|
||
|
|
} else if (selectedRes === 'low' || selectedRes == null || !groupedSrc.res[selectedRes]) {
|
||
|
|
// Select low-res if default is low or not set
|
||
|
|
selectedRes = src[src.length - 1].res;
|
||
|
|
selectedLabel = src[src.length -1].label;
|
||
|
|
} else if (groupedSrc.res[selectedRes]) {
|
||
|
|
selectedLabel = groupedSrc.res[selectedRes][0].label;
|
||
|
|
}
|
||
|
|
|
||
|
|
return {res: selectedRes, label: selectedLabel, sources: groupedSrc.res[selectedRes]};
|
||
|
|
}
|
||
|
|
|
||
|
|
function initResolutionForYt(player){
|
||
|
|
// Init resolution
|
||
|
|
player.tech_.ytPlayer.setPlaybackQuality('default');
|
||
|
|
|
||
|
|
// Capture events
|
||
|
|
player.tech_.ytPlayer.addEventListener('onPlaybackQualityChange', function(){
|
||
|
|
player.trigger('resolutionchange');
|
||
|
|
});
|
||
|
|
|
||
|
|
// We must wait for play event
|
||
|
|
player.one('play', function(){
|
||
|
|
var qualities = player.tech_.ytPlayer.getAvailableQualityLevels();
|
||
|
|
// Map youtube qualities names
|
||
|
|
var _yts = {
|
||
|
|
highres: {res: 1080, label: '1080', yt: 'highres'},
|
||
|
|
hd1080: {res: 1080, label: '1080', yt: 'hd1080'},
|
||
|
|
hd720: {res: 720, label: '720', yt: 'hd720'},
|
||
|
|
large: {res: 480, label: '480', yt: 'large'},
|
||
|
|
medium: {res: 360, label: '360', yt: 'medium'},
|
||
|
|
small: {res: 240, label: '240', yt: 'small'},
|
||
|
|
tiny: {res: 144, label: '144', yt: 'tiny'},
|
||
|
|
auto: {res: 0, label: 'auto', yt: 'default'}
|
||
|
|
};
|
||
|
|
|
||
|
|
var _sources = [];
|
||
|
|
|
||
|
|
qualities.map(function(q){
|
||
|
|
_sources.push({
|
||
|
|
src: player.src().src,
|
||
|
|
type: player.src().type,
|
||
|
|
label: _yts[q].label,
|
||
|
|
res: _yts[q].res,
|
||
|
|
_yt: _yts[q].yt
|
||
|
|
});
|
||
|
|
});
|
||
|
|
|
||
|
|
groupedSrc = bucketSources(_sources);
|
||
|
|
|
||
|
|
// Overwrite defualt sourcePicer function
|
||
|
|
var _customSourcePicker = function(_player, _sources, _label){
|
||
|
|
player.tech_.ytPlayer.setPlaybackQuality(_sources[0]._yt);
|
||
|
|
return player;
|
||
|
|
};
|
||
|
|
|
||
|
|
var choosen = {label: 'auto', res: 0, sources: groupedSrc.label.auto};
|
||
|
|
var menuButton = new ResolutionMenuButton(player, {
|
||
|
|
sources: groupedSrc,
|
||
|
|
initialySelectedLabel: choosen.label,
|
||
|
|
initialySelectedRes: choosen.res,
|
||
|
|
customSourcePicker: _customSourcePicker
|
||
|
|
}, settings, label);
|
||
|
|
|
||
|
|
menuButton.el().classList.add('vjs-resolution-button');
|
||
|
|
player.controlBar.resolutionSwitcher = player.controlBar.addChild(menuButton);
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
player.ready(function(){
|
||
|
|
if(player.options_.sources.length > 1){
|
||
|
|
// tech: Html5 and Flash
|
||
|
|
// Create resolution switcher for videos form <source> tag inside <video>
|
||
|
|
player.updateSrc(player.options_.sources);
|
||
|
|
}
|
||
|
|
|
||
|
|
if(player.techName_ === 'Youtube'){
|
||
|
|
// tech: YouTube
|
||
|
|
initResolutionForYt(player);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
};
|
||
|
|
|
||
|
|
// register the plugin
|
||
|
|
videojs.registerPlugin('videoJsResolutionSwitcher', videoJsResolutionSwitcher);
|
||
|
|
})(window, videojs);
|
||
|
|
})();
|