UNPKG

cloudinary-video-player

Version:

Cloudinary Video Player

1 lines 668 kB
!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(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},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=44)}([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(5))},function(e,t,n){(function(t){var r,i=void 0!==t?t:"undefined"!=typeof window?window:{},a=n(60);"undefined"!=typeof document?r=document:(r=i["__GLOBAL_DOCUMENT_CACHE@4"])||(r=i["__GLOBAL_DOCUMENT_CACHE@4"]=a),e.exports=r}).call(this,n(5))},function(e,t,n){(function(t){e.exports=t.videojs=n(140)}).call(this,n(5))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=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 Object.assign?Object.assign.apply(Object,[e].concat(n)):(n.forEach(function(t){t&&Object.keys(t).forEach(function(n){var r=t[n];e[n]=r})}),e)};t.default=r},function(e,t,n){"use strict";function r(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return r.reduce(function(n,r){return Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r],t&&delete e[r]),n},{})}Object.defineProperty(t,"__esModule",{value:!0}),t.sliceProperties=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 r.apply(void 0,[e,!1].concat(n))},t.sliceAndUnsetProperties=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 r.apply(void 0,[e,!0].concat(n))},t.exceptProperties=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];var i=n.reduce(function(e,t){return e[t]=!0,e},{});return Object.keys(e).reduce(function(t,n){return Object.prototype.hasOwnProperty.call(i,n)||(t[n]=e[n]),t},{})}},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";var r=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 r;return!!e[t]&&(r=e[t].indexOf(n),e[t]=e[t].slice(),e[t].splice(r,1),r>-1)},this.trigger=function(t){var n,r,i,a;if(n=e[t])if(2===arguments.length)for(i=n.length,r=0;r<i;++r)n[r].call(this,arguments[1]);else{for(a=[],r=arguments.length,r=1;r<arguments.length;++r)a.push(arguments[r]);for(i=n.length,r=0;r<i;++r)n[r].apply(this,a)}},this.dispose=function(){e={}}}};r.prototype.pipe=function(e){return this.on("data",function(t){e.push(t)}),this.on("done",function(t){e.flush(t)}),e},r.prototype.push=function(e){this.trigger("data",e)},r.prototype.flush=function(e){this.trigger("done",e)},e.exports=r},function(e,t,n){"use strict";var r,i,a,o,s,u=n(61).toUnsigned;r=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=i(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=r(e.subarray(n+8,s),t.slice(1))).length&&(c=c.concat(l))),n=s;return c},i=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 r(e,["moov","trak"]).reduce(function(e,t){var n,i,a,o,s;return(n=r(t,["tkhd"])[0])?(i=n[0],o=u(n[a=0===i?12:20]<<24|n[a+1]<<16|n[a+2]<<8|n[a+3]),(s=r(t,["mdia","mdhd"])[0])?(a=0===(i=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,i,a;return n=r(t,["moof","traf"]),i=[].concat.apply([],n.map(function(t){return r(t,["tfhd"]).map(function(n){var i,a;return i=u(n[4]<<24|n[5]<<16|n[6]<<8|n[7]),a=e[i]||9e4,(r(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,i),isFinite(a)?a:0},s=function(e){var t=r(e,["moov","trak"]),n=[];return t.forEach(function(e){var t=r(e,["mdia","hdlr"]),a=r(e,["tkhd"]);t.forEach(function(e,t){var r,o,s=i(e.subarray(8,12)),u=a[t];"vide"===s&&(o=0===(r=new DataView(u.buffer,u.byteOffset,u.byteLength)).getUint8(0)?r.getUint32(12):r.getUint32(20),n.push(o))})}),n},e.exports={findBox:r,parseType:i,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 r=n(4),i=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,i.isPlainObject)(e)){var s=(0,o.default)({},e);if(e=(0,r.sliceAndUnsetProperties)(s,"publicId").publicId,!(0,i.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,r=t;return"object"===u(e)&&(n=e.src),"object"===u(t)&&(r=t.src),/^\/\//.test(n)&&(r=r.slice(r.indexOf("//"))),/^\/\//.test(r)&&(n=n.slice(n.indexOf("//"))),n===r};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 r="Video cannot be played -",i={code:10,message:"".concat(r," ").concat(e)},a=e.toLowerCase();return a.startsWith("unknown customer")&&(i.code=11,i.message="".concat(r," Unknown cloud-name ").concat(n)),a.startsWith("resource not found")&&(i.code=12,i.message="".concat(r," Public ID ").concat(t," not found")),a.startsWith("private resource")&&(i.code=13,i.message="".concat(r," Private video")),a.startsWith("unauthenticated access")&&(i.message="".concat(r," Requires authentication"),i.code=14),i}},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 r(e){var t=e.getBoundingClientRect(),n=document.body,r=document.documentElement,i=window.pageYOffset||r.scrollTop||n.scrollTop,a=window.pageXOffset||r.scrollLeft||n.scrollLeft,o=r.clientTop||n.clientTop||0,s=r.clientLeft||n.clientLeft||0,u=t.top+i-o,l=t.left+a-s;return{top:Math.round(u),left:Math.round(l)}}Object.defineProperty(t,"__esModule",{value:!0}),t.getElementPosition=r,t.getPointerPosition=function(e,t){var n={},i=r(e),a=e.offsetWidth,o=e.offsetHeight,s=i.top,u=i.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,i=r(e),a=i.left,o=i.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 r(e){return(r="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"===r(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="",r=0;r<arguments.length;r++)t+=n(e[r])+(arguments[r+1]||"");return t}},function(e,t,n){"use strict";var r,i,a,o,s=n(6),u=n(26),l=n(62),c=n(63),d=n(66),h=n(67),f=n(69),p=n(70).H264Stream,m=n(72),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};(i=function(e,t){var n=[],r=0,a=0,o=0,s=1/0;t=t||{},i.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 i,l,h,f;0!==n.length?(i=c.trimAdtsFramesByEarliestDts(n,e,a),e.baseMediaDecodeTime=d.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),c.prefixWithSilence(e,i,o,s),e.samples=c.generateSampleTable(i),h=u.mdat(c.concatenateFrameData(i)),n=[],l=u.moof(r,[e]),f=new Uint8Array(l.byteLength+h.byteLength),r++,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,(r=function(e,t){var n,i,a=0,o=[],s=[];t=t||{},r.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||i||(i=t.data,e.pps=[t.data]),o.push(t)},this.flush=function(){for(var n,r,i,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),(i=l.groupFramesIntoGops(n))[0][0].keyFrame||((r=this.getGopForFusion_(o[0],e))?(i.unshift(r),i.byteLength+=r.byteLength,i.nalCount+=r.nalCount,i.pts=r.pts,i.dts=r.dts,i.duration+=r.duration):i=l.extendFirstKeyFrame(i)),s.length){var p;if(!(p=t.alignGopsAtEnd?this.alignGopsAtEnd_(i):this.alignGopsAtStart_(i)))return this.gopCache_.unshift({gop:i.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),i=p}d.collectDtsInfo(e,i),e.samples=l.generateSampleTable(i),h=u.mdat(l.concatenateNalData(i)),e.baseMediaDecodeTime=d.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",i.map(function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}})),this.gopCache_.unshift({gop:i.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,i=void 0},this.getGopForFusion_=function(t){var n,r,i,a,o,s=1/0;for(o=0;o<this.gopCache_.length;o++)i=(a=this.gopCache_[o]).gop,e.pps&&b(e.pps[0],a.pps[0])&&e.sps&&b(e.sps[0],a.sps[0])&&(i.dts<e.timelineStartInfo.dts||(n=t.dts-i.dts-i.duration)>=-1e4&&n<=45e3&&(!r||s>n)&&(r=a,s=n));return r?r.gop:null},this.alignGopsAtStart_=function(e){var t,n,r,i,a,o,u,l;for(a=e.byteLength,o=e.nalCount,u=e.duration,t=n=0;t<s.length&&n<e.length&&(r=s[t],i=e[n],r.pts!==i.pts);)i.pts>r.pts?t++:(n++,a-=i.byteLength,o-=i.nalCount,u-=i.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,r,i,a,o,u;for(t=s.length-1,n=e.length-1,a=null,o=!1;t>=0&&n>=0;){if(r=s[t],i=e[n],r.pts===i.pts){o=!0;break}r.pts>i.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,r,i,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,r=u.initSegment(this.pendingTracks),o.initSegment=new Uint8Array(r.byteLength),o.initSegment.set(r),o.data=new Uint8Array(this.pendingBytes),i=0;i<this.pendingBoxes.length;i++)o.data.set(this.pendingBoxes[i],a),a+=this.pendingBoxes[i].byteLength;for(i=0;i<this.pendingCaptions.length;i++)(t=this.pendingCaptions[i]).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(i=0;i<this.pendingMetadata.length;i++)(n=this.pendingMetadata[i]).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(r){"timed-metadata"!==r.type||t.audioSegmentStream||(n=n||{timelineStartInfo:{baseMediaDecodeTime:s.baseMediaDecodeTime},codec:"adts",type:"audio"},t.coalesceStream.numberOfTracks++,t.audioSegmentStream=new i(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 r(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 i(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(r){var i=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=r),n&&(n.timelineStartInfo.dts=void 0,n.timelineStartInfo.pts=void 0,d.clearDtsInfo(n),e.keepOriginalTimestamps||(n.timelineStartInfo.baseMediaDecodeTime=r),i.audioTimestampRolloverStream&&i.audioTimestampRolloverStream.discontinuity()),t&&(i.videoSegmentStream&&(i.videoSegmentStream.gopCache_=[],i.videoTimestampRolloverStream.discontinuity()),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,d.clearDtsInfo(t),i.captionStream.reset(),e.keepOriginalTimestamps||(t.timelineStartInfo.baseMediaDecodeTime=r)),i.timedMetadataTimestampRolloverStream&&i.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:r,AudioSegmentStream:i,AUDIO_PROPERTIES:g,VIDEO_PROPERTIES:v}},function(e,t,n){"use strict";var r=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],i=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,r=e[t+4]<<3;return 6144&e[t+3]|r|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 r[(60&e[t+2])>>>2];t++}return null},parseAacTimestamp:function(e){var t,n,r;t=10,64&e[5]&&(t+=4,t+=i(e.subarray(10,14)));do{if((n=i(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){r=e.subarray(t+10,t+n+10);for(var a=0;a<r.byteLength;a++)if(0===r[a]){if("com.apple.streaming.transportStreamTimestamp"===unescape(function(e,t,n){var r,i="";for(r=t;r<n;r++)i+="%"+("00"+e[r].toString(16)).slice(-2);return i}(r,0,a))){var o=r.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 r,i=n(17),a=(r=n(32))&&r.__esModule?r:{default:r},o=n(33);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,i.startsWith)(e,s)})};t.skinClassPrefix=l;t.setSkinClassPrefix=function(e,t){var n=l(e),r=!!t&&t.replace(s,""),i="";(i=r?u(r):e.options_.skin?u(e.options_.skin):u(a.default.skin))!==n&&(n&&e.removeClass(n),e.addClass(i)),r&&e.options_.skin!==r&&(e.options_.skin=r)}},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 r=r||0;return e.indexOf(t,r)===r}},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 r=l(n(36)),i=l(n(37)),a=n(8),o=n(4),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 r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}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,r=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,r);e=u.publicId,r=u.options,e=e.replace(v,""),(r=(0,s.default)({},g,r)).poster||(r.poster=(0,s.default)({publicId:e},m));var l,d,f=(0,o.sliceAndUnsetProperties)(r,"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,r),n=!d||"object"!==c(d)&&"function"!=typeof d?p(l):d;var k=null,C=null,E=null,O=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 i.default)return k=e,p(p(n));var r=(0,a.normalizeOptions)(e,t,{tolerateMissingId:!0});return e=r.publicId,t=r.options,e||(e=n.publicId(),t=(0,s.default)({},t,m)),t.cloudinaryConfig=t.cloudinaryConfig||n.cloudinaryConfig(),k=new i.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?(O=e,p(p(n))):O},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,r.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(),r=k(t),i={};n&&(i.transformation=n),(0,s.default)(i,{resource_type:"video",format:r});var a="";e.queryParams()&&(a=(0,u.objectToQuerystring)(e.queryParams()));var o="".concat(e.config().url(e.publicId(),i)).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 r,i=(r=n(2))&&r.__esModule?r:{default:r},a=n(137),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 r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}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 r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=f(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.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=i.default.dom||i.default,m=i.default.getComponent("Component"),y={wrap:!1},g=function(e){function t(e,n){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i,o,l=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){u(e,t,n[t])})}return e}({},y,n);i=this,o=f(t).call(this,e,l),(r=!o||"object"!==s(o)&&"function"!=typeof o?c(i):o).player_=e,r.setCls();var d,m=function(e,t){r.options_.fluid=t,r.removeCls(),r.setCls()};return l.wrap&&(d=r.el(),r.videoWrap_=p.createEl("div",{className:"cld-plw-col-player"}),r.contentEl_=r.contentEl_=p.createEl("div",{className:"cld-plw-col-list"}),(0,a.wrap)(r.player().el(),d),d.appendChild(r.videoWrap_),d.appendChild(r.contentEl_),(0,a.wrap)(r.player().el(),r.videoWrap_)),e.on("fluid",m),r.addChild("PlaylistPanel",r.options_),r.dispose=function(){r.removeLayout(),h(f(t.prototype),"dispose",c(r)).call(c(r)),e.off("fluid",m)},r}var n,r,i;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,(r=[{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,r),i&&l(n,i),t}();i.default.registerComponent("playlistLayout",g);var v=g;t.default=v},function(e,t,n){(function(t){e.exports=t.videojs=n(47)}).call(this,n(5))},function(e,t,n){"use strict";var r=n(0),i=n(54),a=n(55),o=n(59);function s(e,t,n){var r=e;return i(t)?(n=t,"string"==typeof e&&(r={uri:e})):r=o(t,{uri:e}),r.callback=n,r}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,r,i){t||(t=!0,e.callback(n,r,i))};function r(){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 i(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 i=v,o=null;return 0!==t?(i={body:r(),statusCode:t,method:f,headers:{},url:h,rawRequest:c},c.getAllResponseHeaders&&(i.headers=a(c.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,i,i.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=i,c.onprogress=function(){},c.onabort=function(){l=!0},c.ontimeout=i,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",i(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=r.XMLHttpRequest||function(){},u.XDomainRequest="withCredentials"in new u.XMLHttpRequest?u.XMLHttpRequest:r.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,r){return(n=s(t,n,r)).method=e.toUpperCase(),l(n)}})},function(e,t,n){var r,i,a,o,s;r=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,i=/^([^\/?#]*)(.*)$/,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 r=s.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");return r.path=s.normalizePath(r.path),s.buildURLFromParts(r)}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=i.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=r.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 r=n(0),i=n.n(r),a=function(e){return!!e&&"object"==typeof e},o=function e(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n.reduce(function(t,n){return Object.keys(n).forEach(function(r){Array.isArray(t[r])&&Array.isArray(n[r])?t[r]=t[r].concat(n[r]):a(t[r])&&a(n[r])?t[r]=e(t[r],n[r]):t[r]=n[r]}),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,r=t.attributes.id+(t.attributes.lang||"");e[r]?(t.segments[0].discontinuity=!0,(n=e[r].segments).push.apply(n,t.segments),t.attributes.contentProtection&&(e[r].attributes.contentProtection=t.attributes.contentProtection)):e[r]=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,r){return t[n]&&e.push(r),e},[])),e})},c=function(e){var t,n=e.attributes,r=e.segments,i={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:r,mediaSequence:r.length?r[0].number:1};return n.contentProtection&&(i.contentProtection=n.contentProtection),i},d=function(e){var t,n=e.attributes,r=e.segments,i={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:r,mediaSequence:r.length?r[0].number:1};return n.contentProtection&&(i.contentProtection=n.contentProtection),i},h=function(e){var t;if(!e.length)return{};var n=e[0].attributes,r=n.sourceDuration,i=n.minimumUpdatePeriod,a=void 0===i?0:i,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:r,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",r=t.attributes.lang||"",i="main";return r&&(i=t.attributes.lang+" ("+n+")"),e[i]&&e[i].playlists[0].attributes.BANDWIDTH>t.attributes.bandwidth?e:(e[i]={language:r,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,r,i,a,o=t.attributes.lang||"text";return e[o]?e:(e[o]={language:o,default:!1,autoselect:!1,playlists:[(n=t,i=n.attributes,a=n.segments,void 0===a&&(a=[{uri:i.baseUrl,timeline:i.periodIndex,resolvedUri:i.baseUrl||"",duration:i.sourceDuration,number:0}],i.duration=i.sourceDuration),{attributes:(r={NAME:i.id,BANDWIDTH:i.bandwidth},r["PROGRAM-ID"]=1,r),uri:"",endList:"static"===(i.type||"static"),timeline:i.periodIndex,resolvedUri:i.baseUrl||"",targetDuration:i.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,r,i,a,o;n=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,r=/^([^\/?#]*)(.*)$/,i=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,o={buildAbsoluteURL:function(e,t,n){if(n=n||{},e=e.trim(),!(t=t.trim())){if(!n.alwaysNormalize)return e;var i=o.parseURL(e);if(!i)throw new Error("Error trying to parse base URL.");return i.path=o.normalizePath(i.path),o.buildURLFromParts(i)}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=r.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(i,"");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(i.a.location.href,e)),p.buildAbsoluteURL(e,t))},y=function(e){var t=e.baseUrl,n=void 0===t?"":t,r=e.source,i=void 0===r?"":r,a=e.range,o=void 0===a?"":a,s={uri:i,resolvedUri:m(n||"",i)};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 r=e.NOW,i=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=(r+i)/1e3+(void 0===c?0:c)-(a+l);return Math.ceil((d*s-t)/n)},v=function(e,t){for(var n=e.type,r=void 0===n?"static":n,i=e.minimumUpdatePeriod,a=void 0===i?0:i,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"===r&&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,r=void 0===n?1:n,i=e.sourceDuration;return{start:0,end:Math.ceil(i/(t/r))}},dynamic:function(e){var t=e.NOW,n=e.clientOffset,r=e.availabilityStartTime,i=e.timescale,a=void 0===i?1:i,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=r+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,r=e.duration,i=e.timescale,a=void 0===i?1:i,o=e.sourceDuration,s=b[n](e),u=function(e,t){for(var n=[],r=e;r<t;r++)n.push(r);return n}(s.start,s.end).map(function(e){return function(t,n){var r=e.duration,i=e.timescale,a=void 0===i?1:i,o=e.periodIndex,s=e.startNumber;return{number:(void 0===s?1:s)+t,duration:r/a,timeline:o,time:n*r}}}(e));if("static"===n){var l=u.length-1;u[l].duration=o-r/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,r,i){if("$$"===t)return"$";if(void 0===e[n])return t;var a=""+e[n];return"RepresentationID"===n?a:(i=r?parseInt(i,10):1,a.length>=i?a:""+new Array(i-a.length+1).join("0")+a)}}(t))},w=function(e,t){var n={RepresentationID:e.id,Bandwidth:e.bandwidth||0},r=e.initialization,i=void 0===r?{sourceURL:"",range:""}:r,a=y({baseUrl:e.baseUrl,source:S(i.sourceURL,n),range:i.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 r=S(e.media||"",n);return{uri:r,timeline:t.timeline,duration:t.duration,resolvedUri:m(e.baseUrl||"",r),map:a,number:t.number}})},k="INVALID_NUMBER_OF_PERIOD",C="DASH_EMPTY_MANIFEST",E="DASH_INVALID_XML",O="NO_BASE_URL",P="SEGMENT_TIME_UNSPECIFIED",A="UNSUPPORTED_UTC_TIMING_SCHEME",L=function(e,t){var n=e.duration,r=e.segmentUrls,i=void 0===r?[]:r;if(!n&&!t||n&&t)throw new Error(P);var a,o=i.map(function(t){return function(e,t){var n=e.baseUrl,r=e.initialization,i=void 0===r?{}:r,a=y({baseUrl:n,source:i.sourceURL,range:i.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,r=void 0===n?{}:n,i=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(O);var c=y({baseUrl:t,source:r.sourceURL,range:r.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 i&&(d.duration=i/o,d.timeline=0);return d.number=0,[d]},j=function(e){var t,n,r=e.attributes,i=e.segmentInfo;if(i.template?(n=w,t=o(r,i.template)):i.base?(n=x,t=o(r,i.base)):i.list&&(n=L,t=o(r,i.list)),!n)return{attributes:r};var a=n(t,i.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()},U=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),r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],u=n[5];return 31536e3*parseFloat(r||0)+2592e3*parseFloat(i||0)+86400*parseFloat(a||0)+3600*parseFloat(o||0)+60*parseFloat(s||0)+parseFloat(u||0)},D={mediaPresentationDuration:function(e){return U(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 U(e)},timeShiftBufferDepth:function(e){return U(e)},start:function(e){return U(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)?U(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}},M=function(e){return e&&e.attributes?u(e.attributes).reduce(function(e,t){var n=D[t.name]||D.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],r=n&&I(n,"SegmentURL").map(function(e){return o({tag:"SegmentURL"},M(e))}),i=I(e,"SegmentBase")[0],a=n||t,s=a&&I(a,"SegmentTimeline")[0],u=n||i||t,l=u&&I(u,"Initialization")[0],c=t&&M(t);c&&l?c.initialization=l&&M(l):c&&c.initialization&&(c.initialization={sourceURL:c.initialization});var d={template:c,timeline:s&&I(s,"S").map(function(e){return M(e)}),list:n&&o(M(n),{segmentUrls:r,initialization:M(l)}),base:i&&o(M(i),{initialization:M(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=M(t),r=B[n.schemeIdUri];if(r){e[r]={attributes:n};var a=I(t,"cenc:pssh")[0];if(a){var o=R(a),s=o&&function(e){for(var t=i.a.atob(e),n=new Uint8Array(t.length),r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}(o);e[r].pssh=s}}return e},{})},H=function(e,t,n){return function(r){var i=M(r),a=N(t,I(r,"BaseURL")),u=I(r,"Role")[0],l={role:M(u)},c=o(e,i,l),d=V(I(r,"ContentProtection"));Object.keys(d).length&&(c=o(c,{contentProtection:d}));var h=F(r),f=I(r,"Representation"),p=o(n,h);return s(f.map(function(e,t,n){return function(r){var i=I(r,"BaseURL"),a=N(t,i),s=o(e,M(r)),u=F(r);return a.map(function(e){return{segmentInfo:o(n,u),attributes:o(s,{baseUrl:e})}})}}(c,a,p)))}},q=function(e,t){void 0===t&&(t={});var n=t,r=n.manifestUri,a=void 0===r?"":r,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=M(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,r){var a=N(t,I(n,"BaseURL")),u=M(n),l=parseInt(u.id,10),c=i.a.isNaN(l)?r:l,d=o(e,{periodIndex:c}),h=I(n,"AdaptationSet"),f=F(n);return s(h.map(H(d,a,f)))}}(f,p)))},z=function(e){if(""===e)throw new Error(C);var t=(new i.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(q(z(e),t).map(j))},G=function(e){return function(e){var t=I(e,"UTCTiming")[0];if(!t)return null;var n=M(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