sync/www/js/videojs-contrib-hls.min.js

12 lines
166 KiB
JavaScript

/**
* videojs-contrib-hls
* @version 3.4.0
* @copyright 2016 Brightcove, Inc
* @license Apache-2.0
*/
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.videojsContribHls=e()}}(function(){return function e(t,i,r){function n(s,o){if(!i[s]){if(!t[s]){var u="function"==typeof require&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var d=new Error("Cannot find module '"+s+"'");throw d.code="MODULE_NOT_FOUND",d}var l=i[s]={exports:{}};t[s][0].call(l.exports,function(e){var i=t[s][1][e];return n(i?i:e)},l,l.exports,e,t,i,r)}return i[s].exports}for(var a="function"==typeof require&&require,s=0;s<r.length;s++)n(r[s]);return n}({1:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(e,t){return e.start(t)+"-"+e.end(t)},n=function(e,t){var i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},a=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},s={hexDump:function(e){for(var t=Array.prototype.slice.call(e),i=16,r="",s=void 0,o=void 0,u=0;u<t.length/i;u++)s=t.slice(u*i,u*i+i).map(n).join(""),o=t.slice(u*i,u*i+i).map(a).join(""),r+=s+" "+o+"\n";return r},tagDump:function(e){return s.hexDump(e.bytes)},textRanges:function(e){var t="",i=void 0;for(i=0;i<e.length;i++)t+=r(e,i)+" ";return t}};i.default=s,t.exports=i.default},{}],2:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.default={GOAL_BUFFER_LENGTH:30},t.exports=i.default},{}],3:[function(e,t,i){(function(r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var s=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),o=e("./ranges"),u=n(o),d="undefined"!=typeof window?window.videojs:"undefined"!=typeof r?r.videojs:null,l=n(d),f=["seeking","seeked","pause","playing","error"],c=function(){function e(t){var i=this;a(this,e),this.tech_=t.tech,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.timer_=null,t.debug&&(this.logger_=l.default.log.bind(l.default,"gap-skipper ->")),this.logger_("initialize");var r=function(){return i.waiting_()},n=function(){return i.timeupdate_()},s=function(){return i.cancelTimer_()};this.tech_.on("waiting",r),this.tech_.on("timeupdate",n),this.tech_.on(f,s),this.dispose=function(){i.logger_("dispose"),i.tech_.off("waiting",r),i.tech_.off("timeupdate",n),i.tech_.off(f,s),i.cancelTimer_()}}return s(e,[{key:"waiting_",value:function(){this.tech_.seeking()||this.setTimer_()}},{key:"timeupdate_",value:function(){if(!this.tech_.paused()&&!this.tech_.seeking()){var e=this.tech_.currentTime();5===this.consecutiveUpdates&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}}},{key:"cancelTimer_",value:function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null}},{key:"skipTheGap_",value:function(e){var t=this.tech_.buffered(),i=this.tech_.currentTime(),r=u.default.findNextRange(t,i);this.consecutiveUpdates=0,this.timer_=null,0!==r.length&&i===e&&(this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",r.start(0)),this.tech_.setCurrentTime(r.start(0)+u.default.TIME_FUDGE_FACTOR))}},{key:"gapFromVideoUnderflow_",value:function(e,t){for(var i=u.default.findGaps(e),r=0;r<i.length;r++){var n=i.start(r),a=i.end(r);if(a-n<1&&t-n<4&&t-a>2)return{start:n,end:a}}return null}},{key:"setTimer_",value:function(){var e=this.tech_.buffered(),t=this.tech_.currentTime(),i=u.default.findNextRange(e,t);if(null===this.timer_){if(0===i.length){var r=this.gapFromVideoUnderflow_(e,t);return void(r&&(this.logger_("setTimer_:","Encountered a gap in video","from: ",r.start,"to: ",r.end,"seeking to current time: ",t),this.tech_.setCurrentTime(t)))}var n=i.start(0)-t;this.logger_("setTimer_:","stopped at:",t,"setting timer for:",n,"seeking to:",i.start(0)),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*n,t)}}},{key:"logger_",value:function(){}}]),e}();i.default=c,t.exports=i.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./ranges":8}],4:[function(e,t,i){(function(r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var o=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),u=function(e,t,i){for(var r=!0;r;){var n=e,a=t,s=i;r=!1,null===n&&(n=Function.prototype);var o=Object.getOwnPropertyDescriptor(n,a);if(void 0!==o){if("value"in o)return o.value;var u=o.get;if(void 0===u)return;return u.call(s)}var d=Object.getPrototypeOf(n);if(null===d)return;e=d,t=a,i=s,r=!0,o=d=void 0}},d="undefined"!=typeof window?window.videojs:"undefined"!=typeof r?r.videojs:null,l=e("./playlist-loader"),f=n(l),c=function(e){function t(e){a(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,{kind:e.default?"main":"alternative",enabled:e.default||!1,language:e.language,label:e.label}),this.hls=e.hls,this.autoselect=e.autoselect||!1,this.default=e.default||!1,this.withCredentials=e.withCredentials||!1,this.mediaGroups_=[],this.addLoader(e.mediaGroup,e.resolvedUri)}return s(t,e),o(t,[{key:"getLoader",value:function(e){for(var t=0;t<this.mediaGroups_.length;t++){var i=this.mediaGroups_[t];if(i.mediaGroup===e)return i.loader}}},{key:"addLoader",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?null:arguments[1],i=null;t&&(i=new f.default(t,this.hls,this.withCredentials)),this.mediaGroups_.push({mediaGroup:e,loader:i})}},{key:"removeLoader",value:function(e){for(var t=0;t<this.mediaGroups_.length;t++){var i=this.mediaGroups_[t];if(i.mediaGroup===e)return i.loader&&i.loader.dispose(),void this.mediaGroups_.splice(t,1)}}},{key:"dispose",value:function(){for(var e=this.mediaGroups_.length;e--;)this.removeLoader(this.mediaGroups_[e].mediaGroup)}}]),t}(d.AudioTrack);i.default=c,t.exports=i.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./playlist-loader":6}],5:[function(e,t,i){(function(r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var o=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),u=function(e,t,i){for(var r=!0;r;){var n=e,a=t,s=i;r=!1,null===n&&(n=Function.prototype);var o=Object.getOwnPropertyDescriptor(n,a);if(void 0!==o){if("value"in o)return o.value;var u=o.get;if(void 0===u)return;return u.call(s)}var d=Object.getPrototypeOf(n);if(null===d)return;e=d,t=a,i=s,r=!0,o=d=void 0}},d=e("./playlist-loader"),l=n(d),f=e("./segment-loader"),c=n(f),h=e("./ranges"),p=n(h),m="undefined"!=typeof window?window.videojs:"undefined"!=typeof r?r.videojs:null,g=n(m),y=e("./hls-audio-track"),v=n(y),b=e("global/window"),_=n(b),w=3e5,T=void 0,S=function(e){var t={codecCount:0,videoCodec:null,audioProfile:null};return t.codecCount=e.split(",").length,t.codecCount=t.codecCount||2,t.videoCodec=/(^|\s|,)+(avc1)[^ ,]*/i.exec(e),t.videoCodec=t.videoCodec&&t.videoCodec[2],t.audioProfile=/(^|\s|,)+mp4a.\d+\.(\d+)/i.exec(e),t.audioProfile=t.audioProfile&&t.audioProfile[2],t},k=function(e){function t(e){var i=this,r=e.url,n=e.withCredentials,s=e.mode,o=e.tech,d=e.bandwidth,f=e.externHls,h=e.useCueTags;a(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this),T=f,this.withCredentials=n,this.tech_=o,this.hls_=o.hls,this.mode_=s,this.useCueTags_=h,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","hls-segment-metadata"),this.cueTagsTrack_.inBandMetadataTrackDispatchType="",this.tech_.textTracks().addTrack_(this.cueTagsTrack_)),this.audioTracks_=[],this.requestOptions_={withCredentials:this.withCredentials,timeout:null},this.mediaSource=new g.default.MediaSource({mode:s}),this.mediaSource.on("audioinfo",function(e){return i.trigger(e)}),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_.bind(this));var p={hls:this.hls_,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:function(){return i.seekable()},seeking:function(){return i.tech_.seeking()},setCurrentTime:function(e){return i.tech_.setCurrentTime(e)},hasPlayed:function(){return 0!==i.tech_.played().length},bandwidth:d};if(this.mainSegmentLoader_=new c.default(p),this.audioSegmentLoader_=new c.default(p),!r)throw new Error("A non-empty playlist URL is required");this.masterPlaylistLoader_=new l.default(r,this.hls_,this.withCredentials),this.masterPlaylistLoader_.on("loadedmetadata",function(){var e=i.masterPlaylistLoader_.media(),t=1.5*i.masterPlaylistLoader_.targetDuration*1e3;i.requestOptions_.timeout=t,e.endList&&"none"!==i.tech_.preload()&&(i.mainSegmentLoader_.playlist(e,i.requestOptions_),i.mainSegmentLoader_.expired(i.masterPlaylistLoader_.expired_),i.mainSegmentLoader_.load()),i.setupSourceBuffer_(),i.setupFirstPlay(),i.useAudio()}),this.masterPlaylistLoader_.on("loadedplaylist",function(){var e=i.masterPlaylistLoader_.media(),t=void 0;return e?(i.updateCues_(e),i.mainSegmentLoader_.playlist(e,i.requestOptions_),i.mainSegmentLoader_.expired(i.masterPlaylistLoader_.expired_),i.updateDuration(),t=i.seekable(),void(e.endList||0===t.length||i.mediaSource.addSeekableRange_(t.start(0),t.end(0)))):(i.initialMedia_=i.selectPlaylist(),i.masterPlaylistLoader_.media(i.initialMedia_),i.fillAudioTracks_(),void i.trigger("selectedinitialmedia"))}),this.masterPlaylistLoader_.on("error",function(){i.blacklistCurrentPlaylist(i.masterPlaylistLoader_.error)}),this.masterPlaylistLoader_.on("mediachanging",function(){i.mainSegmentLoader_.pause()}),this.masterPlaylistLoader_.on("mediachange",function(){var e=i.masterPlaylistLoader_.media(),t=1.5*i.masterPlaylistLoader_.targetDuration*1e3;i.mainSegmentLoader_.abort(),i.masterPlaylistLoader_.isLowestEnabledRendition_()?i.requestOptions_.timeout=0:i.requestOptions_.timeout=t,i.mainSegmentLoader_.playlist(e,i.requestOptions_),i.mainSegmentLoader_.expired(i.masterPlaylistLoader_.expired_),i.mainSegmentLoader_.load(),i.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainSegmentLoader_.on("progress",function(){i.masterPlaylistLoader_.media(i.selectPlaylist()),i.trigger("progress")}),this.mainSegmentLoader_.on("error",function(){i.blacklistCurrentPlaylist(i.mainSegmentLoader_.error())}),this.audioSegmentLoader_.on("error",function(){g.default.log.warn("Problem encountered with the current alternate audio track. Switching back to default."),i.audioSegmentLoader_.abort(),i.audioPlaylistLoader_=null,i.useAudio()}),this.masterPlaylistLoader_.load()}return s(t,e),o(t,[{key:"mediaRequests_",value:function(){return this.audioSegmentLoader_.mediaRequests+this.mainSegmentLoader_.mediaRequests}},{key:"mediaTransferDuration_",value:function(){return this.audioSegmentLoader_.mediaTransferDuration+this.mainSegmentLoader_.mediaTransferDuration}},{key:"mediaBytesTransferred_",value:function(){return this.audioSegmentLoader_.mediaBytesTransferred+this.mainSegmentLoader_.mediaBytesTransferred}},{key:"fillAudioTracks_",value:function(){var e=this.master(),t=e.mediaGroups||{};t&&t.AUDIO&&0!==Object.keys(t.AUDIO).length&&"html5"===this.mode_||(t.AUDIO={main:{default:{default:!0}}});var i={};for(var r in t.AUDIO)for(var n in t.AUDIO[r]){var a=t.AUDIO[r][n];if(i[n])i[n].addLoader(r,a.resolvedUri);else{var s=new v.default(g.default.mergeOptions(a,{hls:this.hls_,withCredentials:this.withCredential,mediaGroup:r,label:n}));i[n]=s,this.audioTracks_.push(s)}}}},{key:"load",value:function(){this.mainSegmentLoader_.load(),this.audioPlaylistLoader_&&this.audioSegmentLoader_.load()}},{key:"activeAudioGroup",value:function(){var e=this.masterPlaylistLoader_.media(),t="main";return e&&e.attributes&&e.attributes.AUDIO&&(t=e.attributes.AUDIO),t}},{key:"useAudio",value:function(){var e=this,t=void 0;if(this.audioTracks_.forEach(function(e){!t&&e.enabled&&(t=e)}),t){this.audioPlaylistLoader_&&(this.audioPlaylistLoader_.pause(),this.audioPlaylistLoader_=null,this.audioSegmentLoader_.pause());var i=t.getLoader(this.activeAudioGroup());if(!i)return void this.mainSegmentLoader_.clearBuffer();if(this.audioPlaylistLoader_=i,this.audioPlaylistLoader_.started)return this.audioPlaylistLoader_.load(),this.audioSegmentLoader_.load(),void this.audioSegmentLoader_.clearBuffer();this.audioPlaylistLoader_.on("loadedmetadata",function(){var t=e.audioPlaylistLoader_.media();e.audioSegmentLoader_.playlist(t,e.requestOptions_),e.addMimeType_(e.audioSegmentLoader_,"mp4a.40.2",t),(!e.tech_.paused()||t.endList&&"none"!==e.tech_.preload())&&e.audioSegmentLoader_.load(),t.endList||e.audioPlaylistLoader_.trigger("firstplay")}),this.audioPlaylistLoader_.on("loadedplaylist",function(){var t=void 0;return e.audioPlaylistLoader_&&(t=e.audioPlaylistLoader_.media()),t?void e.audioSegmentLoader_.playlist(t,e.requestOptions_):void e.audioPlaylistLoader_.media(e.audioPlaylistLoader_.playlists.master.playlists[0])}),this.audioPlaylistLoader_.on("error",function(){g.default.log.warn("Problem encountered loading the alternate audio track. Switching back to default."),e.audioSegmentLoader_.abort(),e.audioPlaylistLoader_=null,e.useAudio()}),this.audioSegmentLoader_.clearBuffer(),this.audioPlaylistLoader_.start()}}},{key:"fastQualityChange_",value:function(){var e=this.selectPlaylist();e!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(e),this.mainSegmentLoader_.sourceUpdater_.remove(this.tech_.currentTime()+5,1/0))}},{key:"play",value:function(){if(!this.setupFirstPlay())return this.tech_.ended()&&this.tech_.setCurrentTime(0),this.load(),this.tech_.duration()===1/0&&this.tech_.currentTime()<this.tech_.seekable().start(0)?this.tech_.setCurrentTime(this.tech_.seekable().start(0)):void 0}},{key:"setupFirstPlay",value:function(){var e=void 0,t=this.masterPlaylistLoader_.media();return!(!t||t.endList||this.tech_.paused()||this.hasPlayed_)&&(this.load(),this.masterPlaylistLoader_.trigger("firstplay"),this.hasPlayed_=!0,e=this.seekable(),e.length&&this.tech_.setCurrentTime(e.end(0)),!0)}},{key:"handleSourceOpen_",value:function(){this.setupSourceBuffer_(),this.tech_.autoplay()&&this.tech_.play(),this.trigger("sourceopen")}},{key:"blacklistCurrentPlaylist",value:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=void 0,i=void 0;return(t=e.playlist||this.masterPlaylistLoader_.media())?(t.excludeUntil=Date.now()+w,(i=this.selectPlaylist())?(g.default.log.warn("Problem encountered with the current HLS playlist. Switching to another playlist."),this.masterPlaylistLoader_.media(i)):(g.default.log.warn("Problem encountered with the current HLS playlist. No suitable alternatives found."),this.error=e,this.mediaSource.endOfStream("network"))):(this.error=e,this.mediaSource.endOfStream("network"))}},{key:"pauseLoading",value:function(){this.mainSegmentLoader_.pause(),this.audioPlaylistLoader_&&this.audioSegmentLoader_.pause()}},{key:"setCurrentTime",value:function(e){var t=p.default.findRange(this.tech_.buffered(),e);return this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media()&&this.masterPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.abort(),this.audioPlaylistLoader_&&this.audioSegmentLoader_.abort(),void(this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioPlaylistLoader_&&this.audioSegmentLoader_.load()))):0}},{key:"duration",value:function(){return this.masterPlaylistLoader_?this.mediaSource?this.mediaSource.duration:T.Playlist.duration(this.masterPlaylistLoader_.media()):0}},{key:"seekable",value:function(){var e=void 0,t=void 0,i=void 0;return this.masterPlaylistLoader_&&(e=this.masterPlaylistLoader_.media())?(t=T.Playlist.seekable(e,this.masterPlaylistLoader_.expired_),0===t.length?t:this.audioPlaylistLoader_&&(i=T.Playlist.seekable(this.audioPlaylistLoader_.media(),this.audioPlaylistLoader_.expired_),0===i.length)?i:i?g.default.createTimeRanges([[i.start(0)>t.start(0)?i.start(0):t.start(0),i.end(0)<t.end(0)?i.end(0):t.end(0)]]):t):g.default.createTimeRanges()}},{key:"updateDuration",value:function(){var e=this,t=this.mediaSource.duration,i=T.Playlist.duration(this.masterPlaylistLoader_.media()),r=this.tech_.buffered(),n=function t(){e.mediaSource.duration=i,e.tech_.trigger("durationchange"),e.mediaSource.removeEventListener("sourceopen",t)};r.length>0&&(i=Math.max(i,r.end(r.length-1))),t!==i&&("open"!==this.mediaSource.readyState?this.mediaSource.addEventListener("sourceopen",n):n())}},{key:"dispose",value:function(){this.masterPlaylistLoader_.dispose(),this.audioTracks_.forEach(function(e){e.dispose()}),this.audioTracks_.length=0,this.mainSegmentLoader_.dispose(),this.audioSegmentLoader_.dispose()}},{key:"master",value:function(){return this.masterPlaylistLoader_.master}},{key:"media",value:function(){return this.masterPlaylistLoader_.media()||this.initialMedia_}},{key:"setupSourceBuffer_",value:function(){var e=this.masterPlaylistLoader_.media();e&&"open"===this.mediaSource.readyState&&(this.addMimeType_(this.mainSegmentLoader_,"avc1.4d400d, mp4a.40.2",e),this.excludeIncompatibleVariants_(e))}},{key:"addMimeType_",value:function(e,t,i){var r="video/mp2t";r+=i.attributes&&i.attributes.CODECS?'; codecs="'+i.attributes.CODECS+'"':'; codecs="'+t+'"',e.mimeType(r)}},{key:"excludeIncompatibleVariants_",value:function(e){var t=this.masterPlaylistLoader_.master,i=2,r=null,n=null,a=void 0;e.attributes&&e.attributes.CODECS&&(a=S(e.attributes.CODECS),r=a.videoCodec,n=a.audioProfile,i=a.codecCount),t.playlists.forEach(function(e){var t={codecCount:2,videoCodec:null,audioProfile:null};e.attributes&&e.attributes.CODECS&&(t=S(e.attributes.CODECS)),t.codecCount!==i&&(e.excludeUntil=1/0),t.videoCodec!==r&&(e.excludeUntil=1/0),("5"===t.audioProfile&&"5"!==n||"5"===n&&"5"!==t.audioProfile)&&(e.excludeUntil=1/0)})}},{key:"updateCues_",value:function(e){if(this.useCueTags_&&e.segments){for(;this.cueTagsTrack_.cues.length;)this.cueTagsTrack_.removeCue(this.cueTagsTrack_.cues[0]);for(var t=0,i=0;i<e.segments.length;i++){var r=e.segments[i];if("cueOut"in r||"cueOutCont"in r||"cueIn"in r){var n={};"cueOut"in r&&(n.cueOut=r.cueOut),"cueOutCont"in r&&(n.cueOutCont=r.cueOutCont),"cueIn"in r&&(n.cueIn=r.cueIn),this.cueTagsTrack_.addCue(new _.default.VTTCue(t,t+.5,JSON.stringify(n)))}t+=r.duration}}}}]),t}(g.default.EventTarget);i.default=k,t.exports=i.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./hls-audio-track":4,"./playlist-loader":6,"./ranges":8,"./segment-loader":11,"global/window":25}],6:[function(e,t,i){(function(r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(i,"__esModule",{value:!0});var a=e("./resolve-url"),s=n(a),o="undefined"!=typeof window?window.videojs:"undefined"!=typeof r?r.videojs:null,u=e("./stream"),d=n(u),l=e("m3u8-parser"),f=n(l),c=e("global/window"),h=n(c),p=function(e,t,i){var r=t.slice(),n=void 0,a=void 0;for(i=i||0,n=Math.min(e.length,t.length+i),a=i;a<n;a++)r[a-i]=(0,o.mergeOptions)(e[a],r[a-i]);return r},m=function(e,t){for(var i=!1,r=(0,o.mergeOptions)(e,{}),n=e.playlists.length,a=void 0,u=void 0,d=void 0;n--;)if(a=r.playlists[n],a.uri===t.uri){if(a.segments&&t.segments&&a.segments.length===t.segments.length&&a.mediaSequence===t.mediaSequence)continue;for(r.playlists[n]=(0,o.mergeOptions)(a,t),r.playlists[t.uri]=r.playlists[n],a.segments&&(r.playlists[n].segments=p(a.segments,t.segments,t.mediaSequence-a.mediaSequence)),d=0,r.playlists[n].segments&&(d=r.playlists[n].segments.length);d--;)u=r.playlists[n].segments[d],u.resolvedUri||(u.resolvedUri=(0,s.default)(a.resolvedUri,u.uri)),u.key&&!u.key.resolvedUri&&(u.key.resolvedUri=(0,s.default)(a.resolvedUri,u.key.uri));i=!0}return i?r:null},g=function e(t,i,r){var n=this,a=this,o=void 0,u=void 0,d=void 0,l=void 0,c=void 0;if(e.prototype.constructor.call(this),this.hls_=i,this.trackExpiredTime_=!1,!t)throw new Error("A non-empty playlist URL is required");l=function(e,t,i){a.setBandwidth(d||e),d=null,i&&(a.state=i),a.error={playlist:a.master.playlists[t],status:e.status,message:"HLS playlist request error at URL: "+t,responseText:e.responseText,code:e.status>=500?4:2},a.trigger("error")},c=function(e,t){var i=void 0,r=void 0,n=void 0;a.setBandwidth(d||e),d=null,a.state="HAVE_METADATA",i=new f.default.Parser,i.push(e.responseText),i.end(),i.manifest.uri=t,n=m(a.master,i.manifest),r=1e3*(i.manifest.targetDuration||10),a.targetDuration=i.manifest.targetDuration,n?(a.master=n,a.updateMediaPlaylist_(i.manifest)):r/=2,a.media().endList||(h.default.clearTimeout(u),u=h.default.setTimeout(function(){a.trigger("mediaupdatetimeout")},r)),a.trigger("loadedplaylist")},a.state="HAVE_NOTHING",this.expired_=0,o=this.dispose,a.dispose=function(){a.stopRequest(),h.default.clearTimeout(u),o.call(this)},a.stopRequest=function(){if(d){var e=d;d=null,e.onreadystatechange=null,e.abort()}},a.enabledPlaylists_=function(){return a.master.playlists.filter(function(e,t,i){return!e.excludeUntil||e.excludeUntil<=Date.now()}).length},a.isLowestEnabledRendition_=function(){if(!a.media())return!1;var e=a.media().attributes.BANDWIDTH;return!(a.master.playlists.filter(function(t,i,r){var n="undefined"==typeof t.excludeUntil||t.excludeUntil<=Date.now();if(!n)return!1;var a=t.attributes.BANDWIDTH;return a<=e}).length>1)},a.media=function(e){var t=a.state,i=void 0;if(!e)return a.media_;if("HAVE_NOTHING"===a.state)throw new Error("Cannot switch media playlist from "+a.state);if("string"==typeof e){if(!a.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=a.master.playlists[e]}if(i=!a.media_||e.uri!==a.media_.uri,a.master.playlists[e.uri].endList)return d&&(d.onreadystatechange=null,d.abort(),d=null),a.state="HAVE_METADATA",a.media_=e,void(i&&(a.trigger("mediachanging"),a.trigger("mediachange")));if(i){if(a.state="SWITCHING_MEDIA",d){if((0,s.default)(a.master.uri,e.uri)===d.url)return;d.onreadystatechange=null,d.abort(),d=null}this.media_&&this.trigger("mediachanging"),d=this.hls_.xhr({uri:(0,s.default)(a.master.uri,e.uri),withCredentials:r},function(i,r){if(d){if(i)return l(d,e.uri,t);c(r,e.uri),"HAVE_MASTER"===t?a.trigger("loadedmetadata"):a.trigger("mediachange")}})}},a.setBandwidth=function(e){a.bandwidth=e.bandwidth},a.on("firstplay",function(){this.trackExpiredTime_=!0}),a.on("mediaupdatetimeout",function(){"HAVE_METADATA"===a.state&&(a.state="HAVE_CURRENT_METADATA",d=this.hls_.xhr({uri:(0,s.default)(a.master.uri,a.media().uri),withCredentials:r},function(e,t){if(d)return e?l(d,a.media().uri):void c(d,a.media().uri)}))}),a.pause=function(){a.stopRequest(),h.default.clearTimeout(u)},a.load=function(){a.started?a.media().endList?a.trigger("loadedplaylist"):a.trigger("mediaupdatetimeout"):a.start()},a.start=function(){a.started=!0,d=n.hls_.xhr({uri:t,withCredentials:r},function(e,i){var r=void 0,n=void 0,o=void 0;if(d){if(d=null,e)return a.error={status:i.status,message:"HLS playlist request error at URL: "+t,responseText:i.responseText,code:2},a.trigger("error");if(r=new f.default.Parser,r.push(i.responseText),r.end(),a.state="HAVE_MASTER",r.manifest.uri=t,r.manifest.playlists){for(a.master=r.manifest,o=a.master.playlists.length;o--;)n=a.master.playlists[o],a.master.playlists[n.uri]=n,n.resolvedUri=(0,s.default)(a.master.uri,n.uri);for(var u in a.master.mediaGroups.AUDIO)for(var l in a.master.mediaGroups.AUDIO[u]){var p=a.master.mediaGroups.AUDIO[u][l];p.uri&&(p.resolvedUri=(0,s.default)(a.master.uri,p.uri))}return a.trigger("loadedplaylist"),void(d||a.media(r.manifest.playlists[0]))}return a.master={uri:h.default.location.href,playlists:[{uri:t}]},a.master.playlists[t]=a.master.playlists[0],a.master.playlists[0].resolvedUri=t,c(i,t),a.trigger("loadedmetadata")}})}};g.prototype=new d.default,g.prototype.updateMediaPlaylist_=function(e){var t=void 0,i=void 0,r=void 0;if(t=this.media_,this.media_=this.master.playlists[e.uri],t&&this.trackExpiredTime_&&e.uri===t.uri){if(e.segments.length){if("undefined"!=typeof e.segments[0].start)return void(this.expired_=e.segments[0].start);if("undefined"!=typeof e.segments[0].end)return void(this.expired_=e.segments[0].end-e.segments[0].duration)}for(i=e.mediaSequence-t.mediaSequence-1;i>=0;i--)if(r=t.segments[i]){if("undefined"!=typeof r.end)return void(this.expired_=r.end);if("undefined"!=typeof r.start)return void(this.expired_=r.start+r.duration);this.expired_+=r.duration}else this.expired_+=t.targetDuration||10}},i.default=g,t.exports=i.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./resolve-url":10,"./stream":13,"global/window":25,"m3u8-parser":62}],7:[function(e,t,i){(function(t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(i,"__esModule",{value:!0});var n="undefined"!=typeof window?window.videojs:"undefined"!=typeof t?t.videojs:null,a=e("global/window"),s=r(a),o={UNSAFE_LIVE_SEGMENTS:3},u=function(e,t){var i=0,r=t-e.mediaSequence,n=e.segments[r];if(n){if("undefined"!=typeof n.start)return{result:n.start,precise:!0};if("undefined"!=typeof n.end)return{result:n.end-n.duration,precise:!0}}for(;r--;){if(n=e.segments[r],"undefined"!=typeof n.end)return{result:i+n.end,precise:!0};if(i+=n.duration,"undefined"!=typeof n.start)return{result:i+n.start,precise:!0}}return{result:i,precise:!1}},d=function(e,t){for(var i=0,r=void 0,n=t-e.mediaSequence;n<e.segments.length;n++){if(r=e.segments[n],"undefined"!=typeof r.start)return{result:r.start-i,precise:!0};if(i+=r.duration,"undefined"!=typeof r.end)return{result:r.end-i,precise:!0}}return{result:-1,precise:!1}},l=function(e,t,i){var r=void 0,n=void 0;return"undefined"==typeof t&&(t=e.mediaSequence+e.segments.length),t<e.mediaSequence?0:(r=u(e,t),r.precise?r.result:(n=d(e,t),n.precise?n.result:r.result+i))},f=function(e,t,i){if(!e)return 0;if("number"!=typeof i&&(i=0),"undefined"==typeof t){if(e.totalDuration)return e.totalDuration;if(!e.endList)return s.default.Infinity}return l(e,t,i)};i.duration=f;var c=function(e,t){var i=void 0,r=void 0,a=void 0;return"number"!=typeof t&&(t=0),e&&e.segments?e.endList?(0,n.createTimeRange)(0,f(e)):(i=l(e,e.mediaSequence,t),a=Math.max(0,e.segments.length-o.UNSAFE_LIVE_SEGMENTS),r=l(e,e.mediaSequence+a,t),(0,n.createTimeRange)(i,r)):(0,n.createTimeRange)()};i.seekable=c;var h=function(e,t,i){var r=void 0,n=void 0,a=t,s=e.segments.length,o=s-1,u=void 0,d=void 0,l=void 0,f=void 0;if(!e)return 0;if(t<0)return 0;if(0===t&&!i)return 0;for(i=i||0,r=0;r<s;r++)if(n=e.segments[r],n.end){if(n.end>t){f=n.end,d=r;break}l=n.end,u=r+1}if(u===s)return s;if("undefined"!=typeof u){for(t-=l,r=u;r<(d||s);r++)if(n=e.segments[r],t-=n.duration,t<0)return r;return r>=d?u+Math.floor((a-l)/(f-l)*(d-u)):o}if("undefined"!=typeof d){for(t=f-t,r=d;r>=0;r--)if(n=e.segments[r],t-=n.duration,t<0)return r;return 0===t?0:-1}if(t-=i,t<0)return-1;for(r=0;r<s;r++)if(n=e.segments[r],t-=n.duration,t<0)return r;return o};i.getMediaIndexForTime_=h,o.duration=f,o.seekable=c,o.getMediaIndexForTime_=h,i.default=o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"global/window":25}],8:[function(e,t,i){(function(e){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){var i=[],r=!0,n=!1,a=void 0;try{for(var s,o=e[Symbol.iterator]();!(r=(s=o.next()).done)&&(i.push(s.value),!t||i.length!==t);r=!0);}catch(e){n=!0,a=e}finally{try{!r&&o.return&&o.return()}finally{if(n)throw a}}return i}return function(t,i){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a="undefined"!=typeof window?window.videojs:"undefined"!=typeof e?e.videojs:null,s=r(a),o=1/30,u=function(e,t){var i=n(t,2),r=i[0],a=i[1];return Math.min(Math.max(r,e),a)},d=function(e,t){var i=[],r=void 0;if(e&&e.length)for(r=0;r<e.length;r++)t(e.start(r),e.end(r))&&i.push([e.start(r),e.end(r)]);return s.default.createTimeRanges(i)},l=function(e,t){return d(e,function(e,i){return e-o<=t&&i+o>=t})},f=function(e,t){return d(e,function(e){return e-o>=t})},c=function(e){if(e.length<2)return s.default.createTimeRanges();for(var t=[],i=1;i<e.length;i++){var r=e.end(i-1),n=e.start(i);t.push([r,n])}return s.default.createTimeRanges(t)},h=function(e,t){var i=void 0,r=void 0,n=void 0,a=[],s=[],o=function(e){return e[0]<=n&&e[1]>=n};if(e)for(i=0;i<e.length;i++)r=e.start(i),n=e.end(i),s.push([r,n]);if(t)for(i=0;i<t.length;i++)r=t.start(i),n=t.end(i),s.some(o)||a.push(n);return 1!==a.length?null:a[0]},p=function(e,t){var i=null,r=null,n=0,a=[],o=[];if(!(e&&e.length&&t&&t.length))return s.default.createTimeRange();for(var u=e.length;u--;)a.push({time:e.start(u),type:"start"}),a.push({time:e.end(u),type:"end"});for(u=t.length;u--;)a.push({time:t.start(u),type:"start"}),a.push({time:t.end(u),type:"end"});for(a.sort(function(e,t){return e.time-t.time}),u=0;u<a.length;u++)"start"===a[u].type?(n++,2===n&&(i=a[u].time)):"end"===a[u].type&&(n--,1===n&&(r=a[u].time)),null!==i&&null!==r&&(o.push([i,r]),i=null,r=null);return s.default.createTimeRanges(o)},m=function(e,t,i,r){for(var n=t.end(0)-t.start(0),a=e.end(0)-e.start(0),s=n-a,o=p(e,r),u=p(t,r),d=0,l=0,f=o.length;f--;)d+=o.end(f)-o.start(f),o.start(f)===i&&(d+=s);for(f=u.length;f--;)l+=u.end(f)-u.start(f);return Math.max(d,l)/n*100},g=function(e,t,i,r){var n=e+t,a=s.default.createTimeRanges([[e,n]]),o=s.default.createTimeRanges([[u(e,[i,n]),n]]);if(o.start(0)===o.end(0))return 0;var d=m(o,a,i,r);return isNaN(d)||d===1/0||d===-(1/0)?0:d};i.default={findRange:l,findNextRange:f,findGaps:c,findSoleUncommonTimeRangesEnd:h,getSegmentBufferedPercent:g,TIME_FUDGE_FACTOR:o},t.exports=i.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],9:[function(e,t,i){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var n=function(e,t,i){var r="undefined"==typeof e.excludeUntil||e.excludeUntil<=Date.now();return"undefined"==typeof i?r:(i!==r&&(i?delete e.excludeUntil:e.excludeUntil=1/0,t()),i)},a=function e(t,i,a){r(this,e);var s=t.masterPlaylistController_.fastQualityChange_.bind(t.masterPlaylistController_);if(i.attributes){
var o=i.attributes;if(o.RESOLUTION){var u=o.RESOLUTION;this.width=u.width,this.height=u.height}this.bandwidth=o.BANDWIDTH}this.id=a,this.enabled=n.bind(this,i,s)},s=function(e){var t=e.playlists;e.representations=function(){return t.master.playlists.map(function(t,i){return new a(e,t,i)})}};i.default=s,t.exports=i.default},{}],10:[function(e,t,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(i,"__esModule",{value:!0});var n=e("global/document"),a=r(n),s=function(e,t){var i=a.default.querySelector("base"),r=a.default.querySelector("head"),n=a.default.createElement("a"),s=i,o=void 0,u=void 0;return i?o=i.href:s=r.appendChild(a.default.createElement("base")),s.href=e,n.href=t,u=n.href,i?i.href=o:r.removeChild(s),u};i.default=s,t.exports=i.default},{"global/document":24}],11:[function(e,t,i){(function(r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var o=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),u=function(e,t,i){for(var r=!0;r;){var n=e,a=t,s=i;r=!1,null===n&&(n=Function.prototype);var o=Object.getOwnPropertyDescriptor(n,a);if(void 0!==o){if("value"in o)return o.value;var u=o.get;if(void 0===u)return;return u.call(s)}var d=Object.getPrototypeOf(n);if(null===d)return;e=d,t=a,i=s,r=!0,o=d=void 0}},d=e("./ranges"),l=n(d),f=e("./playlist"),c="undefined"!=typeof window?window.videojs:"undefined"!=typeof r?r.videojs:null,h=n(c),p=e("./source-updater"),m=n(p),g=e("aes-decrypter"),y=e("./config"),v=n(y),b=e("global/window"),_=n(b),w=500,T=function(e,t,i){if(!e)return!1;var r=e.segments[t],n=e.segments[t-1];return!(!i||!r)&&(r.end=i,n?n.end&&(r.duration=r.end-n.end):r.duration=r.end,!0)},S=function(e,t,i,r){if(!e)return!1;var n=e.segments,a=i===n.length-1,s=r.length&&n[n.length-1].end<=r.end(0);return e.endList&&"open"===t.readyState&&(a||s)},k=function(e){var t=void 0,i=void 0;return i=e.offset+e.length-1,t=e.offset,"bytes="+t+"-"+i},O=function(e){var t={};return"byterange"in e&&(t.Range=k(e.byterange)),t},P=function(e){function t(e){a(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this);var i=void 0;if(!e)throw new TypeError("Initialization options are required");if("function"!=typeof e.currentTime)throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");i=h.default.mergeOptions(h.default.options.hls,e),this.state="INIT",this.bandwidth=i.bandwidth,this.roundTrip=NaN,this.resetStats_(),this.hasPlayed_=i.hasPlayed,this.currentTime_=i.currentTime,this.seekable_=i.seekable,this.seeking_=i.seeking,this.setCurrentTime_=i.setCurrentTime,this.mediaSource_=i.mediaSource,this.checkBufferTimeout_=null,this.error_=void 0,this.expired_=0,this.timeCorrection_=0,this.currentTimeline_=-1,this.xhr_=null,this.pendingSegment_=null,this.sourceUpdater_=null,this.hls_=i.hls,this.xhrOptions_=null}return s(t,e),o(t,[{key:"resetStats_",value:function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaTransferDuration=0}},{key:"dispose",value:function(){this.state="DISPOSED",this.abort_(),this.sourceUpdater_&&this.sourceUpdater_.dispose(),this.resetStats_()}},{key:"abort",value:function(){"WAITING"===this.state&&(this.abort_(),this.paused()||(this.state="READY",this.fillBuffer_()))}},{key:"error",value:function(e){return"undefined"!=typeof e&&(this.error_=e),this.pendingSegment_=null,this.error_}},{key:"load",value:function(){this.monitorBuffer_(),this.playlist_&&(!this.sourceUpdater_||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY",this.fillBuffer_()))}},{key:"playlist",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(this.playlist_=e,this.xhrOptions_=t,this.sourceUpdater_&&e&&"INIT"===this.state&&!this.paused())return this.state="READY",this.fillBuffer_()}},{key:"pause",value:function(){this.checkBufferTimeout_&&(_.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}},{key:"paused",value:function(){return null===this.checkBufferTimeout_}},{key:"expired",value:function(e){this.expired_=e}},{key:"mimeType",value:function(e){if(!this.sourceUpdater_&&(this.sourceUpdater_=new m.default(this.mediaSource_,e),this.clearBuffer(),this.playlist_&&"INIT"===this.state&&!this.paused()))return this.state="READY",this.fillBuffer_()}},{key:"monitorBuffer_",value:function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&_.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=_.default.setTimeout(this.monitorBuffer_.bind(this),w)}},{key:"checkBuffer_",value:function(e,t,i){var r=l.default.findRange(e,i);0===r.length&&0===i&&(r=l.default.findRange(e,i+l.default.TIME_FUDGE_FACTOR));var n=void 0,a=void 0,s=this.sourceUpdater_.timestampOffset(),o=void 0,u=void 0;if(t.segments.length){if(0===r.length)u=(0,f.getMediaIndexForTime_)(t,i+this.timeCorrection_,this.expired_);else{if(a=r.end(0),n=Math.max(0,a-i),!this.hasPlayed_()&&n>=1)return null;if(this.hasPlayed_()&&n>=v.default.GOAL_BUFFER_LENGTH)return null;u=(0,f.getMediaIndexForTime_)(t,a+this.timeCorrection_,this.expired_)}if(u<0||u===t.segments.length)return null;o=t.segments[u];var d=(0,f.duration)(t,t.mediaSequence+u,this.expired_);return(o.timeline!==this.currentTimeline_||d<this.sourceUpdater_.timestampOffset())&&(s=d),{uri:o.resolvedUri,mediaIndex:u,playlist:t,bytes:null,encryptedBytes:null,buffered:null,timestampOffset:s,timeline:o.timeline,duration:o.duration}}}},{key:"abort_",value:function(){this.xhr_&&this.xhr_.abort(),this.pendingSegment_=null}},{key:"fillBuffer_",value:function(){if(!this.sourceUpdater_.updating()){var e=this.checkBuffer_(this.sourceUpdater_.buffered(),this.playlist_,this.currentTime_(),this.timestampOffset_);if(e&&(e.mediaIndex!==this.playlist_.segments.length-1||"ended"!==this.mediaSource_.readyState||this.seeking_())){var t=this.playlist_.segments[e.mediaIndex],i=(0,f.duration)(this.playlist_,this.playlist_.mediaSequence+e.mediaIndex,this.expired_),r=l.default.getSegmentBufferedPercent(i,t.duration,this.currentTime_(),this.sourceUpdater_.buffered());if(r>=90){var n=this.incrementTimeCorrection_(this.playlist_.targetDuration/2,1);return void(n&&!this.paused()&&this.fillBuffer_())}this.loadSegment_(e)}}}},{key:"loadSegment_",value:function(e){var t=void 0,i=void 0,r=void 0,n=this.seekable_(),a=this.currentTime_(),s=0;if(s=n.length&&n.start(0)>0&&n.start(0)<a?n.start(0):a-60,s>0&&this.sourceUpdater_.remove(0,s),t=e.playlist.segments[e.mediaIndex],t.key){var o=h.default.mergeOptions(this.xhrOptions_,{uri:t.key.resolvedUri,responseType:"arraybuffer"});i=this.hls_.xhr(o,this.handleResponse_.bind(this))}this.pendingSegment_=e;var u=h.default.mergeOptions(this.xhrOptions_,{uri:e.uri,responseType:"arraybuffer",headers:O(t)});r=this.hls_.xhr(u,this.handleResponse_.bind(this)),this.xhr_={keyXhr:i,segmentXhr:r,abort:function(){this.segmentXhr&&(this.segmentXhr.onreadystatechange=null,this.segmentXhr.abort(),this.segmentXhr=null),this.keyXhr&&(this.keyXhr.onreadystatechange=null,this.keyXhr.abort(),this.keyXhr=null)}},this.state="WAITING"}},{key:"handleResponse_",value:function(e,t){var i=void 0,r=void 0,n=void 0,a=void 0;if(this.xhr_&&(t===this.xhr_.segmentXhr||t===this.xhr_.keyXhr)){if(i=this.pendingSegment_,r=i.playlist.segments[i.mediaIndex],t.timedout)return this.abort_(),this.bandwidth=1,this.roundTrip=NaN,this.state="READY",this.trigger("progress");if(!t.aborted&&e)return n=this.xhr_.keyXhr,this.abort_(),this.error({status:t.status,message:t===n?"HLS key request error at URL: "+r.key.uri:"HLS segment request error at URL: "+i.uri,code:2,xhr:t}),this.state="READY",this.pause(),this.trigger("error");if(!t.response)return void this.abort_();if(t===this.xhr_.segmentXhr&&(this.xhr_.segmentXhr=null,this.roundTrip=t.roundTripTime,this.bandwidth=t.bandwidth,this.mediaBytesTransferred+=t.bytesReceived||0,this.mediaRequests+=1,this.mediaTransferDuration+=t.roundTripTime||0,r.key?i.encryptedBytes=new Uint8Array(t.response):i.bytes=new Uint8Array(t.response)),t===this.xhr_.keyXhr){if(n=this.xhr_.segmentXhr,this.xhr_.keyXhr=null,16!==t.response.byteLength)return this.abort_(),this.error({status:t.status,message:"Invalid HLS key at URL: "+r.key.uri,code:2,xhr:t}),this.state="READY",this.pause(),this.trigger("error");a=new DataView(t.response),r.key.bytes=new Uint32Array([a.getUint32(0),a.getUint32(4),a.getUint32(8),a.getUint32(12)]),r.key.iv=r.key.iv||new Uint32Array([0,0,0,i.mediaIndex+i.playlist.mediaSequence])}this.xhr_.segmentXhr||this.xhr_.keyXhr||(this.xhr_=null,this.processResponse_())}}},{key:"clearBuffer",value:function(){this.sourceUpdater_&&this.sourceUpdater_.buffered().length&&this.sourceUpdater_.remove(0,1/0)}},{key:"processResponse_",value:function(){var e=void 0,t=void 0;this.state="DECRYPTING",e=this.pendingSegment_,t=e.playlist.segments[e.mediaIndex],t.key?new g.Decrypter(e.encryptedBytes,t.key.bytes,t.key.iv,function(t,i){e.bytes=i,this.handleSegment_()}.bind(this)):this.handleSegment_()}},{key:"handleSegment_",value:function(){var e=void 0;this.state="APPENDING",e=this.pendingSegment_,e.buffered=this.sourceUpdater_.buffered(),this.currentTimeline_=e.timeline,e.timestampOffset!==this.sourceUpdater_.timestampOffset()&&this.sourceUpdater_.timestampOffset(e.timestampOffset),this.sourceUpdater_.appendBuffer(e.bytes,this.handleUpdateEnd_.bind(this))}},{key:"handleUpdateEnd_",value:function(){var e=this.pendingSegment_,t=this.currentTime_();this.pendingSegment_=null;var i=this.updateTimeline_(e);this.trigger("progress");var r=e.mediaIndex;r+=e.playlist.mediaSequence-this.playlist_.mediaSequence;var n=l.default.findRange(this.sourceUpdater_.buffered(),t),a=S(e.playlist,this.mediaSource_,r,n);a&&this.mediaSource_.endOfStream();var s=this.seekable_(),o=l.default.findNextRange(this.sourceUpdater_.buffered(),t);if(this.seeking_()&&0===n.length&&s.length&&t<s.start(0)&&o.length&&(h.default.log("tried seeking to",t,"but that was too early, retrying at",o.start(0)),this.setCurrentTime_(o.start(0)+l.default.TIME_FUDGE_FACTOR)),this.state="READY",i)return this.timeCorrection_=0,void(this.paused()||this.fillBuffer_());var u=this.incrementTimeCorrection_(e.duration,4);u&&!this.paused()&&this.fillBuffer_()}},{key:"updateTimeline_",value:function(e){var t=void 0,i=void 0,r=!1,n=e.playlist,a=e.mediaIndex;return a+=n.mediaSequence-this.playlist_.mediaSequence,t=n.segments[a],t&&e&&e.playlist.uri===this.playlist_.uri&&(i=l.default.findSoleUncommonTimeRangesEnd(e.buffered,this.sourceUpdater_.buffered()),r=T(n,a,i)),r}},{key:"incrementTimeCorrection_",value:function(e,t){return this.timeCorrection_>=this.playlist_.targetDuration*t?(this.timeCorrection_=0,!1):(this.timeCorrection_+=e,!0)}}]),t}(h.default.EventTarget);i.default=P,t.exports=i.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./config":2,"./playlist":7,"./ranges":8,"./source-updater":12,"aes-decrypter":18,"global/window":25}],12:[function(e,t,i){(function(e){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var a=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),s="undefined"!=typeof window?window.videojs:"undefined"!=typeof e?e.videojs:null,o=r(s),u=function(){function e(t,i){var r=this;n(this,e);var a=function(){r.sourceBuffer_=t.addSourceBuffer(i),r.onUpdateendCallback_=function(){var e=r.pendingCallback_;r.pendingCallback_=null,e&&e(),r.runCallback_()},r.sourceBuffer_.addEventListener("updateend",r.onUpdateendCallback_),r.runCallback_()};this.callbacks_=[],this.pendingCallback_=null,this.timestampOffset_=0,this.mediaSource=t,"closed"===t.readyState?t.addEventListener("sourceopen",a):a()}return a(e,[{key:"abort",value:function(e){var t=this;this.queueCallback_(function(){t.sourceBuffer_.abort()},e)}},{key:"appendBuffer",value:function(e,t){var i=this;this.queueCallback_(function(){i.sourceBuffer_.appendBuffer(e)},t)}},{key:"buffered",value:function(){return this.sourceBuffer_?this.sourceBuffer_.buffered:o.default.createTimeRanges()}},{key:"duration",value:function(e){var t=this;this.queueCallback_(function(){t.sourceBuffer_.duration=e})}},{key:"remove",value:function(e,t){var i=this;this.queueCallback_(function(){i.sourceBuffer_.remove(e,t)})}},{key:"updating",value:function(){return!this.sourceBuffer_||this.sourceBuffer_.updating}},{key:"timestampOffset",value:function(e){var t=this;return"undefined"!=typeof e&&(this.queueCallback_(function(){t.sourceBuffer_.timestampOffset=e}),this.timestampOffset_=e),this.timestampOffset_}},{key:"queueCallback_",value:function(e,t){this.callbacks_.push([e.bind(this),t]),this.runCallback_()}},{key:"runCallback_",value:function(){var e=void 0;this.sourceBuffer_&&!this.sourceBuffer_.updating&&this.callbacks_.length&&(e=this.callbacks_.shift(),this.pendingCallback_=e[1],e[0]())}},{key:"dispose",value:function(){this.sourceBuffer_.removeEventListener("updateend",this.onUpdateendCallback_),this.sourceBuffer_&&"open"===this.mediaSource.readyState&&this.sourceBuffer_.abort()}}]),e}();i.default=u,t.exports=i.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],13:[function(e,t,i){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),a=function(){function e(){r(this,e),this.listeners={}}return n(e,[{key:"on",value:function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}},{key:"off",value:function(e,t){var i=void 0;return!!this.listeners[e]&&(i=this.listeners[e].indexOf(t),this.listeners[e].splice(i,1),i>-1)}},{key:"trigger",value:function(e){var t=void 0,i=void 0,r=void 0,n=void 0;if(t=this.listeners[e])if(2===arguments.length)for(r=t.length,i=0;i<r;++i)t[i].call(this,arguments[1]);else for(n=Array.prototype.slice.call(arguments,1),r=t.length,i=0;i<r;++i)t[i].apply(this,n)}},{key:"dispose",value:function(){this.listeners={}}},{key:"pipe",value:function(e){this.on("data",function(t){e.push(t)})}}]),e}();i.default=a,t.exports=i.default},{}],14:[function(e,t,i){(function(e){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r="undefined"!=typeof window?window.videojs:"undefined"!=typeof e?e.videojs:null,n=function(){var e=function e(t,i){if(t=(0,r.mergeOptions)({timeout:45e3},t),e.beforeRequest&&"function"==typeof e.beforeRequest){var n=e.beforeRequest(t);n&&(t=n)}var a=(0,r.xhr)(t,function(e,t){!e&&a.response&&(a.responseTime=(new Date).getTime(),a.roundTripTime=a.responseTime-a.requestTime,a.bytesReceived=a.response.byteLength||a.response.length,a.bandwidth||(a.bandwidth=Math.floor(a.bytesReceived/a.roundTripTime*8*1e3))),e||a.timedout?a.timedout=a.timedout||"ETIMEDOUT"===e.code:a.timedout=!1,e||200===t.statusCode||206===t.statusCode||0===t.statusCode||(e=new Error("XHR Failed with a response of: "+(a&&(a.response||a.responseText)))),i(e,a)});return a.requestTime=(new Date).getTime(),a};return e};i.default=n,t.exports=i.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],15:[function(e,t,i){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),a=function(){var e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],i=e[1],r=t[4],n=i[4],a=void 0,s=void 0,o=void 0,u=[],d=[],l=void 0,f=void 0,c=void 0,h=void 0,p=void 0,m=void 0;for(a=0;a<256;a++)d[(u[a]=a<<1^283*(a>>7))^a]=a;for(s=o=0;!r[s];s^=l||1,o=d[o]||1)for(h=o^o<<1^o<<2^o<<3^o<<4,h=h>>8^255&h^99,r[s]=h,n[h]=s,c=u[f=u[l=u[s]]],m=16843009*c^65537*f^257*l^16843008*s,p=257*u[h]^16843008*h,a=0;a<4;a++)t[a][s]=p=p<<24^p>>>8,i[a][h]=m=m<<24^m>>>8;for(a=0;a<5;a++)t[a]=t[a].slice(0),i[a]=i[a].slice(0);return e},s=null,o=function(){function e(t){r(this,e),s||(s=a()),this._tables=[[s[0][0].slice(),s[0][1].slice(),s[0][2].slice(),s[0][3].slice(),s[0][4].slice()],[s[1][0].slice(),s[1][1].slice(),s[1][2].slice(),s[1][3].slice(),s[1][4].slice()]];var i=void 0,n=void 0,o=void 0,u=void 0,d=void 0,l=this._tables[0][4],f=this._tables[1],c=t.length,h=1;if(4!==c&&6!==c&&8!==c)throw new Error("Invalid aes key size");for(u=t.slice(0),d=[],this._key=[u,d],i=c;i<4*c+28;i++)o=u[i-1],(i%c===0||8===c&&i%c===4)&&(o=l[o>>>24]<<24^l[o>>16&255]<<16^l[o>>8&255]<<8^l[255&o],i%c===0&&(o=o<<8^o>>>24^h<<24,h=h<<1^283*(h>>7))),u[i]=u[i-c]^o;for(n=0;i;n++,i--)o=u[3&n?i:i-4],i<=4||n<4?d[n]=o:d[n]=f[0][l[o>>>24]]^f[1][l[o>>16&255]]^f[2][l[o>>8&255]]^f[3][l[255&o]]}return n(e,[{key:"decrypt",value:function(e,t,i,r,n,a){var s=this._key[1],o=e^s[0],u=r^s[1],d=i^s[2],l=t^s[3],f=void 0,c=void 0,h=void 0,p=s.length/4-2,m=void 0,g=4,y=this._tables[1],v=y[0],b=y[1],_=y[2],w=y[3],T=y[4];for(m=0;m<p;m++)f=v[o>>>24]^b[u>>16&255]^_[d>>8&255]^w[255&l]^s[g],c=v[u>>>24]^b[d>>16&255]^_[l>>8&255]^w[255&o]^s[g+1],h=v[d>>>24]^b[l>>16&255]^_[o>>8&255]^w[255&u]^s[g+2],l=v[l>>>24]^b[o>>16&255]^_[u>>8&255]^w[255&d]^s[g+3],g+=4,o=f,u=c,d=h;for(m=0;m<4;m++)n[(3&-m)+a]=T[o>>>24]<<24^T[u>>16&255]<<16^T[d>>8&255]<<8^T[255&l]^s[g++],f=o,o=u,u=d,d=l,l=f}}]),e}();i.default=o,t.exports=i.default},{}],16:[function(e,t,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var s=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),o=function(e,t,i){for(var r=!0;r;){var n=e,a=t,s=i;r=!1,null===n&&(n=Function.prototype);var o=Object.getOwnPropertyDescriptor(n,a);if(void 0!==o){if("value"in o)return o.value;var u=o.get;if(void 0===u)return;return u.call(s)}var d=Object.getPrototypeOf(n);if(null===d)return;e=d,t=a,i=s,r=!0,o=d=void 0}},u=e("./stream"),d=r(u),l=function(e){function t(){n(this,t),o(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,d.default),this.jobs=[],this.delay=1,this.timeout_=null}return a(t,e),s(t,[{key:"processJob_",value:function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}},{key:"push",value:function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}]),t}(d.default);i.default=l,t.exports=i.default},{"./stream":19}],17:[function(e,t,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var a=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),s=e("./aes"),o=r(s),u=e("./async-stream"),d=r(u),l=e("pkcs7"),f=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},c=function(e,t,i){var r=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),n=new o.default(Array.prototype.slice.call(t)),a=new Uint8Array(e.byteLength),s=new Int32Array(a.buffer),u=void 0,d=void 0,l=void 0,c=void 0,h=void 0,p=void 0,m=void 0,g=void 0,y=void 0;for(u=i[0],d=i[1],l=i[2],c=i[3],y=0;y<r.length;y+=4)h=f(r[y]),p=f(r[y+1]),m=f(r[y+2]),g=f(r[y+3]),n.decrypt(h,p,m,g,s,y),s[y]=f(s[y]^u),s[y+1]=f(s[y+1]^d),s[y+2]=f(s[y+2]^l),s[y+3]=f(s[y+3]^c),u=h,d=p,l=m,c=g;return a};i.decrypt=c;var h=function(){function e(t,i,r,a){n(this,e);var s=e.STEP,o=new Int32Array(t.buffer),u=new Uint8Array(t.byteLength),c=0;for(this.asyncStream_=new d.default,this.asyncStream_.push(this.decryptChunk_(o.subarray(c,c+s),i,r,u)),c=s;c<o.length;c+=s)r=new Uint32Array([f(o[c-4]),f(o[c-3]),f(o[c-2]),f(o[c-1])]),this.asyncStream_.push(this.decryptChunk_(o.subarray(c,c+s),i,r,u));this.asyncStream_.push(function(){a(null,(0,l.unpad)(u))})}return a(e,[{key:"decryptChunk_",value:function(e,t,i,r){return function(){var n=c(e,t,i);r.set(n,e.byteOffset)}}}],[{key:"STEP",get:function(){return 32e3}}]),e}();i.Decrypter=h,i.default={Decrypter:h,decrypt:c}},{"./aes":15,"./async-stream":16,pkcs7:21}],18:[function(e,t,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(i,"__esModule",{value:!0});var n=e("./decrypter"),a=e("./async-stream"),s=r(a);i.default={decrypt:n.decrypt,Decrypter:n.Decrypter,AsyncStream:s.default},t.exports=i.default},{"./async-stream":16,"./decrypter":17}],19:[function(e,t,i){arguments[4][13][0].apply(i,arguments)},{dup:13}],20:[function(e,t,i){"use strict";var r;t.exports=function(e){var t=r[e.byteLength%16||0],i=new Uint8Array(e.byteLength+t.length);return i.set(e),i.set(t,e.byteLength),i},r=[[16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16],[15,15,15,15,15,15,15,15,15,15,15,15,15,15,15],[14,14,14,14,14,14,14,14,14,14,14,14,14,14],[13,13,13,13,13,13,13,13,13,13,13,13,13],[12,12,12,12,12,12,12,12,12,12,12,12],[11,11,11,11,11,11,11,11,11,11,11],[10,10,10,10,10,10,10,10,10,10],[9,9,9,9,9,9,9,9,9],[8,8,8,8,8,8,8,8],[7,7,7,7,7,7,7],[6,6,6,6,6,6],[5,5,5,5,5],[4,4,4,4],[3,3,3],[2,2],[1]]},{}],21:[function(e,t,i){"use strict";i.pad=e("./pad.js"),i.unpad=e("./unpad.js")},{"./pad.js":20,"./unpad.js":22}],22:[function(e,t,i){"use strict";t.exports=function(e){return e.subarray(0,e.byteLength-e[e.byteLength-1])}},{}],23:[function(e,t,i){},{}],24:[function(e,t,i){(function(i){var r="undefined"!=typeof i?i:"undefined"!=typeof window?window:{},n=e("min-document");if("undefined"!=typeof document)t.exports=document;else{var a=r["__GLOBAL_DOCUMENT_CACHE@4"];a||(a=r["__GLOBAL_DOCUMENT_CACHE@4"]=n),t.exports=a}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"min-document":23}],25:[function(e,t,i){(function(e){"undefined"!=typeof window?t.exports=window:"undefined"!=typeof e?t.exports=e:"undefined"!=typeof self?t.exports=self:t.exports={}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],26:[function(e,t,i){function r(e,t){if("function"!=typeof e)throw new TypeError(n);return t=a(void 0===t?e.length-1:+t||0,0),function(){for(var i=arguments,r=-1,n=a(i.length-t,0),s=Array(n);++r<n;)s[r]=i[t+r];switch(t){case 0:return e.call(this,s);case 1:return e.call(this,i[0],s);case 2:return e.call(this,i[0],i[1],s)}var o=Array(t+1);for(r=-1;++r<t;)o[r]=i[r];return o[t]=s,e.apply(this,o)}}var n="Expected a function",a=Math.max;t.exports=r},{}],27:[function(e,t,i){function r(e,t){var i=-1,r=e.length;for(t||(t=Array(r));++i<r;)t[i]=e[i];return t}t.exports=r},{}],28:[function(e,t,i){function r(e,t){for(var i=-1,r=e.length;++i<r&&t(e[i],i,e)!==!1;);return e}t.exports=r},{}],29:[function(e,t,i){function r(e,t,i){i||(i={});for(var r=-1,n=t.length;++r<n;){var a=t[r];i[a]=e[a]}return i}t.exports=r},{}],30:[function(e,t,i){var r=e("./createBaseFor"),n=r();t.exports=n},{"./createBaseFor":37}],31:[function(e,t,i){function r(e,t){return n(e,t,a)}var n=e("./baseFor"),a=e("../object/keysIn");t.exports=r},{"../object/keysIn":58,"./baseFor":30}],32:[function(e,t,i){function r(e,t,i,c,h){if(!u(e))return e;var p=o(t)&&(s(t)||l(t)),m=p?void 0:f(t);return n(m||t,function(n,s){if(m&&(s=n,n=t[s]),d(n))c||(c=[]),h||(h=[]),a(e,t,s,r,i,c,h);else{var o=e[s],u=i?i(o,n,s,e,t):void 0,l=void 0===u;l&&(u=n),void 0===u&&(!p||s in e)||!l&&(u===u?u===o:o!==o)||(e[s]=u)}}),e}var n=e("./arrayEach"),a=e("./baseMergeDeep"),s=e("../lang/isArray"),o=e("./isArrayLike"),u=e("../lang/isObject"),d=e("./isObjectLike"),l=e("../lang/isTypedArray"),f=e("../object/keys");t.exports=r},{"../lang/isArray":49,"../lang/isObject":52,"../lang/isTypedArray":55,"../object/keys":57,"./arrayEach":28,"./baseMergeDeep":33,"./isArrayLike":40,"./isObjectLike":45}],33:[function(e,t,i){function r(e,t,i,r,f,c,h){for(var p=c.length,m=t[i];p--;)if(c[p]==m)return void(e[i]=h[p]);var g=e[i],y=f?f(g,m,i,e,t):void 0,v=void 0===y;v&&(y=m,o(m)&&(s(m)||d(m))?y=s(g)?g:o(g)?n(g):[]:u(m)||a(m)?y=a(g)?l(g):u(g)?g:{}:v=!1),c.push(m),h.push(y),v?e[i]=r(y,m,f,c,h):(y===y?y!==g:g===g)&&(e[i]=y)}var n=e("./arrayCopy"),a=e("../lang/isArguments"),s=e("../lang/isArray"),o=e("./isArrayLike"),u=e("../lang/isPlainObject"),d=e("../lang/isTypedArray"),l=e("../lang/toPlainObject");t.exports=r},{"../lang/isArguments":48,"../lang/isArray":49,"../lang/isPlainObject":53,"../lang/isTypedArray":55,"../lang/toPlainObject":56,"./arrayCopy":27,"./isArrayLike":40}],34:[function(e,t,i){function r(e){return function(t){return null==t?void 0:n(t)[e]}}var n=e("./toObject");t.exports=r},{"./toObject":47}],35:[function(e,t,i){function r(e,t,i){if("function"!=typeof e)return n;if(void 0===t)return e;switch(i){case 1:return function(i){return e.call(t,i)};case 3:return function(i,r,n){return e.call(t,i,r,n)};case 4:return function(i,r,n,a){return e.call(t,i,r,n,a)};case 5:return function(i,r,n,a,s){return e.call(t,i,r,n,a,s)}}return function(){return e.apply(t,arguments)}}var n=e("../utility/identity");t.exports=r},{"../utility/identity":61}],36:[function(e,t,i){function r(e){return s(function(t,i){var r=-1,s=null==t?0:i.length,o=s>2?i[s-2]:void 0,u=s>2?i[2]:void 0,d=s>1?i[s-1]:void 0;for("function"==typeof o?(o=n(o,d,5),s-=2):(o="function"==typeof d?d:void 0,s-=o?1:0),u&&a(i[0],i[1],u)&&(o=s<3?void 0:o,s=1);++r<s;){var l=i[r];l&&e(t,l,o)}return t})}var n=e("./bindCallback"),a=e("./isIterateeCall"),s=e("../function/restParam");t.exports=r},{"../function/restParam":26,"./bindCallback":35,"./isIterateeCall":43}],37:[function(e,t,i){function r(e){return function(t,i,r){for(var a=n(t),s=r(t),o=s.length,u=e?o:-1;e?u--:++u<o;){var d=s[u];if(i(a[d],d,a)===!1)break}return t}}var n=e("./toObject");t.exports=r},{"./toObject":47}],38:[function(e,t,i){var r=e("./baseProperty"),n=r("length");t.exports=n},{"./baseProperty":34}],39:[function(e,t,i){function r(e,t){var i=null==e?void 0:e[t];return n(i)?i:void 0}var n=e("../lang/isNative");t.exports=r},{"../lang/isNative":51}],40:[function(e,t,i){function r(e){return null!=e&&a(n(e))}var n=e("./getLength"),a=e("./isLength");t.exports=r},{"./getLength":38,"./isLength":44}],41:[function(e,t,i){var r=function(){try{Object({toString:0}+"")}catch(e){return function(){return!1}}return function(e){return"function"!=typeof e.toString&&"string"==typeof(e+"")}}();t.exports=r},{}],42:[function(e,t,i){function r(e,t){return e="number"==typeof e||n.test(e)?+e:-1,t=null==t?a:t,e>-1&&e%1==0&&e<t}var n=/^\d+$/,a=9007199254740991;t.exports=r},{}],43:[function(e,t,i){function r(e,t,i){if(!s(i))return!1;var r=typeof t;if("number"==r?n(i)&&a(t,i.length):"string"==r&&t in i){var o=i[t];return e===e?e===o:o!==o}return!1}var n=e("./isArrayLike"),a=e("./isIndex"),s=e("../lang/isObject");t.exports=r},{"../lang/isObject":52,"./isArrayLike":40,"./isIndex":42}],44:[function(e,t,i){function r(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}var n=9007199254740991;t.exports=r},{}],45:[function(e,t,i){function r(e){return!!e&&"object"==typeof e}t.exports=r},{}],46:[function(e,t,i){function r(e){for(var t=d(e),i=t.length,r=i&&e.length,l=!!r&&o(r)&&(a(e)||n(e)||u(e)),c=-1,h=[];++c<i;){var p=t[c];(l&&s(p,r)||f.call(e,p))&&h.push(p)}return h}var n=e("../lang/isArguments"),a=e("../lang/isArray"),s=e("./isIndex"),o=e("./isLength"),u=e("../lang/isString"),d=e("../object/keysIn"),l=Object.prototype,f=l.hasOwnProperty;t.exports=r},{"../lang/isArguments":48,"../lang/isArray":49,"../lang/isString":54,"../object/keysIn":58,"./isIndex":42,"./isLength":44}],47:[function(e,t,i){function r(e){if(s.unindexedChars&&a(e)){for(var t=-1,i=e.length,r=Object(e);++t<i;)r[t]=e.charAt(t);return r}return n(e)?e:Object(e)}var n=e("../lang/isObject"),a=e("../lang/isString"),s=e("../support");t.exports=r},{"../lang/isObject":52,"../lang/isString":54,"../support":60}],48:[function(e,t,i){function r(e){return a(e)&&n(e)&&o.call(e,"callee")&&!u.call(e,"callee")}var n=e("../internal/isArrayLike"),a=e("../internal/isObjectLike"),s=Object.prototype,o=s.hasOwnProperty,u=s.propertyIsEnumerable;t.exports=r},{"../internal/isArrayLike":40,"../internal/isObjectLike":45}],49:[function(e,t,i){var r=e("../internal/getNative"),n=e("../internal/isLength"),a=e("../internal/isObjectLike"),s="[object Array]",o=Object.prototype,u=o.toString,d=r(Array,"isArray"),l=d||function(e){return a(e)&&n(e.length)&&u.call(e)==s};t.exports=l},{"../internal/getNative":39,"../internal/isLength":44,"../internal/isObjectLike":45}],50:[function(e,t,i){function r(e){return n(e)&&o.call(e)==a}var n=e("./isObject"),a="[object Function]",s=Object.prototype,o=s.toString;t.exports=r},{"./isObject":52}],51:[function(e,t,i){function r(e){return null!=e&&(n(e)?f.test(d.call(e)):s(e)&&(a(e)?f:o).test(e))}var n=e("./isFunction"),a=e("../internal/isHostObject"),s=e("../internal/isObjectLike"),o=/^\[object .+?Constructor\]$/,u=Object.prototype,d=Function.prototype.toString,l=u.hasOwnProperty,f=RegExp("^"+d.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=r},{"../internal/isHostObject":41,"../internal/isObjectLike":45,"./isFunction":50}],52:[function(e,t,i){function r(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}t.exports=r},{}],53:[function(e,t,i){function r(e){var t;if(!o(e)||c.call(e)!=d||s(e)||a(e)||!f.call(e,"constructor")&&(t=e.constructor,"function"==typeof t&&!(t instanceof t)))return!1;var i;return u.ownLast?(n(e,function(e,t,r){return i=f.call(r,t),!1}),i!==!1):(n(e,function(e,t){i=t}),void 0===i||f.call(e,i))}var n=e("../internal/baseForIn"),a=e("./isArguments"),s=e("../internal/isHostObject"),o=e("../internal/isObjectLike"),u=e("../support"),d="[object Object]",l=Object.prototype,f=l.hasOwnProperty,c=l.toString;t.exports=r},{"../internal/baseForIn":31,"../internal/isHostObject":41,"../internal/isObjectLike":45,"../support":60,"./isArguments":48}],54:[function(e,t,i){function r(e){return"string"==typeof e||n(e)&&o.call(e)==a}var n=e("../internal/isObjectLike"),a="[object String]",s=Object.prototype,o=s.toString;t.exports=r},{"../internal/isObjectLike":45
}],55:[function(e,t,i){function r(e){return a(e)&&n(e.length)&&!!E[j.call(e)]}var n=e("../internal/isLength"),a=e("../internal/isObjectLike"),s="[object Arguments]",o="[object Array]",u="[object Boolean]",d="[object Date]",l="[object Error]",f="[object Function]",c="[object Map]",h="[object Number]",p="[object Object]",m="[object RegExp]",g="[object Set]",y="[object String]",v="[object WeakMap]",b="[object ArrayBuffer]",_="[object Float32Array]",w="[object Float64Array]",T="[object Int8Array]",S="[object Int16Array]",k="[object Int32Array]",O="[object Uint8Array]",P="[object Uint8ClampedArray]",x="[object Uint16Array]",A="[object Uint32Array]",E={};E[_]=E[w]=E[T]=E[S]=E[k]=E[O]=E[P]=E[x]=E[A]=!0,E[s]=E[o]=E[b]=E[u]=E[d]=E[l]=E[f]=E[c]=E[h]=E[p]=E[m]=E[g]=E[y]=E[v]=!1;var L=Object.prototype,j=L.toString;t.exports=r},{"../internal/isLength":44,"../internal/isObjectLike":45}],56:[function(e,t,i){function r(e){return n(e,a(e))}var n=e("../internal/baseCopy"),a=e("../object/keysIn");t.exports=r},{"../internal/baseCopy":29,"../object/keysIn":58}],57:[function(e,t,i){var r=e("../internal/getNative"),n=e("../internal/isArrayLike"),a=e("../lang/isObject"),s=e("../internal/shimKeys"),o=e("../support"),u=r(Object,"keys"),d=u?function(e){var t=null==e?void 0:e.constructor;return"function"==typeof t&&t.prototype===e||("function"==typeof e?o.enumPrototypes:n(e))?s(e):a(e)?u(e):[]}:s;t.exports=d},{"../internal/getNative":39,"../internal/isArrayLike":40,"../internal/shimKeys":46,"../lang/isObject":52,"../support":60}],58:[function(e,t,i){function r(e){if(null==e)return[];l(e)||(e=Object(e));var t=e.length;t=t&&d(t)&&(s(e)||a(e)||f(e))&&t||0;for(var i=e.constructor,r=-1,n=o(i)&&i.prototype||k,h=n===e,p=Array(t),m=t>0,y=c.enumErrorProps&&(e===S||e instanceof Error),v=c.enumPrototypes&&o(e);++r<t;)p[r]=r+"";for(var _ in e)v&&"prototype"==_||y&&("message"==_||"name"==_)||m&&u(_,t)||"constructor"==_&&(h||!P.call(e,_))||p.push(_);if(c.nonEnumShadows&&e!==k){var E=e===O?w:e===S?g:x.call(e),L=A[E]||A[b];for(E==b&&(n=k),t=T.length;t--;){_=T[t];var j=L[_];h&&j||(j?!P.call(e,_):e[_]===n[_])||p.push(_)}}return p}var n=e("../internal/arrayEach"),a=e("../lang/isArguments"),s=e("../lang/isArray"),o=e("../lang/isFunction"),u=e("../internal/isIndex"),d=e("../internal/isLength"),l=e("../lang/isObject"),f=e("../lang/isString"),c=e("../support"),h="[object Array]",p="[object Boolean]",m="[object Date]",g="[object Error]",y="[object Function]",v="[object Number]",b="[object Object]",_="[object RegExp]",w="[object String]",T=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],S=Error.prototype,k=Object.prototype,O=String.prototype,P=k.hasOwnProperty,x=k.toString,A={};A[h]=A[m]=A[v]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},A[p]=A[w]={constructor:!0,toString:!0,valueOf:!0},A[g]=A[y]=A[_]={constructor:!0,toString:!0},A[b]={constructor:!0},n(T,function(e){for(var t in A)if(P.call(A,t)){var i=A[t];i[e]=P.call(i,e)}}),t.exports=r},{"../internal/arrayEach":28,"../internal/isIndex":42,"../internal/isLength":44,"../lang/isArguments":48,"../lang/isArray":49,"../lang/isFunction":50,"../lang/isObject":52,"../lang/isString":54,"../support":60}],59:[function(e,t,i){var r=e("../internal/baseMerge"),n=e("../internal/createAssigner"),a=n(r);t.exports=a},{"../internal/baseMerge":32,"../internal/createAssigner":36}],60:[function(e,t,i){var r=Array.prototype,n=Error.prototype,a=Object.prototype,s=a.propertyIsEnumerable,o=r.splice,u={};!function(e){var t=function(){this.x=e},i={0:e,length:e},r=[];t.prototype={valueOf:e,y:e};for(var a in new t)r.push(a);u.enumErrorProps=s.call(n,"message")||s.call(n,"name"),u.enumPrototypes=s.call(t,"prototype"),u.nonEnumShadows=!/valueOf/.test(r),u.ownLast="x"!=r[0],u.spliceObjects=(o.call(i,0,1),!i[0]),u.unindexedChars="x"[0]+Object("x")[0]!="xx"}(1,0),t.exports=u},{}],61:[function(e,t,i){function r(e){return e}t.exports=r},{}],62:[function(e,t,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(i,"__esModule",{value:!0});var n=e("./line-stream"),a=r(n),s=e("./parse-stream"),o=r(s),u=e("./parser"),d=r(u);i.default={LineStream:a.default,ParseStream:o.default,Parser:d.default},t.exports=i.default},{"./line-stream":63,"./parse-stream":64,"./parser":65}],63:[function(e,t,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var s=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),o=function(e,t,i){for(var r=!0;r;){var n=e,a=t,s=i;r=!1,null===n&&(n=Function.prototype);var o=Object.getOwnPropertyDescriptor(n,a);if(void 0!==o){if("value"in o)return o.value;var u=o.get;if(void 0===u)return;return u.call(s)}var d=Object.getPrototypeOf(n);if(null===d)return;e=d,t=a,i=s,r=!0,o=d=void 0}},u=e("./stream"),d=r(u),l=function(e){function t(){n(this,t),o(Object.getPrototypeOf(t.prototype),"constructor",this).call(this),this.buffer=""}return a(t,e),s(t,[{key:"push",value:function(e){var t=void 0;for(this.buffer+=e,t=this.buffer.indexOf("\n");t>-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}]),t}(d.default);i.default=l,t.exports=i.default},{"./stream":66}],64:[function(e,t,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var s=function(){function e(e,t){var i=[],r=!0,n=!1,a=void 0;try{for(var s,o=e[Symbol.iterator]();!(r=(s=o.next()).done)&&(i.push(s.value),!t||i.length!==t);r=!0);}catch(e){n=!0,a=e}finally{try{!r&&o.return&&o.return()}finally{if(n)throw a}}return i}return function(t,i){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),u=function(e,t,i){for(var r=!0;r;){var n=e,a=t,s=i;r=!1,null===n&&(n=Function.prototype);var o=Object.getOwnPropertyDescriptor(n,a);if(void 0!==o){if("value"in o)return o.value;var u=o.get;if(void 0===u)return;return u.call(s)}var d=Object.getPrototypeOf(n);if(null===d)return;e=d,t=a,i=s,r=!0,o=d=void 0}},d=e("./stream"),l=r(d),f=function(){var e="[^=]*",t='"[^"]*"|[^,]*',i="(?:"+e+")=(?:"+t+")";return new RegExp("(?:^|,)("+i+")")},c=function(e){for(var t=e.split(f()),i=t.length,r={},n=void 0;i--;)""!==t[i]&&(n=/([^=]*)=(.*)/.exec(t[i]).slice(1),n[0]=n[0].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^['"](.*)['"]$/g,"$1"),r[n[0]]=n[1]);return r},h=function(e){function t(){n(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this)}return a(t,e),o(t,[{key:"push",value:function(e){var t=void 0,i=void 0;if(e=e.replace(/^[\u0000\s]+|[\u0000\s]+$/g,""),0!==e.length){if("#"!==e[0])return void this.trigger("data",{type:"uri",uri:e});if(0!==e.indexOf("#EXT"))return void this.trigger("data",{type:"comment",text:e.slice(1)});if(e=e.replace("\r",""),t=/^#EXTM3U/.exec(e))return void this.trigger("data",{type:"tag",tagType:"m3u"});if(t=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e))return i={type:"tag",tagType:"inf"},t[1]&&(i.duration=parseFloat(t[1])),t[2]&&(i.title=t[2]),void this.trigger("data",i);if(t=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"targetduration"},t[1]&&(i.duration=parseInt(t[1],10)),void this.trigger("data",i);if(t=/^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"totalduration"},t[1]&&(i.duration=parseInt(t[1],10)),void this.trigger("data",i);if(t=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"version"},t[1]&&(i.version=parseInt(t[1],10)),void this.trigger("data",i);if(t=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"media-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void this.trigger("data",i);if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void this.trigger("data",i);if(t=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e))return i={type:"tag",tagType:"playlist-type"},t[1]&&(i.playlistType=t[1]),void this.trigger("data",i);if(t=/^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"byterange"},t[1]&&(i.length=parseInt(t[1],10)),t[2]&&(i.offset=parseInt(t[2],10)),void this.trigger("data",i);if(t=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e))return i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),void this.trigger("data",i);if(t=/^#EXT-X-MAP:?(.*)$/.exec(e)){if(i={type:"tag",tagType:"map"},t[1]){var r=c(t[1]);if(r.URI&&(i.uri=r.URI),r.BYTERANGE){var n=r.BYTERANGE.split("@"),a=s(n,2),o=a[0],u=a[1];i.byterange={},o&&(i.byterange.length=parseInt(o,10)),u&&(i.byterange.offset=parseInt(u,10))}}return void this.trigger("data",i)}if(t=/^#EXT-X-STREAM-INF:?(.*)$/.exec(e)){if(i={type:"tag",tagType:"stream-inf"},t[1]){if(i.attributes=c(t[1]),i.attributes.RESOLUTION){var d=i.attributes.RESOLUTION.split("x"),l={};d[0]&&(l.width=parseInt(d[0],10)),d[1]&&(l.height=parseInt(d[1],10)),i.attributes.RESOLUTION=l}i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))}return void this.trigger("data",i)}return(t=/^#EXT-X-MEDIA:?(.*)$/.exec(e))?(i={type:"tag",tagType:"media"},t[1]&&(i.attributes=c(t[1])),void this.trigger("data",i)):(t=/^#EXT-X-ENDLIST/.exec(e))?void this.trigger("data",{type:"tag",tagType:"endlist"}):(t=/^#EXT-X-DISCONTINUITY/.exec(e))?void this.trigger("data",{type:"tag",tagType:"discontinuity"}):(t=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e))?(i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),void this.trigger("data",i)):(t=/^#EXT-X-KEY:?(.*)$/.exec(e))?(i={type:"tag",tagType:"key"},t[1]&&(i.attributes=c(t[1]),i.attributes.IV&&("0x"===i.attributes.IV.substring(0,2).toLowerCase()&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),void this.trigger("data",i)):(t=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e))?(i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",void this.trigger("data",i)):(t=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(e))?(i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",void this.trigger("data",i)):(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(e))?(i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",void this.trigger("data",i)):void this.trigger("data",{type:"tag",data:e.slice(4)})}}}]),t}(l.default);i.default=h,t.exports=i.default},{"./stream":66}],65:[function(e,t,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var s=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),o=function(e,t,i){for(var r=!0;r;){var n=e,a=t,s=i;r=!1,null===n&&(n=Function.prototype);var o=Object.getOwnPropertyDescriptor(n,a);if(void 0!==o){if("value"in o)return o.value;var u=o.get;if(void 0===u)return;return u.call(s)}var d=Object.getPrototypeOf(n);if(null===d)return;e=d,t=a,i=s,r=!0,o=d=void 0}},u=e("./stream"),d=r(u),l=e("./line-stream"),f=r(l),c=e("./parse-stream"),h=r(c),p=e("lodash-compat/object/merge"),m=r(p),g=function(e){function t(){n(this,t),o(Object.getPrototypeOf(t.prototype),"constructor",this).call(this),this.lineStream=new f.default,this.parseStream=new h.default,this.lineStream.pipe(this.parseStream);var e=this,i=[],r={},a=void 0,s=void 0,u=function(){},d={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},l=0;this.manifest={allowCache:!0,discontinuityStarts:[]},this.parseStream.on("data",function(t){var n=void 0,o=void 0;({tag:function(){(({"allow-cache":function(){this.manifest.allowCache=t.allowed,"allowed"in t||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange:function e(){var e={};"length"in t&&(r.byterange=e,e.length=t.length,"offset"in t||(this.trigger("info",{message:"defaulting offset to zero"}),t.offset=0)),"offset"in t&&(r.byterange=e,e.offset=t.offset)},endlist:function(){this.manifest.endList=!0},inf:function(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),t.duration>0&&(r.duration=t.duration),0===t.duration&&(r.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=i},key:function(){return t.attributes?"NONE"===t.attributes.METHOD?void(s=null):t.attributes.URI?(t.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),s={method:t.attributes.METHOD||"AES-128",uri:t.attributes.URI},void("undefined"!=typeof t.attributes.IV&&(s.iv=t.attributes.IV))):void this.trigger("warn",{message:"ignoring key declaration without URI"}):void this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){return isFinite(t.number)?void(this.manifest.mediaSequence=t.number):void this.trigger("warn",{message:"ignoring invalid media sequence: "+t.number})},"discontinuity-sequence":function(){return isFinite(t.number)?(this.manifest.discontinuitySequence=t.number,void(l=t.number)):void this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+t.number})},"playlist-type":function(){return/VOD|EVENT/.test(t.playlistType)?void(this.manifest.playlistType=t.playlistType):void this.trigger("warn",{message:"ignoring unknown playlist type: "+t.playlist})},map:function(){a={},t.uri&&(a.uri=t.uri),t.byterange&&(a.byterange=t.byterange)},"stream-inf":function(){return this.manifest.playlists=i,this.manifest.mediaGroups=this.manifest.mediaGroups||d,t.attributes?(r.attributes||(r.attributes={}),void(r.attributes=(0,m.default)(r.attributes,t.attributes))):void this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||d,!(t.attributes&&t.attributes.TYPE&&t.attributes["GROUP-ID"]&&t.attributes.NAME))return void this.trigger("warn",{message:"ignoring incomplete or missing media group"});var e=this.manifest.mediaGroups[t.attributes.TYPE];e[t.attributes["GROUP-ID"]]=e[t.attributes["GROUP-ID"]]||{},n=e[t.attributes["GROUP-ID"]],o={default:/yes/i.test(t.attributes.DEFAULT)},o.default?o.autoselect=!0:o.autoselect=/yes/i.test(t.attributes.AUTOSELECT),t.attributes.LANGUAGE&&(o.language=t.attributes.LANGUAGE),t.attributes.URI&&(o.uri=t.attributes.URI),t.attributes["INSTREAM-ID"]&&(o.instreamId=t.attributes["INSTREAM-ID"]),n[t.attributes.NAME]=o},discontinuity:function(){l+=1,r.discontinuity=!0,this.manifest.discontinuityStarts.push(i.length)},"program-date-time":function(){this.manifest.dateTimeString=t.dateTimeString,this.manifest.dateTimeObject=t.dateTimeObject},targetduration:function(){return!isFinite(t.duration)||t.duration<0?void this.trigger("warn",{message:"ignoring invalid target duration: "+t.duration}):void(this.manifest.targetDuration=t.duration)},totalduration:function(){return!isFinite(t.duration)||t.duration<0?void this.trigger("warn",{message:"ignoring invalid total duration: "+t.duration}):void(this.manifest.totalDuration=t.duration)},"cue-out":function(){r.cueOut=t.data},"cue-out-cont":function(){r.cueOutCont=t.data},"cue-in":function(){r.cueIn=t.data}})[t.tagType]||u).call(e)},uri:function(){r.uri=t.uri,i.push(r),!this.manifest.targetDuration||"duration"in r||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),r.duration=this.manifest.targetDuration),s&&(r.key=s),r.timeline=l,a&&(r.map=a),r={}},comment:function(){}})[t.type].call(e)})}return a(t,e),s(t,[{key:"push",value:function(e){this.lineStream.push(e)}},{key:"end",value:function(){this.lineStream.push("\n")}}]),t}(d.default);i.default=g,t.exports=i.default},{"./line-stream":63,"./parse-stream":64,"./stream":66,"lodash-compat/object/merge":59}],66:[function(e,t,i){arguments[4][13][0].apply(i,arguments)},{dup:13}],67:[function(e,t,i){(function(r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(i,"__esModule",{value:!0});var a=e("global/window"),s=n(a),o="undefined"!=typeof window?window.videojs:"undefined"!=typeof r?r.videojs:null,u=n(o),d=function(e){Object.defineProperties(e.frame,{id:{get:function(){return u.default.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get:function(){return u.default.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get:function(){return u.default.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data}}})},l=function(e,t,i){var r=s.default.WebKitDataCue||s.default.VTTCue;t&&t.forEach(function(e){this.inbandTextTrack_.addCue(new r(e.startTime+this.timestampOffset,e.endTime+this.timestampOffset,e.text))},e),i&&i.forEach(function(e){var t=e.cueTime+this.timestampOffset;e.frames.forEach(function(e){var i=new r(t,t,e.value||e.url||e.data||"");i.frame=e,i.value=e,d(i),this.metadataTrack_.addCue(i)},this)},e)};i.default=l,t.exports=i.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"global/window":25}],68:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(e){return/mp4a\.\d+.\d+/i.test(e)},n=function(e){return/avc1\.[\da-f]+/i.test(e)},a=function(e){var t={type:"",parameters:{}},i=e.trim().split(";");return t.type=i.shift().trim(),i.forEach(function(e){var i=e.trim().split("=");if(i.length>1){var r=i[0].replace(/"/g,"").trim(),n=i[1].replace(/"/g,"").trim();t.parameters[r]=n}}),t};i.default={isAudioCodec:r,parseContentType:a,isVideoCodec:n},t.exports=i.default},{}],69:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(e,t,i){i.captions&&i.captions.length&&!e.inbandTextTrack_&&(e.inbandTextTrack_=t.player_.addTextTrack("captions","cc1")),i.metadata&&i.metadata.length&&!e.metadataTrack_&&(e.metadataTrack_=t.player_.addTextTrack("metadata","Timed Metadata"),e.metadataTrack_.inBandMetadataTrackDispatchType=i.metadata.dispatchType)};i.default=r,t.exports=i.default},{}],70:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r={TIME_BETWEEN_TICKS:Math.floor(1e3/480),TIME_PER_TICK:Math.floor(1e3/240),BYTES_PER_CHUNK:1024,MIN_CHUNK:1024,MAX_CHUNK:1048576};i.default=r,t.exports=i.default},{}],71:[function(e,t,i){(function(r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var o=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),u=function(e,t,i){for(var r=!0;r;){var n=e,a=t,s=i;r=!1,null===n&&(n=Function.prototype);var o=Object.getOwnPropertyDescriptor(n,a);if(void 0!==o){if("value"in o)return o.value;var u=o.get;if(void 0===u)return;return u.call(s)}var d=Object.getPrototypeOf(n);if(null===d)return;e=d,t=a,i=s,r=!0,o=d=void 0}},d=e("global/document"),l=n(d),f="undefined"!=typeof window?window.videojs:"undefined"!=typeof r?r.videojs:null,c=n(f),h=e("./flash-source-buffer"),p=n(h),m=e("./flash-constants"),g=n(m),y=e("./codec-utils"),v=function(e){function t(){var e=this;a(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this),this.sourceBuffers=[],this.readyState="closed",this.on(["sourceopen","webkitsourceopen"],function(t){e.swfObj=l.default.getElementById(t.swfId),e.player_=(0,c.default)(e.swfObj.parentNode),e.tech_=e.swfObj.tech,e.readyState="open",e.tech_.on("seeking",function(){for(var t=e.sourceBuffers.length;t--;)e.sourceBuffers[t].abort()}),e.swfObj&&e.swfObj.vjs_load()})}return s(t,e),o(t,[{key:"addSeekableRange_",value:function(){}},{key:"addSourceBuffer",value:function(e){var t=(0,y.parseContentType)(e),i=void 0;if("video/mp2t"!==t.type)throw new Error("NotSupportedError (Video.js)");return i=new p.default(this),this.sourceBuffers.push(i),i}},{key:"endOfStream",value:function(e){"network"===e?this.tech_.error(2):"decode"===e&&this.tech_.error(3),"ended"!==this.readyState&&(this.readyState="ended",this.swfObj.vjs_endOfStream())}}]),t}(c.default.EventTarget);i.default=v;try{Object.defineProperty(v.prototype,"duration",{get:function(){return this.swfObj?this.swfObj.vjs_getProperty("duration"):NaN},set:function(e){var t=void 0,i=this.swfObj.vjs_getProperty("duration");if(this.swfObj.vjs_setProperty("duration",e),e<i)for(t=0;t<this.sourceBuffers.length;t++)this.sourceBuffers[t].remove(e,i);return e}})}catch(e){v.prototype.duration=NaN}for(var b in g.default)v[b]=g.default[b];t.exports=i.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./codec-utils":68,"./flash-constants":70,"./flash-source-buffer":72,"global/document":24}],72:[function(e,t,i){(function(r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var o=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),u=function(e,t,i){for(var r=!0;r;){var n=e,a=t,s=i;r=!1,null===n&&(n=Function.prototype);var o=Object.getOwnPropertyDescriptor(n,a);if(void 0!==o){if("value"in o)return o.value;var u=o.get;if(void 0===u)return;return u.call(s)}var d=Object.getPrototypeOf(n);if(null===d)return;e=d,t=a,i=s,r=!0,o=d=void 0}},d=e("global/window"),l=n(d),f="undefined"!=typeof window?window.videojs:"undefined"!=typeof r?r.videojs:null,c=n(f),h=e("mux.js/lib/flv"),p=n(h),m=e("./remove-cues-from-track"),g=n(m),y=e("./create-text-tracks-if-necessary"),v=n(y),b=e("./add-text-track-data"),_=n(b),w=e("./flash-constants"),T=n(w),S=function(e){l.default.setTimeout(e,T.default.TIME_BETWEEN_TICKS)},k=function(e,t){("number"!=typeof t||t<0)&&(t=0);var i=Math.pow(10,t);return Math.round(e*i)/i},O=function(e){function t(e){var i=this;a(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this);var r=void 0;this.chunkSize_=T.default.BYTES_PER_CHUNK,this.buffer_=[],this.bufferSize_=0,this.basePtsOffset_=NaN,this.mediaSource=e,this.updating=!1,this.timestampOffset_=0,this.segmentParser_=new p.default.Transmuxer,this.segmentParser_.on("data",this.receiveBuffer_.bind(this)),r=l.default.btoa(String.fromCharCode.apply(null,Array.prototype.slice.call(this.segmentParser_.getFlvHeader()))),this.mediaSource.swfObj.vjs_appendBuffer(r),this.one("updateend",function(){i.mediaSource.tech_.trigger("loadedmetadata")}),Object.defineProperty(this,"timestampOffset",{get:function(){return this.timestampOffset_},set:function(e){"number"==typeof e&&e>=0&&(this.timestampOffset_=e,this.segmentParser_=new p.default.Transmuxer,this.segmentParser_.on("data",this.receiveBuffer_.bind(this)),this.mediaSource.swfObj.vjs_discontinuity(),this.basePtsOffset_=NaN)}}),Object.defineProperty(this,"buffered",{get:function(){if(!(this.mediaSource&&this.mediaSource.swfObj&&"vjs_getProperty"in this.mediaSource.swfObj))return c.default.createTimeRange();var e=this.mediaSource.swfObj.vjs_getProperty("buffered");return e&&e.length&&(e[0][0]=k(e[0][0],3),e[0][1]=k(e[0][1],3)),c.default.createTimeRanges(e)}}),this.mediaSource.player_.on("seeked",function(){(0,g.default)(0,1/0,i.metadataTrack_),(0,g.default)(0,1/0,i.inbandTextTrack_)})}return s(t,e),o(t,[{key:"appendBuffer",value:function(e){var t=this,i=void 0,r=524288,n=0;if(this.updating)throw i=new Error("SourceBuffer.append() cannot be called while an update is in progress"),i.name="InvalidStateError",i.code=11,i;this.updating=!0,this.mediaSource.readyState="open",this.trigger({type:"update"});var a=function i(){t.segmentParser_.push(e.subarray(n,n+r)),n+=r,S(n<e.byteLength?i:t.segmentParser_.flush.bind(t.segmentParser_))};a()}},{key:"abort",value:function(){this.buffer_=[],this.bufferSize_=0,this.mediaSource.swfObj.vjs_abort(),this.updating&&(this.updating=!1,this.trigger({type:"updateend"}))}},{key:"remove",value:function(e,t){(0,g.default)(e,t,this.metadataTrack_),(0,g.default)(e,t,this.inbandTextTrack_),this.trigger({type:"update"}),this.trigger({type:"updateend"})}},{key:"receiveBuffer_",value:function(e){var t=this;(0,v.default)(this,this.mediaSource,e),(0,_.default)(this,e.captions,e.metadata),S(function(){var i=t.convertTagsToData_(e);0===t.buffer_.length&&S(t.processBuffer_.bind(t)),i&&(t.buffer_.push(i),t.bufferSize_+=i.byteLength)})}},{key:"processBuffer_",value:function(){var e=void 0,t=void 0,i=void 0,r=void 0,n=void 0,a=0,s=0,o=+new Date,u=void 0;if(!this.buffer_.length)return void(this.updating!==!1&&(this.updating=!1,this.trigger({type:"updateend"})));do{for(s++,e=this.buffer_[0].subarray(a,a+this.chunkSize_),e.byteLength<this.chunkSize_||this.buffer_[0].byteLength===a+this.chunkSize_?(a=0,this.buffer_.shift()):a+=this.chunkSize_,this.bufferSize_-=e.byteLength,r="",i=e.byteLength,t=0;t<i;t++)r+=String.fromCharCode(e[t]);n=l.default.btoa(r),this.mediaSource.swfObj.CallFunction('<invoke name="vjs_appendBuffer"returntype="javascript"><arguments><string>'+n+"</string></arguments></invoke>"),u=new Date-o}while(this.buffer_.length&&u<T.default.TIME_PER_TICK);this.buffer_.length&&a&&(this.buffer_[0]=this.buffer_[0].subarray(a)),u>=T.default.TIME_PER_TICK&&(this.chunkSize_=Math.floor(this.chunkSize_*(s/4))),this.chunkSize_=Math.max(T.default.MIN_CHUNK,Math.min(this.chunkSize_,T.default.MAX_CHUNK)),0!==this.bufferSize_?S(this.processBuffer_.bind(this)):(this.updating=!1,this.trigger({type:"updateend"}))}},{key:"convertTagsToData_",value:function(e){var t=0,i=this.mediaSource.tech_,r=0,n=void 0,a=void 0,s=void 0,o=[],u=this.getOrderedTags_(e);for(isNaN(this.basePtsOffset_)&&u.length&&(this.basePtsOffset_=u[0].pts),i.buffered().length&&(r=i.buffered().end(0)-this.timestampOffset),r=Math.max(r,i.currentTime()-this.timestampOffset),r*=1e3,r+=this.basePtsOffset_,n=0;n<u.length;n++)u[n].pts>=r&&o.push(u[n]);if(0!==o.length){for(n=0;n<o.length;n++)t+=o[n].bytes.byteLength;for(s=new Uint8Array(t),n=0,a=0;n<o.length;n++)s.set(o[n].bytes,a),a+=o[n].bytes.byteLength;return s}}},{key:"getOrderedTags_",value:function(e){for(var t=e.tags.videoTags,i=e.tags.audioTags,r=void 0,n=[];t.length||i.length;)r=t.length?i.length&&i[0].dts<t[0].dts?i.shift():t.shift():i.shift(),n.push(r.finalize());return n}}]),t}(c.default.EventTarget);i.default=O,t.exports=i.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./add-text-track-data":67,"./create-text-tracks-if-necessary":69,"./flash-constants":70,"./remove-cues-from-track":74,"global/window":25,"mux.js/lib/flv":82}],73:[function(e,t,i){(function(r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var o=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),u=function(e,t,i){for(var r=!0;r;){var n=e,a=t,s=i;r=!1,null===n&&(n=Function.prototype);var o=Object.getOwnPropertyDescriptor(n,a);if(void 0!==o){if("value"in o)return o.value;var u=o.get;if(void 0===u)return;return u.call(s)}var d=Object.getPrototypeOf(n);if(null===d)return;e=d,t=a,i=s,r=!0,o=d=void 0}},d=e("global/window"),l=n(d),f=e("global/document"),c=n(f),h="undefined"!=typeof window?window.videojs:"undefined"!=typeof r?r.videojs:null,p=n(h),m=e("./virtual-source-buffer"),g=n(m),y=e("./codec-utils"),v=function(e){return e.map(function(e){return e.replace(/avc1\.(\d+)\.(\d+)/i,function(e,t,i){var r=("00"+Number(t).toString(16)).slice(-2),n=("00"+Number(i).toString(16)).slice(-2);return"avc1."+r+"00"+n})})},b=function(e){function t(){var e=this;a(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this);var i=void 0;this.nativeMediaSource_=new l.default.MediaSource;for(i in this.nativeMediaSource_)i in t.prototype||"function"!=typeof this.nativeMediaSource_[i]||(this[i]=this.nativeMediaSource_[i].bind(this.nativeMediaSource_));this.duration_=NaN,Object.defineProperty(this,"duration",{get:function(){return this.duration_===1/0?this.duration_:this.nativeMediaSource_.duration},set:function(e){if(this.duration_=e,
e!==1/0)return void(this.nativeMediaSource_.duration=e)}}),Object.defineProperty(this,"seekable",{get:function(){return this.duration_===1/0?p.default.createTimeRanges([[0,this.nativeMediaSource_.duration]]):this.nativeMediaSource_.seekable}}),Object.defineProperty(this,"readyState",{get:function(){return this.nativeMediaSource_.readyState}}),Object.defineProperty(this,"activeSourceBuffers",{get:function(){return this.activeSourceBuffers_}}),this.sourceBuffers=[],this.activeSourceBuffers_=[],this.updateActiveSourceBuffers_=function(){e.activeSourceBuffers_.length=0;for(var t=!1,i=!0,r=0;r<e.player_.audioTracks().length;r++){var n=e.player_.audioTracks()[r];if(n.enabled&&"main"!==n.kind){t=!0,i=!1;break}}e.sourceBuffers.forEach(function(r){if(r.videoCodec_&&r.audioCodec_)r.audioDisabled_=t;else if(r.videoCodec_&&!r.audioCodec_)r.audioDisabled_=!0,i=!1;else if(!r.videoCodec_&&r.audioCodec_&&(r.audioDisabled_=i,i))return;e.activeSourceBuffers_.push(r)})},["sourceopen","sourceclose","sourceended"].forEach(function(e){this.nativeMediaSource_.addEventListener(e,this.trigger.bind(this))},this),this.on("sourceopen",function(t){var i=c.default.querySelector('[src="'+e.url_+'"]');i&&(e.player_=(0,p.default)(i.parentNode),e.player_.audioTracks&&e.player_.audioTracks()&&(e.player_.audioTracks().on("change",e.updateActiveSourceBuffers_),e.player_.audioTracks().on("addtrack",e.updateActiveSourceBuffers_),e.player_.audioTracks().on("removetrack",e.updateActiveSourceBuffers_)))}),this.on("sourceclose",function(e){this.sourceBuffers.forEach(function(e){e.transmuxer_&&e.transmuxer_.terminate()}),this.sourceBuffers.length=0,this.player_&&this.player_.audioTracks&&this.player_.audioTracks()&&(this.player_.audioTracks().off("change",this.updateActiveSourceBuffers_),this.player_.audioTracks().off("addtrack",this.updateActiveSourceBuffers_),this.player_.audioTracks().off("removetrack",this.updateActiveSourceBuffers_))})}return s(t,e),o(t,[{key:"addSeekableRange_",value:function(e,t){var i=void 0;if(this.duration!==1/0)throw i=new Error("MediaSource.addSeekableRange() can only be invoked when the duration is Infinity"),i.name="InvalidStateError",i.code=11,i;(t>this.nativeMediaSource_.duration||isNaN(this.nativeMediaSource_.duration))&&(this.nativeMediaSource_.duration=t)}},{key:"addSourceBuffer",value:function(e){var t=void 0,i=(0,y.parseContentType)(e);if("video/mp2t"===i.type){var r=[];i.parameters&&i.parameters.codecs&&(r=i.parameters.codecs.split(","),r=v(r),r=r.filter(function(e){return(0,y.isAudioCodec)(e)||(0,y.isVideoCodec)(e)})),0===r.length&&(r=["avc1.4d400d","mp4a.40.2"]),t=new g.default(this,r),0!==this.sourceBuffers.length&&(this.sourceBuffers[0].createRealSourceBuffers_(),t.createRealSourceBuffers_(),this.sourceBuffers[0].audioDisabled_=!0)}else t=this.nativeMediaSource_.addSourceBuffer(e);return this.sourceBuffers.push(t),t}}]),t}(p.default.EventTarget);i.default=b,t.exports=i.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./codec-utils":68,"./virtual-source-buffer":77,"global/document":24,"global/window":25}],74:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(e,t,i){var r=void 0,n=void 0;if(i)for(r=i.cues.length;r--;)n=i.cues[r],n.startTime<=t&&n.endTime>=e&&i.removeCue(n)};i.default=r,t.exports=i.default},{}],75:[function(e,t,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var a=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),s=e("global/window"),o=r(s),u=e("mux.js/lib/mp4"),d=r(u),l=function(e){e.on("data",function(e){var t=e.data;e.data=t.buffer,o.default.postMessage({action:"data",segment:e,byteOffset:t.byteOffset,byteLength:t.byteLength},[e.data])}),e.captionStream&&e.captionStream.on("data",function(e){o.default.postMessage({action:"caption",data:e})}),e.on("done",function(e){o.default.postMessage({action:"done"})})},f=function(){function e(t){n(this,e),this.options=t||{},this.init()}return a(e,[{key:"init",value:function(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new d.default.Transmuxer(this.options),l(this.transmuxer)}},{key:"push",value:function(e){var t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(t)}},{key:"reset",value:function(){this.init()}},{key:"setTimestampOffset",value:function(e){var t=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(9e4*t))}},{key:"flush",value:function(e){this.transmuxer.flush()}}]),e}(),c=function(e){e.onmessage=function(e){return"init"===e.data.action&&e.data.options?void(this.messageHandlers=new f(e.data.options)):(this.messageHandlers||(this.messageHandlers=new f),void(e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data)))}};i.default=function(e){return new c(e)},t.exports=i.default},{"global/window":25,"mux.js/lib/mp4":88}],76:[function(e,t,i){(function(t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(i,"__esModule",{value:!0});var n=e("global/window"),a=r(n),s=e("./flash-media-source"),o=r(s),u=e("./html-media-source"),d=r(u),l="undefined"!=typeof window?window.videojs:"undefined"!=typeof t?t.videojs:null,f=r(l),c=0,h={mode:"auto"};f.default.mediaSources={};var p=function(e,t){var i=f.default.mediaSources[e];if(!i)throw new Error("Media Source not found (Video.js)");i.trigger({type:"sourceopen",swfId:t})},m=function(){return!!a.default.MediaSource&&!!a.default.MediaSource.isTypeSupported&&a.default.MediaSource.isTypeSupported('video/mp4;codecs="avc1.4d400d,mp4a.40.2"')},g=function(e){var t=f.default.mergeOptions(h,e);return this.MediaSource={open:p,supportsNativeMediaSources:m},"html5"===t.mode||"auto"===t.mode&&m()?new d.default:new o.default};i.MediaSource=g,g.open=p,g.supportsNativeMediaSources=m;var y={createObjectURL:function(e){var t="blob:vjs-media-source/",i=void 0;return e instanceof d.default?(i=a.default.URL.createObjectURL(e.nativeMediaSource_),e.url_=i,i):e instanceof o.default?(i=t+c,c++,f.default.mediaSources[i]=e,i):(i=a.default.URL.createObjectURL(e),e.url_=i,i)}};i.URL=y,f.default.MediaSource=g,f.default.URL=y}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./flash-media-source":71,"./html-media-source":73,"global/window":25}],77:[function(e,t,i){(function(r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var o=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),u=function(e,t,i){for(var r=!0;r;){var n=e,a=t,s=i;r=!1,null===n&&(n=Function.prototype);var o=Object.getOwnPropertyDescriptor(n,a);if(void 0!==o){if("value"in o)return o.value;var u=o.get;if(void 0===u)return;return u.call(s)}var d=Object.getPrototypeOf(n);if(null===d)return;e=d,t=a,i=s,r=!0,o=d=void 0}},d="undefined"!=typeof window?window.videojs:"undefined"!=typeof r?r.videojs:null,l=n(d),f=e("./create-text-tracks-if-necessary"),c=n(f),h=e("./remove-cues-from-track"),p=n(h),m=e("./add-text-track-data"),g=n(m),y=e("webworkify"),v=n(y),b=e("./transmuxer-worker"),_=n(b),w=e("./codec-utils"),T=function(e){function t(e,i){var r=this;a(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,l.default.EventTarget),this.timestampOffset_=0,this.pendingBuffers_=[],this.bufferUpdating_=!1,this.mediaSource_=e,this.codecs_=i,this.audioCodec_=null,this.videoCodec_=null,this.audioDisabled_=!1;var n={remux:!1};this.codecs_.forEach(function(e){(0,w.isAudioCodec)(e)?r.audioCodec_=e:(0,w.isVideoCodec)(e)&&(r.videoCodec_=e)}),this.transmuxer_=(0,v.default)(_.default),this.transmuxer_.postMessage({action:"init",options:n}),this.transmuxer_.onmessage=function(e){return"data"===e.data.action?r.data_(e):"done"===e.data.action?r.done_(e):void 0},Object.defineProperty(this,"timestampOffset",{get:function(){return this.timestampOffset_},set:function(e){"number"==typeof e&&e>=0&&(this.timestampOffset_=e,this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e}))}}),Object.defineProperty(this,"appendWindowStart",{get:function(){return(this.videoBuffer_||this.audioBuffer_).appendWindowStart},set:function(e){this.videoBuffer_&&(this.videoBuffer_.appendWindowStart=e),this.audioBuffer_&&(this.audioBuffer_.appendWindowStart=e)}}),Object.defineProperty(this,"updating",{get:function(){return!!(this.bufferUpdating_||!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.updating||this.videoBuffer_&&this.videoBuffer_.updating)}}),Object.defineProperty(this,"buffered",{get:function(){var e=null,t=null,i=0,r=[],n=[];if(!this.videoBuffer_&&(this.audioDisabled_||!this.audioBuffer_))return l.default.createTimeRange();if(!this.videoBuffer_)return this.audioBuffer_.buffered;if(this.audioDisabled_||!this.audioBuffer_)return this.videoBuffer_.buffered;if(!(this.videoBuffer_&&0!==this.videoBuffer_.buffered.length||this.audioBuffer_&&0!==this.audioBuffer_.buffered.length))return l.default.createTimeRange();for(var a=this.videoBuffer_.buffered,s=this.audioBuffer_.buffered,o=a.length;o--;)r.push({time:a.start(o),type:"start"}),r.push({time:a.end(o),type:"end"});for(o=s.length;o--;)r.push({time:s.start(o),type:"start"}),r.push({time:s.end(o),type:"end"});for(r.sort(function(e,t){return e.time-t.time}),o=0;o<r.length;o++)"start"===r[o].type?(i++,2===i&&(e=r[o].time)):"end"===r[o].type&&(i--,1===i&&(t=r[o].time)),null!==e&&null!==t&&(n.push([e,t]),e=null,t=null);return l.default.createTimeRanges(n)}})}return s(t,e),o(t,[{key:"data_",value:function(e){var t=e.data.segment;t.data=new Uint8Array(t.data,e.data.byteOffset,e.data.byteLength),(0,c.default)(this,this.mediaSource_,t),this.pendingBuffers_.push(t)}},{key:"done_",value:function(e){this.processPendingSegments_()}},{key:"createRealSourceBuffers_",value:function(){var e=this,t=["audio","video"];t.forEach(function(i){if(e[i+"Codec_"]&&!e[i+"Buffer_"]){var r=null;e.mediaSource_[i+"Buffer_"]?r=e.mediaSource_[i+"Buffer_"]:(r=e.mediaSource_.nativeMediaSource_.addSourceBuffer(i+'/mp4;codecs="'+e[i+"Codec_"]+'"'),e.mediaSource_[i+"Buffer_"]=r),e[i+"Buffer_"]=r,["update","updatestart","updateend"].forEach(function(n){r.addEventListener(n,function(){if("audio"!==i||!e.audioDisabled_){var r=t.every(function(t){return!("audio"!==t||!e.audioDisabled_)||(i===t||!e[t+"Buffer_"]||!e[t+"Buffer_"].updating)});return r?e.trigger(n):void 0}})})}})}},{key:"appendBuffer",value:function(e){this.bufferUpdating_=!0,this.transmuxer_.postMessage({action:"push",data:e.buffer,byteOffset:e.byteOffset,byteLength:e.byteLength},[e.buffer]),this.transmuxer_.postMessage({action:"flush"})}},{key:"remove",value:function(e,t){this.videoBuffer_&&this.videoBuffer_.remove(e,t),!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.remove(e,t),(0,p.default)(e,t,this.metadataTrack_),(0,p.default)(e,t,this.inbandTextTrack_)}},{key:"processPendingSegments_",value:function(){var e={video:{segments:[],bytes:0},audio:{segments:[],bytes:0},captions:[],metadata:[]};e=this.pendingBuffers_.reduce(function(e,t){var i=t.type,r=t.data;return e[i].segments.push(r),e[i].bytes+=r.byteLength,t.captions&&(e.captions=e.captions.concat(t.captions)),t.info&&(e[i].info=t.info),t.metadata&&(e.metadata=e.metadata.concat(t.metadata)),e},e),this.videoBuffer_||this.audioBuffer_||(0===e.video.bytes&&(this.videoCodec_=null),0===e.audio.bytes&&(this.audioCodec_=null),this.createRealSourceBuffers_()),e.audio.info&&this.mediaSource_.trigger({type:"audioinfo",info:e.audio.info}),e.video.info&&this.mediaSource_.trigger({type:"videoinfo",info:e.video.info}),this.videoBuffer_&&(this.concatAndAppendSegments_(e.video,this.videoBuffer_),(0,g.default)(this,e.captions,e.metadata)),!this.audioDisabled_&&this.audioBuffer_&&this.concatAndAppendSegments_(e.audio,this.audioBuffer_),this.pendingBuffers_.length=0,this.bufferUpdating_=!1}},{key:"concatAndAppendSegments_",value:function(e,t){var i=0,r=void 0;e.bytes&&(r=new Uint8Array(e.bytes),e.segments.forEach(function(e){r.set(e,i),i+=e.byteLength}),t.appendBuffer(r))}},{key:"abort",value:function(){this.videoBuffer_&&this.videoBuffer_.abort(),this.audioBuffer_&&this.audioBuffer_.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"reset"}),this.pendingBuffers_.length=0,this.bufferUpdating_=!1}}]),t}(l.default.EventTarget);i.default=T,t.exports=i.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./add-text-track-data":67,"./codec-utils":68,"./create-text-tracks-if-necessary":69,"./remove-cues-from-track":74,"./transmuxer-worker":75,webworkify:93}],78:[function(e,t,i){"use strict";var r,n=e("../utils/stream.js");r=function(){var e=new Uint8Array,t=0;r.prototype.init.call(this),this.setTimestamp=function(e){t=e},this.parseId3TagSize=function(e,t){var i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],r=e[t+5],n=(16&r)>>4;return n?i+20:i+10},this.parseAdtsSize=function(e,t){var i=(224&e[t+5])>>5,r=e[t+4]<<3,n=6144&e[t+3];return n|r|i},this.push=function(i){var r,n,a,s,o=0,u=0;for(e.length?(s=e.length,e=new Uint8Array(i.byteLength+s),e.set(e.subarray(0,s)),e.set(i,s)):e=i;e.length-u>=3;)if(e[u]!=="I".charCodeAt(0)||e[u+1]!=="D".charCodeAt(0)||e[u+2]!=="3".charCodeAt(0))if(e[u]&!0&&240===(240&e[u+1])){if(e.length-u<7)break;if(o=this.parseAdtsSize(e,u),o>e.length)break;a={type:"audio",data:e.subarray(u,u+o),pts:t,dts:t},this.trigger("data",a),u+=o}else u++;else{if(e.length-u<10)break;if(o=this.parseId3TagSize(e,u),o>e.length)break;n={type:"timed-metadata",data:e.subarray(u,u+o)},this.trigger("data",n),u+=o}r=e.length-u,e=r>0?e.subarray(u):new Uint8Array}},r.prototype=new n,t.exports=r},{"../utils/stream.js":92}],79:[function(e,t,i){"use strict";var r,n=e("../utils/stream.js"),a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];r=function(){var e;r.prototype.init.call(this),this.push=function(t){var i,r,n,s,o,u,d=0,l=0;if("audio"===t.type)for(e?(s=e,e=new Uint8Array(s.byteLength+t.data.byteLength),e.set(s),e.set(t.data,s.byteLength)):e=t.data;d+5<e.length;)if(255===e[d]&&240===(246&e[d+1])){if(r=2*(1&~e[d+1]),i=(3&e[d+3])<<11|e[d+4]<<3|(224&e[d+5])>>5,o=1024*((3&e[d+6])+1),u=9e4*o/a[(60&e[d+2])>>>2],n=d+i,e.byteLength<n)return;if(this.trigger("data",{pts:t.pts+l*u,dts:t.dts+l*u,sampleCount:o,audioobjecttype:(e[d+2]>>>6&3)+1,channelcount:(1&e[d+2])<<2|(192&e[d+3])>>>6,samplerate:a[(60&e[d+2])>>>2],samplingfrequencyindex:(60&e[d+2])>>>2,samplesize:16,data:e.subarray(d+7+r,n)}),e.byteLength===n)return void(e=void 0);l++,e=e.subarray(n)}else d++},this.flush=function(){this.trigger("done")}},r.prototype=new n,t.exports=r},{"../utils/stream.js":92}],80:[function(e,t,i){"use strict";var r,n,a,s=e("../utils/stream.js"),o=e("../utils/exp-golomb.js");n=function(){var e,t,i=0;n.prototype.init.call(this),this.push=function(r){var n;for(t?(n=new Uint8Array(t.byteLength+r.data.byteLength),n.set(t),n.set(r.data,t.byteLength),t=n):t=r.data;i<t.byteLength-3;i++)if(1===t[i+2]){e=i+5;break}for(;e<t.byteLength;)switch(t[e]){case 0:if(0!==t[e-1]){e+=2;break}if(0!==t[e-2]){e++;break}i+3!==e-2&&this.trigger("data",t.subarray(i+3,e-2));do e++;while(1!==t[e]&&e<t.length);i=e-2,e+=3;break;case 1:if(0!==t[e-1]||0!==t[e-2]){e+=3;break}this.trigger("data",t.subarray(i+3,e-2)),i=e-2,e+=3;break;default:e+=3}t=t.subarray(i),e-=i,i=0},this.flush=function(){t&&t.byteLength>3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")}},n.prototype=new s,a={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},r=function(){var e,t,i,s,u,d,l,f=new n;r.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,s=e.dts,f.push(e))},f.on("data",function(r){var n={trackId:t,pts:i,dts:s,data:r};switch(31&r[0]){case 5:n.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:n.nalUnitType="sei_rbsp",n.escapedRBSP=u(r.subarray(1));break;case 7:n.nalUnitType="seq_parameter_set_rbsp",n.escapedRBSP=u(r.subarray(1)),n.config=d(n.escapedRBSP);break;case 8:n.nalUnitType="pic_parameter_set_rbsp";break;case 9:n.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",n)}),f.on("done",function(){e.trigger("done")}),this.flush=function(){f.flush()},l=function(e,t){var i,r,n=8,a=8;for(i=0;i<e;i++)0!==a&&(r=t.readExpGolomb(),a=(n+r+256)%256),n=0===a?n:a},u=function(e){for(var t,i,r=e.byteLength,n=[],a=1;a<r-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(n.push(a+2),a+=2):a++;if(0===n.length)return e;t=r-n.length,i=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===n[0]&&(s++,n.shift()),i[a]=e[s];return i},d=function(e){var t,i,r,n,s,u,d,f,c,h,p,m,g,y,v=0,b=0,_=0,w=0,T=1;if(t=new o(e),i=t.readUnsignedByte(),n=t.readUnsignedByte(),r=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),a[i]&&(s=t.readUnsignedExpGolomb(),3===s&&t.skipBits(1),t.skipUnsignedExpGolomb(),t.skipUnsignedExpGolomb(),t.skipBits(1),t.readBoolean()))for(p=3!==s?8:12,y=0;y<p;y++)t.readBoolean()&&(y<6?l(16,t):l(64,t));if(t.skipUnsignedExpGolomb(),u=t.readUnsignedExpGolomb(),0===u)t.readUnsignedExpGolomb();else if(1===u)for(t.skipBits(1),t.skipExpGolomb(),t.skipExpGolomb(),d=t.readUnsignedExpGolomb(),y=0;y<d;y++)t.skipExpGolomb();if(t.skipUnsignedExpGolomb(),t.skipBits(1),f=t.readUnsignedExpGolomb(),c=t.readUnsignedExpGolomb(),h=t.readBits(1),0===h&&t.skipBits(1),t.skipBits(1),t.readBoolean()&&(v=t.readUnsignedExpGolomb(),b=t.readUnsignedExpGolomb(),_=t.readUnsignedExpGolomb(),w=t.readUnsignedExpGolomb()),t.readBoolean()&&t.readBoolean()){switch(g=t.readUnsignedByte()){case 1:m=[1,1];break;case 2:m=[12,11];break;case 3:m=[10,11];break;case 4:m=[16,11];break;case 5:m=[40,33];break;case 6:m=[24,11];break;case 7:m=[20,11];break;case 8:m=[32,11];break;case 9:m=[80,33];break;case 10:m=[18,11];break;case 11:m=[15,11];break;case 12:m=[64,33];break;case 13:m=[160,99];break;case 14:m=[4,3];break;case 15:m=[3,2];break;case 16:m=[2,1];break;case 255:m=[t.readUnsignedByte()<<8|t.readUnsignedByte(),t.readUnsignedByte()<<8|t.readUnsignedByte()]}m&&(T=m[0]/m[1])}return{profileIdc:i,levelIdc:r,profileCompatibility:n,width:Math.ceil((16*(f+1)-2*v-2*b)*T),height:(2-h)*(c+1)*16-2*_-2*w}}},r.prototype=new s,t.exports={H264Stream:r,NalByteStream:n}},{"../utils/exp-golomb.js":91,"../utils/stream.js":92}],81:[function(e,t,i){"use strict";var r;r=function(e,t){var i,n=0,a=16384,s=function(e,t){var i,r=e.position+t;r<e.bytes.byteLength||(i=new Uint8Array(2*r),i.set(e.bytes.subarray(0,e.position),0),e.bytes=i,e.view=new DataView(e.bytes.buffer))},o=r.widthBytes||new Uint8Array("width".length),u=r.heightBytes||new Uint8Array("height".length),d=r.videocodecidBytes||new Uint8Array("videocodecid".length);if(!r.widthBytes){for(i=0;i<"width".length;i++)o[i]="width".charCodeAt(i);for(i=0;i<"height".length;i++)u[i]="height".charCodeAt(i);for(i=0;i<"videocodecid".length;i++)d[i]="videocodecid".charCodeAt(i);r.widthBytes=o,r.heightBytes=u,r.videocodecidBytes=d}switch(this.keyFrame=!1,e){case r.VIDEO_TAG:this.length=16,a*=6;break;case r.AUDIO_TAG:this.length=13,this.keyFrame=!0;break;case r.METADATA_TAG:this.length=29,this.keyFrame=!0;break;default:throw new Error("Unknown FLV tag type")}this.bytes=new Uint8Array(a),this.view=new DataView(this.bytes.buffer),this.bytes[0]=e,this.position=this.length,this.keyFrame=t,this.pts=0,this.dts=0,this.writeBytes=function(e,t,i){var r,n=t||0;i=i||e.byteLength,r=n+i,s(this,i),this.bytes.set(e.subarray(n,r),this.position),this.position+=i,this.length=Math.max(this.length,this.position)},this.writeByte=function(e){s(this,1),this.bytes[this.position]=e,this.position++,this.length=Math.max(this.length,this.position)},this.writeShort=function(e){s(this,2),this.view.setUint16(this.position,e),this.position+=2,this.length=Math.max(this.length,this.position)},this.negIndex=function(e){return this.bytes[this.length-e]},this.nalUnitSize=function(){return 0===n?0:this.length-(n+4)},this.startNalUnit=function(){if(n>0)throw new Error("Attempted to create new NAL wihout closing the old one");n=this.length,this.length+=4,this.position=this.length},this.endNalUnit=function(e){var t,i;this.length===n+4?this.length-=4:n>0&&(t=n+4,i=this.length-t,this.position=n,this.view.setUint32(this.position,i),this.position=this.length,e&&e.push(this.bytes.subarray(t,t+i))),n=0},this.writeMetaDataDouble=function(e,t){var i;if(s(this,2+e.length+9),this.view.setUint16(this.position,e.length),this.position+=2,"width"===e)this.bytes.set(o,this.position),this.position+=5;else if("height"===e)this.bytes.set(u,this.position),this.position+=6;else if("videocodecid"===e)this.bytes.set(d,this.position),this.position+=12;else for(i=0;i<e.length;i++)this.bytes[this.position]=e.charCodeAt(i),this.position++;this.position++,this.view.setFloat64(this.position,t),this.position+=8,this.length=Math.max(this.length,this.position),++n},this.writeMetaDataBoolean=function(e,t){var i;for(s(this,2),this.view.setUint16(this.position,e.length),this.position+=2,i=0;i<e.length;i++)s(this,1),this.bytes[this.position]=e.charCodeAt(i),this.position++;s(this,2),this.view.setUint8(this.position,1),this.position++,this.view.setUint8(this.position,t?1:0),this.position++,this.length=Math.max(this.length,this.position),++n},this.finalize=function(){var e,i;switch(this.bytes[0]){case r.VIDEO_TAG:this.bytes[11]=7|(this.keyFrame||t?16:32),this.bytes[12]=t?0:1,e=this.pts-this.dts,this.bytes[13]=(16711680&e)>>>16,this.bytes[14]=(65280&e)>>>8,this.bytes[15]=(255&e)>>>0;break;case r.AUDIO_TAG:this.bytes[11]=175,this.bytes[12]=t?0:1;break;case r.METADATA_TAG:this.position=11,this.view.setUint8(this.position,2),this.position++,this.view.setUint16(this.position,10),this.position+=2,this.bytes.set([111,110,77,101,116,97,68,97,116,97],this.position),this.position+=10,this.bytes[this.position]=8,this.position++,this.view.setUint32(this.position,n),this.position=this.length,this.bytes.set([0,0,9],this.position),this.position+=3,this.length=this.position}return i=this.length-11,this.bytes[1]=(16711680&i)>>>16,this.bytes[2]=(65280&i)>>>8,this.bytes[3]=(255&i)>>>0,this.bytes[4]=(16711680&this.dts)>>>16,this.bytes[5]=(65280&this.dts)>>>8,this.bytes[6]=(255&this.dts)>>>0,this.bytes[7]=(4278190080&this.dts)>>>24,this.bytes[8]=0,this.bytes[9]=0,this.bytes[10]=0,s(this,4),this.view.setUint32(this.length,this.length),this.length+=4,this.position+=4,this.bytes=this.bytes.subarray(0,this.length),this.frameTime=r.frameTime(this.bytes),this}},r.AUDIO_TAG=8,r.VIDEO_TAG=9,r.METADATA_TAG=18,r.isAudioFrame=function(e){return r.AUDIO_TAG===e[0]},r.isVideoFrame=function(e){return r.VIDEO_TAG===e[0]},r.isMetaData=function(e){return r.METADATA_TAG===e[0]},r.isKeyFrame=function(e){return r.isVideoFrame(e)?23===e[11]:!!r.isAudioFrame(e)||!!r.isMetaData(e)},r.frameTime=function(e){var t=e[4]<<16;return t|=e[5]<<8,t|=e[6]<<0,t|=e[7]<<24},t.exports=r},{}],82:[function(e,t,i){t.exports={tag:e("./flv-tag"),Transmuxer:e("./transmuxer")}},{"./flv-tag":81,"./transmuxer":83}],83:[function(e,t,i){"use strict";var r,n,a,s,o,u,d,l=e("../utils/stream.js"),f=e("./flv-tag.js"),c=e("../m2ts/m2ts.js"),h=e("../codecs/adts.js"),p=e("../codecs/h264").H264Stream;o=function(e,t){"number"==typeof t.pts&&(void 0===e.timelineStartInfo.pts?e.timelineStartInfo.pts=t.pts:e.timelineStartInfo.pts=Math.min(e.timelineStartInfo.pts,t.pts)),"number"==typeof t.dts&&(void 0===e.timelineStartInfo.dts?e.timelineStartInfo.dts=t.dts:e.timelineStartInfo.dts=Math.min(e.timelineStartInfo.dts,t.dts))},u=function(e,t){var i=new f(f.METADATA_TAG);return i.dts=t,i.pts=t,i.writeMetaDataDouble("videocodecid",7),i.writeMetaDataDouble("width",e.width),i.writeMetaDataDouble("height",e.height),i},d=function(e,t){var i,r=new f(f.VIDEO_TAG,(!0));for(r.dts=t,r.pts=t,r.writeByte(1),r.writeByte(e.profileIdc),r.writeByte(e.profileCompatibility),r.writeByte(e.levelIdc),r.writeByte(255),r.writeByte(225),r.writeShort(e.sps[0].length),r.writeBytes(e.sps[0]),r.writeByte(e.pps.length),i=0;i<e.pps.length;++i)r.writeShort(e.pps[i].length),r.writeBytes(e.pps[i]);return r},a=function(e){var t,i=[];a.prototype.init.call(this),this.push=function(t){o(e,t),e&&void 0===e.channelcount&&(e.audioobjecttype=t.audioobjecttype,e.channelcount=t.channelcount,e.samplerate=t.samplerate,e.samplingfrequencyindex=t.samplingfrequencyindex,e.samplesize=t.samplesize,e.extraData=e.audioobjecttype<<11|e.samplingfrequencyindex<<7|e.channelcount<<3),t.pts=Math.round(t.pts/90),t.dts=Math.round(t.dts/90),i.push(t)},this.flush=function(){var r,n,a,s=[];if(0===i.length)return void this.trigger("done");for(a=-(1/0);i.length;)r=i.shift(),(e.extraData!==t||r.pts-a>=1e3)&&(n=new f(f.METADATA_TAG),n.pts=r.pts,n.dts=r.dts,n.writeMetaDataDouble("audiocodecid",10),n.writeMetaDataBoolean("stereo",2===e.channelcount),n.writeMetaDataDouble("audiosamplerate",e.samplerate),n.writeMetaDataDouble("audiosamplesize",16),s.push(n),t=e.extraData,n=new f(f.AUDIO_TAG,(!0)),n.pts=r.pts,n.dts=r.dts,n.view.setUint16(n.position,e.extraData),n.position+=2,n.length=Math.max(n.length,n.position),s.push(n),a=r.pts),n=new f(f.AUDIO_TAG),n.pts=r.pts,n.dts=r.dts,n.writeBytes(r.data),s.push(n);t=null,this.trigger("data",{track:e,tags:s}),this.trigger("done")}},a.prototype=new l,n=function(e){var t,i,r=[];n.prototype.init.call(this),this.finishFrame=function(i,r){r&&(t&&e&&e.newMetadata&&(r.keyFrame||0===i.length)&&(i.push(u(t,r.pts)),i.push(d(e,r.pts)),e.newMetadata=!1),r.endNalUnit(),i.push(r))},this.push=function(t){o(e,t),t.pts=Math.round(t.pts/90),t.dts=Math.round(t.dts/90),r.push(t)},this.flush=function(){for(var n,a=[];r.length&&"access_unit_delimiter_rbsp"!==r[0].nalUnitType;)r.shift();if(0===r.length)return void this.trigger("done");for(;r.length;)n=r.shift(),"seq_parameter_set_rbsp"===n.nalUnitType?(e.newMetadata=!0,t=n.config,e.width=t.width,e.height=t.height,e.sps=[n.data],e.profileIdc=t.profileIdc,e.levelIdc=t.levelIdc,e.profileCompatibility=t.profileCompatibility,i.endNalUnit()):"pic_parameter_set_rbsp"===n.nalUnitType?(e.newMetadata=!0,e.pps=[n.data],i.endNalUnit()):"access_unit_delimiter_rbsp"===n.nalUnitType?(i&&this.finishFrame(a,i),i=new f(f.VIDEO_TAG),i.pts=n.pts,i.dts=n.dts):("slice_layer_without_partitioning_rbsp_idr"===n.nalUnitType&&(i.keyFrame=!0),i.endNalUnit()),i.startNalUnit(),i.writeBytes(n.data);i&&this.finishFrame(a,i),this.trigger("data",{track:e,tags:a}),this.trigger("done")}},n.prototype=new l,s=function(e){this.numberOfTracks=0,this.metadataStream=e.metadataStream,this.videoTags=[],this.audioTags=[],this.videoTrack=null,this.audioTrack=null,this.pendingCaptions=[],this.pendingMetadata=[],this.pendingTracks=0,s.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):("video"===e.track.type&&(this.videoTrack=e.track,this.videoTags=e.tags,this.pendingTracks++),void("audio"===e.track.type&&(this.audioTrack=e.track,this.audioTags=e.tags,this.pendingTracks++)))}},s.prototype=new l,s.prototype.flush=function(){var e,t,i,r,n={tags:{},captions:[],metadata:[]};if(!(this.pendingTracks<this.numberOfTracks)){for(this.videoTrack?r=this.videoTrack.timelineStartInfo.pts:this.audioTrack&&(r=this.audioTrack.timelineStartInfo.pts),n.tags.videoTags=this.videoTags,n.tags.audioTags=this.audioTags,i=0;i<this.pendingCaptions.length;i++)t=this.pendingCaptions[i],t.startTime=t.startPts-r,t.startTime/=9e4,t.endTime=t.endPts-r,t.endTime/=9e4,n.captions.push(t);for(i=0;i<this.pendingMetadata.length;i++)e=this.pendingMetadata[i],e.cueTime=e.pts-r,e.cueTime/=9e4,n.metadata.push(e);n.metadata.dispatchType=this.metadataStream.dispatchType,this.videoTrack=null,this.audioTrack=null,this.videoTags=[],this.audioTags=[],this.pendingCaptions.length=0,this.pendingMetadata.length=0,this.pendingTracks=0,this.trigger("data",n),this.trigger("done")}},r=function(e){var t,i,o,u,d,l,m,g,y,v=this;r.prototype.init.call(this),e=e||{},this.metadataStream=new c.MetadataStream,e.metadataStream=this.metadataStream,t=new c.TransportPacketStream,i=new c.TransportParseStream,o=new c.ElementaryStream,u=new h,d=new p,y=new s(e),t.pipe(i).pipe(o),o.pipe(d),o.pipe(u),o.pipe(this.metadataStream).pipe(y),g=new c.CaptionStream,d.pipe(g).pipe(y),o.on("data",function(e){var t,i,r;if("metadata"===e.type){for(t=e.tracks.length;t--;)"video"===e.tracks[t].type?i=e.tracks[t]:"audio"===e.tracks[t].type&&(r=e.tracks[t]);i&&!l&&(y.numberOfTracks++,l=new n(i),d.pipe(l).pipe(y)),r&&!m&&(y.numberOfTracks++,m=new a(r),u.pipe(m).pipe(y))}}),this.push=function(e){t.push(e)},this.flush=function(){t.flush()},y.on("data",function(e){v.trigger("data",e)}),y.on("done",function(){v.trigger("done")}),this.getFlvHeader=function(e,t,i){var r,n,a,s=new Uint8Array(9),o=new DataView(s.buffer);return e=e||0,t=void 0===t||t,i=void 0===i||i,o.setUint8(0,70),o.setUint8(1,76),o.setUint8(2,86),o.setUint8(3,1),o.setUint8(4,(t?4:0)|(i?1:0)),o.setUint32(5,s.byteLength),e<=0?(n=new Uint8Array(s.byteLength+4),n.set(s),n.set([0,0,0,0],s.byteLength),n):(r=new f(f.METADATA_TAG),r.pts=r.dts=0,r.writeMetaDataDouble("duration",e),a=r.finalize().length,n=new Uint8Array(s.byteLength+a),n.set(s),n.set(o.byteLength,a),n)}},r.prototype=new l,t.exports=r},{"../codecs/adts.js":79,"../codecs/h264":80,"../m2ts/m2ts.js":85,"../utils/stream.js":92,"./flv-tag.js":81}],84:[function(e,t,i){"use strict";var r=4,n=128,a=e("../utils/stream"),s=function(e){for(var t=0,i={payloadType:-1,payloadSize:0},a=0,s=0;t<e.byteLength&&e[t]!==n;){for(;255===e[t];)a+=255,t++;for(a+=e[t++];255===e[t];)s+=255,t++;if(s+=e[t++],!i.payload&&a===r){i.payloadType=a,i.payloadSize=s,i.payload=e.subarray(t,t+s);break}t+=s,a=0,s=0}return i},o=function(e){return 181!==e.payload[0]?null:49!==(e.payload[1]<<8|e.payload[2])?null:"GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])?null:3!==e.payload[7]?null:e.payload.subarray(8,e.payload.length-1)},u=function(e,t){var i,r,n,a,s=[];if(!(64&t[0]))return s;for(r=31&t[0],i=0;i<r;i++)n=3*i,a={type:3&t[n+2],pts:e},4&t[n+2]&&(a.ccData=t[n+3]<<8|t[n+4],s.push(a));return s},d=function(){d.prototype.init.call(this),this.captionPackets_=[],this.field1_=new k,this.field1_.on("data",this.trigger.bind(this,"data")),this.field1_.on("done",this.trigger.bind(this,"done"))};d.prototype=new a,d.prototype.push=function(e){var t,i;"sei_rbsp"===e.nalUnitType&&(t=s(e.escapedRBSP),t.payloadType===r&&(i=o(t),i&&(this.captionPackets_=this.captionPackets_.concat(u(e.pts,i)))))},d.prototype.flush=function(){return this.captionPackets_.length?(this.captionPackets_.sort(function(e,t){return e.pts-t.pts}),this.captionPackets_.forEach(this.field1_.push,this.field1_),this.captionPackets_.length=0,void this.field1_.flush()):void this.field1_.flush()};var l={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608},f=function(e){return null===e?"":(e=l[e]||e,String.fromCharCode(e))},c=0,h=5152,p=5167,m=5157,g=5158,y=5159,v=5165,b=5153,_=5164,w=5166,T=14,S=function(){for(var e=[],t=T+1;t--;)e.push("");return e},k=function(){k.prototype.init.call(this),this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=S(),this.nonDisplayed_=S(),
this.lastControlCode_=null,this.push=function(e){if(0===e.type){var t,i,r,n;if(t=32639&e.ccData,t===this.lastControlCode_)return void(this.lastControlCode_=null);switch(4096===(61440&t)?this.lastControlCode_=t:this.lastControlCode_=null,t){case c:break;case h:this.mode_="popOn";break;case p:this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;break;case m:this.topRow_=T-1,this.mode_="rollUp";break;case g:this.topRow_=T-2,this.mode_="rollUp";break;case y:this.topRow_=T-3,this.mode_="rollUp";break;case v:this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;break;case b:"popOn"===this.mode_?this.nonDisplayed_[T]=this.nonDisplayed_[T].slice(0,-1):this.displayed_[T]=this.displayed_[T].slice(0,-1);break;case _:this.flushDisplayed(e.pts),this.displayed_=S();break;case w:this.nonDisplayed_=S();break;default:if(r=t>>>8,n=255&t,r>=16&&r<=23&&n>=64&&n<=127&&(16!==r||n<96)&&(r=32,n=null),(17===r||25===r)&&n>=48&&n<=63&&(r=9834,n=""),16===(240&r))return;this[this.mode_](e.pts,r,n)}}}};k.prototype=new a,k.prototype.flushDisplayed=function(e){var t=this.displayed_.map(function(e){return e.trim()}).filter(function(e){return e.length}).join("\n");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t})},k.prototype.popOn=function(e,t,i){var r=this.nonDisplayed_[T];r+=f(t),r+=f(i),this.nonDisplayed_[T]=r},k.prototype.rollUp=function(e,t,i){var r=this.displayed_[T];""===r&&(this.flushDisplayed(e),this.startPts_=e),r+=f(t),r+=f(i),this.displayed_[T]=r},k.prototype.shiftRowsUp_=function(){var e;for(e=0;e<this.topRow_;e++)this.displayed_[e]="";for(e=this.topRow_;e<T;e++)this.displayed_[e]=this.displayed_[e+1];this.displayed_[T]=""},t.exports={CaptionStream:d,Cea608Stream:k}},{"../utils/stream":92}],85:[function(e,t,i){"use strict";var r,n,a,s=e("../utils/stream.js"),o=e("./caption-stream"),u=e("./stream-types"),d=e("./stream-types.js"),l=188,f=71;r=function(){var e=new Uint8Array(l),t=0;r.prototype.init.call(this),this.push=function(i){var r,n=0,a=l;for(t?(r=new Uint8Array(i.byteLength+t),r.set(e.subarray(0,t)),r.set(i,t),t=0):r=i;a<r.byteLength;)r[n]!==f||r[a]!==f?(n++,a++):(this.trigger("data",r.subarray(n,a)),n+=l,a+=l);n<r.byteLength&&(e.set(r.subarray(n),0),t=r.byteLength-n)},this.flush=function(){t===l&&e[0]===f&&(this.trigger("data",e),t=0),this.trigger("done")}},r.prototype=new s,n=function(){var e,t,i,r;n.prototype.init.call(this),r=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,e=function(e,r){var n=0;r.payloadUnitStartIndicator&&(n+=e[n]+1),"pat"===r.type?t(e.subarray(n),r):i(e.subarray(n),r)},t=function(e,t){t.section_number=e[7],t.last_section_number=e[8],r.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=r.pmtPid},i=function(e,t){var i,n,a,s;if(1&e[5]){for(r.programMapTable={},i=(15&e[1])<<8|e[2],n=3+i-4,a=(15&e[10])<<8|e[11],s=12+a;s<n;)r.programMapTable[(31&e[s+1])<<8|e[s+2]]=e[s],s+=((15&e[s+3])<<8|e[s+4])+5;for(t.programMapTable=r.programMapTable;r.packetsWaitingForPmt.length;)r.processPes_.apply(r,r.packetsWaitingForPmt.shift())}},this.push=function(t){var i={},r=4;i.payloadUnitStartIndicator=!!(64&t[1]),i.pid=31&t[1],i.pid<<=8,i.pid|=t[2],(48&t[3])>>>4>1&&(r+=t[r]+1),0===i.pid?(i.type="pat",e(t.subarray(r),i),this.trigger("data",i)):i.pid===this.pmtPid?(i.type="pmt",e(t.subarray(r),i),this.trigger("data",i)):void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,r,i]):this.processPes_(t,r,i)},this.processPes_=function(e,t,i){i.streamType=this.programMapTable[i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}},n.prototype=new s,n.STREAM_TYPES={h264:27,adts:15},a=function(){var e=this,t={data:[],size:0},i={data:[],size:0},r={data:[],size:0},n=function(e,t){var i;t.dataAlignmentIndicator=0!==(4&e[6]),i=e[7],192&i&&(t.pts=(14&e[9])<<27|(255&e[10])<<20|(254&e[11])<<12|(255&e[12])<<5|(254&e[13])>>>3,t.pts*=4,t.pts+=(6&e[13])>>>1,t.dts=t.pts,64&i&&(t.dts=(14&e[14])<<27|(255&e[15])<<20|(254&e[16])<<12|(255&e[17])<<5|(254&e[18])>>>3,t.dts*=4,t.dts+=(6&e[18])>>>1)),t.data=e.subarray(9+e[8])},s=function(t,i){var r,a=new Uint8Array(t.size),s={type:i},o=0;if(t.data.length){for(s.trackId=t.data[0].pid;t.data.length;)r=t.data.shift(),a.set(r.data,o),o+=r.data.byteLength;n(a,s),t.size=0,e.trigger("data",s)}};a.prototype.init.call(this),this.push=function(n){({pat:function(){},pes:function(){var e,a;switch(n.streamType){case u.H264_STREAM_TYPE:case d.H264_STREAM_TYPE:e=t,a="video";break;case u.ADTS_STREAM_TYPE:e=i,a="audio";break;case u.METADATA_STREAM_TYPE:e=r,a="timed-metadata";break;default:return}n.payloadUnitStartIndicator&&s(e,a),e.data.push(n),e.size+=n.data.byteLength},pmt:function(){var t,i,r={type:"metadata",tracks:[]},a=n.programMapTable;for(t in a)a.hasOwnProperty(t)&&(i={timelineStartInfo:{baseMediaDecodeTime:0}},i.id=+t,a[t]===d.H264_STREAM_TYPE?(i.codec="avc",i.type="video"):a[t]===d.ADTS_STREAM_TYPE&&(i.codec="adts",i.type="audio"),r.tracks.push(i));e.trigger("data",r)}})[n.type]()},this.flush=function(){s(t,"video"),s(i,"audio"),s(r,"timed-metadata"),this.trigger("done")}},a.prototype=new s;var c={PAT_PID:0,MP2T_PACKET_LENGTH:l,TransportPacketStream:r,TransportParseStream:n,ElementaryStream:a,CaptionStream:o.CaptionStream,Cea608Stream:o.Cea608Stream,MetadataStream:e("./metadata-stream")};for(var h in u)u.hasOwnProperty(h)&&(c[h]=u[h]);t.exports=c},{"../utils/stream.js":92,"./caption-stream":84,"./metadata-stream":86,"./stream-types":87,"./stream-types.js":87}],86:[function(e,t,i){"use strict";var r,n=e("../utils/stream"),a=e("./stream-types"),s=function(e,t,i){var r,n="";for(r=t;r<i;r++)n+="%"+("00"+e[r].toString(16)).slice(-2);return n},o=function(e,t,i){return decodeURIComponent(s(e,t,i))},u=function(e,t,i){return unescape(s(e,t,i))},d=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},l={TXXX:function(e){var t;if(3===e.data[0]){for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=o(e.data,1,t),e.value=o(e.data,t+1,e.data.length-1);break}e.data=e.value}},WXXX:function(e){var t;if(3===e.data[0])for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=o(e.data,1,t),e.url=o(e.data,t+1,e.data.length);break}},PRIV:function(e){var t;for(t=0;t<e.data.length;t++)if(0===e.data[t]){e.owner=u(e.data,0,t);break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}};r=function(e){var t,i={debug:!(!e||!e.debug),descriptor:e&&e.descriptor},n=0,s=[],o=0;if(r.prototype.init.call(this),this.dispatchType=a.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(t=0;t<i.descriptor.length;t++)this.dispatchType+=("00"+i.descriptor[t].toString(16)).slice(-2);this.push=function(e){var t,r,a,u,f,c;if("timed-metadata"===e.type){if(e.dataAlignmentIndicator&&(o=0,s.length=0),0===s.length&&(e.data.length<10||e.data[0]!=="I".charCodeAt(0)||e.data[1]!=="D".charCodeAt(0)||e.data[2]!=="3".charCodeAt(0)))return void(i.debug&&console.log("Skipping unrecognized metadata packet"));if(s.push(e),o+=e.data.byteLength,1===s.length&&(n=d(e.data.subarray(6,10)),n+=10),!(o<n)){for(t={data:new Uint8Array(n),frames:[],pts:s[0].pts,dts:s[0].dts},f=0;f<n;)t.data.set(s[0].data.subarray(0,n-f),f),f+=s[0].data.byteLength,o-=s[0].data.byteLength,s.shift();r=10,64&t.data[5]&&(r+=4,r+=d(t.data.subarray(10,14)),n-=d(t.data.subarray(16,20)));do{if(a=d(t.data.subarray(r+4,r+8)),a<1)return console.log("Malformed ID3 frame encountered. Skipping metadata parsing.");if(c=String.fromCharCode(t.data[r],t.data[r+1],t.data[r+2],t.data[r+3]),u={id:c,data:t.data.subarray(r+10,r+a+10)},u.key=u.id,l[u.id]&&(l[u.id](u),"com.apple.streaming.transportStreamTimestamp"===u.owner)){var h=u.data,p=(1&h[3])<<30|h[4]<<22|h[5]<<14|h[6]<<6|h[7]>>>2;p*=4,p+=3&h[7],u.timeStamp=p,this.trigger("timestamp",u)}t.frames.push(u),r+=10,r+=a}while(r<n);this.trigger("data",t)}}}},r.prototype=new n,t.exports=r},{"../utils/stream":92,"./stream-types":87}],87:[function(e,t,i){"use strict";t.exports={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21}},{}],88:[function(e,t,i){t.exports={generator:e("./mp4-generator"),Transmuxer:e("./transmuxer").Transmuxer,AudioSegmentStream:e("./transmuxer").AudioSegmentStream,VideoSegmentStream:e("./transmuxer").VideoSegmentStream}},{"./mp4-generator":89,"./transmuxer":90}],89:[function(e,t,i){"use strict";var r,n,a,s,o,u,d,l,f,c,h,p,m,g,y,v,b,_,w,T,S,k,O,P,x,A,E,L,j,C,U,D,I,M,B,R;!function(){var e;if(O={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(e in O)O.hasOwnProperty(e)&&(O[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);P=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),A=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),x=new Uint8Array([0,0,0,1]),E=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),L=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),j={video:E,audio:L},D=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),U=new Uint8Array([0,0,0,0,0,0,0,0]),I=new Uint8Array([0,0,0,0,0,0,0,0]),M=I,B=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),R=I,C=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),r=function(e){var t,i,r,n=[],a=0;for(t=1;t<arguments.length;t++)n.push(arguments[t]);for(t=n.length;t--;)a+=n[t].byteLength;for(i=new Uint8Array(a+8),r=new DataView(i.buffer,i.byteOffset,i.byteLength),r.setUint32(0,i.byteLength),i.set(e,4),t=0,a=8;t<n.length;t++)i.set(n[t],a),a+=n[t].byteLength;return i},n=function(){return r(O.dinf,r(O.dref,D))},a=function(e){return r(O.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,e.audioobjecttype<<3|e.samplingfrequencyindex>>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},s=function(){return r(O.ftyp,P,x,P,A)},v=function(e){return r(O.hdlr,j[e])},o=function(e){return r(O.mdat,e)},y=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(t[12]=e.samplerate>>>24&255,t[13]=e.samplerate>>>16&255,t[14]=e.samplerate>>>8&255,t[15]=255&e.samplerate),r(O.mdhd,t)},g=function(e){return r(O.mdia,y(e),v(e.type),d(e))},u=function(e){return r(O.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},d=function(e){return r(O.minf,"video"===e.type?r(O.vmhd,C):r(O.smhd,U),n(),_(e))},l=function(e,t){for(var i=[],n=t.length;n--;)i[n]=T(t[n]);return r.apply(null,[O.moof,u(e)].concat(i))},f=function(e){for(var t=e.length,i=[];t--;)i[t]=p(e[t]);return r.apply(null,[O.moov,h(4294967295)].concat(i).concat(c(e)))},c=function(e){for(var t=e.length,i=[];t--;)i[t]=S(e[t]);return r.apply(null,[O.mvex].concat(i))},h=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return r(O.mvhd,t)},b=function(e){var t,i,n=e.samples||[],a=new Uint8Array(4+n.length);for(i=0;i<n.length;i++)t=n[i].flags,a[i+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return r(O.sdtp,a)},_=function(e){return r(O.stbl,w(e),r(O.stts,R),r(O.stsc,M),r(O.stsz,B),r(O.stco,I))},function(){var e,t;w=function(i){return r(O.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===i.type?e(i):t(i))},e=function(e){var t,i=e.sps||[],n=e.pps||[],a=[],s=[];for(t=0;t<i.length;t++)a.push((65280&i[t].byteLength)>>>8),a.push(255&i[t].byteLength),a=a.concat(Array.prototype.slice.call(i[t]));for(t=0;t<n.length;t++)s.push((65280&n[t].byteLength)>>>8),s.push(255&n[t].byteLength),s=s.concat(Array.prototype.slice.call(n[t]));return r(O.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),r(O.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([i.length]).concat(a).concat([n.length]).concat(s))),r(O.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))},t=function(e){return r(O.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),a(e))}}(),m=function(e){var t=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return r(O.tkhd,t)},T=function(e){var t,i,n,a,s;return t=r(O.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),i=r(O.tfdt,new Uint8Array([0,0,0,0,e.baseMediaDecodeTime>>>24&255,e.baseMediaDecodeTime>>>16&255,e.baseMediaDecodeTime>>>8&255,255&e.baseMediaDecodeTime])),s=88,"audio"===e.type?(n=k(e,s),r(O.traf,t,i,n)):(a=b(e),n=k(e,a.length+s),r(O.traf,t,i,n,a))},p=function(e){return e.duration=e.duration||4294967295,r(O.trak,m(e),g(e))},S=function(e){var t=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(t[t.length-1]=0),r(O.trex,t)},function(){var e,t,i;i=function(e,t){var i=0,r=0,n=0,a=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(r=2),void 0!==e[0].flags&&(n=4),void 0!==e[0].compositionTimeOffset&&(a=8)),[0,0,i|r|n|a,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},t=function(e,t){var n,a,s,o;for(a=e.samples||[],t+=20+16*a.length,n=i(a,t),o=0;o<a.length;o++)s=a[o],n=n.concat([(4278190080&s.duration)>>>24,(16711680&s.duration)>>>16,(65280&s.duration)>>>8,255&s.duration,(4278190080&s.size)>>>24,(16711680&s.size)>>>16,(65280&s.size)>>>8,255&s.size,s.flags.isLeading<<2|s.flags.dependsOn,s.flags.isDependedOn<<6|s.flags.hasRedundancy<<4|s.flags.paddingValue<<1|s.flags.isNonSyncSample,61440&s.flags.degradationPriority,15&s.flags.degradationPriority,(4278190080&s.compositionTimeOffset)>>>24,(16711680&s.compositionTimeOffset)>>>16,(65280&s.compositionTimeOffset)>>>8,255&s.compositionTimeOffset]);return r(O.trun,new Uint8Array(n))},e=function(e,t){var n,a,s,o;for(a=e.samples||[],t+=20+8*a.length,n=i(a,t),o=0;o<a.length;o++)s=a[o],n=n.concat([(4278190080&s.duration)>>>24,(16711680&s.duration)>>>16,(65280&s.duration)>>>8,255&s.duration,(4278190080&s.size)>>>24,(16711680&s.size)>>>16,(65280&s.size)>>>8,255&s.size]);return r(O.trun,new Uint8Array(n))},k=function(i,r){return"audio"===i.type?e(i,r):t(i,r)}}(),t.exports={ftyp:s,mdat:o,moof:l,moov:f,initSegment:function(e){var t,i=s(),r=f(e);return t=new Uint8Array(i.byteLength+r.byteLength),t.set(i),t.set(r,i.byteLength),t}}},{}],90:[function(e,t,i){"use strict";var r,n,a,s,o,u,d,l,f,c,h,p=e("../utils/stream.js"),m=e("./mp4-generator.js"),g=e("../m2ts/m2ts.js"),y=e("../codecs/adts.js"),v=e("../codecs/h264").H264Stream,b=e("../aac"),_=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],w=["width","height","profileIdc","levelIdc","profileCompatibility"];o=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0}}},u=function(e){return e[0]==="I".charCodeAt(0)&&e[1]==="D".charCodeAt(0)&&e[2]==="3".charCodeAt(0)},c=function(e,t){var i;if(e.length!==t.length)return!1;for(i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0},h=function(e){var t,i,r=0;for(t=0;t<e.length;t++)i=e[t],r+=i.data.byteLength;return r},n=function(e){var t=[],i=0,r=0;n.prototype.init.call(this),this.push=function(i){d(e,i),e&&_.forEach(function(t){e[t]=i[t]}),t.push(i)},this.setEarliestDts=function(t){r=t-e.timelineStartInfo.baseMediaDecodeTime},this.flush=function(){var r,n,a,s;return 0===t.length?void this.trigger("done","AudioSegmentStream"):(r=this.trimAdtsFramesByEarliestDts_(t),e.samples=this.generateSampleTable_(r),a=m.mdat(this.concatenateFrameData_(r)),t=[],f(e),n=m.moof(i,[e]),s=new Uint8Array(n.byteLength+a.byteLength),i++,s.set(n),s.set(a,n.byteLength),l(e),this.trigger("data",{track:e,boxes:s}),void this.trigger("done","AudioSegmentStream"))},this.trimAdtsFramesByEarliestDts_=function(t){return e.minSegmentDts>=r?t:(e.minSegmentDts=1/0,t.filter(function(t){return t.dts>=r&&(e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),e.minSegmentPts=e.minSegmentDts,!0)}))},this.generateSampleTable_=function(e){var t,i,r=[];for(t=0;t<e.length;t++)i=e[t],r.push({size:i.data.byteLength,duration:1024});return r},this.concatenateFrameData_=function(e){var t,i,r=0,n=new Uint8Array(h(e));for(t=0;t<e.length;t++)i=e[t],n.set(i.data,r),r+=i.data.byteLength;return n}},n.prototype=new p,r=function(e){var t,i,n=0,a=[];r.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(r){d(e,r),"seq_parameter_set_rbsp"!==r.nalUnitType||t||(t=r.config,e.sps=[r.data],w.forEach(function(i){e[i]=t[i]},this)),"pic_parameter_set_rbsp"!==r.nalUnitType||i||(i=r.data,e.pps=[r.data]),a.push(r)},this.flush=function(){for(var t,i,r,s,o,u;a.length&&"access_unit_delimiter_rbsp"!==a[0].nalUnitType;)a.shift();return 0===a.length?(this.resetStream_(),void this.trigger("done","VideoSegmentStream")):(t=this.groupNalsIntoFrames_(a),r=this.groupFramesIntoGops_(t),r[0][0].keyFrame||(i=this.getGopForFusion_(a[0],e),i?(r.unshift(i),r.byteLength+=i.byteLength,r.nalCount+=i.nalCount,r.pts=i.pts,r.dts=i.dts,r.duration+=i.duration):r=this.extendFirstKeyFrame_(r)),d(e,r),e.samples=this.generateSampleTable_(r),o=m.mdat(this.concatenateNalData_(r)),this.gopCache_.unshift({gop:r.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),a=[],f(e),this.trigger("timelineStartInfo",e.timelineStartInfo),s=m.moof(n,[e]),u=new Uint8Array(s.byteLength+o.byteLength),n++,u.set(s),u.set(o,s.byteLength),this.trigger("data",{track:e,boxes:u}),this.resetStream_(),void this.trigger("done","VideoSegmentStream"))},this.resetStream_=function(){l(e),t=void 0,i=void 0},this.getGopForFusion_=function(t){var i,r,n,a,s,o=45e3,u=1e4,d=1/0;for(s=0;s<this.gopCache_.length;s++)a=this.gopCache_[s],n=a.gop,e.pps&&c(e.pps[0],a.pps[0])&&e.sps&&c(e.sps[0],a.sps[0])&&(n.dts<e.timelineStartInfo.dts||(i=t.dts-n.dts-n.duration,i>=-u&&i<=o&&(!r||d>i)&&(r=a,d=i)));return r?r.gop:null},this.extendFirstKeyFrame_=function(e){var t;return e[0][0].keyFrame||(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},this.groupNalsIntoFrames_=function(e){var t,i,r=[],n=[];for(r.byteLength=0,t=0;t<e.length;t++)i=e[t],"access_unit_delimiter_rbsp"===i.nalUnitType?(r.length&&(r.duration=i.dts-r.dts,n.push(r)),r=[i],r.byteLength=i.data.byteLength,r.pts=i.pts,r.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(r.keyFrame=!0),r.duration=i.dts-r.dts,r.byteLength+=i.data.byteLength,r.push(i));return n.length&&(!r.duration||r.duration<=0)&&(r.duration=n[n.length-1].duration),n.push(r),n},this.groupFramesIntoGops_=function(e){var t,i,r=[],n=[];for(r.byteLength=0,r.nalCount=0,r.duration=0,r.pts=e[0].pts,r.dts=e[0].dts,n.byteLength=0,n.nalCount=0,n.duration=0,n.pts=e[0].pts,n.dts=e[0].dts,t=0;t<e.length;t++)i=e[t],i.keyFrame?(r.length&&(n.push(r),n.byteLength+=r.byteLength,n.nalCount+=r.nalCount,n.duration+=r.duration),r=[i],r.nalCount=i.length,r.byteLength=i.byteLength,r.pts=i.pts,r.dts=i.dts,r.duration=i.duration):(r.duration+=i.duration,r.nalCount+=i.length,r.byteLength+=i.byteLength,r.push(i));return n.length&&r.duration<=0&&(r.duration=n[n.length-1].duration),n.byteLength+=r.byteLength,n.nalCount+=r.nalCount,n.duration+=r.duration,n.push(r),n},this.generateSampleTable_=function(e,t){var i,r,n,a,s,u=t||0,d=[];for(i=0;i<e.length;i++)for(a=e[i],r=0;r<a.length;r++)s=a[r],n=o(),n.dataOffset=u,n.compositionTimeOffset=s.pts-s.dts,n.duration=s.duration,n.size=4*s.length,n.size+=s.byteLength,s.keyFrame&&(n.flags.dependsOn=2),u+=n.size,d.push(n);return d},this.concatenateNalData_=function(e){var t,i,r,n,a,s,o=0,u=e.byteLength,d=e.nalCount,l=u+4*d,f=new Uint8Array(l),c=new DataView(f.buffer);for(t=0;t<e.length;t++)for(n=e[t],i=0;i<n.length;i++)for(a=n[i],r=0;r<a.length;r++)s=a[r],c.setUint32(o,s.data.byteLength),o+=4,f.set(s.data,o),o+=s.data.byteLength;return f}},r.prototype=new p,d=function(e,t){"number"==typeof t.pts&&(void 0===e.timelineStartInfo.pts&&(e.timelineStartInfo.pts=t.pts),void 0===e.minSegmentPts?e.minSegmentPts=t.pts:e.minSegmentPts=Math.min(e.minSegmentPts,t.pts),void 0===e.maxSegmentPts?e.maxSegmentPts=t.pts:e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)),"number"==typeof t.dts&&(void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts),void 0===e.minSegmentDts?e.minSegmentDts=t.dts:e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),void 0===e.maxSegmentDts?e.maxSegmentDts=t.dts:e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts))},l=function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},f=function(e){var t,i=9e4,r=e.minSegmentDts-e.timelineStartInfo.dts,n=e.minSegmentPts-e.minSegmentDts;e.baseMediaDecodeTime=e.timelineStartInfo.baseMediaDecodeTime,e.baseMediaDecodeTime+=r,e.baseMediaDecodeTime-=n,e.baseMediaDecodeTime=Math.max(0,e.baseMediaDecodeTime),"audio"===e.type&&(t=e.samplerate/i,e.baseMediaDecodeTime*=t,e.baseMediaDecodeTime=Math.floor(e.baseMediaDecodeTime))},s=function(e,t){this.numberOfTracks=0,this.metadataStream=t,"undefined"!=typeof e.remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,s.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)))}},s.prototype=new p,s.prototype.flush=function(e){var t,i,r,n,a=0,s={captions:[],metadata:[],info:{}},o=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?(o=this.videoTrack.timelineStartInfo.pts,w.forEach(function(e){s.info[e]=this.videoTrack[e]},this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,_.forEach(function(e){s.info[e]=this.audioTrack[e]},this)),1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,r=m.initSegment(this.pendingTracks),s.data=new Uint8Array(r.byteLength+this.pendingBytes),s.data.set(r),a+=r.byteLength,n=0;n<this.pendingBoxes.length;n++)s.data.set(this.pendingBoxes[n],a),a+=this.pendingBoxes[n].byteLength;for(n=0;n<this.pendingCaptions.length;n++)t=this.pendingCaptions[n],t.startTime=t.startPts-o,t.startTime/=9e4,t.endTime=t.endPts-o,t.endTime/=9e4,s.captions.push(t);for(n=0;n<this.pendingMetadata.length;n++)i=this.pendingMetadata[n],i.cueTime=i.pts-o,i.cueTime/=9e4,s.metadata.push(i);s.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",s),this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},a=function(e){var t,i,o=this,d=!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 g.MetadataStream,t.aacStream=new b,t.adtsStream=new y,t.coalesceStream=new s(e,t.metadataStream),t.headOfPipeline=t.aacStream,t.aacStream.pipe(t.adtsStream),t.aacStream.pipe(t.metadataStream),t.metadataStream.pipe(t.coalesceStream),t.metadataStream.on("timestamp",function(e){t.aacStream.setTimestamp(e.timeStamp)}),t.aacStream.on("data",function(e){"timed-metadata"!==e.type||t.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:o.baseMediaDecodeTime},codec:"adts",type:"audio"},t.coalesceStream.numberOfTracks++,t.audioSegmentStream=new n(i),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 g.MetadataStream,a.packetStream=new g.TransportPacketStream,a.parseStream=new g.TransportParseStream,a.elementaryStream=new g.ElementaryStream,a.adtsStream=new y,a.h264Stream=new v,a.captionStream=new g.CaptionStream,a.coalesceStream=new s(e,a.metadataStream),a.headOfPipeline=a.packetStream,a.packetStream.pipe(a.parseStream).pipe(a.elementaryStream),a.elementaryStream.pipe(a.h264Stream),a.elementaryStream.pipe(a.adtsStream),a.elementaryStream.pipe(a.metadataStream).pipe(a.coalesceStream),a.h264Stream.pipe(a.captionStream).pipe(a.coalesceStream),a.elementaryStream.on("data",function(e){var s;if("metadata"===e.type){for(s=e.tracks.length;s--;)t||"video"!==e.tracks[s].type?i||"audio"!==e.tracks[s].type||(i=e.tracks[s],i.timelineStartInfo.baseMediaDecodeTime=o.baseMediaDecodeTime):(t=e.tracks[s],t.timelineStartInfo.baseMediaDecodeTime=o.baseMediaDecodeTime);t&&!a.videoSegmentStream&&(a.coalesceStream.numberOfTracks++,a.videoSegmentStream=new r(t),a.videoSegmentStream.on("timelineStartInfo",function(e){i&&(i.timelineStartInfo=e,a.audioSegmentStream.setEarliestDts(e.dts))}),a.h264Stream.pipe(a.videoSegmentStream).pipe(a.coalesceStream)),i&&!a.audioSegmentStream&&(a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new n(i),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(e){var r=this.transmuxPipeline_;this.baseMediaDecodeTime=e,i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,l(i),i.timelineStartInfo.baseMediaDecodeTime=e),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,l(t),t.timelineStartInfo.baseMediaDecodeTime=e)},this.push=function(e){if(d){var t=u(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),d=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){d=!0,this.transmuxPipeline_.headOfPipeline.flush()}},a.prototype=new p,t.exports={Transmuxer:a,VideoSegmentStream:r,AudioSegmentStream:n,AUDIO_PROPERTIES:_,VIDEO_PROPERTIES:w}},{"../aac":78,"../codecs/adts.js":79,"../codecs/h264":80,"../m2ts/m2ts.js":85,"../utils/stream.js":92,"./mp4-generator.js":89}],91:[function(e,t,i){"use strict";var r;r=function(e){var t=e.byteLength,i=0,r=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+r},this.loadWord=function(){var n=e.byteLength-t,a=new Uint8Array(4),s=Math.min(4,t);if(0===s)throw new Error("no bytes available");a.set(e.subarray(n,n+s)),i=new DataView(a.buffer).getUint32(0),r=8*s,t-=s},this.skipBits=function(e){var n;r>e?(i<<=e,r-=e):(e-=r,n=Math.floor(e/8),e-=8*n,t-=n,this.loadWord(),i<<=e,r-=e)},this.readBits=function(e){var n=Math.min(r,e),a=i>>>32-n;return r-=n,r>0?i<<=n:t>0&&this.loadWord(),n=e-n,n>0?a<<n|this.readBits(n):a},this.skipLeadingZeros=function(){var e;for(e=0;e<r;++e)if(0!==(i&2147483648>>>e))return i<<=e,r-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()},t.exports=r},{}],92:[function(e,t,i){"use strict";var r=function(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t].push(i)},this.off=function(t,i){var r;return!!e[t]&&(r=e[t].indexOf(i),e[t].splice(r,1),r>-1)},this.trigger=function(t){var i,r,n,a;if(i=e[t])if(2===arguments.length)for(n=i.length,r=0;r<n;++r)i[r].call(this,arguments[1]);else{for(a=[],r=arguments.length,r=1;r<arguments.length;++r)a.push(arguments[r]);for(n=i.length,r=0;r<n;++r)i[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)},t.exports=r},{}],93:[function(e,t,i){var r=arguments[3],n=arguments[4],a=arguments[5],s=JSON.stringify;t.exports=function(e){for(var t,i=Object.keys(a),o=0,u=i.length;o<u;o++){var d=i[o];if(a[d].exports===e){t=d;break}}if(!t){t=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var l={},o=0,u=i.length;o<u;o++){var d=i[o];l[d]=d}n[t]=[Function(["require","module","exports"],"("+e+")(self)"),l]}var f=Math.floor(Math.pow(16,8)*Math.random()).toString(16),c={};c[t]=t,n[f]=[Function(["require"],"require("+s(t)+")(self)"),c];var h="("+r+")({"+Object.keys(n).map(function(e){return s(e)+":["+n[e][0]+","+s(n[e][1])+"]"}).join(",")+"},{},["+s(f)+"])",p=window.URL||window.webkitURL||window.mozURL||window.msURL;return new Worker(p.createObjectURL(new Blob([h],{type:"text/javascript"})))}},{}],94:[function(e,t,i){(function(i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),o=function(e,t,i){for(var r=!0;r;){var n=e,a=t,s=i;r=!1,null===n&&(n=Function.prototype);var o=Object.getOwnPropertyDescriptor(n,a);if(void 0!==o){if("value"in o)return o.value;var u=o.get;if(void 0===u)return;return u.call(s)}var d=Object.getPrototypeOf(n);if(null===d)return;e=d,t=a,i=s,r=!0,o=d=void 0}},u=e("global/document"),d=r(u),l=e("./playlist-loader"),f=r(l),c=e("./playlist"),h=r(c),p=e("./xhr"),m=r(p),g=e("aes-decrypter"),y=e("./bin-utils"),v=r(y),b=e("videojs-contrib-media-sources"),_=e("m3u8-parser"),w=r(_),T="undefined"!=typeof window?window.videojs:"undefined"!=typeof i?i.videojs:null,S=r(T),k=e("./master-playlist-controller"),O=r(k),P=e("./config"),x=r(P),A=e("./rendition-mixin"),E=r(A),L=e("./gap-skipper"),j=r(L),C=e("global/window"),U=r(C),D=function(e,t){
if(typeof e!=typeof t)return!0;if(Object.keys(e).length!==Object.keys(t).length)return!0;for(var i in e)if(!t[i]||e[i]!==t[i])return!0;return!1},I={PlaylistLoader:f.default,Playlist:h.default,Decrypter:g.Decrypter,AsyncStream:g.AsyncStream,decrypt:g.decrypt,utils:v.default,xhr:(0,m.default)()};Object.defineProperty(I,"GOAL_BUFFER_LENGTH",{get:function(){return S.default.log.warn("using Hls.GOAL_BUFFER_LENGTH is UNSAFE be sure you know what you are doing"),x.default.GOAL_BUFFER_LENGTH},set:function(e){return S.default.log.warn("using Hls.GOAL_BUFFER_LENGTH is UNSAFE be sure you know what you are doing"),"number"!=typeof e||e<=0?void S.default.log.warn("value passed to Hls.GOAL_BUFFER_LENGTH must be a number and greater than 0"):void(x.default.GOAL_BUFFER_LENGTH=e)}});var M=1.2,B=function(e,t){var i=void 0;return e?(i=U.default.getComputedStyle(e),i?i[t]:""):""};I.STANDARD_PLAYLIST_SELECTOR=function(){var e=void 0,t=this.playlists.master.playlists.slice(),i=[],r=+new Date,n=void 0,a=void 0,s=void 0,o=void 0,u=void 0,d=void 0,l=void 0,f=void 0;for(t.sort(I.comparePlaylistBandwidth),t=t.filter(function(e){return"undefined"==typeof e.excludeUntil||r>=e.excludeUntil}),n=t.length;n--;)a=t[n],a.attributes&&a.attributes.BANDWIDTH&&(e=a.attributes.BANDWIDTH*M,e<this.bandwidth&&(i.push(a),s||(s=a)));for(n=i.length,i.sort(I.comparePlaylistResolution),a=null,l=parseInt(B(this.tech_.el(),"width"),10),f=parseInt(B(this.tech_.el(),"height"),10);n--;)if(a=i[n],a.attributes&&a.attributes.RESOLUTION&&a.attributes.RESOLUTION.width&&a.attributes.RESOLUTION.height){var c=a.attributes.RESOLUTION;if(c.width===l&&c.height===f){o=null,d=a;break}if(c.width<l&&c.height<f)break;(!o||c.width<u.width&&c.height<u.height)&&(o=a,u=o.attributes.RESOLUTION)}return o||d||s||t[0]},I.canPlaySource=function(){return S.default.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")},I.supportsNativeHls=function(){var e=d.default.createElement("video");if(!S.default.getComponent("Html5").isSupported())return!1;var t=["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"];return t.some(function(t){return/maybe|probably/i.test(e.canPlayType(t))})}(),I.isSupported=function(){return S.default.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var R=S.default.getComponent("Component"),N=function(e){function t(e,i,r){var a=this;if(n(this,t),o(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,i),i.options_&&i.options_.playerId){var s=(0,S.default)(i.options_.playerId);s.hasOwnProperty("hls")||Object.defineProperty(s,"hls",{get:function(){return S.default.log.warn("player.hls is deprecated. Use player.tech.hls instead."),a}})}this.tech_=i,this.source_=e,this.stats={},this.options_=S.default.mergeOptions(S.default.options.hls||{},r.hls),this.setOptions_(),this.on(d.default,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],function(e){var t=d.default.fullscreenElement||d.default.webkitFullscreenElement||d.default.mozFullScreenElement||d.default.msFullscreenElement;t&&t.contains(a.tech_.el())&&a.masterPlaylistController_.fastQualityChange_()}),this.on(this.tech_,"seeking",function(){this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.masterPlaylistController_&&this.masterPlaylistController_.pauseLoading()}),this.audioTrackChange_=function(){a.masterPlaylistController_.useAudio()},this.on(this.tech_,"play",this.play)}return a(t,e),s(t,[{key:"setOptions_",value:function(){var e=this;this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.bandwidth=this.options_.bandwidth||4194304,["withCredentials","bandwidth"].forEach(function(t){"undefined"!=typeof e.source_[t]&&(e.options_[t]=e.source_[t])}),this.bandwidth=this.options_.bandwidth}},{key:"src",value:function(e){var t=this;e&&(this.setOptions_(),this.options_.url=this.source_.src,this.options_.tech=this.tech_,this.options_.externHls=I,this.masterPlaylistController_=new O.default(this.options_),this.gapSkipper_=new j.default(this.options_),this.masterPlaylistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):I.STANDARD_PLAYLIST_SELECTOR.bind(this),this.playlists=this.masterPlaylistController_.masterPlaylistLoader_,this.mediaSource=this.masterPlaylistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get:function(){return this.masterPlaylistController_.selectPlaylist},set:function(e){this.masterPlaylistController_.selectPlaylist=e.bind(this)}},bandwidth:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.bandwidth},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=e}}}),Object.defineProperties(this.stats,{bandwidth:{get:function(){return t.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return t.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return t.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return t.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.masterPlaylistController_.on("sourceopen",function(){t.tech_.audioTracks().addEventListener("change",t.audioTrackChange_)}),this.masterPlaylistController_.on("audioinfo",function(e){if(!S.default.browser.IS_FIREFOX||!t.audioInfo_||!D(t.audioInfo_,e.info))return void(t.audioInfo_=e.info);var i="had different audio properties (channels, sample rate, etc.) or changed in some other way. This behavior is currently unsupported in Firefox due to an issue: \n\nhttps://bugzilla.mozilla.org/show_bug.cgi?id=1247138\n\n",r=void 0,n=void 0;t.masterPlaylistController_.audioTracks_.forEach(function(e){!n&&e.default&&(n=e),!r&&e.enabled&&(r=e)}),r.getLoader(t.activeAudioGroup_())?(i="The audio track '"+r.label+"' that we tried to "+("switch to "+i+" Unfortunately this means we will have to ")+("return you to the main track '"+n.label+"'. Sorry!"),n.enabled=!0,t.tech_.audioTracks().removeTrack(r)):(i="The rendition that we tried to switch to "+i+"Unfortunately that means we will have to blacklist the current playlist and switch to another. Sorry!",t.masterPlaylistController_.blacklistCurrentPlaylist()),S.default.log.warn(i),t.masterPlaylistController_.useAudio()}),this.masterPlaylistController_.on("selectedinitialmedia",function(){t.tech_.clearTracks("audio"),t.masterPlaylistController_.audioTracks_.forEach(function(e){t.tech_.audioTracks().addTrack(e)}),(0,E.default)(t)}),this.on(this.masterPlaylistController_,"progress",function(){this.bandwidth=this.masterPlaylistController_.mainSegmentLoader_.bandwidth,this.tech_.trigger("progress")}),this.tech_.el()&&this.tech_.src(S.default.URL.createObjectURL(this.masterPlaylistController_.mediaSource)))}},{key:"activeAudioGroup_",value:function(){return this.masterPlaylistController_.activeAudioGroup()}},{key:"play",value:function(){this.masterPlaylistController_.play()}},{key:"setCurrentTime",value:function(e){this.masterPlaylistController_.setCurrentTime(e)}},{key:"duration",value:function(){return this.masterPlaylistController_.duration()}},{key:"seekable",value:function(){return this.masterPlaylistController_.seekable()}},{key:"dispose",value:function(){this.masterPlaylistController_&&this.masterPlaylistController_.dispose(),this.gapSkipper_.dispose(),this.tech_.audioTracks().removeEventListener("change",this.audioTrackChange_),o(Object.getPrototypeOf(t.prototype),"dispose",this).call(this)}}]),t}(R),F=function e(t){return{canHandleSource:function(i){return(!S.default.options.hls||!S.default.options.hls.mode||S.default.options.hls.mode===t)&&e.canPlayType(i.type)},handleSource:function(e,i,r){"flash"===t&&i.setTimeout(function(){i.trigger("loadstart")},1);var n=S.default.mergeOptions(r,{hls:{mode:t}});return i.hls=new N(e,i,n),i.hls.xhr=(0,m.default)(),S.default.Hls.xhr.beforeRequest&&(i.hls.xhr.beforeRequest=S.default.Hls.xhr.beforeRequest),i.hls.src(e.src),i.hls},canPlayType:function(t){return e.canPlayType(t)?"maybe":""}}};I.comparePlaylistBandwidth=function(e,t){var i=void 0,r=void 0;return e.attributes&&e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||U.default.Number.MAX_VALUE,t.attributes&&t.attributes.BANDWIDTH&&(r=t.attributes.BANDWIDTH),r=r||U.default.Number.MAX_VALUE,i-r},I.comparePlaylistResolution=function(e,t){var i=void 0,r=void 0;return e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||U.default.Number.MAX_VALUE,t.attributes&&t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(r=t.attributes.RESOLUTION.width),r=r||U.default.Number.MAX_VALUE,i===r&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-r},F.canPlayType=function(e){var t=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i;return!I.supportsNativeHls&&t.test(e)},"undefined"!=typeof S.default.MediaSource&&"undefined"!=typeof S.default.URL||(S.default.MediaSource=b.MediaSource,S.default.URL=b.URL),b.MediaSource.supportsNativeMediaSources()&&S.default.getComponent("Html5").registerSourceHandler(F("html5")),U.default.Uint8Array&&S.default.getComponent("Flash").registerSourceHandler(F("flash")),S.default.HlsHandler=N,S.default.HlsSourceHandler=F,S.default.Hls=I,S.default.m3u8=w.default,S.default.registerComponent("Hls",I),S.default.options.hls=S.default.options.hls||{},t.exports={Hls:I,HlsHandler:N,HlsSourceHandler:F}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./bin-utils":1,"./config":2,"./gap-skipper":3,"./master-playlist-controller":5,"./playlist":7,"./playlist-loader":6,"./rendition-mixin":9,"./xhr":14,"aes-decrypter":18,"global/document":24,"global/window":25,"m3u8-parser":62,"videojs-contrib-media-sources":76}]},{},[94])(94)});