cloudinary-video-player
Version:
Cloudinary Video Player
1 lines • 722 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("cloudinary-core")):"function"==typeof define&&define.amd?define(["cloudinary-core"],t):"object"==typeof exports?exports.cloudinaryVideoPlayer=t(require("cloudinary-core")):e.cloudinaryVideoPlayer=t(e.cloudinary)}(window,function(e){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=45)}([function(e,t,n){(function(t){var n;n="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{},e.exports=n}).call(this,n(4))},function(e,t,n){(function(t){var i,r=void 0!==t?t:"undefined"!=typeof window?window:{},a=n(61);"undefined"!=typeof document?i=document:(i=r["__GLOBAL_DOCUMENT_CACHE@4"])||(i=r["__GLOBAL_DOCUMENT_CACHE@4"]=a),e.exports=i}).call(this,n(4))},function(e,t,n){(function(t){e.exports=t.videojs=n(142)}).call(this,n(4))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Object.assign?Object.assign.apply(Object,[e].concat(n)):(n.forEach(function(t){t&&Object.keys(t).forEach(function(n){var i=t[n];e[n]=i})}),e)};t.default=i},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";function i(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];return i.reduce(function(n,i){return Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i],t&&delete e[i]),n},{})}Object.defineProperty(t,"__esModule",{value:!0}),t.sliceProperties=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return i.apply(void 0,[e,!1].concat(n))},t.sliceAndUnsetProperties=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return i.apply(void 0,[e,!0].concat(n))},t.exceptProperties=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];var r=n.reduce(function(e,t){return e[t]=!0,e},{});return Object.keys(e).reduce(function(t,n){return Object.prototype.hasOwnProperty.call(r,n)||(t[n]=e[n]),t},{})}},function(e,t,n){"use strict";var i=function(){this.init=function(){var e={};this.on=function(t,n){e[t]||(e[t]=[]),e[t]=e[t].concat(n)},this.off=function(t,n){var i;return!!e[t]&&(i=e[t].indexOf(n),e[t]=e[t].slice(),e[t].splice(i,1),i>-1)},this.trigger=function(t){var n,i,r,a;if(n=e[t])if(2===arguments.length)for(r=n.length,i=0;i<r;++i)n[i].call(this,arguments[1]);else{for(a=[],i=arguments.length,i=1;i<arguments.length;++i)a.push(arguments[i]);for(r=n.length,i=0;i<r;++i)n[i].apply(this,a)}},this.dispose=function(){e={}}}};i.prototype.pipe=function(e){return this.on("data",function(t){e.push(t)}),this.on("done",function(t){e.flush(t)}),e},i.prototype.push=function(e){this.trigger("data",e)},i.prototype.flush=function(e){this.trigger("done",e)},e.exports=i},function(e,t,n){"use strict";var i,r,a,o,s,u=n(62).toUnsigned;i=function(e,t){var n,a,o,s,l,c=[];if(!t.length)return null;for(n=0;n<e.byteLength;)a=u(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3]),o=r(e.subarray(n+4,n+8)),s=a>1?n+a:e.byteLength,o===t[0]&&(1===t.length?c.push(e.subarray(n+8,s)):(l=i(e.subarray(n+8,s),t.slice(1))).length&&(c=c.concat(l))),n=s;return c},r=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3])},a=function(e){return i(e,["moov","trak"]).reduce(function(e,t){var n,r,a,o,s;return(n=i(t,["tkhd"])[0])?(r=n[0],o=u(n[a=0===r?12:20]<<24|n[a+1]<<16|n[a+2]<<8|n[a+3]),(s=i(t,["mdia","mdhd"])[0])?(a=0===(r=s[0])?12:20,e[o]=u(s[a]<<24|s[a+1]<<16|s[a+2]<<8|s[a+3]),e):null):null},{})},o=function(e,t){var n,r,a;return n=i(t,["moof","traf"]),r=[].concat.apply([],n.map(function(t){return i(t,["tfhd"]).map(function(n){var r,a;return r=u(n[4]<<24|n[5]<<16|n[6]<<8|n[7]),a=e[r]||9e4,(i(t,["tfdt"]).map(function(e){var t,n;return t=e[0],n=u(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),1===t&&(n*=Math.pow(2,32),n+=u(e[8]<<24|e[9]<<16|e[10]<<8|e[11])),n})[0]||1/0)/a})})),a=Math.min.apply(null,r),isFinite(a)?a:0},s=function(e){var t=i(e,["moov","trak"]),n=[];return t.forEach(function(e){var t=i(e,["mdia","hdlr"]),a=i(e,["tkhd"]);t.forEach(function(e,t){var i,o,s=r(e.subarray(8,12)),u=a[t];"vide"===s&&(o=0===(i=new DataView(u.buffer,u.byteOffset,u.byteLength)).getUint8(0)?i.getUint32(12):i.getUint32(20),n.push(o))})}),n},e.exports={findBox:i,parseType:r,timescale:a,startTime:o,videoTrackIds:s}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cloudinaryErrorsConverter=t.mergeTransformation=t.mergeCloudinaryConfig=t.isSrcEqual=t.normalizeOptions=void 0;var i=n(5),r=n(12),a=s(n(9)),o=s(n(3));function s(e){return e&&e.__esModule?e:{default:e}}function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}t.normalizeOptions=function(e,t){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).tolerateMissingId,a=void 0!==n&&n;if((0,r.isPlainObject)(e)){var s=(0,o.default)({},e);if(e=(0,i.sliceAndUnsetProperties)(s,"publicId").publicId,!(0,r.isString)(e)&&!a)throw new Error("Source is missing 'publicId'.");t&&(t=(0,o.default)({},s,t))}return{publicId:e,options:t}};t.isSrcEqual=function(e,t){var n=e,i=t;return"object"===u(e)&&(n=e.src),"object"===u(t)&&(i=t.src),/^\/\//.test(n)&&(i=i.slice(i.indexOf("//"))),/^\/\//.test(i)&&(n=n.slice(n.indexOf("//"))),n===i};t.mergeCloudinaryConfig=function(e,t){"Cloudinary"===e.constructor.name&&e.config&&(e=e.config());var n=new a.default.Cloudinary(e);return"Cloudinary"===t.constructor.name&&t.config&&(t=e.config()),n.config(t)};t.mergeTransformation=function(e,t){return"Transformation"===e.constructor.name&&e.toOptions&&(e=e.toOptions()),new a.default.Transformation(e).fromOptions(t)};t.cloudinaryErrorsConverter=function(e,t,n){var i="Video cannot be played -",r={code:10,message:"".concat(i," ").concat(e)},a=e.toLowerCase();return a.startsWith("unknown customer")&&(r.code=11,r.message="".concat(i," Unknown cloud-name ").concat(n)),a.startsWith("resource not found")&&(r.code=12,r.message="".concat(i," Public ID ").concat(t," not found")),a.startsWith("private resource")&&(r.code=13,r.message="".concat(i," Private video")),a.startsWith("unauthenticated access")&&(r.message="".concat(i," Requires authentication"),r.code=14),r}},function(t,n){t.exports=e},function(e,t,n){"use strict";e.exports={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21}},function(e,t,n){"use strict";function i(e){var t=e.getBoundingClientRect(),n=document.body,i=document.documentElement,r=window.pageYOffset||i.scrollTop||n.scrollTop,a=window.pageXOffset||i.scrollLeft||n.scrollLeft,o=i.clientTop||n.clientTop||0,s=i.clientLeft||n.clientLeft||0,u=t.top+r-o,l=t.left+a-s;return{top:Math.round(u),left:Math.round(l)}}Object.defineProperty(t,"__esModule",{value:!0}),t.getElementPosition=i,t.getPointerPosition=function(e,t){var n={},r=i(e),a=e.offsetWidth,o=e.offsetHeight,s=r.top,u=r.left,l=t.pageY,c=t.pageX;t.changedTouches&&(c=t.changedTouches[0].pageX,l=t.changedTouches[0].pageY);return n.y=Math.max(0,Math.min(1,(s-l+o)/o)),n.x=Math.max(0,Math.min(1,(c-u)/a)),n},t.isElementInViewport=function(e,t){var n=t.fraction,r=i(e),a=r.left,o=r.top,s=e.offsetHeight,u=e.offsetWidth,l=a+u,c=o+s,d=Math.max(0,Math.min(u,window.pageXOffset+window.innerWidth-a,l-window.pageXOffset)),h=Math.max(0,Math.min(u,window.pageYOffset+window.innerHeight-o,c-window.pageYOffset));return d*h/(u*s)>n},t.setPosition=function(e,t,n){e.style.left="".concat(t,"px"),e.style.top="".concat(n,"px")}},function(e,t,n){"use strict";function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.isPlainObject=function(e){return null!==e&&"object"===i(e)&&"[object Object]"===Object.prototype.toString.call(e)},t.isString=function(e){return e instanceof String||"string"==typeof e},t.isInteger=function(e){return"number"==typeof e&&e%1==0}},function(e,t){function n(e){return e.replace(/\n\r?\s*/g,"")}e.exports=function(e){for(var t="",i=0;i<arguments.length;i++)t+=n(e[i])+(arguments[i+1]||"");return t}},function(e,t,n){"use strict";var i,r,a,o,s=n(6),u=n(26),l=n(63),c=n(64),d=n(67),h=n(68),f=n(70),p=n(71).H264Stream,m=n(73),y=n(15).isLikelyAacData,g=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],v=["width","height","profileIdc","levelIdc","profileCompatibility"],b=function(e,t){var n;if(e.length!==t.length)return!1;for(n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0};(r=function(e,t){var n=[],i=0,a=0,o=0,s=1/0;t=t||{},r.prototype.init.call(this),this.push=function(t){d.collectDtsInfo(e,t),e&&g.forEach(function(n){e[n]=t[n]}),n.push(t)},this.setEarliestDts=function(t){a=t-e.timelineStartInfo.baseMediaDecodeTime},this.setVideoBaseMediaDecodeTime=function(e){s=e},this.setAudioAppendStart=function(e){o=e},this.flush=function(){var r,l,h,f;0!==n.length?(r=c.trimAdtsFramesByEarliestDts(n,e,a),e.baseMediaDecodeTime=d.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),c.prefixWithSilence(e,r,o,s),e.samples=c.generateSampleTable(r),h=u.mdat(c.concatenateFrameData(r)),n=[],l=u.moof(i,[e]),f=new Uint8Array(l.byteLength+h.byteLength),i++,f.set(l),f.set(h,l.byteLength),d.clearDtsInfo(e),this.trigger("data",{track:e,boxes:f}),this.trigger("done","AudioSegmentStream")):this.trigger("done","AudioSegmentStream")}}).prototype=new s,(i=function(e,t){var n,r,a=0,o=[],s=[];t=t||{},i.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){d.collectDtsInfo(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||n||(n=t.config,e.sps=[t.data],v.forEach(function(t){e[t]=n[t]},this)),"pic_parameter_set_rbsp"!==t.nalUnitType||r||(r=t.data,e.pps=[t.data]),o.push(t)},this.flush=function(){for(var n,i,r,c,h,f;o.length&&"access_unit_delimiter_rbsp"!==o[0].nalUnitType;)o.shift();if(0===o.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(n=l.groupNalsIntoFrames(o),(r=l.groupFramesIntoGops(n))[0][0].keyFrame||((i=this.getGopForFusion_(o[0],e))?(r.unshift(i),r.byteLength+=i.byteLength,r.nalCount+=i.nalCount,r.pts=i.pts,r.dts=i.dts,r.duration+=i.duration):r=l.extendFirstKeyFrame(r)),s.length){var p;if(!(p=t.alignGopsAtEnd?this.alignGopsAtEnd_(r):this.alignGopsAtStart_(r)))return this.gopCache_.unshift({gop:r.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),o=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");d.clearDtsInfo(e),r=p}d.collectDtsInfo(e,r),e.samples=l.generateSampleTable(r),h=u.mdat(l.concatenateNalData(r)),e.baseMediaDecodeTime=d.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",r.map(function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}})),this.gopCache_.unshift({gop:r.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),o=[],this.trigger("baseMediaDecodeTime",e.baseMediaDecodeTime),this.trigger("timelineStartInfo",e.timelineStartInfo),c=u.moof(a,[e]),f=new Uint8Array(c.byteLength+h.byteLength),a++,f.set(c),f.set(h,c.byteLength),this.trigger("data",{track:e,boxes:f}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.resetStream_=function(){d.clearDtsInfo(e),n=void 0,r=void 0},this.getGopForFusion_=function(t){var n,i,r,a,o,s=1/0;for(o=0;o<this.gopCache_.length;o++)r=(a=this.gopCache_[o]).gop,e.pps&&b(e.pps[0],a.pps[0])&&e.sps&&b(e.sps[0],a.sps[0])&&(r.dts<e.timelineStartInfo.dts||(n=t.dts-r.dts-r.duration)>=-1e4&&n<=45e3&&(!i||s>n)&&(i=a,s=n));return i?i.gop:null},this.alignGopsAtStart_=function(e){var t,n,i,r,a,o,u,l;for(a=e.byteLength,o=e.nalCount,u=e.duration,t=n=0;t<s.length&&n<e.length&&(i=s[t],r=e[n],i.pts!==r.pts);)r.pts>i.pts?t++:(n++,a-=r.byteLength,o-=r.nalCount,u-=r.duration);return 0===n?e:n===e.length?null:((l=e.slice(n)).byteLength=a,l.duration=u,l.nalCount=o,l.pts=l[0].pts,l.dts=l[0].dts,l)},this.alignGopsAtEnd_=function(e){var t,n,i,r,a,o,u;for(t=s.length-1,n=e.length-1,a=null,o=!1;t>=0&&n>=0;){if(i=s[t],r=e[n],i.pts===r.pts){o=!0;break}i.pts>r.pts?t--:(t===s.length-1&&(a=n),n--)}if(!o&&null===a)return null;if(0===(u=o?n:a))return e;var l=e.slice(u),c=l.reduce(function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e},{byteLength:0,duration:0,nalCount:0});return l.byteLength=c.byteLength,l.duration=c.duration,l.nalCount=c.nalCount,l.pts=l[0].pts,l.dts=l[0].dts,l},this.alignGopsWith=function(e){s=e}}).prototype=new s,(o=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps&&(this.keepOriginalTimestamps=e.keepOriginalTimestamps),this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,o.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBoxes.push(e.boxes),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track),void("audio"===e.track.type&&(this.audioTrack=e.track)))}}).prototype=new s,o.prototype.flush=function(e){var t,n,i,r,a=0,o={captions:[],captionStreams:{},metadata:[],info:{}},s=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==e&&"AudioSegmentStream"!==e)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}for(this.videoTrack?(s=this.videoTrack.timelineStartInfo.pts,v.forEach(function(e){o.info[e]=this.videoTrack[e]},this)):this.audioTrack&&(s=this.audioTrack.timelineStartInfo.pts,g.forEach(function(e){o.info[e]=this.audioTrack[e]},this)),1===this.pendingTracks.length?o.type=this.pendingTracks[0].type:o.type="combined",this.emittedTracks+=this.pendingTracks.length,i=u.initSegment(this.pendingTracks),o.initSegment=new Uint8Array(i.byteLength),o.initSegment.set(i),o.data=new Uint8Array(this.pendingBytes),r=0;r<this.pendingBoxes.length;r++)o.data.set(this.pendingBoxes[r],a),a+=this.pendingBoxes[r].byteLength;for(r=0;r<this.pendingCaptions.length;r++)(t=this.pendingCaptions[r]).startTime=t.startPts,this.keepOriginalTimestamps||(t.startTime-=s),t.startTime/=9e4,t.endTime=t.endPts,this.keepOriginalTimestamps||(t.endTime-=s),t.endTime/=9e4,o.captionStreams[t.stream]=!0,o.captions.push(t);for(r=0;r<this.pendingMetadata.length;r++)(n=this.pendingMetadata[r]).cueTime=n.pts,this.keepOriginalTimestamps||(n.cueTime-=s),n.cueTime/=9e4,o.metadata.push(n);o.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",o),this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},(a=function(e){var t,n,s=this,u=!0;a.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var t={};this.transmuxPipeline_=t,t.type="aac",t.metadataStream=new h.MetadataStream,t.aacStream=new m,t.audioTimestampRolloverStream=new h.TimestampRolloverStream("audio"),t.timedMetadataTimestampRolloverStream=new h.TimestampRolloverStream("timed-metadata"),t.adtsStream=new f,t.coalesceStream=new o(e,t.metadataStream),t.headOfPipeline=t.aacStream,t.aacStream.pipe(t.audioTimestampRolloverStream).pipe(t.adtsStream),t.aacStream.pipe(t.timedMetadataTimestampRolloverStream).pipe(t.metadataStream).pipe(t.coalesceStream),t.metadataStream.on("timestamp",function(e){t.aacStream.setTimestamp(e.timeStamp)}),t.aacStream.on("data",function(i){"timed-metadata"!==i.type||t.audioSegmentStream||(n=n||{timelineStartInfo:{baseMediaDecodeTime:s.baseMediaDecodeTime},codec:"adts",type:"audio"},t.coalesceStream.numberOfTracks++,t.audioSegmentStream=new r(n,e),t.adtsStream.pipe(t.audioSegmentStream).pipe(t.coalesceStream))}),t.coalesceStream.on("data",this.trigger.bind(this,"data")),t.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setupTsPipeline=function(){var a={};this.transmuxPipeline_=a,a.type="ts",a.metadataStream=new h.MetadataStream,a.packetStream=new h.TransportPacketStream,a.parseStream=new h.TransportParseStream,a.elementaryStream=new h.ElementaryStream,a.videoTimestampRolloverStream=new h.TimestampRolloverStream("video"),a.audioTimestampRolloverStream=new h.TimestampRolloverStream("audio"),a.timedMetadataTimestampRolloverStream=new h.TimestampRolloverStream("timed-metadata"),a.adtsStream=new f,a.h264Stream=new p,a.captionStream=new h.CaptionStream,a.coalesceStream=new o(e,a.metadataStream),a.headOfPipeline=a.packetStream,a.packetStream.pipe(a.parseStream).pipe(a.elementaryStream),a.elementaryStream.pipe(a.videoTimestampRolloverStream).pipe(a.h264Stream),a.elementaryStream.pipe(a.audioTimestampRolloverStream).pipe(a.adtsStream),a.elementaryStream.pipe(a.timedMetadataTimestampRolloverStream).pipe(a.metadataStream).pipe(a.coalesceStream),a.h264Stream.pipe(a.captionStream).pipe(a.coalesceStream),a.elementaryStream.on("data",function(o){var u;if("metadata"===o.type){for(u=o.tracks.length;u--;)t||"video"!==o.tracks[u].type?n||"audio"!==o.tracks[u].type||((n=o.tracks[u]).timelineStartInfo.baseMediaDecodeTime=s.baseMediaDecodeTime):(t=o.tracks[u]).timelineStartInfo.baseMediaDecodeTime=s.baseMediaDecodeTime;t&&!a.videoSegmentStream&&(a.coalesceStream.numberOfTracks++,a.videoSegmentStream=new i(t,e),a.videoSegmentStream.on("timelineStartInfo",function(e){n&&(n.timelineStartInfo=e,a.audioSegmentStream.setEarliestDts(e.dts))}),a.videoSegmentStream.on("processedGopsInfo",s.trigger.bind(s,"gopInfo")),a.videoSegmentStream.on("baseMediaDecodeTime",function(e){n&&a.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),a.h264Stream.pipe(a.videoSegmentStream).pipe(a.coalesceStream)),n&&!a.audioSegmentStream&&(a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new r(n,e),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream))}}),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setBaseMediaDecodeTime=function(i){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=i),n&&(n.timelineStartInfo.dts=void 0,n.timelineStartInfo.pts=void 0,d.clearDtsInfo(n),e.keepOriginalTimestamps||(n.timelineStartInfo.baseMediaDecodeTime=i),r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity()),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[],r.videoTimestampRolloverStream.discontinuity()),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,d.clearDtsInfo(t),r.captionStream.reset(),e.keepOriginalTimestamps||(t.timelineStartInfo.baseMediaDecodeTime=i)),r.timedMetadataTimestampRolloverStream&&r.timedMetadataTimestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){n&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.push=function(e){if(u){var t=y(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),u=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){u=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new s,e.exports={Transmuxer:a,VideoSegmentStream:i,AudioSegmentStream:r,AUDIO_PROPERTIES:g,VIDEO_PROPERTIES:v}},function(e,t,n){"use strict";var i=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],r=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]};e.exports={isLikelyAacData:function(e){return e[0]==="I".charCodeAt(0)&&e[1]==="D".charCodeAt(0)&&e[2]==="3".charCodeAt(0)},parseId3TagSize:function(e,t){var n=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&e[t+5])>>4?n+20:n+10},parseAdtsSize:function(e,t){var n=(224&e[t+5])>>5,i=e[t+4]<<3;return 6144&e[t+3]|i|n},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5<e.length;){if(255===e[t]&&240==(246&e[t+1]))return i[(60&e[t+2])>>>2];t++}return null},parseAacTimestamp:function(e){var t,n,i;t=10,64&e[5]&&(t+=4,t+=r(e.subarray(10,14)));do{if((n=r(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){i=e.subarray(t+10,t+n+10);for(var a=0;a<i.byteLength;a++)if(0===i[a]){if("com.apple.streaming.transportStreamTimestamp"===unescape(function(e,t,n){var i,r="";for(i=t;i<n;i++)r+="%"+("00"+e[i].toString(16)).slice(-2);return r}(i,0,a))){var o=i.subarray(a+1),s=(1&o[3])<<30|o[4]<<22|o[5]<<14|o[6]<<6|o[7]>>>2;return s*=4,s+=3&o[7]}break}}t+=10,t+=n}while(t<e.byteLength);return null}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setSkinClassPrefix=t.skinClass=t.skinClassPrefix=t.playerClassPrefix=t.CLASS_PREFIX=void 0;var i,r=n(17),a=(i=n(33))&&i.__esModule?i:{default:i},o=n(34);t.CLASS_PREFIX="cld-video-player";var s="".concat("cld-video-player","-skin-");t.playerClassPrefix=function(e){return"".concat("cld-video-player","-").concat(e.id_)};var u=function(e){return"".concat(s).concat(e)};t.skinClass=u;var l=function(e){return(0,o.find)(e.el().classList,function(e){return(0,r.startsWith)(e,s)})};t.skinClassPrefix=l;t.setSkinClassPrefix=function(e,t){var n=l(e),i=!!t&&t.replace(s,""),r="";(r=i?u(i):e.options_.skin?u(e.options_.skin):u(a.default.skin))!==n&&(n&&e.removeClass(n),e.addClass(r)),i&&e.options_.skin!==i&&(e.options_.skin=i)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.capitalize=function(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()},t.camelize=function(e){return e.replace(/[_.-](\w|$)/g,function(e,t){return t.toUpperCase()})},t.coerce=function(e){var t=e;try{t=JSON.parse(t)}catch(e){}if(t)return t;if(t=Number(t))return t;return t},t.startsWith=function(e,t,n){if(String.prototype.startsWith)return e.startsWith(t,n);var i=i||0;return e.indexOf(t,i)===i}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getCloudinaryInstanceOf=function(e,t){return t instanceof e?t:new e(t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=l(n(37)),r=l(n(38)),a=n(8),o=n(5),s=l(n(3)),u=n(20);function l(e){return e&&e.__esModule?e:{default:e}}function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var m={format:"jpg",resource_type:"video"},y=["webm","mp4","ogv"],g={resource_type:"video",type:"upload",transformation:[],sourceTransformation:{},sourceTypes:y,recommendations:null,info:{}},v=RegExp("\\.(".concat(y.join("|"),")$$")),b=0,_=function(){return b++},T=function(e){function t(e){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var u=(0,a.normalizeOptions)(e,i);e=u.publicId,i=u.options,e=e.replace(v,""),(i=(0,s.default)({},g,i)).poster||(i.poster=(0,s.default)({publicId:e},m));var l,d,f=(0,o.sliceAndUnsetProperties)(i,"poster","sourceTypes","sourceTransformation","info","recommendations"),y=f.poster,b=f.sourceTypes,T=f.sourceTransformation,S=f.info,w=f.recommendations;l=this,d=h(t).call(this,e,i),n=!d||"object"!==c(d)&&"function"!=typeof d?p(l):d;var k=null,C=null,E=null,A=null,P=null;return n.poster=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return k;if(e instanceof r.default)return k=e,p(p(n));var i=(0,a.normalizeOptions)(e,t,{tolerateMissingId:!0});return e=i.publicId,t=i.options,e||(e=n.publicId(),t=(0,s.default)({},t,m)),t.cloudinaryConfig=t.cloudinaryConfig||n.cloudinaryConfig(),k=new r.default(e,t),p(p(n))},n.sourceTypes=function(e){return e?(C=e,p(p(n))):C},n.sourceTransformation=function(e){return e?(E=e,p(p(n))):E},n.info=function(e){return e?(A=e,p(p(n))):A},n.recommendations=function(e){return void 0===e?P:(P=e,p(p(n)))},n.poster(y),n.sourceTypes(b),n.sourceTransformation(T),n.info(S),n.recommendations(w),n.objectId=_(),n}var n,l,y;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(t,i.default),n=t,(l=[{key:"contains",value:function(e){return this.generateSources().some(function(t){return(0,a.isSrcEqual)(t,e)})}},{key:"generateSources",value:function(){var e=this;return this.sourceTypes().map(function(t){var n=e.sourceTransformation()[t]||e.transformation(),i=k(t),r={};n&&(r.transformation=n),(0,s.default)(r,{resource_type:"video",format:i});var a="";e.queryParams()&&(a=(0,u.objectToQuerystring)(e.queryParams()));var o="".concat(e.config().url(e.publicId(),r)).concat(a);return{type:function(e){e=k(e);var t=S[e];t||(t="video/".concat(e));return t}(t),src:o,cldSrc:e}})}}])&&d(n.prototype,l),y&&d(n,y),t}(),S={ogv:"video/ogg",mpd:"application/dash+xml",m3u8:"application/x-mpegURL"};var w={hls:"m3u8",dash:"mpd"};function k(e){e=e.toLowerCase();var t=w[e];return t||(t=e),t}var C=T;t.default=C},function(e,t,n){"use strict";e.exports={objectToQuerystring:function(e){var t=Object.keys(e);if(!t.length)return"";var n=t.map(function(t){return"".concat(t,"=").concat(e[t])}).join("&");return"?".concat(n)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i,r=(i=n(2))&&i.__esModule?i:{default:i},a=n(139),o=n(16);function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e,t,n){return(h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=f(e)););return e}(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(n):r.value}})(e,t,n||e)}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var p=r.default.dom||r.default,m=r.default.getComponent("Component"),y={wrap:!1},g=function(e){function t(e,n){var i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r,o,l=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),i.forEach(function(t){u(e,t,n[t])})}return e}({},y,n);r=this,o=f(t).call(this,e,l),(i=!o||"object"!==s(o)&&"function"!=typeof o?c(r):o).player_=e,i.setCls();var d,m=function(e,t){i.options_.fluid=t,i.removeCls(),i.setCls()};return l.wrap&&(d=i.el(),i.videoWrap_=p.createEl("div",{className:"cld-plw-col-player"}),i.contentEl_=i.contentEl_=p.createEl("div",{className:"cld-plw-col-list"}),(0,a.wrap)(i.player().el(),d),d.appendChild(i.videoWrap_),d.appendChild(i.contentEl_),(0,a.wrap)(i.player().el(),i.videoWrap_)),e.on("fluid",m),i.addChild("PlaylistPanel",i.options_),i.dispose=function(){i.removeLayout(),h(f(t.prototype),"dispose",c(i)).call(c(i)),e.off("fluid",m)},i}var n,i,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}(t,m),n=t,(i=[{key:"getCls",value:function(){var e=["cld-video-player","cld-plw-layout"];return e.push((0,o.skinClassPrefix)(this.player())),e.push((0,o.playerClassPrefix)(this.player())),this.options_.fluid&&e.push("cld-plw-layout-fluid"),e}},{key:"setCls",value:function(){var e=this;this.removeClass((0,o.skinClassPrefix)(this)),this.getCls().forEach(function(t){e.addClass(t)})}},{key:"removeCls",value:function(){var e=this;this.getCls().forEach(function(t){e.removeClass(t)})}},{key:"update",value:function(e,t){this.options(t),this.removeChild("PlaylistPanel"),this.addChild("PlaylistPanel",this.options_),this.trigger("playlistlayoutupdate")}},{key:"removeLayout",value:function(){var e=this.el().parentElement;this.el().parentElement&&e.appendChild(this.player().el())}},{key:"createEl",value:function(){var e=h(f(t.prototype),"createEl",this).call(this,"div");return e.style.fontFamily=this.player().el().style.fontFamily,e}}])&&l(n.prototype,i),r&&l(n,r),t}();r.default.registerComponent("playlistLayout",g);var v=g;t.default=v},function(e,t,n){(function(t){e.exports=t.videojs=n(48)}).call(this,n(4))},function(e,t,n){"use strict";var i=n(0),r=n(55),a=n(56),o=n(60);function s(e,t,n){var i=e;return r(t)?(n=t,"string"==typeof e&&(i={uri:e})):i=o(t,{uri:e}),i.callback=n,i}function u(e,t,n){return l(t=s(e,t,n))}function l(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,n=function(n,i,r){t||(t=!0,e.callback(n,i,r))};function i(){var e=void 0;if(e=c.response?c.response:c.responseText||function(e){if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML;return null}(c),g)try{e=JSON.parse(e)}catch(e){}return e}function r(e){return clearTimeout(d),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,n(e,v)}function o(){if(!l){var t;clearTimeout(d),t=e.useXDR&&void 0===c.status?200:1223===c.status?204:c.status;var r=v,o=null;return 0!==t?(r={body:i(),statusCode:t,method:f,headers:{},url:h,rawRequest:c},c.getAllResponseHeaders&&(r.headers=a(c.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,r,r.body)}}var s,l,c=e.xhr||null;c||(c=e.cors||e.useXDR?new u.XDomainRequest:new u.XMLHttpRequest);var d,h=c.url=e.uri||e.url,f=c.method=e.method||"GET",p=e.body||e.data,m=c.headers=e.headers||{},y=!!e.sync,g=!1,v={body:void 0,headers:{},statusCode:0,method:f,url:h,rawRequest:c};if("json"in e&&!1!==e.json&&(g=!0,m.accept||m.Accept||(m.Accept="application/json"),"GET"!==f&&"HEAD"!==f&&(m["content-type"]||m["Content-Type"]||(m["Content-Type"]="application/json"),p=JSON.stringify(!0===e.json?p:e.json))),c.onreadystatechange=function(){4===c.readyState&&setTimeout(o,0)},c.onload=o,c.onerror=r,c.onprogress=function(){},c.onabort=function(){l=!0},c.ontimeout=r,c.open(f,h,!y,e.username,e.password),y||(c.withCredentials=!!e.withCredentials),!y&&e.timeout>0&&(d=setTimeout(function(){if(!l){l=!0,c.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",r(e)}},e.timeout)),c.setRequestHeader)for(s in m)m.hasOwnProperty(s)&&c.setRequestHeader(s,m[s]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(c.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(c),c.send(p||null),c}e.exports=u,u.XMLHttpRequest=i.XMLHttpRequest||function(){},u.XDomainRequest="withCredentials"in new u.XMLHttpRequest?u.XMLHttpRequest:i.XDomainRequest,function(e,t){for(var n=0;n<e.length;n++)t(e[n])}(["get","put","post","patch","head","delete"],function(e){u["delete"===e?"del":e]=function(t,n,i){return(n=s(t,n,i)).method=e.toUpperCase(),l(n)}})},function(e,t,n){var i,r,a,o,s;i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,r=/^([^\/?#]*)(.*)$/,a=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,s={buildAbsoluteURL:function(e,t,n){if(n=n||{},e=e.trim(),!(t=t.trim())){if(!n.alwaysNormalize)return e;var i=s.parseURL(e);if(!i)throw new Error("Error trying to parse base URL.");return i.path=s.normalizePath(i.path),s.buildURLFromParts(i)}var a=s.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return n.alwaysNormalize?(a.path=s.normalizePath(a.path),s.buildURLFromParts(a)):t;var o=s.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var u=r.exec(o.path);o.netLoc=u[1],o.path=u[2]}o.netLoc&&!o.path&&(o.path="/");var l={scheme:o.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(l.netLoc=o.netLoc,"/"!==a.path[0]))if(a.path){var c=o.path,d=c.substring(0,c.lastIndexOf("/")+1)+a.path;l.path=s.normalizePath(d)}else l.path=o.path,a.params||(l.params=o.params,a.query||(l.query=o.query));return null===l.path&&(l.path=n.alwaysNormalize?s.normalizePath(a.path):a.path),s.buildURLFromParts(l)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(a,"");e.length!==(e=e.replace(o,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=s},function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return W}),n.d(t,"b",function(){return G});var i=n(0),r=n.n(i),a=function(e){return!!e&&"object"==typeof e},o=function e(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return n.reduce(function(t,n){return Object.keys(n).forEach(function(i){Array.isArray(t[i])&&Array.isArray(n[i])?t[i]=t[i].concat(n[i]):a(t[i])&&a(n[i])?t[i]=e(t[i],n[i]):t[i]=n[i]}),t},{})},s=function(e){return e.reduce(function(e,t){return e.concat(t)},[])},u=function(e){if(!e.length)return[];for(var t=[],n=0;n<e.length;n++)t.push(e[n]);return t},l=function(e){var t;return(t=e.reduce(function(e,t){var n,i=t.attributes.id+(t.attributes.lang||"");e[i]?(t.segments[0].discontinuity=!0,(n=e[i].segments).push.apply(n,t.segments),t.attributes.contentProtection&&(e[i].attributes.contentProtection=t.attributes.contentProtection)):e[i]=t;return e},{}),Object.keys(t).map(function(e){return t[e]})).map(function(e){var t,n;return e.discontinuityStarts=(t=e.segments,n="discontinuity",t.reduce(function(e,t,i){return t[n]&&e.push(i),e},[])),e})},c=function(e){var t,n=e.attributes,i=e.segments,r={attributes:(t={NAME:n.id,BANDWIDTH:n.bandwidth,CODECS:n.codecs},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===(n.type||"static"),timeline:n.periodIndex,resolvedUri:"",targetDuration:n.duration,segments:i,mediaSequence:i.length?i[0].number:1};return n.contentProtection&&(r.contentProtection=n.contentProtection),r},d=function(e){var t,n=e.attributes,i=e.segments,r={attributes:(t={NAME:n.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:n.width,height:n.height},CODECS:n.codecs,BANDWIDTH:n.bandwidth},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===(n.type||"static"),timeline:n.periodIndex,resolvedUri:"",targetDuration:n.duration,segments:i,mediaSequence:i.length?i[0].number:1};return n.contentProtection&&(r.contentProtection=n.contentProtection),r},h=function(e){var t;if(!e.length)return{};var n=e[0].attributes,i=n.sourceDuration,r=n.minimumUpdatePeriod,a=void 0===r?0:r,o=l(e.filter(function(e){var t=e.attributes;return"video/mp4"===t.mimeType||"video"===t.contentType})).map(d),s=l(e.filter(function(e){var t=e.attributes;return"audio/mp4"===t.mimeType||"audio"===t.contentType})),u=e.filter(function(e){var t=e.attributes;return"text/vtt"===t.mimeType||"text"===t.contentType}),h={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(t={AUDIO:{},VIDEO:{}},t["CLOSED-CAPTIONS"]={},t.SUBTITLES={},t),uri:"",duration:i,playlists:o,minimumUpdatePeriod:1e3*a};return s.length&&(h.mediaGroups.AUDIO.audio=s.reduce(function(e,t){var n=t.attributes.role&&t.attributes.role.value||"main",i=t.attributes.lang||"",r="main";return i&&(r=t.attributes.lang+" ("+n+")"),e[r]&&e[r].playlists[0].attributes.BANDWIDTH>t.attributes.bandwidth?e:(e[r]={language:i,autoselect:!0,default:"main"===n,playlists:[c(t)],uri:""},e)},{})),u.length&&(h.mediaGroups.SUBTITLES.subs=function(e){return e.reduce(function(e,t){var n,i,r,a,o=t.attributes.lang||"text";return e[o]?e:(e[o]={language:o,default:!1,autoselect:!1,playlists:[(n=t,r=n.attributes,a=n.segments,void 0===a&&(a=[{uri:r.baseUrl,timeline:r.periodIndex,resolvedUri:r.baseUrl||"",duration:r.sourceDuration,number:0}],r.duration=r.sourceDuration),{attributes:(i={NAME:r.id,BANDWIDTH:r.bandwidth},i["PROGRAM-ID"]=1,i),uri:"",endList:"static"===(r.type||"static"),timeline:r.periodIndex,resolvedUri:r.baseUrl||"",targetDuration:r.duration,segments:a,mediaSequence:a.length?a[0].number:1})],uri:""},e)},{})}(u)),h};"undefined"!=typeof window?window:void 0!==e||"undefined"!=typeof self&&self;var f,p=(function(e,t){var n,i,r,a,o;n=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,i=/^([^\/?#]*)(.*)$/,r=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,o={buildAbsoluteURL:function(e,t,n){if(n=n||{},e=e.trim(),!(t=t.trim())){if(!n.alwaysNormalize)return e;var r=o.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");return r.path=o.normalizePath(r.path),o.buildURLFromParts(r)}var a=o.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return n.alwaysNormalize?(a.path=o.normalizePath(a.path),o.buildURLFromParts(a)):t;var s=o.parseURL(e);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&"/"!==s.path[0]){var u=i.exec(s.path);s.netLoc=u[1],s.path=u[2]}s.netLoc&&!s.path&&(s.path="/");var l={scheme:s.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(l.netLoc=s.netLoc,"/"!==a.path[0]))if(a.path){var c=s.path,d=c.substring(0,c.lastIndexOf("/")+1)+a.path;l.path=o.normalizePath(d)}else l.path=s.path,a.params||(l.params=s.params,a.query||(l.query=s.query));return null===l.path&&(l.path=n.alwaysNormalize?o.normalizePath(a.path):a.path),o.buildURLFromParts(l)},parseURL:function(e){var t=n.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(r,"");e.length!==(e=e.replace(a,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=o}(f={exports:{}},f.exports),f.exports),m=function(e,t){return/^[a-z]+:/i.test(t)?t:(/\/\//i.test(e)||(e=p.buildAbsoluteURL(r.a.location.href,e)),p.buildAbsoluteURL(e,t))},y=function(e){var t=e.baseUrl,n=void 0===t?"":t,i=e.source,r=void 0===i?"":i,a=e.range,o=void 0===a?"":a,s={uri:r,resolvedUri:m(n||"",r)};if(o){var u=o.split("-"),l=parseInt(u[0],10),c=parseInt(u[1],10);s.byterange={length:c-l,offset:l}}return s},g=function(e,t,n){var i=e.NOW,r=e.clientOffset,a=e.availabilityStartTime,o=e.timescale,s=void 0===o?1:o,u=e.start,l=void 0===u?0:u,c=e.minimumUpdatePeriod,d=(i+r)/1e3+(void 0===c?0:c)-(a+l);return Math.ceil((d*s-t)/n)},v=function(e,t){for(var n=e.type,i=void 0===n?"static":n,r=e.minimumUpdatePeriod,a=void 0===r?0:r,o=e.media,s=void 0===o?"":o,u=e.sourceDuration,l=e.timescale,c=void 0===l?1:l,d=e.startNumber,h=void 0===d?1:d,f=e.periodIndex,p=[],m=-1,y=0;y<t.length;y++){var v=t[y],b=v.d,_=v.r||0,T=v.t||0;m<0&&(m=T),T&&T>m&&(m=T);var S=void 0;if(_<0){var w=y+1;S=w===t.length?"dynamic"===i&&a>0&&s.indexOf("$Number$")>0?g(e,m,b):(u*c-m)/b:(t[w].t-m)/b}else S=_+1;for(var k=h+p.length+S,C=h+p.length;C<k;)p.push({number:C,duration:b/c,time:m,timeline:f}),m+=b,C++}return p},b={static:function(e){var t=e.duration,n=e.timescale,i=void 0===n?1:n,r=e.sourceDuration;return{start:0,end:Math.ceil(r/(t/i))}},dynamic:function(e){var t=e.NOW,n=e.clientOffset,i=e.availabilityStartTime,r=e.timescale,a=void 0===r?1:r,o=e.duration,s=e.start,u=void 0===s?0:s,l=e.minimumUpdatePeriod,c=void 0===l?0:l,d=e.timeShiftBufferDepth,h=void 0===d?1/0:d,f=(t+n)/1e3,p=i+u,m=f+c-p,y=Math.ceil(m*a/o),g=Math.floor((f-p-h)*a/o),v=Math.floor((f-p)*a/o);return{start:Math.max(0,g),end:Math.min(y,v)}}},_=function(e){var t=e.type,n=void 0===t?"static":t,i=e.duration,r=e.timescale,a=void 0===r?1:r,o=e.sourceDuration,s=b[n](e),u=function(e,t){for(var n=[],i=e;i<t;i++)n.push(i);return n}(s.start,s.end).map(function(e){return function(t,n){var i=e.duration,r=e.timescale,a=void 0===r?1:r,o=e.periodIndex,s=e.startNumber;return{number:(void 0===s?1:s)+t,duration:i/a,timeline:o,time:n*i}}}(e));if("static"===n){var l=u.length-1;u[l].duration=o-i/a*l}return u},T=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,S=function(e,t){return e.replace(T,function(e){return function(t,n,i,r){if("$$"===t)return"$";if(void 0===e[n])return t;var a=""+e[n];return"RepresentationID"===n?a:(r=i?parseInt(r,10):1,a.length>=r?a:""+new Array(r-a.length+1).join("0")+a)}}(t))},w=function(e,t){var n={RepresentationID:e.id,Bandwidth:e.bandwidth||0},i=e.initialization,r=void 0===i?{sourceURL:"",range:""}:i,a=y({baseUrl:e.baseUrl,source:S(r.sourceURL,n),range:r.range});return function(e,t){return e.duration||t?e.duration?_(e):v(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodIndex}]}(e,t).map(function(t){n.Number=t.number,n.Time=t.time;var i=S(e.media||"",n);return{uri:i,timeline:t.timeline,duration:t.duration,resolvedUri:m(e.baseUrl||"",i),map:a,number:t.number}})},k="INVALID_NUMBER_OF_PERIOD",C="DASH_EMPTY_MANIFEST",E="DASH_INVALID_XML",A="NO_BASE_URL",P="SEGMENT_TIME_UNSPECIFIED",O="UNSUPPORTED_UTC_TIMING_SCHEME",L=function(e,t){var n=e.duration,i=e.segmentUrls,r=void 0===i?[]:i;if(!n&&!t||n&&t)throw new Error(P);var a,o=r.map(function(t){return function(e,t){var n=e.baseUrl,i=e.initialization,r=void 0===i?{}:i,a=y({baseUrl:n,source:r.sourceURL,range:r.range}),o=y({baseUrl:n,source:t.media,range:t.mediaRange});return o.map=a,o}(e,t)});return n&&(a=_(e)),t&&(a=v(e,t)),a.map(function(e,t){if(o[t]){var n=o[t];return n.timeline=e.timeline,n.duration=e.duration,n.number=e.number,n}}).filter(function(e){return e})},x=function(e){var t=e.baseUrl,n=e.initialization,i=void 0===n?{}:n,r=e.sourceDuration,a=e.timescale,o=void 0===a?1:a,s=e.indexRange,u=void 0===s?"":s,l=e.duration;if(!t)throw new Error(A);var c=y({baseUrl:t,source:i.sourceURL,range:i.range}),d=y({baseUrl:t,source:t,range:u});if(d.map=c,l){var h=_(e);h.length&&(d.duration=h[0].duration,d.timeline=h[0].timeline)}else r&&(d.duration=r/o,d.timeline=0);return d.number=0,[d]},j=function(e){var t,n,i=e.attributes,r=e.segmentInfo;if(r.template?(n=w,t=o(i,r.template)):r.base?(n=x,t=o(i,r.base)):r.list&&(n=L,t=o(i,r.list)),!n)return{attributes:i};var a=n(t,r.timeline);if(t.duration){var s=t,u=s.duration,l=s.timescale,c=void 0===l?1:l;t.duration=u/c}else a.length?t.duration=a.reduce(function(e,t){return Math.max(e,Math.ceil(t.duration))},0):t.duration=0;return{attributes:t,segments:a}},I=function(e,t){return u(e.childNodes).filter(function(e){return e.tagName===t})},R=function(e){return e.textContent.trim()},D=function(e){var t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!t)return 0;var n=t.slice(1),i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],u=n[5];return 31536e3*parseFloat(i||0)+2592e3*parseFloat(r||0)+86400*parseFloat(a||0)+3600*parseFloat(o||0)+60*parseFloat(s||0)+parseFloat(u||0)},M={mediaPresentationDuration:function(e){return D(e)},availabilityStartTime:function(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t=e)&&(t+="Z"),Date.parse(t)/1e3;var t},minimumUpdatePeriod:function(e){return D(e)},timeShiftBufferDepth:function(e){return D(e)},start:function(e){return D(e)},width:function(e){return parseInt(e,10)},height:function(e){return parseInt(e,10)},bandwidth:function(e){return parseInt(e,10)},startNumber:function(e){return parseInt(e,10)},timescale:function(e){return parseInt(e,10)},duration:function(e){var t=parseInt(e,10);return isNaN(t)?D(e):t},d:function(e){return parseInt(e,10)},t:function(e){return parseInt(e,10)},r:function(e){return parseInt(e,10)},DEFAULT:function(e){return e}},U=function(e){return e&&e.attributes?u(e.attributes).reduce(function(e,t){var n=M[t.name]||M.DEFAULT;return e[t.name]=n(t.value),e},{}):{}};var B={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"},N=function(e,t){return t.length?s(e.map(function(e){return t.map(function(t){return m(e,R(t))})})):e},F=function(e){var t=I(e,"SegmentTemplate")[0],n=I(e,"SegmentList")[0],i=n&&I(n,"SegmentURL").map(function(e){return o({tag:"SegmentURL"},U(e))}),r=I(e,"SegmentBase")[0],a=n||t,s=a&&I(a,"SegmentTimeline")[0],u=n||r||t,l=u&&I(u,"Initialization")[0],c=t&&U(t);c&&l?c.initialization=l&&U(l):c&&c.initialization&&(c.initialization={sourceURL:c.initialization});var d={template:c,timeline:s&&I(s,"S").map(function(e){return U(e)}),list:n&&o(U(n),{segmentUrls:i,initialization:U(l)}),base:r&&o(U(r),{initialization:U(l)})};return Object.keys(d).forEach(function(e){d[e]||delete d[e]}),d},V=function(e){return e.reduce(function(e,t){var n=U(t),i=B[n.schemeIdUri];if(i){e[i]={attributes:n};var a=I(t,"cenc:pssh")[0];if(a){var o=R(a),s=o&&function(e){for(var t=r.a.atob(e),n=new Uint8Array(t.length),i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}(o);e[i].pssh=s}}return e},{})},H=function(e,t,n){return function(i){var r=U(i),a=N(t,I(i,"BaseURL")),u=I(i,"Role")[0],l={role:U(u)},c=o(e,r,l),d=V(I(i,"ContentProtection"));Object.keys(d).length&&(c=o(c,{contentProtection:d}));var h=F(i),f=I(i,"Representation"),p=o(n,h);return s(f.map(function(e,t,n){return function(i){var r=I(i,"BaseURL"),a=N(t,r),s=o(e,U(i)),u=F(i);return a.map(function(e){return{segmentInfo:o(n,u),attributes:o(s,{baseUrl:e})}})}}(c,a,p)))}},z=function(e,t){void 0===t&&(t={});var n=t,i=n.manifestUri,a=void 0===i?"":i,u=n.NOW,l=void 0===u?Date.now():u,c=n.clientOffset,d=void 0===c?0:c,h=I(e,"Period");if(!h.length)throw new Error(k);var f=U(e),p=N([a],I(e,"BaseURL"));return f.sourceDuration=f.mediaPresentationDuration||0,f.NOW=l,f.clientOffset=d,s(h.map(function(e,t){return function(n,i){var a=N(t,I(n,"BaseURL")),u=U(n),l=parseInt(u.id,10),c=r.a.isNaN(l)?i:l,d=o(e,{periodIndex:c}),h=I(n,"AdaptationSet"),f=F(n);return s(h.map(H(d,a,f)))}}(f,p)))},q=function(e){if(""===e)throw new Error(C);var t=(new r.a.DOMParser).parseFromString(e,"application/xml"),n=t&&"MPD"===t.documentElement.tagName?t.documentElement:null;if(!n||n&&n.getElementsByTagName("parsererror").length>0)throw new Error(E);return n},W=function(e,t){return h(z(q(e),t).map(j))},G=function(e){return function(e){var t=I(e,"UTCTiming")[0];if(!t)return null;var n=U(t);switch(n.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":n.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":n.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":n.method="DIR