tcplayer.js 5.1.0-beta.2 → 5.1.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,9 +12,9 @@ var c=toTitleCase(l[a]),u=Tech.getTech(c);if(c||(u=Component.getComponent(c)),u&
12
12
  e.prototype.enable=function(){this.children().forEach(function(t){return t.enable&&t.enable()}),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDown),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)},e.prototype.handleMouseDown=function(t){var e=this.el_.ownerDocument;this.on(e,"mousemove",this.throttledHandleMouseSeek),this.on(e,"touchmove",this.throttledHandleMouseSeek),this.on(e,"mouseup",this.handleMouseUp),this.on(e,"touchend",this.handleMouseUp)},e.prototype.handleMouseUp=function(t){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUp),this.off(e,"touchend",this.handleMouseUp)},e}(Component);ProgressControl.prototype.options_={children:["seekBar"]},Component.registerComponent("ProgressControl",ProgressControl);var FullscreenToggle=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.on(n,"fullscreenchange",i.handleFullscreenChange),i}return inherits(e,t),e.prototype.buildCSSClass=function(){return"vjs-fullscreen-control "+t.prototype.buildCSSClass.call(this)},e.prototype.handleFullscreenChange=function(t){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},e.prototype.handleClick=function(t){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},e}(Button);FullscreenToggle.prototype.controlText_="Fullscreen",Component.registerComponent("FullscreenToggle",FullscreenToggle);var FullscreenRotate=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.screenRotated=!1,i}return inherits(e,t),e.prototype.createEl=function(){var e=t.prototype.createEl.call(this,"button",{className:"vjs-rotatescreen-control vjs-control"});return this.contentEl_=createEl("div",{innerHTML:'<svg style="width: 24px;height: 24px;margin-top:7px" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 40 40" fill="none">\n <g clip-path="url(#clip0)">\n <path transform="scale(1.5 1.5)" d="M11.6665 9.16663H4.1665C2.78579 9.16663 1.6665 10.2859 1.6665 11.6666V15.8333C1.6665 17.214 2.78579 18.3333 4.1665 18.3333H11.6665C13.0472 18.3333 14.1665 17.214 14.1665 15.8333V11.6666C14.1665 10.2859 13.0472 9.16663 11.6665 9.16663Z" fill="white"></path>\n <path transform="scale(1.5 1.5)" fill-rule="evenodd" clip-rule="evenodd" d="M3.88148 4.06298C3.75371 4.21005 3.67667 4.40231 3.67749 4.61242C3.67847 4.87253 3.79852 5.10435 3.98581 5.25646L6.99111 8.05895C7.32771 8.37283 7.85502 8.35443 8.16891 8.01782C8.48279 7.68122 8.46437 7.15391 8.12778 6.84003L6.62061 5.43457L9.8198 5.4224C9.82848 5.42239 9.8372 5.42221 9.84591 5.4219C10.9714 5.38233 12.0885 5.6285 13.0931 6.13744C14.0976 6.64635 14.957 7.40148 15.5908 8.33234C16.2246 9.2632 16.6122 10.3394 16.7177 11.4606C16.823 12.5819 16.6427 13.7115 16.1934 14.7442C16.0098 15.1661 16.203 15.6571 16.6251 15.8408C17.0471 16.0243 17.5381 15.8311 17.7216 15.4091C18.2833 14.1183 18.5087 12.7063 18.3771 11.3047C18.2453 9.90318 17.7607 8.55792 16.9684 7.39433C16.1761 6.23073 15.1021 5.28683 13.8463 4.65065C12.5946 4.01651 11.203 3.70872 9.80072 3.75583L6.43415 3.76862L7.96326 2.12885C8.27715 1.79225 8.25872 1.26494 7.92213 0.951061C7.58553 0.63718 7.05822 0.655585 6.74433 0.99219L3.90268 4.0395C3.89545 4.04724 3.88841 4.05509 3.88154 4.06303L3.88148 4.06298Z" fill="white"></path>\n </g>\n <defs>\n <clipPath id="clip0">\n <rect width="40" height="40" fill="white"></rect>\n </clipPath>\n </defs>\n </svg>'}),e.appendChild(this.contentEl_),e},e.prototype.handleClick=function(t){this.screenRotated?(this.player_.exitRotatescreen(),this.screenRotated=!1):(this.player_.requestRotatescreen(),this.screenRotated=!0)},e}(Button);FullscreenRotate.prototype.controlText_="Rotate",Component.registerComponent("FullscreenRotate",FullscreenRotate);var checkVolumeSupport=function(t,e){!e.tech_||e.tech_.featuresVolumeControl||e.tech_.featuresMuteControl?e.tech_&&e.tech_.featuresVolumeControl&&t.addClass("enable-volume-control"):t.addClass("vjs-hidden"),t.on(e,"loadstart",function(){e.tech_.featuresVolumeControl||e.tech_.featuresMuteControl?e.tech_.featuresVolumeControl&&(t.removeClass("vjs-hidden"),t.addClass("enable-volume-control")):t.addClass("vjs-hidden")})},VolumeLevel=function(t){function e(){return classCallCheck(this,e),possibleConstructorReturn(this,t.apply(this,arguments))}return inherits(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-volume-level",innerHTML:'<span class="vjs-control-text"></span>'})},e}(Component);Component.registerComponent("VolumeLevel",VolumeLevel);var VolumeBar=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.on("slideractive",i.updateLastVolume_),i.on(n,"volumechange",i.updateARIAAttributes),n.ready(function(){return i.updateARIAAttributes()}),i}return inherits(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},e.prototype.handleMouseDown=function(e){isSingleLeftClick(e)&&t.prototype.handleMouseDown.call(this,e)},e.prototype.handleMouseMove=function(t){isSingleLeftClick(t)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(t)))},e.prototype.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},e.prototype.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},e.prototype.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},e.prototype.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},e.prototype.updateARIAAttributes=function(t){var e=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",e),this.el_.setAttribute("aria-valuetext",e+"%")},e.prototype.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},e.prototype.updateLastVolume_=function(){var t=this,e=this.player_.volume();this.one("sliderinactive",function(){0===t.player_.volume()&&t.player_.lastVolume_(e)})},e}(Slider);VolumeBar.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},VolumeBar.prototype.playerEvent="volumechange",Component.registerComponent("VolumeBar",VolumeBar);var VolumeControl=function(t){function e(n){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};classCallCheck(this,e),r.vertical=r.vertical||!1,("undefined"==typeof r.volumeBar||isPlain(r.volumeBar))&&(r.volumeBar=r.volumeBar||{},r.volumeBar.vertical=r.vertical);var i=possibleConstructorReturn(this,t.call(this,n,r));return checkVolumeSupport(i,n),i.throttledHandleMouseMove=throttle(bind(i,i.handleMouseMove),25),i.on("mousedown",i.handleMouseDown),i.on("touchstart",i.handleMouseDown),i.on(i.volumeBar,["focus","slideractive"],function(){i.volumeBar.addClass("vjs-slider-active"),i.addClass("vjs-slider-active"),i.trigger("slideractive")}),i.on(i.volumeBar,["blur","sliderinactive"],function(){i.volumeBar.removeClass("vjs-slider-active"),i.removeClass("vjs-slider-active"),i.trigger("sliderinactive")}),i}return inherits(e,t),e.prototype.createEl=function(){var e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),t.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+e})},e.prototype.handleMouseDown=function(t){var e=this.el_.ownerDocument;this.on(e,"mousemove",this.throttledHandleMouseMove),this.on(e,"touchmove",this.throttledHandleMouseMove),this.on(e,"mouseup",this.handleMouseUp),this.on(e,"touchend",this.handleMouseUp)},e.prototype.handleMouseUp=function(t){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseMove),this.off(e,"touchmove",this.throttledHandleMouseMove),this.off(e,"mouseup",this.handleMouseUp),this.off(e,"touchend",this.handleMouseUp)},e.prototype.handleMouseMove=function(t){this.volumeBar.handleMouseMove(t)},e}(Component);VolumeControl.prototype.options_={children:["volumeBar"]},Component.registerComponent("VolumeControl",VolumeControl);var MuteToggle=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return checkVolumeSupport(i,n),i.on(n,["loadstart","volumechange"],i.update),i}return inherits(e,t),e.prototype.buildCSSClass=function(){return"vjs-mute-control "+t.prototype.buildCSSClass.call(this)},e.prototype.handleClick=function(t){var e=this.player_.volume(),n=this.player_.lastVolume_();if(0===e){var r=n<.1?.1:n;this.player_.volume(r),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},e.prototype.update=function(t){this.updateIcon_(),this.updateControlText_()},e.prototype.updateIcon_=function(){var t=this.player_.volume(),e=3;0===t||this.player_.muted()?e=0:t<.33?e=1:t<.67&&(e=2);for(var n=0;n<4;n++)removeClass(this.el_,"vjs-vol-"+n);addClass(this.el_,"vjs-vol-"+e)},e.prototype.updateControlText_=function(){var t=this.player_.muted()||0===this.player_.volume(),e=t?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)},e}(Button);MuteToggle.prototype.controlText_="Mute",Component.registerComponent("MuteToggle",MuteToggle);var VolumePanel=function(t){function e(n){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};classCallCheck(this,e),"undefined"!=typeof r.inline?r.inline=r.inline:r.inline=!0,("undefined"==typeof r.volumeControl||isPlain(r.volumeControl))&&(r.volumeControl=r.volumeControl||{},r.volumeControl.vertical=!r.inline);var i=possibleConstructorReturn(this,t.call(this,n,r));return checkVolumeSupport(i,n),i.on(i.volumeControl,["slideractive"],i.sliderActive_),i.on(i.muteToggle,"focus",i.sliderActive_),i.on(i.volumeControl,["sliderinactive"],i.sliderInactive_),i.on(i.muteToggle,"blur",i.sliderInactive_),i}return inherits(e,t),e.prototype.sliderActive_=function(){IS_ANDROID||IS_IOS||this.addClass("vjs-slider-active")},e.prototype.sliderInactive_=function(){IS_ANDROID||IS_IOS||this.removeClass("vjs-slider-active")},e.prototype.createEl=function(){var e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),t.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+e})},e}(Component);VolumePanel.prototype.options_={children:["muteToggle","volumeControl"]},Component.registerComponent("VolumePanel",VolumePanel);var Menu=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return r&&(i.menuButton_=r.menuButton),i.focusedChild_=-1,i.on("keydown",i.handleKeyPress),i}return inherits(e,t),e.prototype.addItem=function(t){this.addChild(t),t.on("click",bind(this,function(e){this.menuButton_&&(this.menuButton_.unpressButton(),"CaptionSettingsMenuItem"!==t.name()&&this.menuButton_.focus())}))},e.prototype.createEl=function(){var e=this.options_.contentElType||"ul";this.contentEl_=createEl(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var n=t.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return n.appendChild(this.contentEl_),on(n,"click",function(t){t.preventDefault(),t.stopImmediatePropagation()}),n},e.prototype.dispose=function(){this.contentEl_=null,t.prototype.dispose.call(this)},e.prototype.handleKeyPress=function(t){37===t.which||40===t.which?(t.preventDefault(),this.stepForward()):38!==t.which&&39!==t.which||(t.preventDefault(),this.stepBack())},e.prototype.stepForward=function(){var t=0;this.focusedChild_!==undefined&&(t=this.focusedChild_+1),this.focus(t)},e.prototype.stepBack=function(){var t=0;this.focusedChild_!==undefined&&(t=this.focusedChild_-1),this.focus(t)},e.prototype.focus=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0,e=this.children().slice();e.length&&e[0].className&&/vjs-menu-title/.test(e[0].className)&&e.shift(),e.length>0&&(t<0?t=0:t>=e.length&&(t=e.length-1),this.focusedChild_=t,e[t].el_.focus())},e}(Component);Component.registerComponent("Menu",Menu);var MenuButton=function(t){function e(n){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));i.menuButton_=new Button(n,r),i.menuButton_.controlText(i.controlText_),i.menuButton_.el_.setAttribute("aria-haspopup","true");var o=Button.prototype.buildCSSClass();return i.menuButton_.el_.className=i.buildCSSClass()+" "+o,i.menuButton_.removeClass("vjs-control"),i.addChild(i.menuButton_),i.update(),i.enabled_=!0,i.on(i.menuButton_,"tap",i.handleClick),i.on(i.menuButton_,"click",i.handleClick),i.on(i.menuButton_,"focus",i.handleFocus),i.on(i.menuButton_,"blur",i.handleBlur),i.on("keydown",i.handleSubmenuKeyPress),i}return inherits(e,t),e.prototype.update=function(){var t=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=t,this.addChild(t),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?this.hide():this.show()},e.prototype.createMenu=function(){var t=new Menu(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var e=createEl("li",{className:"vjs-menu-title",innerHTML:toTitleCase(this.options_.title),tabIndex:-1});this.hideThreshold_+=1,t.children_.unshift(e),prependTo(e,t.contentEl())}if(this.items=this.createItems(),this.items)for(var n=0;n<this.items.length;n++)t.addItem(this.items[n]);return t},e.prototype.createItems=function(){},e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:this.buildWrapperCSSClass()},{})},e.prototype.buildWrapperCSSClass=function(){var e="vjs-menu-button";return!0===this.options_.inline?e+="-inline":e+="-popup","vjs-menu-button "+e+" "+Button.prototype.buildCSSClass()+" "+t.prototype.buildCSSClass.call(this)},e.prototype.buildCSSClass=function(){var e="vjs-menu-button";return!0===this.options_.inline?e+="-inline":e+="-popup","vjs-menu-button "+e+" "+t.prototype.buildCSSClass.call(this)},e.prototype.controlText=function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.menuButton_.el();return this.menuButton_.controlText(t,e)},e.prototype.handleClick=function(t){this.one(this.menu.contentEl(),"mouseleave",bind(this,function(t){this.unpressButton(),this.el_.blur()})),(IS_IOS||IS_ANDROID)&&"SubsCapsButton"===this.name_&&("vjs-menu"===this.menu.el_.className?this.buttonPressed_=!1:this.buttonPressed_=!0),this.buttonPressed_?this.unpressButton():this.pressButton()},e.prototype.focus=function(){this.menuButton_.focus()},e.prototype.blur=function(){this.menuButton_.blur()},e.prototype.handleFocus=function(){on(document_1,"keydown",bind(this,this.handleKeyPress))},e.prototype.handleBlur=function(){off(document_1,"keydown",bind(this,this.handleKeyPress))},e.prototype.handleKeyPress=function(t){27===t.which||9===t.which?(this.buttonPressed_&&this.unpressButton(),9!==t.which&&(t.preventDefault(),this.menuButton_.el_.focus())):38!==t.which&&40!==t.which||this.buttonPressed_||(this.pressButton(),t.preventDefault())},e.prototype.handleSubmenuKeyPress=function(t){27!==t.which&&9!==t.which||(this.buttonPressed_&&this.unpressButton(),9!==t.which&&(t.preventDefault(),this.menuButton_.el_.focus()))},e.prototype.pressButton=function(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),IS_IOS&&isInFrame())return;this.menu.focus()}},e.prototype.unpressButton=function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","false"))},e.prototype.disable=function(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()},e.prototype.enable=function(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()},e}(Component);Component.registerComponent("MenuButton",MenuButton);var TrackButton=function(t){function e(n,r){classCallCheck(this,e);var i=r.tracks,o=possibleConstructorReturn(this,t.call(this,n,r));if(o.items.length<=1&&o.hide(),!i)return possibleConstructorReturn(o);var s=bind(o,o.update);return i.addEventListener("removetrack",s),i.addEventListener("addtrack",s),o.player_.on("ready",s),o.player_.on("dispose",function(){i.removeEventListener("removetrack",s),i.removeEventListener("addtrack",s)}),o}return inherits(e,t),e}(MenuButton);Component.registerComponent("TrackButton",TrackButton);var MenuItem=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.selectable=r.selectable,i.selected(r.selected),i.selectable?i.el_.setAttribute("role","menuitemcheckbox"):i.el_.setAttribute("role","menuitem"),i}return inherits(e,t),e.prototype.createEl=function(e,n,r){return this.nonIconControl=!0,t.prototype.createEl.call(this,"li",assign({className:"vjs-menu-item",innerHTML:'<span class="vjs-menu-item-text">'+this.localize(this.options_.label)+"</span>",tabIndex:-1},n),r)},e.prototype.handleClick=function(t){this.selected(!0)},e.prototype.selected=function(t){this.selectable&&(t?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected")):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText("")))},e}(ClickableComponent);Component.registerComponent("MenuItem",MenuItem);var TextTrackMenuItem=function(t){function e(n,r){classCallCheck(this,e);var i=r.track,o=n.textTracks();r.label=i.label||i.language||"Unknown",r.selected="showing"===i.mode;var s=possibleConstructorReturn(this,t.call(this,n,r));s.track=i;var a=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];s.handleTracksChange.apply(s,e)},l=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];s.handleSelectedLanguageChange.apply(s,e)};if(n.on(["loadstart","texttrackchange"],a),o.addEventListener("change",a),o.addEventListener("selectedlanguagechange",l),s.on("dispose",function(){n.off(["loadstart","texttrackchange"],a),o.removeEventListener("change",a),o.removeEventListener("selectedlanguagechange",l)}),o.onchange===undefined){var c=void 0;s.on(["tap","click"],function(){if("object"!==_typeof(window_1.Event))try{c=new window_1.Event("change")}catch(t){}c||(c=document_1.createEvent("Event"),c.initEvent("change",!0,!0)),o.dispatchEvent(c)})}return s.handleTracksChange(),s}return inherits(e,t),e.prototype.handleClick=function(e){var n=this.track.kind,r=this.track.kinds,i=this.player_.textTracks();if(r||(r=[n]),t.prototype.handleClick.call(this,e),i)for(var o=0;o<i.length;o++){var s=i[o];s===this.track&&r.indexOf(s.kind)>-1?"showing"!==s.mode&&(s.mode="showing"):"disabled"!==s.mode&&(s.mode="disabled")}},e.prototype.handleTracksChange=function(t){this.selected("showing"===this.track.mode)},e.prototype.handleSelectedLanguageChange=function(t){if("showing"===this.track.mode){var e=this.player_.cache_.selectedLanguage;if(e&&e.enabled&&e.language===this.track.language&&e.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}},e.prototype.dispose=function(){this.track=null,t.prototype.dispose.call(this)},e}(MenuItem);Component.registerComponent("TextTrackMenuItem",TextTrackMenuItem);var OffTextTrackMenuItem=function(t){function e(n,r){return classCallCheck(this,e),r.track={player:n,kind:r.kind,kinds:r.kinds,"default":!1,mode:"disabled"},r.kinds||(r.kinds=[r.kind]),r.label?r.track.label=r.label:r.track.label=r.kinds.join(" and ")+" off",r.selectable=!0,possibleConstructorReturn(this,t.call(this,n,r))}return inherits(e,t),e.prototype.handleTracksChange=function(t){for(var e=this.player().textTracks(),n=!0,r=0,i=e.length;r<i;r++){var o=e[r];if(this.options_.kinds.indexOf(o.kind)>-1&&"showing"===o.mode){n=!1;break}}if(this.selected(n),IS_IOS||IS_ANDROID){var s=document.getElementsByClassName("vjs-subs-caps-button"),a=get_1(s,"[0].children[1]");a&&(a.className="vjs-menu")}},e.prototype.handleSelectedLanguageChange=function(t){for(var e=this.player().textTracks(),n=!0,r=0,i=e.length;r<i;r++){var o=e[r];if(["captions","descriptions","subtitles"].indexOf(o.kind)>-1&&"showing"===o.mode){n=!1;break}}n&&(this.player_.cache_.selectedLanguage={enabled:!1})},e}(TextTrackMenuItem);Component.registerComponent("OffTextTrackMenuItem",OffTextTrackMenuItem);var TextTrackButton=function(t){function e(n){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return classCallCheck(this,e),r.tracks=n.textTracks(),possibleConstructorReturn(this,t.call(this,n,r))}return inherits(e,t),e.prototype.createItems=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[],e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:TextTrackMenuItem,n=void 0;this.label_&&(n=this.label_+" off"),t.push(new OffTextTrackMenuItem(this.player_,{kinds:this.kinds_,kind:this.kind_,label:n})),this.hideThreshold_+=1;var r=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var i=0;i<r.length;i++){var o=r[i];if(this.kinds_.indexOf(o.kind)>-1){var s=new e(this.player_,{track:o,selectable:!0});s.addClass("vjs-"+o.kind+"-menu-item"),t.push(s)}}return t},e}(TrackButton);Component.registerComponent("TextTrackButton",TextTrackButton);var ChaptersTrackMenuItem=function(t){function e(n,r){classCallCheck(this,e);var i=r.track,o=r.cue,s=n.currentTime();r.selectable=!0,r.label=o.text,r.selected=o.startTime<=s&&s<o.endTime;var a=possibleConstructorReturn(this,t.call(this,n,r));return a.track=i,a.cue=o,i.addEventListener("cuechange",bind(a,a.update)),a}return inherits(e,t),e.prototype.handleClick=function(e){t.prototype.handleClick.call(this),this.player_.currentTime(this.cue.startTime),this.update(this.cue.startTime)},e.prototype.update=function(t){var e=this.cue,n=this.player_.currentTime();this.selected(e.startTime<=n&&n<e.endTime)},e}(MenuItem);Component.registerComponent("ChaptersTrackMenuItem",ChaptersTrackMenuItem);var ChaptersButton=function(t){function e(n,r,i){return classCallCheck(this,e),possibleConstructorReturn(this,t.call(this,n,r,i))}return inherits(e,t),e.prototype.buildCSSClass=function(){return"vjs-chapters-button "+t.prototype.buildCSSClass.call(this)},e.prototype.buildWrapperCSSClass=function(){return"vjs-chapters-button "+t.prototype.buildWrapperCSSClass.call(this)},e.prototype.update=function(e){this.track_&&(!e||"addtrack"!==e.type&&"removetrack"!==e.type)||this.setTrack(this.findChaptersTrack()),t.prototype.update.call(this)},e.prototype.setTrack=function(t){if(this.track_!==t){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){var e=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);e&&e.removeEventListener("load",this.updateHandler_),this.track_=null}if(this.track_=t,this.track_){this.track_.mode="hidden";var n=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);n&&n.addEventListener("load",this.updateHandler_)}}},e.prototype.findChaptersTrack=function(){for(var t=this.player_.textTracks()||[],e=t.length-1;e>=0;e--){var n=t[e];if(n.kind===this.kind_)return n}},e.prototype.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(toTitleCase(this.kind_))},e.prototype.createMenu=function(){return this.options_.title=this.getMenuCaption(),t.prototype.createMenu.call(this)},e.prototype.createItems=function(){var t=[];if(!this.track_)return t;var e=this.track_.cues;if(!e)return t;for(var n=0,r=e.length;n<r;n++){var i=e[n],o=new ChaptersTrackMenuItem(this.player_,{track:this.track_,cue:i});t.push(o)}return t},e}(TextTrackButton);ChaptersButton.prototype.kind_="chapters",ChaptersButton.prototype.controlText_="Chapters",Component.registerComponent("ChaptersButton",ChaptersButton);var DescriptionsButton=function(t){function e(n,r,i){classCallCheck(this,e);var o=possibleConstructorReturn(this,t.call(this,n,r,i)),s=n.textTracks(),a=bind(o,o.handleTracksChange);return s.addEventListener("change",a),o.on("dispose",function(){s.removeEventListener("change",a)}),o}return inherits(e,t),e.prototype.handleTracksChange=function(t){for(var e=this.player().textTracks(),n=!1,r=0,i=e.length;r<i;r++){var o=e[r];if(o.kind!==this.kind_&&"showing"===o.mode){n=!0;break}}n?this.disable():this.enable()},e.prototype.buildCSSClass=function(){return"vjs-descriptions-button "+t.prototype.buildCSSClass.call(this)},e.prototype.buildWrapperCSSClass=function(){return"vjs-descriptions-button "+t.prototype.buildWrapperCSSClass.call(this)},e}(TextTrackButton);DescriptionsButton.prototype.kind_="descriptions",DescriptionsButton.prototype.controlText_="Descriptions",Component.registerComponent("DescriptionsButton",DescriptionsButton);var SubtitlesButton=function(t){function e(n,r,i){return classCallCheck(this,e),possibleConstructorReturn(this,t.call(this,n,r,i))}return inherits(e,t),e.prototype.buildCSSClass=function(){return"vjs-subtitles-button "+t.prototype.buildCSSClass.call(this)},e.prototype.buildWrapperCSSClass=function(){return"vjs-subtitles-button "+t.prototype.buildWrapperCSSClass.call(this)},e}(TextTrackButton);SubtitlesButton.prototype.kind_="subtitles",SubtitlesButton.prototype.controlText_="Subtitles",Component.registerComponent("SubtitlesButton",SubtitlesButton);var CaptionSettingsMenuItem=function(t){function e(n,r){classCallCheck(this,e),r.track={player:n,kind:r.kind,label:r.kind+" settings",selectable:!1,"default":!1,mode:"disabled"},r.selectable=!1,r.name="CaptionSettingsMenuItem";var i=possibleConstructorReturn(this,t.call(this,n,r));return i.addClass("vjs-texttrack-settings"),i.controlText(", opens "+r.kind+" settings dialog"),i}return inherits(e,t),e.prototype.handleClick=function(t){this.player().getChild("textTrackSettings").open()},e}(TextTrackMenuItem);Component.registerComponent("CaptionSettingsMenuItem",CaptionSettingsMenuItem);var CaptionsButton=function(t){function e(n,r,i){return classCallCheck(this,e),possibleConstructorReturn(this,t.call(this,n,r,i))}return inherits(e,t),e.prototype.buildCSSClass=function(){return"vjs-captions-button "+t.prototype.buildCSSClass.call(this)},e.prototype.buildWrapperCSSClass=function(){return"vjs-captions-button "+t.prototype.buildWrapperCSSClass.call(this)},e.prototype.createItems=function(){var e=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||(e.push(new CaptionSettingsMenuItem(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),t.prototype.createItems.call(this,e)},e}(TextTrackButton);CaptionsButton.prototype.kind_="captions",CaptionsButton.prototype.controlText_="Captions",Component.registerComponent("CaptionsButton",CaptionsButton);var SubsCapsMenuItem=function(t){function e(){return classCallCheck(this,e),possibleConstructorReturn(this,t.apply(this,arguments))}return inherits(e,t),e.prototype.createEl=function(e,n,r){var i='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);return"captions"===this.options_.track.kind&&(i+='\n <span aria-hidden="true" class="vjs-icon-placeholder"></span>\n <span class="vjs-control-text"> '+this.localize("Captions")+"</span>\n "),i+="</span>",t.prototype.createEl.call(this,e,assign({innerHTML:i},n),r)},e}(TextTrackMenuItem);Component.registerComponent("SubsCapsMenuItem",SubsCapsMenuItem);var SubsCapsButton=function(t){function e(n){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.label_="subtitles",["en","en-us","en-ca","fr-ca"].indexOf(i.player_.language_)>-1&&(i.label_="captions"),i.menuButton_.controlText(toTitleCase(i.label_)),i}return inherits(e,t),e.prototype.buildCSSClass=function(){return"vjs-subs-caps-button "+t.prototype.buildCSSClass.call(this)},e.prototype.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+t.prototype.buildWrapperCSSClass.call(this)},e.prototype.createItems=function(){var e=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||IS_IOS||IS_ANDROID||(e.push(new CaptionSettingsMenuItem(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=t.prototype.createItems.call(this,e,SubsCapsMenuItem)},e}(TextTrackButton);SubsCapsButton.prototype.kinds_=["captions","subtitles"],SubsCapsButton.prototype.controlText_="Subtitles",Component.registerComponent("SubsCapsButton",SubsCapsButton);var AudioTrackMenuItem=function(t){function e(n,r){classCallCheck(this,e);var i=r.track,o=n.audioTracks();r.label=i.label||i.language||"Unknown",r.selected=i.enabled;var s=possibleConstructorReturn(this,t.call(this,n,r));s.track=i;var a=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];s.handleTracksChange.apply(s,e)};return s.changeHandler=a,o.addEventListener("change",a),o.addEventListener("enabledchange",a),s.on("dispose",function(){o.removeEventListener("change",a),o.removeEventListener("enabledchange",a)}),s}return inherits(e,t),e.prototype.handleClick=function(e){var n=this.player_.audioTracks();t.prototype.handleClick.call(this,e),this.player_.tech_.hlsProvider.hls.audioTrack=this.track.id;for(var r=0;r<n.length;r++){var i=n[r];i.enabled=i===this.track}},e.prototype.handleTracksChange=function(t){this.selected(this.track.enabled)},e}(MenuItem);Component.registerComponent("AudioTrackMenuItem",AudioTrackMenuItem);var AudioTrackButton=function(t){function e(n){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return classCallCheck(this,e),r.tracks=n.audioTracks(),possibleConstructorReturn(this,t.call(this,n,r))}return inherits(e,t),e.prototype.buildCSSClass=function(){return"vjs-audio-button "+t.prototype.buildCSSClass.call(this)},e.prototype.buildWrapperCSSClass=function(){return"vjs-audio-button "+t.prototype.buildWrapperCSSClass.call(this)},e.prototype.createItems=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];this.hideThreshold_=1;for(var e=this.player_.audioTracks(),n=0;n<e.length;n++){var r=e[n];t.push(new AudioTrackMenuItem(this.player_,{track:r,selectable:!0}))}return t},e}(TrackButton);AudioTrackButton.prototype.controlText_="Audio Track",Component.registerComponent("AudioTrackButton",AudioTrackButton);var PlaybackRateMenuItem=function(t){function e(n,r){classCallCheck(this,e);var i=r.rate,o=parseFloat(i,10);r.label=i,r.selected=1===o,r.selectable=!0;var s=possibleConstructorReturn(this,t.call(this,n,r));return s.label=i,s.rate=o,s.on(n,"ratechange",s.update),s}return inherits(e,t),e.prototype.handleClick=function(e){t.prototype.handleClick.call(this),this.player().playbackRate(this.rate)},e.prototype.update=function(t){this.selected(this.player().playbackRate()===this.rate)},e}(MenuItem);PlaybackRateMenuItem.prototype.contentElType="button",Component.registerComponent("PlaybackRateMenuItem",PlaybackRateMenuItem);var PlaybackRateMenuButton=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.updateVisibility(),i.updateLabel(),i.on(n,"loadstart",i.updateVisibility),i.on(n,"ratechange",i.updateLabel),i}return inherits(e,t),e.prototype.createEl=function(){var e=t.prototype.createEl.call(this);return this.labelEl_=createEl("div",{className:"vjs-playback-rate-value",innerHTML:"1x"}),e.appendChild(this.labelEl_),e},e.prototype.dispose=function(){this.labelEl_=null,t.prototype.dispose.call(this)},e.prototype.buildCSSClass=function(){return"vjs-playback-rate "+t.prototype.buildCSSClass.call(this)},e.prototype.buildWrapperCSSClass=function(){return"vjs-playback-rate "+t.prototype.buildWrapperCSSClass.call(this)},e.prototype.createMenu=function(){var t=new Menu(this.player()),e=this.playbackRates()
13
13
  ;if(e)for(var n=e.length-1;n>=0;n--)t.addChild(new PlaybackRateMenuItem(this.player(),{rate:e[n]+"x"}));return t},e.prototype.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},e.prototype.handleClick=function(t){for(var e=this.player().playbackRate(),n=this.playbackRates(),r=n[0],i=0;i<n.length;i++)if(n[i]>e){r=n[i];break}this.player().playbackRate(r)},e.prototype.playbackRates=function(){return this.options_.playbackRates||this.options_.playerOptions&&this.options_.playerOptions.playbackRates},e.prototype.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0},e.prototype.updateVisibility=function(t){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},e.prototype.updateLabel=function(t){var e=this.player().playbackRate();if(1.1===e)return!1;this.playbackRateSupported()&&(this.labelEl_.innerHTML=e+"x")},e}(MenuButton);PlaybackRateMenuButton.prototype.controlText_="Playback Rate",Component.registerComponent("PlaybackRateMenuButton",PlaybackRateMenuButton);var Spacer=function(t){function e(){return classCallCheck(this,e),possibleConstructorReturn(this,t.apply(this,arguments))}return inherits(e,t),e.prototype.buildCSSClass=function(){return"vjs-spacer "+t.prototype.buildCSSClass.call(this)},e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:this.buildCSSClass()})},e}(Component);Component.registerComponent("Spacer",Spacer);var CustomControlSpacer=function(t){function e(){return classCallCheck(this,e),possibleConstructorReturn(this,t.apply(this,arguments))}return inherits(e,t),e.prototype.buildCSSClass=function(){return"vjs-custom-control-spacer "+t.prototype.buildCSSClass.call(this)},e.prototype.createEl=function(){var e=t.prototype.createEl.call(this,{className:this.buildCSSClass()});return e.innerHTML=" ",e},e}(Spacer);Component.registerComponent("CustomControlSpacer",CustomControlSpacer);var ControlBar=function(t){function e(){return classCallCheck(this,e),possibleConstructorReturn(this,t.apply(this,arguments))}return inherits(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"},{role:"group"})},e}(Component);ControlBar.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","PDTDisplay","progressControl","liveDisplay","remainingTimeDisplay","customControlSpacer","dvrButton","playbackRateMenuButton","chaptersButton","descriptionsButton","audioTrackButton","subsCapsButton","fullscreenToggle"]},Component.registerComponent("ControlBar",ControlBar);var ErrorDisplay=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.on(n,"error",i.open),i}return inherits(e,t),e.prototype.buildCSSClass=function(){return"vjs-error-display "+t.prototype.buildCSSClass.call(this)},e.prototype.content=function(){var t=this.player().error();return t?this.localize(t.message):""},e}(ModalDialog);ErrorDisplay.prototype.options_=mergeOptions(ModalDialog.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),Component.registerComponent("ErrorDisplay",ErrorDisplay);var LOCAL_STORAGE_KEY="vjs-text-track-settings",COLOR_BLACK=["#000","Black"],COLOR_BLUE=["#00F","Blue"],COLOR_CYAN=["#0FF","Cyan"],COLOR_GREEN=["#0F0","Green"],COLOR_MAGENTA=["#F0F","Magenta"],COLOR_RED=["#F00","Red"],COLOR_WHITE=["#FFF","White"],COLOR_YELLOW=["#FF0","Yellow"],OPACITY_OPAQUE=["1","Opaque"],OPACITY_SEMI=["0.5","Semi-Transparent"],OPACITY_TRANS=["0","Transparent"],selectConfigs={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[COLOR_BLACK,COLOR_WHITE,COLOR_RED,COLOR_GREEN,COLOR_BLUE,COLOR_YELLOW,COLOR_MAGENTA,COLOR_CYAN]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[OPACITY_SEMI,OPACITY_OPAQUE,OPACITY_TRANS]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[COLOR_WHITE,COLOR_BLACK,COLOR_RED,COLOR_GREEN,COLOR_BLUE,COLOR_YELLOW,COLOR_MAGENTA,COLOR_CYAN]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],"default":2,parser:function(t){return"1.00"===t?null:Number(t)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[OPACITY_OPAQUE,OPACITY_SEMI]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Transparency",options:[OPACITY_TRANS,OPACITY_SEMI,OPACITY_OPAQUE]}};selectConfigs.windowColor.options=selectConfigs.backgroundColor.options;var TextTrackSettings=function(t){function e(n,r){classCallCheck(this,e),r.temporary=!1;var i=possibleConstructorReturn(this,t.call(this,n,r));return i.updateDisplay=bind(i,i.updateDisplay),i.fill(),i.hasBeenOpened_=i.hasBeenFilled_=!0,i.endDialog=createEl("p",{className:"vjs-control-text",textContent:i.localize("End of dialog window.")}),i.el().appendChild(i.endDialog),i.setDefaults(),r.persistTextTrackSettings===undefined&&(i.options_.persistTextTrackSettings=i.options_.playerOptions.persistTextTrackSettings),i.on(i.$(".vjs-done-button"),"click",function(){i.saveSettings(),i.close()}),i.on(i.$(".vjs-default-button"),"click",function(){i.setDefaults(),i.updateDisplay()}),each(selectConfigs,function(t){i.on(i.$(t.selector),"change",i.updateDisplay)}),i.options_.persistTextTrackSettings&&i.restoreSettings(),i}return inherits(e,t),e.prototype.dispose=function(){this.endDialog=null,t.prototype.dispose.call(this)},e.prototype.createElSelect_=function(t){var e=this,n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"",r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"label",i=selectConfigs[t],o=i.id.replace("%s",this.id_);return["<"+r+' id="'+o+'" class="'+("label"===r?"vjs-label":"")+'">',this.localize(i.label),"</"+r+">",'<select aria-labelledby="'+(""!==n?n+" ":"")+o+'">'].concat(i.options.map(function(t){var r=o+"-"+t[1];return['<option id="'+r+'" value="'+t[0]+'" ','aria-labelledby="'+(""!==n?n+" ":"")+o+" "+r+'">',e.localize(t[1]),"</option>"].join("")})).concat("</select>").join("")},e.prototype.createElFgColor_=function(){var t="captions-text-legend-"+this.id_;return['<fieldset class="vjs-fg-color vjs-track-setting">','<legend id="'+t+'">',this.localize("Text"),"</legend>",this.createElSelect_("color",t),'<span class="vjs-text-opacity vjs-opacity">',this.createElSelect_("textOpacity",t),"</span>","</fieldset>"].join("")},e.prototype.createElBgColor_=function(){var t="captions-background-"+this.id_;return['<fieldset class="vjs-bg-color vjs-track-setting">','<legend id="'+t+'">',this.localize("Background"),"</legend>",this.createElSelect_("backgroundColor",t),'<span class="vjs-bg-opacity vjs-opacity">',this.createElSelect_("backgroundOpacity",t),"</span>","</fieldset>"].join("")},e.prototype.createElWinColor_=function(){var t="captions-window-"+this.id_;return['<fieldset class="vjs-window-color vjs-track-setting">','<legend id="'+t+'">',this.localize("Window"),"</legend>",this.createElSelect_("windowColor",t),'<span class="vjs-window-opacity vjs-opacity">',this.createElSelect_("windowOpacity",t),"</span>","</fieldset>"].join("")},e.prototype.createElColors_=function(){return createEl("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},e.prototype.createElFont_=function(){return createEl("div",{className:'vjs-track-settings-font">',innerHTML:['<fieldset class="vjs-font-percent vjs-track-setting">',this.createElSelect_("fontPercent","","legend"),"</fieldset>",'<fieldset class="vjs-edge-style vjs-track-setting">',this.createElSelect_("edgeStyle","","legend"),"</fieldset>",'<fieldset class="vjs-font-family vjs-track-setting">',this.createElSelect_("fontFamily","","legend"),"</fieldset>"].join("")})},e.prototype.createElControls_=function(){var t=this.localize("restore all settings to the default values");return createEl("div",{className:"vjs-track-settings-controls",innerHTML:['<button class="vjs-default-button" title="'+t+'">',this.localize("Reset"),'<span class="vjs-control-text"> '+t+"</span>","</button>",'<button class="vjs-done-button">'+this.localize("Done")+"</button>"].join("")})},e.prototype.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},e.prototype.label=function(){return this.localize("Caption Settings Dialog")},e.prototype.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},e.prototype.buildCSSClass=function(){return t.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},e.prototype.getValues=function(){var t=this;return reduce(selectConfigs,function(e,n,r){var i=getSelectedOptionValue(t.$(n.selector),n.parser);return i!==undefined&&(e[r]=i),e},{})},e.prototype.setValues=function(t){var e=this;each(selectConfigs,function(n,r){setSelectedOption(e.$(n.selector),t[r],n.parser)})},e.prototype.setDefaults=function(){var t=this;each(selectConfigs,function(e){var n=e.hasOwnProperty("default")?e["default"]:0;t.$(e.selector).selectedIndex=n})},e.prototype.restoreSettings=function(){var t=void 0;try{t=JSON.parse(window_1.localStorage.getItem(LOCAL_STORAGE_KEY))}catch(e){log$2.warn(e)}t&&this.setValues(t)},e.prototype.saveSettings=function(){if(this.options_.persistTextTrackSettings){var t=this.getValues();try{Object.keys(t).length?window_1.localStorage.setItem(LOCAL_STORAGE_KEY,JSON.stringify(t)):window_1.localStorage.removeItem(LOCAL_STORAGE_KEY)}catch(e){log$2.warn(e)}}},e.prototype.updateDisplay=function(){var t=this.player_.getChild("textTrackDisplay");t&&t.updateDisplay()},e.prototype.conditionalBlur_=function(){this.previouslyActiveEl_=null,this.off(document_1,"keydown",this.handleKeyDown);var t=this.player_.controlBar,e=t&&t.subsCapsButton,n=t&&t.captionsButton;e?e.focus():n&&n.focus()},e}(ModalDialog);Component.registerComponent("TextTrackSettings",TextTrackSettings);var _templateObject$2=taggedTemplateLiteralLoose(["Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\n This may prevent text tracks from loading."],["Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\n This may prevent text tracks from loading."]),Html5=function(t){function e(n,r,i){classCallCheck(this,e);var o=possibleConstructorReturn(this,t.call(this,n,r,i)),s=r.source,a=!1;if(s&&(o.el_.currentSrc!==s.src||r.tag&&3===r.tag.initNetworkState_)?o.setSource(s):o.handleLateInit_(o.el_),o.el_.hasChildNodes()){for(var l=o.el_.childNodes,c=l.length,u=[];c--;){var h=l[c];"track"===h.nodeName.toLowerCase()&&(o.featuresNativeTextTracks?(o.remoteTextTrackEls().addTrackElement_(h),o.remoteTextTracks().addTrack(h.track),o.textTracks().addTrack(h.track),a||o.el_.hasAttribute("crossorigin")||!isCrossOrigin(h.src)||(a=!0)):u.push(h))}for(var p=0;p<u.length;p++)o.el_.removeChild(u[p])}return o.proxyNativeTracks_(),o.featuresNativeTextTracks&&a&&log$2.warn(tsml(_templateObject$2)),o.restoreMetadataTracksInIOSNativePlayer_(),(TOUCH_ENABLED||IS_IPHONE||IS_NATIVE_ANDROID)&&!0===r.nativeControlsForTouch&&o.setControls(!0),o.proxyWebkitFullscreen_(),o.triggerReady(),o}return inherits(e,t),e.prototype.dispose=function(){e.disposeMediaElement(this.el_),this.options_=null,t.prototype.dispose.call(this)},e.prototype.restoreMetadataTracksInIOSNativePlayer_=function(){var t=this.textTracks(),e=void 0,n=function(){e=[];for(var n=0;n<t.length;n++){var r=t[n];"metadata"===r.kind&&e.push({track:r,storedMode:r.mode})}};n(),t.addEventListener("change",n),this.on("dispose",function(){return t.removeEventListener("change",n)});var r=function i(){for(var n=0;n<e.length;n++){var r=e[n];"disabled"===r.track.mode&&r.track.mode!==r.storedMode&&(r.track.mode=r.storedMode)}t.removeEventListener("change",i)};this.on("webkitbeginfullscreen",function(){t.removeEventListener("change",n),t.removeEventListener("change",r),t.addEventListener("change",r)}),this.on("webkitendfullscreen",function(){t.removeEventListener("change",n),t.addEventListener("change",n),t.removeEventListener("change",r)})},e.prototype.proxyNativeTracks_=function(){var t=this;NORMAL.names.forEach(function(e){var n=NORMAL[e],r=t.el()[n.getterName],i=t[n.getterName]();if(t["featuresNative"+n.capitalName+"Tracks"]&&r&&r.addEventListener){var o={change:function(t){i.trigger({type:"change",target:i,currentTarget:i,srcElement:i})},addtrack:function(t){i.addTrack(t.track)},removetrack:function(t){i.removeTrack(t.track)}},s=function(){for(var t=[],e=0;e<i.length;e++){for(var n=!1,o=0;o<r.length;o++)if(r[o]===i[e]){n=!0;break}n||t.push(i[e])}for(;t.length;)i.removeTrack(t.shift())};Object.keys(o).forEach(function(e){var n=o[e];r.addEventListener(e,n),t.on("dispose",function(t){return r.removeEventListener(e,n)})}),t.on("loadstart",s),t.on("dispose",function(e){return t.off("loadstart",s)})}})},e.prototype.createEl=function(){var t=this.options_.tag;if(!t||!this.options_.playerElIngest&&!this.movingMediaElementInDOM){if(t){var n=t.cloneNode(!0);t.parentNode&&t.parentNode.insertBefore(n,t),e.disposeMediaElement(t),t=n}else{t=document_1.createElement("video");var r=this.options_.tag&&getAttributes(this.options_.tag),i=mergeOptions({},r);TOUCH_ENABLED&&!0===this.options_.nativeControlsForTouch||delete i.controls,setAttributes(t,assign(i,{id:this.options_.techId,"class":"vjs-tech"}))}t.playerId=this.options_.playerId}"undefined"!=typeof this.options_.preload&&setAttribute(t,"preload",this.options_.preload);for(var o=["loop","muted","playsinline","autoplay"],s=0;s<o.length;s++){var a=o[s],l=this.options_[a];void 0!==l&&(l?setAttribute(t,a,a):removeAttribute(t,a),t[a]=l)}return t},e.prototype.handleLateInit_=function(t){if(0!==t.networkState&&3!==t.networkState){if(0===t.readyState){var e=!1,n=function(){e=!0};this.on("loadstart",n);var r=function(){e||this.trigger("loadstart")};return this.on("loadedmetadata",r),void this.ready(function(){this.off("loadstart",n),this.off("loadedmetadata",r),e||this.trigger("loadstart")})}var i=["loadstart"];i.push("loadedmetadata"),t.readyState>=2&&i.push("loadeddata"),t.readyState>=3&&i.push("canplay"),t.readyState>=4&&i.push("canplaythrough"),this.ready(function(){i.forEach(function(t){this.trigger(t)},this)})}},e.prototype.setCurrentTime=function(t){try{this.el_.currentTime=t}catch(e){log$2(e,"Video is not ready. (Video.js)")}},e.prototype.duration=function(){var t=this;if(this.el_.duration===Infinity&&IS_ANDROID&&IS_CHROME&&0===this.el_.currentTime){var e=function n(){t.el_.currentTime>0&&(t.el_.duration===Infinity&&t.trigger("durationchange"),t.off("timeupdate",n))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN},e.prototype.width=function(){return this.el_.offsetWidth},e.prototype.height=function(){return this.el_.offsetHeight},e.prototype.proxyWebkitFullscreen_=function(){var t=this;if("webkitDisplayingFullscreen"in this.el_){var e=function(){this.trigger("fullscreenchange",{isFullscreen:!1})},n=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0}))};this.on("webkitbeginfullscreen",n),this.on("dispose",function(){t.off("webkitbeginfullscreen",n),t.off("webkitendfullscreen",e)})}},e.prototype.supportsFullScreen=function(){if("function"==typeof this.el_.webkitEnterFullScreen){var t=window_1.navigator&&window_1.navigator.userAgent||"";if(/Android/.test(t)||!/Chrome|Mac OS X 10.5/.test(t))return!0}return!1},e.prototype.enterFullScreen=function(){var t=this.el_;t.paused&&t.networkState<=t.HAVE_METADATA?(this.el_.play(),this.setTimeout(function(){t.pause(),t.webkitEnterFullScreen()},0)):t.webkitEnterFullScreen()},e.prototype.exitFullScreen=function(){this.el_.webkitExitFullScreen()},e.prototype.src=function(t){if(t===undefined)return this.el_.src;this.setSrc(t)},e.prototype.reset=function(){e.resetMediaElement(this.el_)},e.prototype.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},e.prototype.setControls=function(t){this.el_.controls=!!t},e.prototype.addTextTrack=function(e,n,r){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,n,r):t.prototype.addTextTrack.call(this,e,n,r)},e.prototype.createRemoteTextTrack=function(e){if(!this.featuresNativeTextTracks)return t.prototype.createRemoteTextTrack.call(this,e);var n=document_1.createElement("track");return e.kind&&(n.kind=e.kind),e.label&&(n.label=e.label),(e.language||e.srclang)&&(n.srclang=e.language||e.srclang),e["default"]&&(n["default"]=e["default"]),e.id&&(n.id=e.id),e.src&&(n.src=e.src),n},e.prototype.addRemoteTextTrack=function(e,n){var r=t.prototype.addRemoteTextTrack.call(this,e,n);return this.featuresNativeTextTracks&&this.el().appendChild(r),r},e.prototype.removeRemoteTextTrack=function(e){if(t.prototype.removeRemoteTextTrack.call(this,e),this.featuresNativeTextTracks)for(var n=this.$$("track"),r=n.length;r--;)e!==n[r]&&e!==n[r].track||this.el().removeChild(n[r])},e.prototype.getVideoPlaybackQuality=function(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var t={};return"undefined"!=typeof this.el().webkitDroppedFrameCount&&"undefined"!=typeof this.el().webkitDecodedFrameCount&&(t.droppedVideoFrames=this.el().webkitDroppedFrameCount,t.totalVideoFrames=this.el().webkitDecodedFrameCount),window_1.performance&&"function"==typeof window_1.performance.now?t.creationTime=window_1.performance.now():window_1.performance&&window_1.performance.timing&&"number"==typeof window_1.performance.timing.navigationStart&&(t.creationTime=window_1.Date.now()-window_1.performance.timing.navigationStart),t},e}(Tech);if(isReal()){Html5.TEST_VID=document_1.createElement("video");var track=document_1.createElement("track");track.kind="captions",track.srclang="en",track.label="English",Html5.TEST_VID.appendChild(track)}Html5.isSupported=function(){try{Html5.TEST_VID.volume=.5}catch(t){return!1}return!(!Html5.TEST_VID||!Html5.TEST_VID.canPlayType)},Html5.canPlayType=function(t){return Html5.TEST_VID.canPlayType(t)},Html5.canPlaySource=function(t,e){return Html5.canPlayType(t.type)},Html5.canControlVolume=function(){try{var t=Html5.TEST_VID.volume;return Html5.TEST_VID.volume=t/2+.1,t!==Html5.TEST_VID.volume}catch(e){return!1}},Html5.canControlMute=function(){try{var t=Html5.TEST_VID.muted;return Html5.TEST_VID.muted=!0,t!==Html5.TEST_VID.muted}catch(e){return!1}},Html5.canControlPlaybackRate=function(){if(IS_ANDROID&&IS_CHROME&&CHROME_VERSION<58)return!1;try{var t=Html5.TEST_VID.playbackRate;return Html5.TEST_VID.playbackRate=t/2+.1,t!==Html5.TEST_VID.playbackRate}catch(e){return!1}},Html5.supportsNativeTextTracks=function(){return IS_ANY_SAFARI},Html5.supportsNativeVideoTracks=function(){return!(!Html5.TEST_VID||!Html5.TEST_VID.videoTracks)},Html5.supportsNativeAudioTracks=function(){return!(!Html5.TEST_VID||!Html5.TEST_VID.audioTracks)},Html5.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],Html5.prototype.featuresVolumeControl=Html5.canControlVolume(),Html5.prototype.featuresMuteControl=Html5.canControlMute(),Html5.prototype.featuresPlaybackRate=Html5.canControlPlaybackRate(),Html5.prototype.movingMediaElementInDOM=!IS_IOS,Html5.prototype.featuresFullscreenResize=!0,Html5.prototype.featuresProgressEvents=!0,Html5.prototype.featuresTimeupdateEvents=!0,Html5.prototype.featuresNativeTextTracks=Html5.supportsNativeTextTracks(),Html5.prototype.featuresNativeVideoTracks=Html5.supportsNativeVideoTracks(),Html5.prototype.featuresNativeAudioTracks=Html5.supportsNativeAudioTracks();var canPlayType=Html5.TEST_VID&&Html5.TEST_VID.constructor.prototype.canPlayType,mpegurlRE=/^application\/(?:x-|vnd\.apple\.)mpegurl/i,mp4RE=/^video\/mp4/i;Html5.patchCanPlayType=function(){ANDROID_VERSION>=4&&!IS_FIREFOX?Html5.TEST_VID.constructor.prototype.canPlayType=function(t){return t&&mpegurlRE.test(t)?"maybe":canPlayType.call(this,t)}:IS_OLD_ANDROID&&(Html5.TEST_VID.constructor.prototype.canPlayType=function(t){return t&&mp4RE.test(t)?"maybe":canPlayType.call(this,t)})},Html5.unpatchCanPlayType=function(){var t=Html5.TEST_VID.constructor.prototype.canPlayType;return Html5.TEST_VID.constructor.prototype.canPlayType=canPlayType,t},Html5.patchCanPlayType(),Html5.disposeMediaElement=function(t){if(t){for(t.parentNode&&t.parentNode.removeChild(t);t.hasChildNodes();)t.removeChild(t.firstChild);t.removeAttribute("src"),"function"==typeof t.load&&function(){try{t.load()}catch(e){}}()}},Html5.resetMediaElement=function(t){if(t){for(var e=t.querySelectorAll("source"),n=e.length;n--;)t.removeChild(e[n]);t.removeAttribute("src"),"function"==typeof t.load&&function(){try{t.load()}catch(e){}}()}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(t){Html5.prototype[t]=function(){return this.el_[t]||this.el_.hasAttribute(t)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(t){Html5.prototype["set"+toTitleCase(t)]=function(e){this.el_[t]=e,e?this.el_.setAttribute(t,t):this.el_.removeAttribute(t)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","played","networkState","readyState","videoWidth","videoHeight"].forEach(function(t){Html5.prototype[t]=function(){return this.el_[t]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate"].forEach(function(t){Html5.prototype["set"+toTitleCase(t)]=function(e){"src"===t&&this.player_&&this.player_.trigger&&this.player_.trigger({type:"debug",data:{message:"debug === 播放地址直传 video: "+e}}),this.el_[t]=e}}),["pause","load","play"].forEach(function(t){Html5.prototype[t]=function(){return this.el_[t]()}}),Tech.withSourceHandlers(Html5),Html5.nativeSourceHandler={},Html5.nativeSourceHandler.canPlayType=function(t){setTimeout(function(){},2e3);try{return"video/m3u8"===t?"maybe":Html5.TEST_VID.canPlayType(t)}catch(e){return""}},Html5.nativeSourceHandler.canHandleSource=function(t,e){if(t.type)return Html5.nativeSourceHandler.canPlayType(t.type);if(t.src){var n=getFileExtension(t.src);return Html5.nativeSourceHandler.canPlayType("video/"+n)}return""},Html5.nativeSourceHandler.handleSource=function(t,e,n){e.setSrc(t.src)},Html5.nativeSourceHandler.dispose=function(){},Html5.registerSourceHandler(Html5.nativeSourceHandler),Tech.registerTech("Html5",Html5);var _templateObject$1=taggedTemplateLiteralLoose(["\n Using the tech directly can be dangerous. I hope you know what you're doing.\n See https://github.com/videojs/video.js/issues/2617 for more info.\n "],["\n Using the tech directly can be dangerous. I hope you know what you're doing.\n See https://github.com/videojs/video.js/issues/2617 for more info.\n "]),preventScroll=function(t){t.preventDefault()},TECH_EVENTS_RETRIGGER=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","ratechange","resize","volumechange","texttrackchange"],Player=function(t){function e(n,r,i){if(classCallCheck(this,e),n.id=n.id||"vjs_video_"+newGUID(),r=assign(e.getTagSettings(n),r),r.initChildren=!1,r.createEl=!1,r.evented=!1,r.reportTouchActivity=!1,!r.language)if("function"==typeof n.closest){var o=n.closest("[lang]");o&&o.getAttribute&&(r.language=o.getAttribute("lang"))}else for(var s=n;s&&1===s.nodeType;){if(getAttributes(s).hasOwnProperty("lang")){r.language=s.getAttribute("lang");break}s=s.parentNode}var a=possibleConstructorReturn(this,t.call(this,null,r,i));if(a.isReady_=!1,a.hasStarted_=!1,a.userActive_=!1,!a.options_||!a.options_.techOrder||!a.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(a.tag=n,a.tagAttributes=n&&getAttributes(n),a.language(a.options_.language),r.languages){var l={};Object.getOwnPropertyNames(r.languages).forEach(function(t){l[t.toLowerCase()]=r.languages[t]}),a.languages_=l}else a.languages_=e.prototype.options_.languages;a.cache_={},a.poster_=r.poster||"",a.controls_=!!r.controls,a.cache_.lastVolume=1,n.controls=!1,n.removeAttribute("controls"),r.controlBar&&r.controlBar.fullscreenRotate&&(a.conW=window_1.innerWidth||document_1.documentElement.clientWidth||document_1.body.clientWidth,a.conH=window_1.innerHeight||document_1.documentElement.clientHeight||document_1.body.clientHeight,a.currentDirection="portrait",a.lastDirection="portrait",a.recordDirection()),a.scrubbing_=!1,a.textTrackCleared_=!1,a.el_=a.createEl(),evented(a,{eventBusKey:"el_"});var c=mergeOptions(a.options_);if(r.plugins){var u=r.plugins,h=new Enc;a.enc=h,h.initPlugins(u,videojs,a)}return a.options_.playerOptions=c,a.middleware_=[],a.initChildren(),a.isAudio("audio"===n.nodeName.toLowerCase()),a.controls()?a.addClass("vjs-controls-enabled"):a.addClass("vjs-controls-disabled"),a.el_.setAttribute("role","region"),a.isAudio()?a.el_.setAttribute("aria-label",a.localize("Audio Player")):a.el_.setAttribute("aria-label",a.localize("Video Player")),a.isAudio()&&a.addClass("vjs-audio"),a.flexNotSupported_()&&a.addClass("vjs-no-flex"),IS_IOS||IS_ANDROID||a.addClass("vjs-workinghover"),e.players[a.id_]=a,a.userActive(!0),a.reportUserActivity(),a.listenForUserActivity_(),a.on("fullscreenchange",a.handleFullscreenChange_),a.on("stageclick",a.handleStageClick_),a.changingSrc_=!1,a.playWaitingForReady_=!1,a.playOnLoadstart_=null,a.forceAutoplayInChrome_(),a}return inherits(e,t),e.prototype.recordDirection=function(){var t=this,e=this;this.currentDirection="portrait",this.lastDirection="portrait";var n="onorientationchange"in window_1?"orientationchange":"resize";window_1.addEventListener(n,function(){0==window_1.orientation||180==window_1.orientation?(e.lastDirection=e.currentDirection.slice(),e.currentDirection="portrait"):(e.lastDirection=e.currentDirection.slice(),e.currentDirection="landscape"),t.screenRotated&&("portrait"===e.lastDirection&&"landscape"===t.currentDirection&&e.landscapeForOrientation(),"landscape"===e.lastDirection&&"portrait"===t.currentDirection&&e.portrait(!0)),t.screenRotated||("portrait"===e.lastDirection&&"landscape"===t.currentDirection&&e.landscapeForOrientation(),"landscape"===e.lastDirection&&"portrait"===t.currentDirection&&e.portrait(!0)),e.trigger("directionchanged")},!1)},e.prototype.requestRotatescreen=function(){var t=this;return t.screenRotated?(t.exitRotatescreen(),!1):"landscape"!==t.currentDirection||t.screenRotated?(t.el_.style.width="100vw",t.el_.style.height="100%",t.el_.style.position="fixed",t.el_.style.zIndex="999",t.el_.style.top="0",document_1.body.style.overflowY="hidden",document_1.addEventListener("touchmove",preventScroll,{passive:!1}),void t.landscape()):(t.portrait(),!1)},e.prototype.portrait=function(){var t=this;t.screenRotated=!1,t.el_.removeAttribute("style")},e.prototype.landscapeForOrientation=function(){var t=this;t.portrait(),setTimeout(function(){var e=window_1.innerHeight||document_1.documentElement.clientHeight||document_1.body.clientHeight;t.el_.style.transform="rotate(0deg)",t.el_.style.width="100vw",t.el_.style.height=e+"px",t.el_.style["transform-origin"]="center center",t.el_.style["-webkit-transform-origin"]="center center"},150)},e.prototype.landscape=function(){var t=this;t.screenRotated=!0,t.el_.style.transform="rotate(90deg) translate("+(t.conH-t.conW)/2+"px,"+(t.conH-t.conW)/2+"px)",t.el_.style.width=t.conH+"px",t.el_.style.height=t.conW+"px",t.el_.style["transform-origin"]="center center",t.el_.style["-webkit-transform-origin"]="center center"},e.prototype.exitRotatescreen=function(){this.el_.removeAttribute("style"),document_1.removeEventListener("touchmove",preventScroll,{passive:!1}),document_1.body.style.overflowY="",this.screenRotated=!1,this.portrait(!0)},e.prototype.dispose=function(){if(!this.el_)return!1;this.trigger("dispose"),this.off("dispose"),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),e.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&this.tech_.dispose(),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),t.prototype.dispose.call(this)},e.prototype.createEl=function(){var e=this.tag,n=void 0,r=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player"),i="video-js"===this.tag.tagName.toLowerCase();r?n=this.el_=e.parentNode:i||(n=this.el_=t.prototype.createEl.call(this,"div"));var o=getAttributes(e);if(i){for(n=this.el_=e,e=this.tag=document_1.createElement("video");n.children.length;)e.appendChild(n.firstChild);hasClass(n,"video-js")||addClass(n,"video-js"),n.appendChild(e),r=this.playerElIngest_=n}if(e.setAttribute("tabindex","-1"),e.removeAttribute("width"),e.removeAttribute("height"),Object.getOwnPropertyNames(o).forEach(function(t){"class"===t?(n.className+=" "+o[t],i&&(e.className+=" "+o[t])):(n.setAttribute(t,o[t]),i&&e.setAttribute(t,o[t]))}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=n.player=this,this.addClass("vjs-paused"),!0!==window_1.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=createStyleElement("vjs-styles-dimensions");var s=$(".vjs-styles-defaults"),a=$("head");a.insertBefore(this.styleEl_,s?s.nextSibling:a.firstChild)}this.width(this.options_.width),this.height(this.options_.height),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio);for(var l=e.getElementsByTagName("a"),c=0;c<l.length;c++){var u=l.item(c);addClass(u,"vjs-hidden"),u.setAttribute("hidden","hidden")}return e.initNetworkState_=e.networkState,e.parentNode&&!r&&e.parentNode.insertBefore(n,e),prependTo(e,n),this.children_.unshift(e),this.el_.setAttribute("lang",this.language_),this.el_=n,n},e.prototype.width=function(t,e){return this.dimension("width",t,e)},e.prototype.height=function(t,e){return this.dimension("height",t,e)},e.prototype.dimension=function(t,e,n){var r=t+"_";if(e===undefined)return this[r]||0;if(""===e)return this[r]=undefined,void this.updateStyleEl_();var i=parseFloat(e);if(isNaN(i))return void log$2.error('Improper value "'+e+'" supplied for for '+t);this[r]=i,this.updateStyleEl_(),this.isReady_&&!n&&this.trigger("playerresize")},e.prototype.fluid=function(t){if(t===undefined)return!!this.fluid_;this.fluid_=!!t,t?this.addClass("vjs-fluid"):this.removeClass("vjs-fluid"),this.updateStyleEl_()},e.prototype.aspectRatio=function(t){if(t===undefined)return this.aspectRatio_
14
14
  ;if(!/^\d+\:\d+$/.test(t))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=t,this.fluid(!0),this.updateStyleEl_()},e.prototype.updateStyleEl_=function(){if(!0===window_1.VIDEOJS_NO_DYNAMIC_STYLE){var t="number"==typeof this.width_?this.width_:this.options_.width,e="number"==typeof this.height_?this.height_:this.options_.height,n=this.tech_&&this.tech_.el();return void(n&&(t>=0&&(n.width=t),e>=0&&(n.height=e)))}var r=void 0,i=void 0,o=void 0,s=void 0;o=this.aspectRatio_!==undefined&&"auto"!==this.aspectRatio_?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9";var a=o.split(":"),l=a[1]/a[0];r=this.width_!==undefined?this.width_:this.height_!==undefined?this.height_/l:this.videoWidth()||300,i=this.height_!==undefined?this.height_:r*l,s=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(s),setTextContent(this.styleEl_,"\n ."+s+" {\n width: "+r+"px;\n height: "+i+"px;\n }\n\n ."+s+".vjs-fluid {\n padding-top: "+100*l+"%;\n }\n ")},e.prototype.loadTech_=function(t,e){var n=this;this.tech_&&this.unloadTech_();var r=toTitleCase(t),i=t.charAt(0).toLowerCase()+t.slice(1);"Html5"!==r&&this.tag&&(Tech.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=r,this.isReady_=!1;var o={source:e,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+r+"_api",autoplay:this.options_.autoplay,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],swf:this.options_.swf,hlsConfig:this.options_.hlsConfig,dashConfig:this.options_.dashConfig,flvConfig:this.options_.flvConfig,webrtcConfig:this.options_.webrtcConfig,xp2pConfig:this.options_.xp2pConfig};ALL.names.forEach(function(t){var e=ALL[t];o[e.getterName]=n[e.privateName]}),assign(o,this.options_[r]),assign(o,this.options_[i]),assign(o,this.options_[t.toLowerCase()]),this.tag&&(o.tag=this.tag),e&&e.src===this.cache_.src&&this.cache_.currentTime>0&&(o.startTime=this.cache_.currentTime);var s=Tech.getTech(t);if(!s)throw new Error("No Tech named '"+r+"' exists! '"+r+"' should be registered using videojs.registerTech()'");this.tech_=new s(this,o),this.tech_.ready(bind(this,this.handleTechReady_),!0),textTrackConverter.jsonToTextTracks(this.textTracksJson_||[],this.tech_),TECH_EVENTS_RETRIGGER.forEach(function(t){n.on(n.tech_,t,n["handleTech"+toTitleCase(t)+"_"])}),this.on(this.tech_,"loadstart",this.handleTechLoadStart_),this.on(this.tech_,"waiting",this.handleTechWaiting_),this.on(this.tech_,"canplay",this.handleTechCanPlay_),this.on(this.tech_,"canplaythrough",this.handleTechCanPlayThrough_),this.on(this.tech_,"playing",this.handleTechPlaying_),this.on(this.tech_,"ended",this.handleTechEnded_),this.on(this.tech_,"seeking",this.handleTechSeeking_),this.on(this.tech_,"seeked",this.handleTechSeeked_),this.on(this.tech_,"play",this.handleTechPlay_),this.on(this.tech_,"firstplay",this.handleTechFirstPlay_),this.on(this.tech_,"pause",this.handleTechPause_),this.on(this.tech_,"durationchange",this.handleTechDurationChange_),this.on(this.tech_,"fullscreenchange",this.handleTechFullscreenChange_),this.on(this.tech_,"error",this.handleTechError_),this.on(this.tech_,"loadedmetadata",this.updateStyleEl_),this.on(this.tech_,"posterchange",this.handleTechPosterChange_),this.on(this.tech_,"textdata",this.handleTechTextData_),this.on(this.tech_,"x5videoexitfullscreen",this.handleX5ExitFullscreen_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===r&&this.tag||prependTo(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},e.prototype.unloadTech_=function(){var t=this;ALL.names.forEach(function(e){var n=ALL[e];t[n.privateName]=t[n.getterName]()}),this.textTracksJson_=textTrackConverter.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1},e.prototype.tech=function(t){return t===undefined&&log$2.warn(tsml(_templateObject$1)),this.tech_},e.prototype.addTechControlsListeners_=function(){this.tech_&&(this.removeTechControlsListeners_(),this.on(this.tech_,"mousedown",this.handleTechClick_),this.on(this.tech_,"touchstart",this.handleTechTouchStart_),this.on(this.tech_,"touchmove",this.handleTechTouchMove_),this.on(this.tech_,"touchend",this.handleTechTouchEnd_),this.on(this.tech_,"tap",this.handleTechTap_))},e.prototype.removeTechControlsListeners_=function(){this.tech_&&(this.off(this.tech_,"tap",this.handleTechTap_),this.off(this.tech_,"touchstart",this.handleTechTouchStart_),this.off(this.tech_,"touchmove",this.handleTechTouchMove_),this.off(this.tech_,"touchend",this.handleTechTouchEnd_),this.off(this.tech_,"mousedown",this.handleTechClick_))},e.prototype.handleTechReady_=function(){if(this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_(),(this.src()||this.currentSrc())&&this.tag&&this.options_.autoplay&&this.paused())try{delete this.tag.poster}catch(t){log$2("deleting tag.poster throws in some browsers",t)}},e.prototype.handleTechLoadStart_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-seeking"),this.licenseCheckFailed||this.error(null),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):(this.trigger("loadstart"),this.trigger("firstplay"))},e.prototype.hasStarted=function(t){if(t===undefined)return this.hasStarted_;t!==this.hasStarted_&&(this.hasStarted_=t,this.hasStarted_?(this.addClass("vjs-has-started"),this.trigger("firstplay")):this.removeClass("vjs-has-started"))},e.prototype.handleTechPlay_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")},e.prototype.handleTechWaiting_=function(){var t=this;this.addClass("vjs-waiting"),this.trigger("waiting"),this.one("timeupdate",function(){return t.removeClass("vjs-waiting")})},e.prototype.handleTechCanPlay_=function(){this.removeClass("vjs-waiting"),this.trigger("canplay")},e.prototype.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},e.prototype.handleTechPlaying_=function(){this.removeClass("vjs-waiting"),this.trigger("playing")},e.prototype.handleTechSeeking_=function(){this.addClass("vjs-seeking"),this.trigger("seeking")},e.prototype.handleTechSeeked_=function(){this.removeClass("vjs-seeking"),this.trigger("seeked")},e.prototype.handleTechFirstPlay_=function(){this.options_.starttime&&(log$2.warn("Passing the `starttime` option to the player will be deprecated in 6.0"),this.currentTime(this.options_.starttime)),this.addClass("vjs-has-started"),this.trigger("firstplay")},e.prototype.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},e.prototype.handleTechEnded_=function(){this.addClass("vjs-ended"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},e.prototype.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},e.prototype.handleTechClick_=function(t){isSingleLeftClick(t)&&this.controls_&&(this.paused()?this.play():this.pause())},e.prototype.handleTechTap_=function(){this.userActive(!this.userActive())},e.prototype.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},e.prototype.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},e.prototype.handleTechTouchEnd_=function(t){t.preventDefault()},e.prototype.handleFullscreenChange_=function(){IS_IOS||(this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen"))},e.prototype.handleStageClick_=function(){this.reportUserActivity()},e.prototype.toggleFullscreenClass_=function(){IS_IOS||(this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen"))},e.prototype.documentFullscreenChange_=function(t){var e=FullscreenApi;this.isFullscreen(document_1[e.fullscreenElement]),!1===this.isFullscreen()&&off(document_1,e.fullscreenchange,bind(this,this.documentFullscreenChange_)),prefixedAPI||this.trigger("fullscreenchange")},e.prototype.handleTechFullscreenChange_=function(t,e){e&&this.isFullscreen(e.isFullscreen),this.trigger("fullscreenchange")},e.prototype.handleTechError_=function(){var t=this.tech_.error();this.error(t)},e.prototype.handleTechTextData_=function(){var t=null;arguments.length>1&&(t=arguments[1]),this.trigger("textdata",t)},e.prototype.handleX5ExitFullscreen_=function(){this.removeClass("vjs-fullscreen"),this.isFullscreen_=!this.isFullscreen_},e.prototype.getCache=function(){return this.cache_},e.prototype.techCall_=function(t,e){this.ready(function(){if(t in allowedSetters)return set$1(this.middleware_,this.tech_,t,e);try{this.tech_&&this.tech_[t](e)}catch(n){throw log$2(n),n}},!0)},e.prototype.techGet_=function(t){if(this.tech_&&this.tech_.isReady_){if(t in allowedGetters)return get$3(this.middleware_,this.tech_,t);try{return this.tech_[t]()}catch(e){if(this.tech_[t]===undefined)throw log$2("Video.js: "+t+" method not defined for "+this.techName_+" playback technology.",e),e;if("TypeError"===e.name)throw log$2("Video.js: "+t+" unavailable on "+this.techName_+" playback technology element.",e),this.tech_.isReady_=!1,e;throw log$2(e),e}}},e.prototype.play=function(){var t=this;if(this.fatalError)return!1;if(this.playOnLoadstart_&&this.off("loadstart",this.playOnLoadstart_),this.isReady_){if(!this.changingSrc_&&(this.src()||this.currentSrc()))return this.techGet_("play");this.playOnLoadstart_=function(){t.playOnLoadstart_=null,silencePromise(t.play())},this.one("loadstart",this.playOnLoadstart_)}else{if(this.playWaitingForReady_)return;this.playWaitingForReady_=!0,this.ready(function(){t.playWaitingForReady_=!1,silencePromise(t.play())})}},e.prototype.pause=function(){this.techCall_("pause")},e.prototype.paused=function(){return!1!==this.techGet_("paused")},e.prototype.played=function(){return this.techGet_("played")||createTimeRanges(0,0)},e.prototype.scrubbing=function(t){if(void 0===t)return this.scrubbing_;this.scrubbing_=!!t,t?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")},e.prototype.currentTime=function(t){if(void 0!==t)return t<0&&(t=0),void this.techCall_("setCurrentTime",t);try{return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime}catch(e){return 0}},e.prototype.currentPDT=function(t){if(!this.plugins||!this.plugins.pdt)return"";var e=get_1(this,"tech_.hlsProvider.hls.playingDate");if(!e)return"";var n=new Date(e).getTime();if(t){var r=this.currentTime(),i=t-n;return this.currentTime(r+i/1e3),!1}return n},e.prototype.duration=function(t,e){t&&e&&(this.cache_.dvrDuration=t);var n="event"===get_1(this,"options_.plugins.Dvr.mode"),r="dvrEvent"===this.dvrMode();if(n&&r){var i=get_1(this,"tech_.hlsProvider.hls.levels[0].details.totalduration");i&&(this.cache_.duration=i),this.cache_.duration&&this.removeClass("vjs-live")}if(t===undefined)return this.cache_.duration!==undefined?this.cache_.duration:NaN;t=parseFloat(t),t<=0&&(t=Infinity),t!==this.cache_.duration&&(this.cache_.duration=t,t===Infinity?this.addClass("vjs-live"):this.removeClass("vjs-live"),this.trigger("durationchange"))},e.prototype.dvrMode=function(){if(!this.cache_.src)return"dvrDefalt";var t=this.options_.plugins.Dvr;return t&&"event"===t.mode&&t.shiftURL&&this.cache_.src===t.shiftURL&&(this.cache_.src.indexOf("tsEventmode=on")>-1||this.cache_.src.indexOf("mode")>-1)?"dvrEvent":this.cache_.src.indexOf("delay=")>-1?"dvrDelay":t&&"event"===t.mode&&t.liveURL&&t.spriteURL&&t.startTime&&this.cache_.src===t.liveURL?"dvrLive":"dvrDefalt"},e.prototype.remainingTime=function(){return this.duration()-this.currentTime()},e.prototype.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},e.prototype.buffered=function(){var t=this.techGet_("buffered");return t&&t.length||(t=createTimeRanges(0,0)),t},e.prototype.bufferedPercent=function(){return bufferedPercent(this.buffered(),this.duration())},e.prototype.bufferedEnd=function(){var t=this.buffered(),e=this.duration(),n=t.end(t.length-1);return n>e&&(n=e),n},e.prototype.volume=function(t){var e=void 0;return t!==undefined?(e=Math.max(0,Math.min(1,parseFloat(t))),this.cache_.volume=e,this.techCall_("setVolume",e),void(e>0?(this.muted(!1),this.lastVolume_(e)):this.muted(!0))):(e=parseFloat(this.techGet_("volume")),isNaN(e)?1:e)},e.prototype.muted=function(t){return t!==undefined?void this.techCall_("setMuted",t):this.techGet_("muted")||!1},e.prototype.defaultMuted=function(t){return t!==undefined?this.techCall_("setDefaultMuted",t):this.techGet_("defaultMuted")||!1},e.prototype.lastVolume_=function(t){return t!==undefined&&0!==t?void(this.cache_.lastVolume=t):this.cache_.lastVolume},e.prototype.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},e.prototype.isFullscreen=function(t){return t!==undefined?(this.isFullscreen_=!!t,void this.toggleFullscreenClass_()):!!this.isFullscreen_},e.prototype.requestFullscreen=function(){var t=FullscreenApi;if(this.isFullscreen(!0),this.options_.fakeFullscreen){var e=this;return(IS_IOS||IS_ANDROID)&&e.forceFixSubtitlesFont(),IS_IOS?(e.el_.style.width="100vw",e.el_.style.height="100%",e.el_.style.position="fixed",e.el_.style.zIndex="999",e.el_.style.top="0",document_1.body.style.overflowY="hidden",document_1.addEventListener("touchmove",preventScroll,{passive:!1}),this.trigger("fullscreenchange")):(this.enterFullWindow(),this.trigger("fullscreenchange")),!1}t.requestFullscreen?(on(document_1,t.fullscreenchange,bind(this,this.documentFullscreenChange_)),this.el_[t.requestFullscreen]()):this.tech_.supportsFullScreen()?this.techCall_("enterFullScreen"):(this.enterFullWindow(),this.trigger("fullscreenchange"))},e.prototype.exitFullscreen=function(){var t=FullscreenApi;if(this.isFullscreen(!1),this.options_.fakeFullscreen)return(IS_IOS||IS_ANDROID)&&this.releaseSubtitlesFont(),IS_IOS?(this.el_.removeAttribute("style"),document_1.removeEventListener("touchmove",preventScroll,{passive:!1}),document_1.body.style.overflowY="",this.trigger("fullscreenchange")):(this.exitFullWindow(),this.trigger("fullscreenchange")),!1;t.requestFullscreen?document_1[t.exitFullscreen]():this.tech_.supportsFullScreen()?this.techCall_("exitFullScreen"):(this.exitFullWindow(),this.trigger("fullscreenchange"))},e.prototype.forceFixSubtitlesFont=function(){loadCssText("tcp_force_fix_font","\n .vjs-text-track-display div div {\n font: "+(get_1(this.getChild("textTrackDisplay").el_,"children[0].children[0].style.font")||"10px sans-serif")+"!important;\n }\n ")},e.prototype.releaseSubtitlesFont=function(t){var e=get_1(this.getChild("textTrackDisplay").el_,"children[0].children[0]");e&&(e.style.display="none"),t&&setTimeout(function(){releaseCssText("tcp_force_fix_font")},1e3)},e.prototype.enterFullWindow=function(){this.isFullWindow=!0,this.docOrigOverflow=document_1.documentElement.style.overflow,on(document_1,"keydown",bind(this,this.fullWindowOnEscKey)),document_1.documentElement.style.overflow="hidden",addClass(document_1.body,"vjs-full-window"),this.trigger("enterFullWindow")},e.prototype.fullWindowOnEscKey=function(t){27===t.keyCode&&(!0===this.isFullscreen()?this.exitFullscreen():this.exitFullWindow())},e.prototype.exitFullWindow=function(){this.isFullWindow=!1,off(document_1,"keydown",this.fullWindowOnEscKey),document_1.documentElement.style.overflow=this.docOrigOverflow,removeClass(document_1.body,"vjs-full-window"),this.trigger("exitFullWindow")},e.prototype.canPlayType=function(t){for(var e=void 0,n=0,r=this.options_.techOrder;n<r.length;n++){var i=r[n],o=Tech.getTech(i);if(o||(o=Component.getComponent(i)),o){if(o.isSupported()&&(e=o.canPlayType(t)))return e}else log$2.error('The "'+i+'" tech is undefined. Skipped browser support check for that tech.')}return""},e.prototype.selectSource=function(t){var e=this,n=this.options_.techOrder.map(function(t){return[t,Tech.getTech(t)]}).filter(function(t){var e=t[0],n=t[1];return n?n.isSupported():(log$2.error('The "'+e+'" tech is undefined. Skipped browser support check for that tech.'),!1)}),r=function(t,e,n){var r=void 0;return t.some(function(t){return e.some(function(e){if(r=n(t,e))return!0})}),r},i=function(t,n){var r=t[0];if(t[1].canPlaySource(n,e.options_[r.toLowerCase()]))return{source:n,tech:r}};return(this.options_.sourceOrder?r(t,n,function(t){return function(e,n){return t(n,e)}}(i)):r(n,t,i))||!1},e.prototype.src=function(t){var e=this;if(void 0===t)return this.cache_.src||this.techGet_("src");var n=filterSource(t);if(n&&n[0]&&n[0].src&&isWebrtcUrl(n[0].src)&&!isWebRTCSupported()){if(this.options_.webrtcConfig&&this.options_.webrtcConfig.fallbackUrl)n[0].src=this.options_.webrtcConfig.fallbackUrl;else{var r=convertProtocol(n[0].src);n[0].src=r&&r[0]||n[0].src}this.setTimeout(function(){e.trigger({type:"webrtcfallback",data:{target:n[0].src}})},0)}if(!n.length)return void this.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0);if(this.options_&&this.options_.hlsConfig&&(this.options_.hlsConfig.disable||this.options_.hlsConfig.skipHlsJs)&&n.map(function(t){t.skipHlsJs=!0}),this.cache_.source&&isWebrtcUrl(this.cache_.source.src)&&isWebrtcUrl(n[0].src)&&this.cache_.source.src!==n[0].src){var i=this.tech_.webrtcProvider;if(i&&i.webrtcPlayer&&i.webrtcPlayer.switchStream)return this.tech_.webrtcProvider.webrtcPlayer.switchStream(n[0].src),this.cache_.sources=n,this.cache_.source=n[0],!1}this.lastSource=this.cache_.sources&&JSON.parse(JSON.stringify(this.cache_.sources)),this.cache_.sources=n,this.changingSrc_=!0,this.cache_.source=n[0],this.lastSource&&!get_1(this,"options_.fileID")&&get_1(this,"options_.plugins.ContinuePlay")&&setTimeout(function(){e.ContinuePlay().init(e.cache_.source)},0);try{this.cache_.source&&!isWebrtcUrl(this.cache_.source.src)&&this.options_.autoplay&&setTimeout(function(){var t=e.play&&e.play();isPromise(t)&&t.then()["catch"](function(){e.trigger("blocked")})},1e3)}catch(o){}setSource(this,n[0],function(t,r){if(e.middleware_=r,e.src_(t)){if(n.length>1){var i=n.slice(1),o=i[0].qualityLabelList;return o&&e.QualitySwitcher().setOptions({qualityLabelList:{video:o.slice(1)}}),e.src(i)}return e.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0),void e.triggerReady()}e.changingSrc_=!1,e.cache_.src=t.src,setTech(r,e.tech_)})},e.prototype.src_=function(t){var e=this.selectSource([t]);return!e||(window_1.performance&&"function"==typeof window_1.performance.mark&&window_1.performance.mark("firstFrameStart"),titleCaseEquals(e.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",t):this.techCall_("src",t.src),"auto"===this.options_.preload&&this.load(),this.one("loadedmetadata",function(){1!==this.memoryPlaybackRate&&this.playbackRate(this.memoryPlaybackRate)})},!0),!1):(this.changingSrc_=!0,this.loadTech_(e.tech,e.source),!1))},e.prototype.load=function(){this.techCall_("load")},e.prototype.unload=function(t){t&&(this.fatalError=!0);try{this.pause(),this.tech_.hlsProvider&&this.tech_.hlsProvider.hls&&this.tech_.hlsProvider.hls.stopLoad(),this.tech_.flvProvider&&this.tech_.flvProvider.flv&&this.tech_.flvProvider.flv.unload(),this.tech_.webrtcProvider&&this.tech_.webrtcProvider.webrtcPlayer&&this.tech_.webrtcProvider.webrtcPlayer.stopPlay()}catch(e){}},e.prototype.reset=function(){this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset")},e.prototype.currentSources=function(){var t=this.currentSource(),e=[];return 0!==Object.keys(t).length&&e.push(t),this.cache_.sources||e},e.prototype.currentSource=function(){return this.cache_.source||{}},e.prototype.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},e.prototype.currentType=function(){return this.currentSource()&&this.currentSource().type||""},e.prototype.preload=function(t){return t!==undefined?(this.techCall_("setPreload",t),void(this.options_.preload=t)):this.techGet_("preload")},e.prototype.autoplay=function(t){return t!==undefined?(this.techCall_("setAutoplay",t),this.options_.autoplay=t,void this.ready(this.forceAutoplayInChrome_)):this.techGet_("autoplay",t)},e.prototype.forceAutoplayInChrome_=function(){this.paused()&&(this.autoplay()||this.options_.autoplay)&&IS_CHROME&&!IS_ANDROID&&this.play()},e.prototype.playsinline=function(t){return t!==undefined?(this.techCall_("setPlaysinline",t),this.options_.playsinline=t,this):this.techGet_("playsinline")},e.prototype.loop=function(t){return t!==undefined?(this.techCall_("setLoop",t),void(this.options_.loop=t)):this.techGet_("loop")},e.prototype.poster=function(t){if(t===undefined)return this.poster_;t||(t=""),this.poster_=t,this.trigger("posterchange")},e.prototype.handleTechPosterChange_=function(){!this.poster_&&this.tech_&&this.tech_.poster&&(this.poster_=this.tech_.poster()||"",this.trigger("posterchange"))},e.prototype.controls=function(t){if(t===undefined)return!!this.controls_;t=!!t,this.controls_!==t&&(this.controls_=t,this.usingNativeControls()&&this.techCall_("setControls",t),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))},e.prototype.usingNativeControls=function(t){if(t===undefined)return!!this.usingNativeControls_;t=!!t,this.usingNativeControls_!==t&&(this.usingNativeControls_=t,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))},e.prototype.error=function(t){return t===undefined?this.error_||null:null===t?(this.error_=t,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close())):(this.error_=new MediaError(t),this.addClass("vjs-error"),log$2.error("(CODE:"+this.error_.code+" "+MediaError.errorTypes[this.error_.code]+")",this.error_.message,this.error_),void this.trigger({type:"error",data:this.error_}))},e.prototype.reportUserActivity=function(t){this.userActivity_=!0},e.prototype.userActive=function(t){if(t===undefined)return this.userActive_;if((t=!!t)!==this.userActive_){if(this.userActive_=t,this.userActive_)return this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),void this.trigger("useractive");this.tech_&&this.tech_.one("mousemove",function(t){t.stopPropagation(),t.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}},e.prototype.listenForUserActivity_=function(){var t=void 0,e=void 0,n=void 0,r=bind(this,this.reportUserActivity),i=function(t){t.screenX===e&&t.screenY===n||(e=t.screenX,n=t.screenY,r())},o=function(){r(),this.clearInterval(t),t=this.setInterval(r,250)},s=function(e){r(),this.clearInterval(t)};this.on("mousedown",o),this.on("mousemove",i),this.on("mouseup",s),this.on("keydown",r),this.on("keyup",r);var a=void 0;this.setInterval(function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a);var t=this.options_.inactivityTimeout;t<=0||(a=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},t))}},250)},e.prototype.playbackRate=function(t){return t!==undefined?(this.techCall_("setPlaybackRate",t),void(this.memoryPlaybackRate=t)):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("playbackRate"):1},e.prototype.defaultPlaybackRate=function(t){return t!==undefined?this.techCall_("setDefaultPlaybackRate",t):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},e.prototype.isAudio=function(t){return t!==undefined?void(this.isAudio_=!!t):!!this.isAudio_},e.prototype.addTextTrack=function(t,e,n){if(this.tech_)return this.tech_.addTextTrack(t,e,n)},e.prototype.addRemoteTextTrack=function(t,e){if(IS_IOS&&!window_1.textTrackCleared_&&(window_1.textTrackCleared_=!0),this.tech_)return this.tech_.addRemoteTextTrack(t,e)},e.prototype.removeRemoteTextTrack=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},e=t.track,n=e===undefined?arguments[0]:e;if(this.tech_)return this.tech_.removeRemoteTextTrack(n)},e.prototype.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},e.prototype.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},e.prototype.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},e.prototype.language=function(t){if(t===undefined)return this.language_;this.language_=String(t).toLowerCase()},e.prototype.languages=function(){return mergeOptions(e.prototype.options_.languages,this.languages_)},e.prototype.toJSON=function(){var t=mergeOptions(this.options_),e=t.tracks;t.tracks=[];for(var n=0;n<e.length;n++){var r=e[n];r=mergeOptions(r),r.player=undefined,t.tracks[n]=r}return t},e.prototype.createModal=function(t,e){var n=this;e=e||{},e.content=t||"";var r=new ModalDialog(this,e);return this.addChild(r),r.on("dispose",function(){n.removeChild(r)}),r.open(),r},e.getTagSettings=function(t){var e={sources:[],tracks:[]},n=getAttributes(t),r=n["data-setup"];if(hasClass(t,"vjs-fluid")&&(n.fluid=!0),null!==r){var i=tuple(r||"{}"),o=i[0],s=i[1];o&&log$2.error(o),assign(n,s)}if(assign(e,n),t.hasChildNodes())for(var a=t.childNodes,l=0,c=a.length;l<c;l++){var u=a[l],h=u.nodeName.toLowerCase();"source"===h?e.sources.push(getAttributes(u)):"track"===h&&e.tracks.push(getAttributes(u))}return e},e.prototype.flexNotSupported_=function(){var t=document_1.createElement("i");return!("flexBasis"in t.style||"webkitFlexBasis"in t.style||"mozFlexBasis"in t.style||"msFlexBasis"in t.style||"msFlexOrder"in t.style)},e}(Component);ALL.names.forEach(function(t){var e=ALL[t];Player.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}}),Player.players={};var navigator$1=window_1.navigator;Player.prototype.options_={techOrder:Tech.defaultTechOrder_,html5:{},flash:{},inactivityTimeout:2e3,playbackRates:[],children:["mediaLoader","mediaAsyncLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","controlBar","errorDisplay","textTrackSettings","videoStatisticPanel"],language:navigator$1&&(navigator$1.languages&&navigator$1.languages[0]||navigator$1.userLanguage||navigator$1.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media."},["ended","seeking","seekable","networkState","readyState"].forEach(function(t){Player.prototype[t]=function(){return this.techGet_(t)}}),TECH_EVENTS_RETRIGGER.forEach(function(t){Player.prototype["handleTech"+toTitleCase(t)+"_"]=function(){return this.trigger(t)}}),Component.registerComponent("Player",Player);var BASE_PLUGIN_NAME="plugin",PLUGIN_CACHE_KEY="activePlugins_",pluginStorage={},pluginExists=function(t){return pluginStorage.hasOwnProperty(t)},getPlugin=function(t){return pluginExists(t)?pluginStorage[t]:undefined},markPluginAsActive=function(t,e){t[PLUGIN_CACHE_KEY]=t[PLUGIN_CACHE_KEY]||{},t[PLUGIN_CACHE_KEY][e]=!0},triggerSetupEvent=function(t,e,n){var r=(n?"before":"")+"pluginsetup";t.trigger(r,e),t.trigger(r+":"+e.name,e)},createBasicPlugin=function(t,e){var n=function(){triggerSetupEvent(this,{name:t,plugin:e,instance:null},!0);var n=e.apply(this,arguments);return markPluginAsActive(this,t),triggerSetupEvent(this,{name:t,plugin:e,instance:n}),n};return Object.keys(e).forEach(function(t){n[t]=e[t]}),n},createPluginFactory=function(t,e){return e.prototype.name=t,function(){triggerSetupEvent(this,{name:t,plugin:e,instance:null},!0);for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];var o=new(Function.prototype.bind.apply(e,[null].concat([this].concat(r))));return this[t]=function(){return o},triggerSetupEvent(this,o.getEventHash()),o}},Plugin=function(){function t(e){if(classCallCheck(this,t),this.constructor===t)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,evented(this),delete this.trigger,stateful(this,this.constructor.defaultState),markPluginAsActive(e,this.name),this.dispose=bind(this,this.dispose),e.on("dispose",this.dispose)}return t.prototype.version=function(){return this.constructor.VERSION},t.prototype.getEventHash=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return t.name=this.name,t.plugin=this.constructor,t.instance=this,t},t.prototype.trigger=function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return trigger(this.eventBusEl_,t,this.getEventHash(e))},t.prototype.handleStateChanged=function(t){},t.prototype.dispose=function(){var t=this.name,e=this.player;this.trigger("dispose"),this.off(),e.off("dispose",this.dispose),e[PLUGIN_CACHE_KEY][t]=!1,this.player=this.state=null,e[t]=createPluginFactory(t,pluginStorage[t])},t.isBasic=function(e){var n="string"==typeof e?getPlugin(e):e;return"function"==typeof n&&!t.prototype.isPrototypeOf(n.prototype)},t.registerPlugin=function(e,n){if("string"!=typeof e)throw new Error('Illegal plugin name, "'+e+'", must be a string, was '+(void 0===e?"undefined":_typeof(e))+".");if(pluginExists(e))log$2.warn('A plugin named "'+e+'" already exists. You may want to avoid re-registering plugins!');else if(Player.prototype.hasOwnProperty(e))throw new Error('Illegal plugin name, "'+e+'", cannot share a name with an existing player method!');if("function"!=typeof n)throw new Error('Illegal plugin for "'+e+'", must be a function, was '+(void 0===n?"undefined":_typeof(n))+".");return pluginStorage[e]=n,e!==BASE_PLUGIN_NAME&&(t.isBasic(n)?Player.prototype[e]=createBasicPlugin(e,n):Player.prototype[e]=createPluginFactory(e,n)),n},t.deregisterPlugin=function(t){if(t===BASE_PLUGIN_NAME)throw new Error("Cannot de-register base plugin.");pluginExists(t)&&(delete pluginStorage[t],delete Player.prototype[t])},t.getPlugins=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:Object.keys(pluginStorage),e=void 0;return t.forEach(function(t){var n=getPlugin(t);n&&(e=e||{},e[t]=n)}),e},t.getPluginVersion=function(t){var e=getPlugin(t);return e&&e.VERSION||""},t}();Plugin.getPlugin=getPlugin,Plugin.BASE_PLUGIN_NAME=BASE_PLUGIN_NAME,Plugin.registerPlugin(BASE_PLUGIN_NAME,Plugin),Player.prototype.usingPlugin=function(t){return!!this[PLUGIN_CACHE_KEY]&&!0===this[PLUGIN_CACHE_KEY][t]},Player.prototype.hasPlugin=function(t){return!!pluginExists(t)};var _inherits=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+(void 0===e?"undefined":_typeof(e)));t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(t.super_=e)},extendFn=function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},n=function(){t.apply(this,arguments)},r={};"object"===(void 0===e?"undefined":_typeof(e))?(e.constructor!==Object.prototype.constructor&&(n=e.constructor),r=e):"function"==typeof e&&(n=e),_inherits(n,t);for(var i in r)r.hasOwnProperty(i)&&(n.prototype[i]=r[i]);return n};if("undefined"==typeof HTMLVideoElement&&isReal()&&(document_1.createElement("video"),document_1.createElement("audio"),
15
- document_1.createElement("track"),document_1.createElement("video-js")),videojs.hooks_={},videojs.hooks=function(t,e){return videojs.hooks_[t]=videojs.hooks_[t]||[],e&&(videojs.hooks_[t]=videojs.hooks_[t].concat(e)),videojs.hooks_[t]},videojs.hook=function(t,e){videojs.hooks(t,e)},videojs.hookOnce=function(t,e){videojs.hooks(t,[].concat(e).map(function(e){return function n(){return videojs.removeHook(t,n),e.apply(undefined,arguments)}}))},videojs.removeHook=function(t,e){var n=videojs.hooks(t).indexOf(e);return!(n<=-1)&&(videojs.hooks_[t]=videojs.hooks_[t].slice(),videojs.hooks_[t].splice(n,1),!0)},!0!==window_1.VIDEOJS_NO_DYNAMIC_STYLE&&isReal()){var style=$(".vjs-styles-defaults");if(!style){style=createStyleElement("vjs-styles-defaults");var head=$("head");head&&head.insertBefore(style,head.firstChild),setTextContent(style,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid {\n padding-top: 56.25%\n }\n ")}}autoSetupTimeout(1,videojs),videojs.VERSION=version,videojs.options=Player.prototype.options_,videojs.getPlayers=function(){return Player.players},videojs.players=Player.players,videojs.getComponent=Component.getComponent,videojs.registerComponent=function(t,e){Tech.isTech(e)&&log$2.warn("The "+t+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"),Component.registerComponent.call(Component,t,e)},videojs.getTech=Tech.getTech,videojs.registerTech=Tech.registerTech,videojs.use=use,videojs.browser=browser,videojs.TOUCH_ENABLED=TOUCH_ENABLED,videojs.extend=extendFn,videojs.mergeOptions=mergeOptions,videojs.bind=bind,videojs.registerPlugin=Plugin.registerPlugin,videojs.plugin=function(t,e){return log$2.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Plugin.registerPlugin(t,e)},videojs.getPlugins=Plugin.getPlugins,videojs.getPlugin=Plugin.getPlugin,videojs.getPluginVersion=Plugin.getPluginVersion,videojs.addLanguage=function(t,e){var n;return t=(""+t).toLowerCase(),videojs.options.languages=mergeOptions(videojs.options.languages,(n={},n[t]=e,n)),videojs.options.languages[t]},videojs.log=log$2,videojs.createTimeRange=videojs.createTimeRanges=createTimeRanges,videojs.formatTime=formatTime,videojs.parseUrl=parseUrl,videojs.isCrossOrigin=isCrossOrigin,videojs.EventTarget=EventTarget,videojs.on=on,videojs.one=one,videojs.off=off,videojs.trigger=trigger,videojs.xhr=xhr,videojs.TextTrack=TextTrack,videojs.AudioTrack=AudioTrack,videojs.VideoTrack=VideoTrack,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(function(t){videojs[t]=function(){return log$2.warn("videojs."+t+"() is deprecated; use videojs.dom."+t+"() instead"),Dom[t].apply(null,arguments)}}),videojs.computedStyle=computedStyle,videojs.dom=Dom,videojs.url=Url;var strictUriEncode=function(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})},getOwnPropertySymbols=Object.getOwnPropertySymbols,hasOwnProperty$5=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable,objectAssign=shouldUseNative()?Object.assign:function(t,e){for(var n,r,i=toObject(t),o=1;o<arguments.length;o++){n=Object(arguments[o]);for(var s in n)hasOwnProperty$5.call(n,s)&&(i[s]=n[s]);if(getOwnPropertySymbols){r=getOwnPropertySymbols(n);for(var a=0;a<r.length;a++)propIsEnumerable.call(n,r[a])&&(i[r[a]]=n[r[a]])}}return i},token="%[a-f0-9]{2}",singleMatcher=new RegExp(token,"gi"),multiMatcher=new RegExp("("+token+")+","gi"),decodeUriComponent=function(t){if("string"!=typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch(e){return customDecodeURIComponent(t)}},extract_1=extract,parse_1=parse,stringify=function(t,e){e=objectAssign({encode:!0,strict:!0,arrayFormat:"none"},e),!1===e.sort&&(e.sort=function(){});var n=encoderForArrayFormat(e);return t?Object.keys(t).sort(e.sort).map(function(r){var i=t[r];if(i===undefined)return"";if(null===i)return encode(r,e);if(Array.isArray(i)){var o=[];return i.slice().forEach(function(t){t!==undefined&&o.push(n(r,t,o.length))}),o.join("&")}return encode(r,e)+"="+encode(i,e)}).filter(function(t){return t.length>0}).join("&"):""},parseUrl$1=function(t,e){return{url:t.split("?")[0]||"",query:parse(extract(t),e)}},queryString={extract:extract_1,parse:parse_1,stringify:stringify,parseUrl:parseUrl$1},count=0,MediaAsyncLoader=function(t){function e(n,r,i){classCallCheck(this,e),log$2("MediaAsyncLoader initializing");var o=mergeOptions({createEl:!1},r),s=possibleConstructorReturn(this,t.call(this,n,o,i));s.enModule=new Enc,n.loadVideoByID=bind(s,s.loadVideoByID);var a=o.playerOptions||o;if(!a.fileID){var l;return l=!1,possibleConstructorReturn(s,l)}return s.playCGIHosts=(a.playCGIHosts||[]).concat([SERVER_PATH,SERVER_PATH_BACKUP]),s.playCGIIndex=0,s.getInfo(a),log$2("MediaAsyncLoader initialized"),s}return inherits(e,t),e.prototype.getInfo=function(t){t&&t.fileID&&t.appID&&(performance&&"function"==typeof performance.mark&&performance.mark("firstFrameStart"),t.playDefinition?this.getInfoV3(t):t.sign||t.ssign?this.getInfoV2(t):this.getInfoV4(t))},e.prototype.getInfoV2=function(t){var e=this.player(),n=this.assemblyPath("getplayinfo",t.appID,t.fileID),r=t.t,i=t.us,o=t.exper,s=t.sign,a={};t.ssign?a.super_sign=t.ssign:s&&(a={t:r,sign:s},(i||0==i)&&(a.us=i),(o||0==o)&&(a.exper=o,e.trigger({type:"feature",data:"exper"})),e.trigger({type:"feature",data:"key"})),t.playerID&&(a.playerid=t.playerID),this.requestTimestamp=+(new Date).getTime(),e.trigger({type:"playcgistart",data:{time:this.requestTimestamp,url:n}}),log$2("playcgi loading");var l=queryString.stringify(a);l&&(n+=(~n.indexOf("?")?"&":"?")+l,n=n.replace("?&","?")),this.getInfoRetryTimes=0,this.getInfoRequest=function(t){if(!t||!this.playCGIHosts[this.playCGIIndex+1])return!1;n=n.replace(this.playCGIHosts[this.playCGIIndex],this.playCGIHosts[this.playCGIIndex+1]),this.playCGIIndex++,IE_VERSION&&IE_VERSION<10?jsonp(n,{param:a,timeout:3e3,prefix:"TcCallBack"},bind(this,this.onResult)):xhr({url:n,timeout:3e3},bind(this,this.onResult))},this.getInfoRequest()},e.prototype.onResult=function(t,e,n){try{n?e=JSON.parse(n):t||e||(t=new Error("ServerError"))}catch(l){t=new Error("ServerError")}var r=this.player();if(t){if(log$2("playcgi loaded failure"),this.getInfoRetryTimes<3)return this.getInfoRetryTimes++,void this.getInfoRequest();if(this.getInfoRetryTimes<6)return this.getInfoRetryTimes++,void this.getInfoRequest({isBackup:!0});r.trigger({type:"playcgiend",data:{time:+(new Date).getTime(),startTime:this.requestTimestamp,error:t,result:e}});var i=12;switch(t.message){case"XMLHttpRequest timeout":case"Timeout":i=10;break;case"ServerError":i=11}this.player().error({code:i})}else{if(r.trigger({type:"playcgiend",data:{time:+(new Date).getTime(),startTime:this.requestTimestamp,error:t,result:e}}),0!=e.code)return log$2("playcgi loaded failure"),void this.player().error({code:e.code});log$2("playcgi loaded success");var o=e.coverInfo,s=e.videoInfo,a=e.playerInfo;this.setPoster(o),this.setLogo(a),this.setSrc(e),this.setPatch(a),this.setVttThumbnail(e),this.setDots(e),this.setOriginDuration(s),this.setPlayList(a)}},e.prototype.getInfoV3=function(t){var e=this.player(),n=this.assemblyPathV3("getplayinfo",t.appID,t.fileID,t.playDefinition),r=t.t,i=t.us,o=t.rlimit,s=t.sign,a={};t.ssign?a.super_sign=t.ssign:s&&(a={t:r,sign:s},(i||0==i)&&(a.us=i),o&&(a.rlimit=o),e.trigger({type:"feature",data:"key"})),t.playerID&&(a.playerid=t.playerID),this.requestTimestamp=+(new Date).getTime(),e.trigger({type:"playcgistart",data:{time:this.requestTimestamp,url:n}}),log$2("playcgi v3 loading");var l=queryString.stringify(a);l&&(n+=(~n.indexOf("?")?"&":"?")+l,n=n.replace("?&","?")),this.getInfoRetryTimes=0,this.getInfoRequest=function(t){t&&(n=n.replace(SERVER_PATH_V3,SERVER_PATH_BACKUP)),IE_VERSION&&IE_VERSION<10?jsonp(n,{param:a,timeout:3e3,prefix:"TcCallBack"},bind(this,this.onResultV3)):xhr({url:n,timeout:3e3},bind(this,this.onResultV3))},this.getInfoRequest()},e.prototype.onResultV3=function(t,e,n){try{n?e=JSON.parse(n):t||e.body||(t=new Error("ServerError"))}catch(a){t=new Error("ServerError")}var r=this.player();if(t){if(log$2("playcgi v3 loaded failure"),this.getInfoRetryTimes<3)return this.getInfoRetryTimes++,void this.getInfoRequest();if(this.getInfoRetryTimes<6)return this.getInfoRetryTimes++,void this.getInfoRequest({isBackup:!0});r.trigger({type:"playcgiend",data:{time:+(new Date).getTime(),startTime:this.requestTimestamp,error:t,result:e}});var i=12;switch(t.message){case"XMLHttpRequest timeout":case"Timeout":i=10;break;case"ServerError":i=11}this.player().error({code:i})}else{if(r.trigger({type:"playcgiend",data:{time:+(new Date).getTime(),startTime:this.requestTimestamp,error:t,result:e}}),0!=e.code)return log$2("playcgi v3 loaded failure"),void this.player().error({code:e.code});log$2("playcgi v3 loaded success");var o=e.mediaInfo,s=e.playerInfo;this.setPoster({coverUrl:o.basicInfo.coverUrl}),this.setLogo(s),this.setSrcV3(o),this.setPatch(s),this.setVttThumbnail(o),this.setDots(o)}},e.prototype.setSrcV3=function(t,e){var n=this,r=this.player(),i=r.options_.plugins,o=r.DRM().options||i.DRM,s=void 0,a=void 0,l=void 0,c=[],u={},h={};if(e=e||(o?o.skipPlan:""),t.previewStreamingInfo&&t.previewStreamingInfo.previewStreamingList.length>0)t.previewStreamingInfo.previewStreamingList.forEach(function(t,e){t.mineType=n.getMIMEType(t.url),u[getFileExtension(t.url)]=t});else{if(!(t.dynamicStreamingInfo.adaptiveStreamingInfoList&&t.dynamicStreamingInfo.adaptiveStreamingInfoList.length>0))return void this.player().error({code:13,message:"no video stream"});if(t.dynamicStreamingInfo.adaptiveStreamingInfoList.forEach(function(t,e){t.mineType=n.getMIMEType(t.url),h[t.drmType.toLowerCase()||getFileExtension(t.url)]=t}),o&&o.token?(s=o.token,l=o.certificateUri,e=IS_SAFARI&&!l?"fairplay":e,a=window_1.encodeURIComponent(s)):e="all",(IS_CHROME||IS_FIREFOX)&&window_1.navigator.requestMediaKeySystemAccess&&h.widevine&&"widevine"!=e&&"all"!=e?(c.push({src:unifyProtocol(h.widevine.url),type:this.getMIMEType(h.widevine.url),keySystems:{"com.widevine.alpha":{serverURL:LICENSE_PATH+"?token="+a+"&drmType="+h.widevine.drmType}}}),log$2("DRM source widevine",c)):IS_SAFARI&&!IS_MQQB&&h.fairplay&&"fairplay"!=e&&"all"!=e&&(c.push({src:unifyProtocol(h.fairplay.url),type:this.getMIMEType(h.fairplay.url),keySystems:{"com.apple.fps.1_0":{certificateUri:l,licenseUri:LICENSE_PATH+"?token="+a+"&drmType="+h.fairplay.drmType}}}),log$2("DRM source fairplay",c)),h.simpleaes&&"all"!=e){var p=h.simpleaes.url.split("/");p[p.length-1]="voddrm.token."+a+"."+p[p.length-1],c.push({src:unifyProtocol(p.join("/")),type:this.getMIMEType(h.simpleaes.url)}),log$2("DRM source simpleaes",c)}h.m3u8&&c.push({src:unifyProtocol(h.m3u8.url),type:this.getMIMEType(h.m3u8.url)}),h.mpd&&c.push({src:unifyProtocol(h.mpd.url),type:this.getMIMEType(h.mpd.url)})}if(!(c.length>0))return void this.player().error({code:4});r.src(c);var d=function(e){return log$2("DRM init Error",c),5!==e.data.code&&2!==e.data.code||!c[0].keySystems["com.widevine.alpha"]?3===e.data.code&&c[0].keySystems["com.apple.fps.1_0"]?void n.setSrcV3(t,"fairplay"):14===e.data.code||3===e.data.code?void n.setSrcV3(t,"all"):void 0:void n.setSrcV3(t,"widevine")};"all"!==e&&(window_1.setTimeout(function(){r.one("error",d)},0),r.one("playing",function(t){}))},e.prototype.getInfoV4=function(t){var e=this.player(),n=this.assemblyPathV4("getplayinfo",t.appID,t.fileID),r=e.options_,i=t.t,o=t.us,s=t.rlimit,a=t.psign,l=t.exper,c={};t.ssign?c.super_sign=t.ssign:a&&(c={t:i,psign:a},(o||0==o)&&(c.us=o),s&&(c.rlimit=s),l&&(c.exper=l)),t.playerConfig&&(c.pcfg=t.playerConfig),t.playerID&&(c.playerid=t.playerID),this.requestTimestamp=+(new Date).getTime(),e.trigger({type:"playcgistart",data:{time:this.requestTimestamp,url:n}}),log$2("playcgi v4 loading");var u=queryString.stringify(c);u?(n+=(~n.indexOf("?")?"&":"?")+u,n=n.replace("?&","?")):n+=~n.indexOf("?")?"":"?";var h=r&&r.hlsConfig&&(r.hlsConfig.disable||r.hlsConfig.skipHlsJs);n=this.enModule.generatePlayCgiUrl(n,browser,h),this.getInfoRetryTimes=0,this.getInfoRequest=function(t){t&&this.playCGIHosts[this.playCGIIndex+1]&&(n=n.replace(this.playCGIHosts[this.playCGIIndex],this.playCGIHosts[this.playCGIIndex+1]),this.playCGIIndex++),IE_VERSION&&IE_VERSION<10?jsonp(n,{param:c,timeout:3e3,prefix:"TcCallBack"},bind(this,this.onResultV4)):xhr({url:n,timeout:3e3},bind(this,this.onResultV4))},this.getInfoRequest()},e.prototype.onResultV4=function(t,e,n){var r=e,i=r.rawRequest;try{n?e=JSON.parse(n):t||e.body||(t=new Error("ServerError"))}catch(h){t=new Error("ServerError")}var o=this.player();if(t){if(log$2("playcgi v4 loaded failure"),this.getInfoRetryTimes<6)return this.getInfoRetryTimes++,void this.getInfoRequest({isBackup:!0});o.trigger({type:"playcgiend",data:{time:+(new Date).getTime(),startTime:this.requestTimestamp,error:t,result:e}});var s=12;switch(t.message){case"XMLHttpRequest timeout":case"Timeout":s=10;break;case"ServerError":s=11}this.player().error({code:s})}else{if(o.trigger({type:"playcgiend",data:{time:+(new Date).getTime(),startTime:this.requestTimestamp,error:t,result:e,rawRequest:i,overlayIv:this.enModule.overlayIv,overlayKey:this.enModule.overlayKey}}),0!=e.code)return log$2("playcgi v4 loaded failure"),e.code>=2e3&&e.code<3e3&&this.getInfoRetryTimes<6?(this.getInfoRetryTimes++,void this.getInfoRequest({isBackup:!0})):void this.player().error({code:e.code});if(log$2("playcgi v4 loaded success",e),4===e.version){var a=e.media;this.setPoster({coverUrl:a.basicInfo.coverUrl}),this.setSrcV4(a),this.setVttThumbnailV4(a),this.setDots(a),this.setGhostContent(a.ghostWatermarkInfo)}else if(2===e.version){var l=e.coverInfo,c=e.videoInfo,u=e.playerInfo;this.setPoster(l),this.setLogo(u),this.setSrc(e),this.setPatch(u),this.setVttThumbnail(e),this.setDots(e),this.setOriginDuration(c)}}},e.prototype.setSrcV4=function(t,e){var n=this,r=this.player(),i=r.options_,o=void 0,s=r.options_.plugins,a=r.DRM().options||s.DRM,l=[],c="plain";e=e||(a?a.skipPlan:"");var u=[],h=[];if("Original"===t.audioVideoType||"Transcode"===t.audioVideoType)return this.setSrc(t),!1;if(!t.streamingInfo)return void this.player().error({code:13,message:"no stream info"});if(t.streamingInfo){if(t.streamingInfo.drmOutput&&Array.isArray(t.streamingInfo.drmOutput)){for(var p=t.streamingInfo.drmOutput,d=0;d<p.length;d++)h.push(p[d].type);if(IS_ANY_SAFARI&&!IS_MQQB&&-1!==h.indexOf("FairPlay")&&"fairplay"!=e&&"all"!=e){var f=h.indexOf("FairPlay"),g=p[f].subStreams;l.push(g),u.push({src:unifyProtocol(p[f].url),type:this.getMIMEType(p[f].url),qualityLabelList:g,keySystems:{"com.apple.fps.1_0":{certificateUri:t.streamingInfo.fairPlayCertificateUrl||(a||{}).certificateUri,licenseUri:t.streamingInfo.fairplayLicenseUrl}}}),log$2("DRM source fairplay",o)}else if(window_1.navigator.requestMediaKeySystemAccess&&-1!==h.indexOf("Widevine")&&!IS_SAFARI&&"widevine"!==e&&"all"!==e){var y=h.indexOf("Widevine"),v=p[y].subStreams,m=v[v.length-1];("audio"===m.type||0===m.width&&0===m.height)&&v.pop(),l.push(v),u.push({src:unifyProtocol(p[y].url),type:this.getMIMEType(p[y].url),qualityLabelList:v,keySystems:{"com.widevine.alpha":{serverURL:t.streamingInfo.widevineLicenseUrl}}}),log$2("DRM source widevine",o)}if(-1!==h.indexOf("SimpleAES")&&"all"!=e){var _,b=h.indexOf("SimpleAES");c="SimpleAES";var T=p[b].url.split("/");T[T.length-1]="voddrm.token."+t.streamingInfo.drmToken+"."+T[T.length-1],o=T.join("/");var C=p[b].subStreams;l.push(p[b].subStreams),o&&u.push({src:unifyProtocol(o),type:EXT_MIME.m3u8,qualityLabelList:C,keySystems:(_={},_[c]={},_)})}}else if(t.streamingInfo.plainOutput){var E;o=t.streamingInfo.plainOutput.url;var S=t.streamingInfo.plainOutput.subStreams;l.push(t.streamingInfo.plainOutput.subStreams),o&&u.push({src:unifyProtocol(o),type:EXT_MIME.m3u8,qualityLabelList:S,keySystems:(E={},E[c]={},E)})}this.setHlsConfig(i,l[0],!1),u.length>0?r.src(u):0!==h.length?!e&&this.player().error({code:18}):this.player().error({code:13,message:"no stream info"}),this.setQualityLabelList(l[0])}var w=function(e){return log$2("DRM init Error",u),u[0].keySystems["com.widevine.alpha"]?void n.setSrcV4(t,"widevine"):u[0].keySystems["com.apple.fps.1_0"]?void n.setSrcV4(t,"fairplay"):3===e.data.code?void n.setSrcV4(t,"all"):void 0};"all"!==e&&window_1.setTimeout(function(){r.one("error",w)},0)},e.prototype.setHlsConfig=function(t,e,n){var r={};(!IS_ENABLED_MSE||IS_TBS||IS_MQQB||IE_VERSION&&IE_VERSION<11)&&!IS_SIMULATOR||(r={overlayKey:this.enModule&&this.enModule.overlayKey,overlayIv:this.enModule&&this.enModule.overlayIv});t.hlsConfig?(t.hlsConfig.qualityLabelList=e,t.hlsConfig.startLevel||(t.hlsConfig.startLevel=e?e.length-1:5)):t.hlsConfig={qualityLabelList:e,startLevel:e?e.length-1:5},Object.assign(t.hlsConfig,r,{forbid:n})},e.prototype.setQualityLabelList=function(t){this.player().QualitySwitcher().setOptions({qualityLabelList:{video:t}})},e.prototype.setLogo=function(t){var e=this.player();t.logoPic?(e.logoImage.update({img:{url:unifyProtocol(t.logoPic),position:t.logoLocation},link:unifyProtocol(t.logoUrl)}),e.trigger({type:"feature",data:"logo"})):e.logoImage.reset()},e.prototype.setPoster=function(t){var e=this.player();t&&t.coverUrl?e.poster(unifyProtocol(t.coverUrl)):e.options_.playerOptions.poster||e.poster("")},e.prototype.setDots=function(t){var e=this.player();if(e.options_.dots=[],t.keyFrameDescInfo&&t.keyFrameDescInfo.keyFrameDescList&&t.keyFrameDescInfo.keyFrameDescList.length>0){var n=t.keyFrameDescInfo.keyFrameDescList;e.options_.dots=n}var r=e.options_.plugins;r&&r.ProgressMarker&&r.ProgressMarker.markers&&r.ProgressMarker.markers.length>0&&(e.options_.dots=e.options_.dots.concat(r.ProgressMarker.markers)),e.ProgressMarker().init()},e.prototype.setSrc=function(t){var e=this.player(),n=t.videoInfo||{};if("Original"===t.audioVideoType&&(n.sourceVideo=t.originalInfo),"Transcode"===t.audioVideoType&&(n.sourceVideo=t.transcodeInfo),(null!=e.options_.definition||e.options_.definition!=undefined)&&n.transcodeList&&n.transcodeList.length>0){e.trigger({type:"feature",data:"definition"});var r=this.getSrcByDefinition(n,e.options_.definition);if(r)return e.src({src:unifyProtocol(r.url),type:this.getMIMEType(r.url)}),!0}if(e.MultiResolution().reset(),n.masterPlayList){e.src(this.getMasterSouces(n));var i=e.options_.hlsConfig;i?i.forbid=!0:Object.assign(e.options_,{hlsConfig:{forbid:!0}}),this.setQualityLabelList([]),e.MultiResolution().store(this.getMultiResolutionData(t))}else if(n.transcodeList&&n.transcodeList.length>0){var o=this.getMultiResolutionData(t);if(o.showOrder.length>0)e.MultiResolution().init(o);else{var s=n.transcodeList[0].url;e.src({src:unifyProtocol(s),type:this.getMIMEType(s)})}}else n.sourceVideo&&this.getMIMEType(n.sourceVideo.url)?e.src({src:unifyProtocol(n.sourceVideo.url),type:this.getMIMEType(n.sourceVideo.url)}):this.player().error({code:13})},e.prototype.setPatch=function(t){var e=this.player();t.patchInfo?e.ImagePatch().init(t.patchInfo):e.ImagePatch().reset()},e.prototype.setVttThumbnail=function(t){var e=this.player();t.imageSpriteInfo&&t.imageSpriteInfo.imageSpriteList?e.ready(bind(this,function(){e.VttThumbnail().init({vttUrl:unifyProtocol(t.imageSpriteInfo.imageSpriteList[0].webVttUrl)})})):e.VttThumbnail().reset()},e.prototype.setVttThumbnailV4=function(t){var e=this.player();t.imageSpriteInfo&&t.imageSpriteInfo.webVttUrl?e.ready(bind(this,function(){e.VttThumbnail().init({vttUrl:unifyProtocol(t.imageSpriteInfo.webVttUrl)})})):e.VttThumbnail().reset()},e.prototype.setOriginDuration=function(t){var e=this.player();if(e.options_.exper>0){var n=t.sourceVideo?t.sourceVideo.floatDuration:t.transcodeList[0].floatDuration;e.one("play",function(){e.duration(n)})}},e.prototype.setOriginDurationV4=function(t){var e=this,n=this.player();n.cache_.originDuration=t.basicInfo.duration,n.off("durationchange",this.keepOriginDuration),n.one("durationchange",function(t){(!n.duration()||n.duration()>0&&Math.floor(n.cache_.originDuration)!==Math.floor(n.duration()))&&(e.keepOriginDuration(t),n.on("durationchange",e.keepOriginDuration))})},e.prototype.setGhostContent=function(t){if(t){var e=this.player(),n=e&&e.DynamicWatermark();n.options.content=t.text,n.options.keep=!0,n.init()}},e.prototype.keepOriginDuration=function(t){var e=this.player(),n=e.cache_.originDuration;Math.floor(n)!==Math.floor(e.duration())&&(log$2("试看视频"),e.duration(Math.round(n)))},e.prototype.getMasterSouces=function(t){var e=t.masterPlayList,n=[];return n.push({src:unifyProtocol(e.url),type:EXT_MIME.m3u8}),n},e.prototype.getMultiResolutionData=function(t){var e={sources:{},labels:{},showOrder:[],defaultRes:""},n=[],r=t.videoInfo.transcodeList,i=this;return t.playerInfo.videoClassification.forEach(function(t,o){r.length>0&&(r=r.filter(function(r){if(!(t.definitionList.indexOf(r.definition)>-1))return!0;n[t.id]||(e.showOrder.push(t.id),e.labels[t.id]=t.name,n[t.id]=[]),n[t.id].push({src:unifyProtocol(r.url),type:i.getMIMEType(r.url)})}))}),e.sources=n,e.defaultRes=t.playerInfo.defaultVideoClassification||Object.keys(n)[0],e},e.prototype.getSrcByDefinition=function(t,e){var n=t.transcodeList,r=t.sourceVideo;if(0==e)return r;for(var i=0;i<n.length;i++)if(n[i].definition==e)return n[i]},e.prototype.getMIMEType=function(t){var e=EXT_MIME[getFileExtension(t)];return e||(log$2.error("MIME type no found! Ext = "+getFileExtension(t)),"")},e.prototype.assemblyPath=function(t,e,n){var r=window_1.location.protocol;return"http:"!=r&&"https:"!=r&&(r="https:"),r+"//"+SERVER_PATH+"/"+t+"/v2/"+e+"/"+n},e.prototype.assemblyPathV3=function(t,e,n,r){var i=window_1.location.protocol;return"http:"!=i&&"https:"!=i&&(i="https:"),i+"//"+SERVER_PATH_V3+"/"+t+"/v3/"+e+"/"+n+"/"+r},e.prototype.assemblyPathV4=function(t,e,n){var r=window_1.location.protocol;return"http:"!=r&&"https:"!=r&&(r="https:"),r+"//"+this.playCGIHosts[this.playCGIIndex]+"/"+t+"/v4/"+e+"/"+n},e.prototype.customHost=function(t){var e=this.player();e.options_.customHost&&/^(?=^.{3,255}$)[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$/.test(e.options_.customHost)&&(t.masterPlayList&&(t.masterPlayList.url=replaceHost(t.masterPlayList.url,e.options_.customHost)),t.sourceVideo&&(t.sourceVideo.url=replaceHost(t.sourceVideo.url,e.options_.customHost)),t.transcodeList.length>0&&t.transcodeList.forEach(function(t,n){t.url=replaceHost(t.url,e.options_.customHost)}),e.trigger({type:"feature",data:"customHost"}))},e.prototype.loadVideoByID=function(t){var e=this.player();e.trigger({type:"loadnewvideo"}),e.hasStarted(!1),this.getInfo(t),e.duration(0),e.options_.appID=t.appID,e.options_.fileID=t.fileID,e.options_.psign=t.psign,t.definition&&(e.options_.definition=t.definition),e.bigPlayButton&&e.bigPlayButton.show(),e.options_.plugins.ContinuePlay&&e.ContinuePlay().init()},e.prototype.setPlayList=function(t){this.player().options_.plugins.PlayList||t.playlist&&t.playlist.data instanceof Array&&t.playlist.data.length>0&&this.player_.PlayList(t.playlist)},e}(Component);Component.registerComponent("MediaAsyncLoader",MediaAsyncLoader);var Component$2=videojs.getComponent("Component"),ClickableComponent$2=videojs.getComponent("ClickableComponent"),positionMap=["left-top","left-bottom","right-top","right-bottom"],LogoImage=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return n.on("logochange",videojs.bind(i,function(t){this.update(t.data)})),r.img&&i.update(r),i}return inherits(e,t),e.prototype.createEl=function(){var t=videojs.dom.createEl("div",{className:"tcp-logo vjs-hidden"}),e=videojs.dom.createEl("a",{className:"tcp-logo-link",target:"_blank"}),n=videojs.dom.createEl("img",{className:"tcp-logo-img"});return this.linkEl_=e,this.imgEl_=n,e.appendChild(n),t.appendChild(e),t},e.prototype.update=function(t){var e=t.img,n=t.link;this.setImg(e),this.setHref(n),this.options_=videojs.mergeOptions(this.options_,t),this.show()},e.prototype.setImg=function(t){if(this.imgEl_){this.imgEl_.src=t.url;var e=positionMap[t.position]||t.position||"left-top";videojs.dom.addClass(this.el_,e)}},e.prototype.setHref=function(t){this.linkEl_&&t&&(this.linkEl_.href=t)},e.prototype.reset=function(){this.hide(),this.imgEl_.removeAttribute("src"),this.linkEl_.removeAttribute("href")},e}(ClickableComponent$2);videojs.registerComponent("LogoImage",LogoImage);var Component$3=videojs.getComponent("Component"),Button$2=videojs.getComponent("Button"),ContinuePlayTips=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.init(r),i}return inherits(e,t),e.prototype.createEl=function(){return videojs.dom.createEl("div",{className:"tcp-continue-play-tips"})},e.prototype.close=function(){this.hide()},e.prototype.init=function(t){var e=this.addChild("closeButton",{controlText:"Close"});this.on(e,"close",this.close),this.addChild("ContinuePlayTipsContent",t);var n=this.addChild("ContinuePlayButton",t);this.on(n,["tap","click"],this.close),this.setTimeout(function(){this.close()},3500)},e}(Component$3);videojs.registerComponent("ContinuePlayTips",ContinuePlayTips);var ContinuePlayTipsContent=function(t){function e(n,r){return classCallCheck(this,e),possibleConstructorReturn(this,t.call(this,n,r))}return inherits(e,t),e.prototype.createEl=function(){var t=videojs.dom.createEl("span",{className:"tcp-continue-play-tips-content"}),e=videojs.dom.createEl("span",{className:"tcp-text",textContent:this.localize(this.options_.text||"Last time play at ")}),n=videojs.dom.createEl("span",{className:"tcp-time",textContent:videojs.formatTime(this.options_.time)});return this.textEl_=e,this.timeEl_=n,t.appendChild(e),t.appendChild(n),t},e}(Component$3);videojs.registerComponent("ContinuePlayTipsContent",ContinuePlayTipsContent);var ContinuePlayButton=function(t){function e(n,r){return classCallCheck(this,e),possibleConstructorReturn(this,t.call(this,n,r))}return inherits(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"button",{className:"tcp-continue-play-buttom",textContent:this.localize(this.options_.btnText||"Resume play")})},e.prototype.handleClick=function(){this.options_.resumeCallback.call()},e}(Button$2);videojs.registerComponent("ContinuePlayButton",ContinuePlayButton);var Component$4=videojs.getComponent("Component"),LevelSwitchTips=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.playing=!1,i.timeoutID=undefined,i.levelSwitch=n.options_.plugins.ContextMenu.levelSwitch,i.init(),n.on("playing",videojs.bind(i,function(){i.playing=!0})),n.on("resolutionswitching",videojs.bind(i,function(t){if(i.playing)if(t.data.label)i.switchHandler(i.createSwitching(t.data.label),2e3);else{var e=i.player().QualitySwitcher().options.qualityData;if(e){var n=e.video.filter(function(e){return t.data.newQuality===e.id})[0];i.switchHandler(i.createSwitching(n.label),2e3)}}})),n.on("resolutionswitched",videojs.bind(i,function(){i.playing&&i.switchHandler(i.createSwitched(),2e3)})),n.on("levelSwitchError",videojs.bind(i,function(){i.switchHandler(i.createSwitchError(),2e3)})),i}return inherits(e,t),e.prototype.switchHandler=function(t,e){var n=this;this.timeoutID&&clearTimeout(this.timeoutID),this.textNode.innerText=t,this.show(),this.timeoutID=setTimeout(function(){n.hide()},e)},e.prototype.createEl=function(){var t=videojs.dom.createEl("div",{className:"tcp-switch vjs-hidden"});return this.textNode=videojs.dom.createEl("div",{innerText:""}),t.appendChild(this.textNode),t},e.prototype.init=function(){var t=this.addChild("closeButton",{controlText:"Close"});this.on(t,"close",this.hide)},e.prototype.createSwitching=function(t){return this.levelSwitch.switchingText?this.levelSwitch.switchingText+t:"正在为您切换至"+t},e.prototype.createSwitched=function(){return this.levelSwitch.switchedText?this.levelSwitch.switchedText:"切换成功"},e.prototype.createSwitchError=function(){return this.levelSwitch.switchErrorText?this.levelSwitch.switchErrorText:"切换失败"},e.prototype.show=function(){t.prototype.show.call(this),this.popped=!0},e.prototype.hide=function(){t.prototype.hide.call(this),this.popped=!1},e}(Component$4);videojs.registerComponent("LevelSwitchTips",LevelSwitchTips);var Component$7=videojs.getComponent("Component"),mapKey={fileID:"file ID",requestID:"request ID",mediaType:"media type",mimeType:"mime type",provider:"provider",resolution:"resolution",rate:"rate",frames:"frames",buffer:"buffer",connectionSpeed:"connection speed",info:"info"},VideoTextItem=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.display=!1,i.displayData="loading",i}return inherits(e,t),e.prototype.createEl=function(){var t=videojs.dom.createEl("div",{className:"tcp-statistic-line vjs-hidden"}),e=videojs.dom.createEl("span",{className:"tcp-statistic-title",innerText:mapKey[this.options_.key]+":"}),n=videojs.dom.createEl("span",{className:"tcp-statistic-data",innerText:this.options_.data});return t.appendChild(e),t.appendChild(n),t},e.prototype.updateTextNode_=function(){for(var t=this.el_.lastChild;t.firstChild;)t.removeChild(t.firstChild);this.displayData&&this.show(),this.textNode_=document_1.createTextNode(this.displayData||""),t.appendChild(this.textNode_)},e.prototype.updateContent=function(t){t!==this.displayData&&(this.displayData=t,this.requestAnimationFrame(this.updateTextNode_))},e.prototype.isDisplay=function(){return this.display},e.prototype.show=function(){t.prototype.show.call(this),this.display=!0,this.popped=!0},e.prototype.hide=function(){t.prototype.hide.call(this),this.display=!1,this.popped=!1},e.prototype.reset=function(){t.prototype.hide.call(this),this.display=!1,this.displayData=""},e}(Component$7);videojs.registerComponent("VideoTextItem",VideoTextItem);var defaultConfig={enableRecoverMediaError:!0,recoverMediaErrorMaxRetry:5,fragLoadingMaxRetry:3,abrMaxWithRealBitrate:!0,emeEnabled:!0},Html5HlsJS=function(){function t(e,n,r){var i=this;classCallCheck(this,t);var o={},s=n.player();e.keySystems&&e.keySystems["com.widevine.alpha"]&&e.keySystems["com.widevine.alpha"].serverURL?(r.hlsConfig.widevineLicenseUrl=e.keySystems["com.widevine.alpha"].serverURL,r.hlsConfig.enableWorker=!0,r.hlsConfig.emeEnabled=!0,r.hlsConfig.startLevel=(r.hlsConfig.qualityLabelList||[]).length-1,o=r.hlsConfig):o=n.player_.options_.hlsConfig||r.hlsConfig||{},o.forbid&&(delete o.overlayKey,delete o.overlayIv),this.drmBackup=r.hlsConfig&&r.hlsConfig.drmBackup;var a=function(){var t=window.Hls;s.trigger({type:"debug",data:{message:"debug === 加载hls.js完成,进入初始化 hls 阶段"}});var a=new t(videojs.mergeOptions(defaultConfig,o)),l=n.el();i.Hls=t,i.tech=n,i.hls=a,i.switchStatus="",i.manifests=[],i.subtitlesLoadedCount=0,i.audioTrackLoadedCount=0,i.subtitles=[],i.audioTracks=[],i.hlsjsErrorHandler=i.errorHandlerFactory(),a.on(t.Events.ERROR,i.onError.bind(i)),a.on(t.Events.MANIFEST_PARSED,videojs.bind(i,i.onMetaData)),a.on(t.Events.MANIFEST_LOADED,i.loadSubtiles.bind(i)),a.on(t.Events.MANIFEST_LOADED,i.loadAudioTracks.bind(i)),a.on(t.Events.LEVEL_LOADED,i.onLevelLoaded.bind(i)),s.on("ready",i.addHlsSubtitles.bind(i));for(var c in t.Events)a.on(t.Events[c],videojs.bind(i,i.onEvent));a.attachMedia(l),a.loadSource(e.src),s.trigger({type:"hlsInstanceCreated",data:{hls:a}}),s.trigger({type:"debug",data:{message:"debug === 初始化 hls.js 完成,已传递 hls 地址"}}),setInterval(function(){if(!s.el_)return!1;var t=a.levels[a.currentLevel]&&a.levels[a.currentLevel].realBitrate/1e3,e=s.getVideoPlaybackQuality(),n=e.droppedVideoFrames||0,r=e.totalVideoFrames||0,i="",o=s.tech_.hlsProvider.hls.abrController.bwEstimator;o&&o.getEstimate()&&(i=+(125e-6*o.getEstimate()).toFixed(0)),s.trigger({type:"playstatus",data:{type:"hls",
16
- droppedFrames:n,decodedFrames:r,bitrate:t,speed:i}})},1e3),window.Hls&&r.xp2pConfig&&r.xp2pConfig.useXP2P&&s.XP2PHlsjsPlugin&&s.XP2PHlsjsPlugin().startHLSP2P(i.hls,window.HLSP2P,function(t){})};s.trigger({type:"debug",data:{message:"debug === 开始加载hls.js"}}),Promise.all([function(){return r.xp2pConfig&&r.xp2pConfig.useXP2P&&"hls"===r.xp2pConfig.format&&!window.HLSP2P?new Promise(function(t){loadScript(XP2P_HLS_PATH,function(){t()})}):Promise.resolve()}(),function(){return window.Hls?Promise.resolve():new Promise(function(t){loadScript(HLS_PATH,function(){t()})})}()]).then(function(){a()})}return t.prototype.switchQuality=function(t){t.id!=this.hls.currentLevel&&(this.switchStatus="switching",this.switchData=t,this.tech.trigger({type:"hlsresolutionswitching",data:this.switchData}),this.hls.nextLevel=t.id)},t.prototype.dispose=function(){this.hls.destroy()},t.prototype.onSubtitleLoaded=function(t,e){var n=this,r=this.tech.player(),i=this.subtitlesLoadedCount,o=this.subtitles||this.hls.subtitleTracks;this.subtitles[i].url=e.details.fragments[0].url,++this.subtitlesLoadedCount<o.length?this.hls.trigger(this.Hls.Events.SUBTITLE_TRACK_LOADING,{url:o[this.subtitlesLoadedCount].url,id:o[this.subtitlesLoadedCount].id}):r.ready(function(){n.addHlsSubtitles()})},t.prototype.onAudioTrackLoaded=function(t,e){var n=this,r=this.tech.player(),i=this.audioTrackLoadedCount,o=this.hls.audioTracks;this.audioTracks[i].url=e.details.fragments[0].url,++this.audioTrackLoadedCount<o.length?this.hls.trigger(this.Hls.Events.AUDIO_TRACK_LOADING,{url:o[this.audioTrackLoadedCount].url,id:o[this.audioTrackLoadedCount].id}):r.ready(function(){n.addAudioTracks()})},t.prototype.loadAudioTracks=function(){var t=this,e=this.hls.audioTracks;if(e.length){e.forEach(function(e){t.audioTracks.push({id:e.id,name:e.name,lang:e.lang,loaded:!1,"default":e["default"]})});var n=e[0];this.hls.trigger(this.Hls.Events.AUDIO_TRACK_LOADING,{url:n.url,id:n.id}),this.hls.on(this.Hls.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded.bind(this))}},t.prototype.loadSubtiles=function(){var t=this,e=this.hls.subtitleTracks&&this.hls.subtitleTracks.length>0?this.hls.subtitleTracks:this.hls.subtitleTrackController.tracks;if(e.length){e.forEach(function(e){t.subtitles.push({name:e.name,lang:e.lang,loaded:!1,url:e.url,id:e.id})});var n=e[0];this.hls.on(this.Hls.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleLoaded.bind(this)),this.hls.trigger(this.Hls.Events.SUBTITLE_TRACK_LOADING,{url:n.url,id:n.id})}},t.prototype.addAudioTracks=function(){var t=this;this.audioTracks.length&&this.audioTracks.some(function(t){return!t.loaded})&&this.audioTracks.forEach(function(e){var n=t.tech.addAudioTrack({id:e.id,src:e.url,kind:"audio",srclang:e.lang,label:e.name,enabled:e["default"]},!0);n.addEventListener("load",function(){e.loaded=!0})})},t.prototype.addHlsSubtitles=function(){var t=this;this.subtitles.length&&this.subtitles.some(function(t){return!t.loaded})&&this.subtitles.forEach(function(e){var n=t.tech.addRemoteTextTrack({src:e.url,kind:"subtitles",srclang:e.lang,label:e.name},!0);n.addEventListener("load",function(){e.loaded=!0})})},t.prototype.onEvent=function(t,e){this.tech.trigger({type:t,data:e});var n=this.tech.player();switch(t){case this.Hls.Events.MANIFEST_LOADED:this.manifests.push(e.networkDetails.response||e.networkDetails.responseText);break;case this.Hls.Events.LEVEL_SWITCHING:break;case this.Hls.Events.LEVEL_SWITCHED:"switching"==this.switchStatus&&(this.switchStatus="switched",this.tech.trigger({type:"hlsresolutionswitched",data:this.switchData}),this.switchData=null);break;case this.Hls.Events.LEVEL_SWITCH_ERROR:n.trigger({type:"levelSwitchError"})}},t.prototype.onMetaData=function(t,e){var n=[],r=this.hls,i=this;if(e.levels.length>1){var o={id:-1,label:"auto",selected:-1===r.manualLevel};n.push(o),e.levels.forEach(function(t,e){var o={};o.id=e,o.selected=e===r.manualLevel,o.label=i.getLevelLabel(t),n.push(o)});var s={qualityData:{video:n},callbacks:{video:videojs.bind(this,this.switchQuality)}};this.tech.setTimeout(function(){this.trigger({type:"masterplaylistchange",data:s})},1)}},t.prototype.getLevelLabel=function(t){return t.height?t.height+"p":t.width?Math.round(9*t.width/16)+"p":t.bitrate?t.bitrate/1e3+"kbps":0},t.prototype.onLevelLoaded=function(t,e){this._duration=e.details.live?Infinity:e.details.totalduration},t.prototype.onError=function(t,e){var n=this.tech.player();if(e.fatal)switch(e.type){case this.Hls.ErrorTypes.NETWORK_ERROR:n.error({code:14,source:e});break;case this.Hls.ErrorTypes.MEDIA_ERROR:this.hls.config.enableRecoverMediaError?this.hlsjsErrorHandler(e):n.error({code:15,source:e});break;case this.Hls.ErrorTypes.MUX_ERROR:n.error({code:16,source:e});break;case this.Hls.ErrorTypes.OTHER_ERROR:default:n.error({code:17,source:e}),this.drmBackup&&"keySystemError"===e.type&&n.error(null)}else switch(e.details){case this.Hls.ErrorDetails.KEY_LOAD_ERROR:}},t.prototype.errorHandlerFactory=function(){var t=this.hls,e=this.tech.player(),n=null,r=null,i=0;return function(o){var s=Date.now();i==t.config.recoverMediaErrorMaxRetry?e.error({code:15,source:o}):(!n||s-n>2e3?(n=s,t.recoverMediaError()):(!r||s-r>2e3)&&(r=s,t.swapAudioCodec(),t.recoverMediaError()),i++)}},t.prototype.duration=function(){return this._duration},t}(),hlsTypeRE=/^application\/(x-mpegURL|vnd\.apple\.mpegURL)$/i,hlsExtRE=/.m3u8(?![^?])/i,HlsSourceHandler={name:"hlsSourceHandler",canHandleSource:function(t){return t.skipHlsJs||t.keySystems&&t.keySystems["com.apple.fps.1_0"]?"":hlsTypeRE.test(t.type)&&hlsExtRE.test(t.src)?"probably":hlsExtRE.test(t.src)?"maybe":""},handleSource:function(t,e,n){return e.hlsProvider?(e.hlsProvider.dispose(),e.hlsProvider=null):n.hlsConfig&&!1===n.hlsConfig.autoStartLoad&&e.on("play",function(){this.player().hasStarted()||this.hlsProvider.hls.startLoad()}),e.hlsProvider=new Html5HlsJS(t,e,n),e.hlsProvider},canPlayType:function(t){return hlsTypeRE.test(t)?"probably":""}};TCPlayer.mountHlsProvider=mountHlsProvider,mountHlsProvider();var Html5DashJS=function(){function t(e,n,r){var i=this;classCallCheck(this,t);var o=function(){var o=window_1.dashjs;if(i.dashjs=o,r=r||n.options_,i.player=videojs(r.playerId),i.player.dash=i.player.dash||{},i.tech_=n,i.el_=n.el(),i.elParent_=i.el_.parentNode,i.hasFiniteDuration_=!1,e.src){n.isReady_=!1,t.updateSourceData&&(videojs.log.warn('updateSourceData has been deprecated. Please switch to using hook("updatesource", callback).'),e=t.updateSourceData(e)),t.hooks("updatesource").forEach(function(t){e=t(e)});var s=e.src;i.keySystemOptions_=t.buildDashJSProtData(e.keySystemOptions||e.keySystems),i.player.dash.mediaPlayer=o.MediaPlayer().create(),i.mediaPlayer_=i.player.dash.mediaPlayer,t.useVideoJSDebug&&(videojs.log.warn('useVideoJSDebug has been deprecated. Please switch to using hook("beforeinitialize", callback).'),t.useVideoJSDebug(i.mediaPlayer_)),t.beforeInitialize&&(videojs.log.warn('beforeInitialize has been deprecated. Please switch to using hook("beforeinitialize", callback).'),t.beforeInitialize(i.player,i.mediaPlayer_)),t.hooks("beforeinitialize").forEach(function(t){t(i.player,i.mediaPlayer_)}),i.mediaPlayer_.initialize(),i.retriggerError_=function(t){if("capability"===t.error&&"mediasource"===t.event)i.player.error({code:4,message:"The media cannot be played because it requires a feature that your browser does not support."});else if("manifestError"!==t.error||"createParser"!==t.event.id&&"codec"!==t.event.id&&"nostreams"!==t.event.id&&"nostreamscomposed"!==t.event.id&&"parse"!==t.event.id&&"multiplexedrep"!==t.event.id)if("mediasource"===t.error)t.event.match("MEDIA_ERR_ABORTED")?i.player.error({code:1,message:t.event}):t.event.match("MEDIA_ERR_NETWORK")?i.player.error({code:2,message:t.event}):t.event.match("MEDIA_ERR_DECODE")?i.player.error({code:3,message:t.event}):t.event.match("MEDIA_ERR_SRC_NOT_SUPPORTED")?i.player.error({code:4,message:t.event}):t.event.match("MEDIA_ERR_ENCRYPTED")?i.player.error({code:5,message:t.event}):(t.event.match("UNKNOWN"),i.player.error({code:4,message:t.event}));else if("capability"===t.error&&"encryptedmedia"===t.event)i.player.error({code:5,message:"The media cannot be played because it requires encryption features that your browser does not support."});else if("key_session"===t.error)i.player.error({code:5,message:t.event});else if("download"===t.error)i.player.error({code:2,message:"The media playback was aborted because too many consecutive download errors occurred."});else{if("mssError"!==t.error)return;i.player.error({code:3,message:t.event})}else i.player.error({code:4,message:t.event.message});setTimeout(function(){i.mediaPlayer_.reset()},10)},i.mediaPlayer_.on(o.MediaPlayer.events.ERROR,i.retriggerError_),i.getDuration_=function(t){var e=t.data.Period_asArray,n=i.hasFiniteDuration_;t.data.mediaPresentationDuration||e[e.length-1].duration?i.hasFiniteDuration_=!0:i.hasFiniteDuration_=!1,i.hasFiniteDuration_!==n&&i.player.trigger("durationchange")},i.mediaPlayer_.on(o.MediaPlayer.events.MANIFEST_LOADED,i.getDuration_),i.mediaPlayer_.on(o.MediaPlayer.events.STREAM_INITIALIZED,videojs.bind(i,i.onMetaData)),i.currentQuality={video:"",audio:""},Object.keys(o.MediaPlayer.events).forEach(function(t){i.mediaPlayer_.on(o.MediaPlayer.events[t],videojs.bind(i,i.onEvent))}),r.dashConfig&&Object.keys(r.dashConfig).forEach(function(t){var e,n="set"+t.charAt(0).toUpperCase()+t.slice(1),o=r.dashConfig[t];if(i.mediaPlayer_.hasOwnProperty(n)&&(videojs.log.warn("Using dash options in videojs-contrib-dash without the set prefix has been deprecated. Change '"+t+"' to '"+n+"'"),t=n),!i.mediaPlayer_.hasOwnProperty(t))return void videojs.log.warn("Warning: dash configuration option unrecognized: "+t);Array.isArray(o)||(o=[o]),(e=i.mediaPlayer_)[t].apply(e,o)}),i.mediaPlayer_.attachView(i.el_),i.mediaPlayer_.setAutoPlay(!1),setupAudioTracks.call(null,i.player,n),setupTextTracks.call(null,i.player,n,r),i.mediaPlayer_.setProtectionData(i.keySystemOptions_),i.mediaPlayer_.attachSource(s),i.tech_.triggerReady()}};window_1.dashjs?o():loadScript(DASH_PATH,function(){o()})}return t.buildDashJSProtData=function(t){var e={};if(!t)return null;if(Array.isArray(t))for(var n=0;n<t.length;n++){var r=t[n],i=videojs.mergeOptions({},r.options);i.licenseUrl&&(i.serverURL=i.licenseUrl,delete i.licenseUrl),e[r.name]=i}else e=t;return e},t.prototype.dispose=function(){var t=this;this.mediaPlayer_&&(this.mediaPlayer_.off(this.dashjs.MediaPlayer.events.ERROR,this.retriggerError_),this.mediaPlayer_.off(this.dashjs.MediaPlayer.events.MANIFEST_LOADED,this.getDuration_),Object.keys(this.dashjs.MediaPlayer.events).forEach(function(e){t.mediaPlayer_.off(t.dashjs.MediaPlayer.events[e],videojs.bind(t,t.onEvent))}),this.mediaPlayer_.reset()),this.player.dash&&delete this.player.dash},t.prototype.duration=function(){return this.mediaPlayer_?this.mediaPlayer_.isDynamic()&&!this.hasFiniteDuration_?Infinity:this.mediaPlayer_.duration():0},t.hooks=function(e,n){return t.hooks_[e]=t.hooks_[e]||[],n&&(t.hooks_[e]=t.hooks_[e].concat(n)),t.hooks_[e]},t.hook=function(e,n){t.hooks(e,n)},t.removeHook=function(e,n){var r=t.hooks(e).indexOf(n);return-1!==r&&(t.hooks_[e]=t.hooks_[e].slice(),t.hooks_[e].splice(r,1),!0)},t.prototype.onMetaData=function(t){var e=this,n=this.mediaPlayer_,r=n.getBitrateInfoListFor("video"),i=n.getSettings(),o=i.streaming.abr.autoSwitchBitrate.video,s=[];if(r.length>0){s.push({id:-1,label:"auto",selected:o}),r.forEach(function(t,n){s.push({id:n,label:e.getLevelLabel(t),selected:!o&&e.currentQuality.video===n})});var a={qualityData:{video:s},callbacks:{video:videojs.bind(this,this.switchQuality)}};this.tech_.setTimeout(function(){this.trigger({type:"masterplaylistchange",data:a})},1)}},t.prototype.switchQuality=function(t){var e=this.mediaPlayer_;-1===t.id?e.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!0}}}}):t.id!=this.currentQuality[t.trackType]&&(e.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!1}}}}),e.setQualityFor(t.trackType,t.id))},t.prototype.getLevelLabel=function(t){return t.height?t.height+"p":t.width?Math.round(9*t.width/16)+"p":t.bitrate?t.bitrate/1e3+"kbps":0},t.prototype.onEvent=function(t){switch(this.tech_.trigger({type:"dash_"+t.type,data:t}),t.type){case this.dashjs.MediaPlayer.events.QUALITY_CHANGE_REQUESTED:this.tech_.trigger({type:"dashqualityswitching",data:t});break;case this.dashjs.MediaPlayer.events.QUALITY_CHANGE_RENDERED:this.tech_.trigger({type:"dashqualityswitched",data:t}),this.currentQuality[t.mediaType]=t.newQuality}},t}();Html5DashJS.hooks_={};var canHandleKeySystems=function(t){t=JSON.parse(JSON.stringify(t)),Html5DashJS.updateSourceData&&(videojs.log.warn('updateSourceData has been deprecated. Please switch to using hook("updatesource", callback).'),t=Html5DashJS.updateSourceData(t)),Html5DashJS.hooks("updatesource").forEach(function(e){t=e(t)});var e=document_1.createElement("video");return!(t.keySystemOptions&&!window_1.navigator.requestMediaKeySystemAccess&&!e.msSetMediaKeys)};videojs.DashSourceHandler=function(){return{name:"dashSourceHandler",canHandleSource:function(t){var e=/\.mpd/i;return canHandleKeySystems(t)?videojs.DashSourceHandler.canPlayType(t.type)?"probably":e.test(t.src)?"maybe":"":""},handleSource:function(t,e,n){return new Html5DashJS(t,e,n)},canPlayType:function(t){return videojs.DashSourceHandler.canPlayType(t)}}},videojs.DashSourceHandler.canPlayType=function(t){return/^application\/dash\+xml/i.test(t)?"probably":""},TCPlayer.mountDashProvider=mountDashProvider,mountDashProvider(),videojs.Html5DashJS=Html5DashJS;var Component$6=videojs.getComponent("Component"),hlsOption=["fileID","requestID","mediaType","mimeType","provider","resolution","rate","frames","buffer","connectionSpeed"],mp4Option=["fileID","requestID","mediaType","mimeType","resolution","rate","buffer"],dashOption=["fileID","requestID","mediaType","mimeType","resolution","rate","buffer","provider","connectionSpeed"],infoOption=["info"],VideoStatisticWrapper=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.nodelist={},i.status={fileID:"",requestID:"",mediaType:"",mimeType:"",provider:"",resolution:"",rate:"",frames:"",buffer:"",connectionSpeed:"",info:""},n.on("playcgiend",function(){clearTimeout(i.timeoutID),Object.keys(i.status).forEach(function(t){i.nodelist[t].reset()})}),n.on("statistic",videojs.bind(i,function(t){"open"===t.data.action?i.tick():i.clearTimeout(i.timeoutID)})),i.init(),i}return inherits(e,t),e.prototype.tick=function(){var t=this;this.timeoutID=setTimeout(videojs.bind(this,function(){t.tick()}),1e3),this.updatePanel()},e.prototype.createEl=function(){return videojs.dom.createEl("div",{className:"tcp-statistic-wrapper"})},e.prototype.init=function(){var t=this;Object.keys(this.status).forEach(function(e){var n=new VideoTextItem(t,{key:e,data:t.status[e]});t.nodelist[e]=n,t.addChild(n)})},e.prototype.updatePanel=function(){var t=this;if("Html5"===this.player().techName_)switch(this.getStatus(),this.status.mediaType){case"m3u8":hlsOption.forEach(function(e){t.nodelist[e].updateContent(t.status[e])});break;case"mp4":mp4Option.forEach(function(e){t.nodelist[e].updateContent(t.status[e])});break;case"mpd":dashOption.forEach(function(e){t.nodelist[e].updateContent(t.status[e])})}else"Flash"===this.player().techName_&&(this.getFlashStatus(),infoOption.forEach(function(e){"info"===e&&t.nodelist[e].updateContent(t.status[e])}))},e.prototype.getStatus=function(){this.getFileID(),this.getRequestID(),this.getMediaType(),this.getMIMEType(),this.getResolution(),this.getRate(),this.getProvider(),this.getBuffer(),"m3u8"===this.status.mediaType&&(this.getFrames(),this.getConnectionSpeed()),"mpd"===this.status.mediaType&&this.getConnectionSpeed()},e.prototype.getFlashStatus=function(){this.status.mediaType="flash",this.getSupport()},e.prototype.getFileID=function(){var t=this.player().options_.fileID||"";return this.status.fileID=t,t},e.prototype.getRequestID=function(){var t=this.player().PlayerMetrics().playStatus;if(t){var e=t.requestID;return this.status.requestID=e,e}},e.prototype.getMediaType=function(){this.player_.src()&&/\/(.+)\.(.+)\?|\/(.+)\.(.+)/.test(this.player_.src());var t=RegExp.$2||RegExp.$4||"";return this.status.mediaType=t,t},e.prototype.getMIMEType=function(){var t=this.player().src(),e=EXT_MIME[getFileExtension(t)]||"";return this.status.mimeType=e,e},e.prototype.getResolution=function(){var t=this.player_.tech_.el_.videoHeight||0,e=this.player_.tech_.el_.videoWidth||0,n=e+" x "+t;return this.status.resolution=n,n},e.prototype.getRate=function(){var t=this.player().playbackRate()||1;return this.status.rate=t+"x",t},e.prototype.getBuffer=function(){var t=this.player_.bufferedEnd().toFixed(1)||0,e=this.player_.duration().toFixed(1)||0,n=(t/e*100).toFixed(1)+"%",r=t+" / "+e+" ("+n+")";return this.status.buffer=r,r},e.prototype.getSupport=function(){var t=void 0;return t="m3u8"!==this.status.mediaType&&"mp4"!==this.status.mediaType&&"dash"!==this.status.mediaType?"视频统计功能不支持当前视频格式":"",this.status.info=t,t},e.prototype.getProvider=function(){var t=this.player_.tech_.sourceHandler_;return t instanceof Html5HlsJS?(this.status.provider="HlsJS","HlsJS"):t instanceof Html5DashJS?(this.status.provider="DashJS","DashJS"):""},e.prototype.getFrames=function(){var t=this.player_.getVideoPlaybackQuality(),e=(t.droppedVideoFrames||0)+" dropped of "+(t.totalVideoFrames||0);return this.status.frames=e,e},e.prototype.getConnectionSpeed=function(){var t=void 0;if("m3u8"===this.status.mediaType){var e=this.player_.tech_.hlsProvider.hls.abrController._bwEstimator;t=e&&e.getEstimate()?(125e-6*e.getEstimate()).toFixed(0)+"KB/s":"0KB/s",this.status.connectionSpeed=t}if("mpd"===this.status.mediaType){var n=this.player_.dash.mediaPlayer,r=n.getDashMetrics(),i=n.getDashAdapter(),o=n.getActiveStream().getStreamInfo(),s=o.index,a=r.getCurrentRepresentationSwitch("video").to,l=i.getBandwidthForRepresentation(a,s);t=l?(125e-6*l).toFixed(0)+"KB/s":"0KB/s",this.status.connectionSpeed=t}return t},e}(Component$6);videojs.registerComponent("VideoStatisticWrapper",VideoStatisticWrapper);var Component$5=videojs.getComponent("Component"),VideoStatisticPanel=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return n.on("statistic",videojs.bind(i,function(t){"open"===t.data.action?i.show():i.hide()})),n.on("playcgistart",function(){n.trigger({type:"statistic",data:{action:"close"}})}),i.init(),i}return inherits(e,t),e.prototype.createEl=function(){var t=this,e=videojs.dom.createEl("div",{className:"tcp-statistic vjs-hidden"}),n=videojs.dom.createEl("div",{className:"tcp-statistic-close",innerText:"[X]"});return n.addEventListener("click",function(){t.hide(),t.player().trigger({type:"statistic",data:{action:"close"}})}),e.appendChild(n),e},e.prototype.init=function(){this.addChild("VideoStatisticWrapper")},e.prototype.show=function(){t.prototype.show.call(this),this.popped=!0},e.prototype.hide=function(){t.prototype.hide.call(this),this.popped=!1},e}(Component$5);videojs.registerComponent("VideoStatisticPanel",VideoStatisticPanel);var MenuItem$3=videojs.getComponent("MenuItem"),MirrorMenuItem=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.addClass("tc-menu-list"),i.open=!1,i.hasOpen=!1,i.player=n,i.setup(),i}return inherits(e,t),e.prototype.setup=function(){var t=this;this.on(["tap","click"],function(){var e=t.player.tech().el();t.hasOpen||(window.MtaH5&&MtaH5.clickStat("mirror",{appid:t.player.options_.appID,fileid:t.player.options_.fileID}),t.player.trigger({type:"feature",data:"mirror"})),t.open?(videojs.dom.removeClass(e,"tcp-mirror"),videojs.dom.removeClass(t.el_,"tcp-menu-item-select")):(videojs.dom.addClass(e,"tcp-mirror"),videojs.dom.addClass(t.el_,"tcp-menu-item-select"),t.hasOpen=!0),t.open=!t.open})},e}(MenuItem$3);videojs.registerComponent("MirrorMenuItem",MirrorMenuItem);var MenuItem$4=videojs.getComponent("MenuItem"),PoweredByMenuItem=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.addClass("tc-menu-list"),i}return inherits(e,t),e}(MenuItem$4);videojs.registerComponent("PoweredByMenuItem",PoweredByMenuItem);var MenuItem$5=videojs.getComponent("MenuItem"),StatusMenuItem=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.addClass("tc-menu-list"),i.hasOpen=!1,i.player=n,n.on("statistic",videojs.bind(i,function(t){"close"===t.data.action&&(videojs.dom.removeClass(i.el_,"tcp-menu-item-select"),i.hasOpen=!1)})),i.setup(),i}return inherits(e,t),e.prototype.setup=function(){var t=this;this.on(["tap","click"],function(){t.hasOpen?(videojs.dom.removeClass(t.el_,"tcp-menu-item-select"),t.player.trigger({type:"statistic",data:{action:"close"}}),t.hasOpen=!1):(videojs.dom.addClass(t.el_,"tcp-menu-item-select"),t.player.trigger({type:"statistic",data:{action:"open"}}),t.hasOpen=!0,window.MtaH5&&MtaH5.clickStat("mirror",{appid:t.player.options_.appID,fileid:t.player.options_.fileID}),t.player.trigger({type:"feature",data:"statistic"}))})},e}(MenuItem$5);videojs.registerComponent("StatusMenuItem",StatusMenuItem);var Component$8=videojs.getComponent("Component"),Menu$2=videojs.getComponent("Menu"),MenuItem$2=videojs.getComponent("MenuItem"),RightClickPopupMenu=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));i.hide(),i.addChild("PoweredByMenuItem",{label:"Powered by Tencent Cloud."}),!r.statistic||IS_IOS||IS_ANDROID||i.addChild("StatusMenuItem",{label:"Video statistic"}),r.mirror&&i.addChild("MirrorMenuItem",{label:"Mirror"}),n.on("contextmenu",videojs.bind(i,i.onContextmenu)),n.on(["tap","click"],videojs.bind(i,function(t){if(this.popped)return this.hide(),t.stopPropagation(),t.preventDefault(),!1})),videojs.on(document,["tap","click"],videojs.bind(i,function(t){this.popped&&this.hide()}));var o=i;return i.children().forEach(function(t){t.on(["tap","click"],function(){o.hide()})}),i}return inherits(e,t),e.prototype.createEl=function(){var e=t.prototype.createEl.call(this);return videojs.dom.addClass(e,"tcp-right-click-popup-menu"),e},e.prototype.show=function(){t.prototype.show.call(this),this.popped=!0},e.prototype.hide=function(){t.prototype.hide.call(this),this.popped=!1},e.prototype.onContextmenu=function(t){t.preventDefault(),this.show();var e=this.el(),n=t.clientX,r=t.clientY,i=getViewportSize(),o=i.width,s=i.height,a=n+e.offsetWidth-o+5;a=Math.max(0,a);var l=r+e.offsetHeight-s+5;l=Math.max(0,l);var c=this.player().el().getBoundingClientRect();e.style.left=Math.max(0,n-c.left-a)+"px",e.style.top=Math.max(0,r-c.top-l)+"px"},e}(Menu$2);videojs.registerComponent("RightClickPopupMenu",RightClickPopupMenu);var clickableComponent=videojs.getComponent("ClickableComponent"),TimeTooltip$2=videojs.getComponent("TimeTooltip"),Component$9=videojs.getComponent("Component"),dom=videojs.dom,formatTime$2=videojs.formatTime,COMMENT_WIDTH=140,COMMENT_HEIGHT_SINGLE_LINE=23,COMMENT_SHOW_ON_THE_LEFT={POPUP_CONTAINER_OFFSET:-130,POPUP_CONTAINER_OFFSET_WITHOUTGIT:-100,TRIANGLE_OFFEST:96,TRIANGLE_OFFEST_WITHOUTGIF:95},COMMENT_SHOW_ON_THE_RIGHT={TRIANGLE_OFFEST:6,POPUP_CONTAINER_OFFSET:0},ProgressMarkerGenerator=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.duration=0,i.registerListener(),i}return inherits(e,t),e.prototype.registerListener=function(){this.player_.one("canplay",videojs.bind(this,this.resetDotsElement))},e.prototype.resetDotsElement=function(){var t=this.player_;this.duration=t.duration(),dom.emptyEl(this.el_),this.resetEl()},e.prototype.resetEl=function(){this.setUpEl()},e.prototype.dotMouseLeave=function(){var t=event.currentTarget,e=t.getAttribute("container-id");this.getChildById(e).hide()},e.prototype.dotHover=function(){var t=event.currentTarget.parentElement.offsetWidth,e=event.currentTarget.offsetLeft+COMMENT_WIDTH,n=this.getChildById(event.currentTarget.getAttribute("container-id")),r=n.getAttribute("class").search("tcp-without-gif")>=0,i=n.el_.querySelector(".tcp-triangle-both")||n.el_.querySelector(".tcp-triangle");e>t?r?(n.el_.style.left=COMMENT_SHOW_ON_THE_LEFT.POPUP_CONTAINER_OFFSET_WITHOUTGIT+"px",i.style.left=COMMENT_SHOW_ON_THE_LEFT.TRIANGLE_OFFEST_WITHOUTGIF+"%"):(n.el_.style.left=COMMENT_SHOW_ON_THE_LEFT.POPUP_CONTAINER_OFFSET+"px",i.style.left=COMMENT_SHOW_ON_THE_LEFT.TRIANGLE_OFFEST+"%"):event.currentTarget.offsetLeft<=COMMENT_WIDTH&&!r&&(n.el_.style.left=COMMENT_SHOW_ON_THE_RIGHT.POPUP_CONTAINER_OFFSET+"px",i.style.left=COMMENT_SHOW_ON_THE_RIGHT.TRIANGLE_OFFEST+"px");var o=n.getChild("DotImage");if(o){var s=o.el_.getElementsByClassName("tcp-dot-timestamp")[0],a=event.currentTarget.getAttribute("dotinsecond"),l=formatTime$2(a);s.innerHTML=l}n.show()},e.prototype.setChildInTheContainer=function(t,e){var n=t.content&&""!==t.content?decodeURIComponent(t.content.replace(/\+/g," ")):"";if(""!==n){var r=e.addChild("DotComment");r.el_.innerHTML=encodeHTML(n)}if(t.img){e.el_.querySelector(".tcp-triangle").setAttribute("class","tcp-triangle-both");var i=e.addChild("DotImage");if(i.el_.firstChild.setAttribute("src",t.img),""==n)e.addClass("tcp-only-gif"),i.el_.firstChild.className="tcp-image-in-container-only-image";else{this.countContentSize(n)<=20&&(e.addClass("tcp-single-line"),r.el_.style.height=COMMENT_HEIGHT_SINGLE_LINE+"px")}}else if(""!==n){var o=this.countContentSize(n);o<=14?e.addClass("tcp-single-line"):o<=28&&e.addClass("tcp-two-lines"),e.addClass("tcp-without-gif"),r.addClass("tcp-large-comment")}},e.prototype.markSetUp=function(t){var e=t.timeOffset>0?t.timeOffset/1e3:0,n=this.duration?this.duration:0;if(!("number"!=typeof e||e>n)){var r=document.createElement("div");r.className="tcp-dot-basic-style",r.setAttribute("dotinsecond",e.toString()),t["class"]&&(r.className+=" "+t["class"]);var i=this.addChild("PopUpContainer");return r.setAttribute("container-id",i.id_),this.setChildInTheContainer(t,i),r.appendChild(i.el_),r.style.left=e/n*100+"%",r.addEventListener("mouseover",videojs.bind(this,this.dotHover)),r.addEventListener("mouseleave",videojs.bind(this,this.dotMouseLeave)),r}},e.prototype.setUpEl=function(){var e=this,n=this.player_.options_.dots||0,r=this.el_||t.prototype.createEl.call(this);return videojs.dom.addClass(r,"tcp-dot-component"),n&&n instanceof Array&&n.length>0&&n.forEach(function(t){var n=t.content||"";if(n&&""!=n||t.img){var i=e.markSetUp(t);i&&r.appendChild(i)}}),r},e.prototype.countContentSize=function(t){for(var e=0,n=t.length,r=-1,i=0;i<n;i++)r=t.charCodeAt(i),e+=r>=0&&r<=128?1:2;return e},e.prototype.createEl=function(){return this.setUpEl()},e}(clickableComponent);videojs.registerComponent("ProgressMarkerGenerator",ProgressMarkerGenerator);var DotComment=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.addClass("tcp-dot-comment"),i}return inherits(e,t),e}(Component$9);videojs.registerComponent("DotComment",DotComment);var DotImage=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));i.addClass("tcp-dot-image");var o=i.el_||t.prototype.createEl.call(i),s=dom.createEl("img");s.className="tcp-image-in-container",o.appendChild(s);var a=dom.createEl("span");return a.className="tcp-dot-timestamp",a.innerHTML="",o.appendChild(a),i}return inherits(e,t),e}(Component$9);videojs.registerComponent("DotImage",DotImage);var PopUpContainer=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));i.addClass("tcp-popup-container");var o=dom.createEl("div");return o.setAttribute("class","tcp-triangle"),i.el_.appendChild(o),i.hide(),i}return inherits(e,t),e}(TimeTooltip$2);videojs.registerComponent("PopUpContainer",PopUpContainer);var Plugin$2=videojs.getPlugin("plugin"),SpeedUp=function(t){function e(n){classCallCheck(this,e);var r=possibleConstructorReturn(this,t.call(this,n));return r.TARGET_LANTENCY=1,r.MAX_LATENCY=3,r.RATEVALUE=1.1,n.ready(videojs.bind(r,r.init)),r}return inherits(e,t),e.prototype.checkLatency=function(){var t=this.player.bufferedEnd()-this.player.currentTime();t>this.MAX_LATENCY&&this.player.playbackRate(this.RATEVALUE),t<this.TARGET_LANTENCY&&this.player.playbackRate(1)},e.prototype.init=function(){var t=this,e=this.player,n=void 0;e.on("playing",function(){e.duration()===Infinity&&(n=setInterval(t.checkLatency.bind(t),1e3))}),e.on("waiting",function(){t.reset(n)}),e.on("pause",function(){t.reset(n)})},e.prototype.reset=function(t){this.player.playbackRate(1),clearInterval(t)},e}(Plugin$2);videojs.registerPlugin("SpeedUp",SpeedUp);var Button$3=videojs.getComponent("Button"),BigPlayButton$2=videojs.getComponent("BigPlayButton");BigPlayButton$2.prototype.createEl=function(){var t=Button$3.prototype.createEl.call(this),e=getTemplate();return(this.options_.shapeType||this.options_.styleType)&&(e=getTemplate(this.options_.shapeType,this.options_.styleType)),t.appendChild(videojs.dom.createEl("div",{className:"vjs-button-icon",innerHTML:e})),t},BigPlayButton$2.prototype.controlText_="Play";var Component$10=videojs.getComponent("Component"),VideoStatisticWrapper$1=videojs.getComponent("VideoStatisticWrapper"),LoadingSpinner$2=videojs.getComponent("LoadingSpinner");LoadingSpinner$2.prototype.createEl=function(){function t(t,e){var n=new VideoStatisticWrapper$1(t);if(n.getMediaType(),(n.getBuffer()||"").indexOf("100.0%")>-1)return e.innerText="",!1;e.innerText=n.getConnectionSpeed()}var e=this,n=Component$10.prototype.createEl.call(this,"div",{className:"tcp-loading-spinner",dir:"ltr"});if(!this.player_.options_.loadingSpeed)return n;var r=null;return this.player_.on("waiting",function(){r=setInterval(function(){t(e.player_,n)},100)}),this.player_.on("timeupdate",function(){r&&clearInterval(r)}),n};var Plugin$3=videojs.getPlugin("plugin"),log$3=videojs.log,Skin=function(t){function e(n,r){classCallCheck(this,e),log$3("Skin initializing");var i=possibleConstructorReturn(this,t.call(this,n));return i.player.addClass("tcp-skin"),log$3("Skin initialized"),i}return inherits(e,t),e}(Plugin$3);videojs.registerPlugin("Skin",Skin);var now=function(){return _root.Date.now()},now_1=now,reWhitespace=/\s/,_trimmedEndIndex=trimmedEndIndex,reTrimStart=/^\s+/,_baseTrim=baseTrim,NAN=NaN,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt,toNumber_1=toNumber,FUNC_ERROR_TEXT$2="Expected a function",nativeMax=Math.max,nativeMin=Math.min,debounce_1=debounce,FUNC_ERROR_TEXT$1="Expected a function",throttle_1=throttle$1,Component$11=videojs.getComponent("Component"),DvrProgressControl=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.on("mousemove",i.handleMouseMove),i.on("mouseup",i.handleMouseUp),i}return inherits(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control tcp-dvr-progress-control"})},e.prototype.update=function(t){this.getChild("DvrSeekBar").update(t)},e.prototype.handleMouseMove=function(t){var e=this.getChild("DvrSeekBar"),n=e.calculateDistance(t),r=e.getChild("DvrMouseTimeDisplay");r&&r.update(videojs.dom.getBoundingClientRect(e.el()),n)},e.prototype.handleMouseUp=function(t){this.getChild("DvrSeekBar").handleMouseUp(t)},e}(Component$11);DvrProgressControl.prototype.options_={children:["DvrSeekBar"]},videojs.registerComponent("DvrProgressControl",DvrProgressControl);var Slider$2=videojs.getComponent("Slider"),DvrSeekBar=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.percent_=1,i.update=throttle_1(videojs.bind(i,i.update),50),i.on(n,"seekToLive",videojs.bind(i,function(t){this.update(t.data)})),i}return inherits(e,t),e.prototype.createEl=function(){
17
- return t.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},e.prototype.update=function(t){t!=undefined&&(this.percent_=t,this.bar.update(videojs.dom.getBoundingClientRect(this.el_),t),this.updateAriaAttributes(t))},e.prototype.handleMouseDown=function(e){t.prototype.handleMouseDown.call(this,e),this.isMouseDown=!0},e.prototype.handleMouseMove=function(t){var e=this.calculateDistance(t);this.update(e)},e.prototype.handleMouseUp=function(e){t.prototype.handleMouseUp.call(this);var n=this.calculateDistance(e);this.update(n),this.player().Dvr().timeShift(n)},e.prototype.stepBack=function(){},e.prototype.stepForward=function(){},e.prototype.updateAriaAttributes=function(t){this.el().setAttribute("aria-valuenow",(100*t).toFixed(2))},e.prototype.getPercent=function(){return this.percent_},e}(Slider$2);DvrSeekBar.prototype.options_={children:["DvrMouseTimeDisplay","DvrTimeShiftBar"],barName:"DvrTimeShiftBar"},videojs.registerComponent("DvrSeekBar",DvrSeekBar);var DvrTimeShiftBar=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.el_.style.width="100%",i}return inherits(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar tcp-dvr-time-shift",innerHTML:'<span class="vjs-control-text"><span>'+this.localize("Progress")+"</span>: 100%</span>"})},e.prototype.update=function(t,e){var n=(100*e).toFixed(2)+"%";this.el_.style.width=n},e}(Component$11);videojs.registerComponent("DvrTimeShiftBar",DvrTimeShiftBar);var MouseTimeDisplay$2=videojs.getComponent("MouseTimeDisplay"),DvrMouseTimeDisplay=function(t){function e(){return classCallCheck(this,e),possibleConstructorReturn(this,t.apply(this,arguments))}return inherits(e,t),e.prototype.update=function(t,e){var n=this;this.rafId_&&this.cancelAnimationFrame(this.rafId_),this.rafId_=this.requestAnimationFrame(function(){var r=n.player().Dvr().dvrData.maxTimeShift,i=videojs.formatTime((1-e)*r,r);n.el_.style.left=t.width*e+"px",n.getChild("timeTooltip").update(t,e,i)})},e}(MouseTimeDisplay$2);videojs.registerComponent("DvrMouseTimeDisplay",DvrMouseTimeDisplay);var Button$4=videojs.getComponent("Button"),LiveButton=function(t){function e(){return classCallCheck(this,e),possibleConstructorReturn(this,t.apply(this,arguments))}return inherits(e,t),e.prototype.createEl=function(){var t=Button$4.prototype.createEl.call(this,"button",{className:"vjs-live-control vjs-control"});return this.contentEl_=videojs.dom.createEl("div",{className:"vjs-live-display",innerHTML:this.localize("LIVE")},{"aria-live":"off"}),t.appendChild(this.contentEl_),t},e.prototype.update=function(){},e.prototype.updateControlText=function(t){this.controlText(t?"直播中":"返回直播")},e.prototype.handleClick=function(t){this.player().Dvr().seekToLive()},e}(Button$4);LiveButton.prototype.controlText_="返回直播",videojs.registerComponent("LiveButton",LiveButton);var Plugin$4=videojs.getPlugin("plugin"),Dvr=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));i.isInit=!1,i.options=r;var o=i;return n.ready(function(){var t=n.tech(!0);t&&t.hlsProvider&&n.one("loadedmetadata",function(e){t.el_.setAttribute("poster",""),o.init(),o.options.liveURL&&o.seekToLive()})}),i}return inherits(e,t),e.prototype.init=function(){var t=this.player,e=t.tech(!0).hlsProvider;if(this.parseM3u8(e.manifests[0]),!this.dvrData.startTime&&!this.isInit)return void t.one("loadedmetadata",videojs.bind(this,function(t){this.init()}));this.initControl(),this.delay=getParams("delay",t.tech_.currentSource_.src)||0,this.updateControl(!this.isLive()),t.on("loadedmetadata",videojs.bind(this,function(){this.parseM3u8(e.manifests[0]),this.delay=getParams("delay",t.tech_.currentSource_.src)||0,this.updateControl()})),this.isInit=!0},e.prototype.initControl=function(){var t=this.player;t.addClass("vjs-dvr"),t.controlBar.getChild("ProgressControl").hide(),t.controlBar.getChild("LiveDisplay").hide(),t.controlBar.addChild("DvrProgressControl",{},5),t.controlBar.addChild("liveButton",{},6)},e.prototype.updateControl=function(t){var e=this.player,n=e.controlBar.getChild("ProgressControl"),r=e.controlBar.getChild("LiveDisplay"),i=e.controlBar.getChild("DvrProgressControl"),o=e.controlBar.getChild("LiveButton");e.toggleClass("vjs-dvr-live",this.isLive()),o.updateControlText(this.isLive()),t&&i.update(1-this.delay/this.dvrData.maxTimeShift),this.dvrData.startTime?(i.show(),o.show(),n.hide(),r.hide()):(i.hide(),o.hide(),n.show(),r.show())},e.prototype.seekToLive=function(){this.isLive()||(this.timeShift(1),this.player.trigger({type:"seekToLive",data:1}))},e.prototype.isLive=function(){return!(this.delay>0)},e.prototype.timeShift=function(t){var e=this.player,n=(e.getChild("ControlBar").getChild("LiveButton"),e.tech_.currentSource_),r=Math.floor(this.dvrData.maxTimeShift*(1-t));this.delay=r,0==r&&this.options.liveURL?e.src(this.options.liveURL):(n.src=(this.options.shiftURL||n.src).replace(/delay=*(\d+)/,"delay="+r),e.src(e.tech_.currentSource_.src)),e.bigPlayButton.hide(),e.posterImage.hide(),e.tech_.one("hlsManifestParsed",videojs.bind(this,function(){e.play()}))},e.prototype.parseM3u8=function(t){this.dvrData={};for(var e=new RegExp([/#EXT-TX-TS-START-TIME:*(.+)/.source,/|#EXT-TX-TS-DURATION:*(.+)/.source].join(""),"g"),n=void 0;null!==(n=e.exec(t));)n[1]?this.dvrData.startTime=n[1]:n[2]&&(this.dvrData.duration=n[2]);this.dvrData.startTime&&(this.dvrData.maxTimeShift=Math.min(Math.floor((new Date).getTime()/1e3-this.dvrData.startTime),this.dvrData.duration))},e}(Plugin$4);videojs.registerPlugin("Dvr",Dvr);var Component$12=videojs.getComponent("Component"),LiveProgressControl=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.on("mousemove",i.handleMouseMove),i.on("mouseup",i.handleMouseUp),i.on("loadedmetadata",i.handleInit),i}return inherits(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control tcp-live-progress-control"})},e.prototype.update=function(t){this.getChild("LiveSeekBar").update(t)},e.prototype.handleInit=function(){"dvrLive"!==this.player.dvrMode()?this.hide():(this.player.removeClass("vjs-live"),this.show(),player.controlBar.currentTimeDisplay.show())},e.prototype.handleMouseMove=function(t){var e=this.getChild("LiveSeekBar"),n=e.calculateDistance(t),r=e.getChild("LiveMouseTimeDisplay");r&&r.update(videojs.dom.getBoundingClientRect(e.el()),n)},e.prototype.handleMouseUp=function(t){this.getChild("LiveSeekBar").handleMouseUp(t)},e}(Component$12);LiveProgressControl.prototype.options_={children:["LiveSeekBar"]},videojs.registerComponent("LiveProgressControl",LiveProgressControl);var Slider$3=videojs.getComponent("Slider"),LiveSeekBar=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.percent_=1,i.update=throttle_1(videojs.bind(i,i.update),50),i.on(n,"timeupdate",i.update),i}return inherits(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},e.prototype.update=function(t){t!=undefined&&(this.percent_=t,this.bar.update(videojs.dom.getBoundingClientRect(this.el_),t),this.updateAriaAttributes(t))},e.prototype.handleMouseDown=function(e){t.prototype.handleMouseDown.call(this,e),this.isMouseDown=!0},e.prototype.handleMouseMove=function(t){var e=this.calculateDistance(t);this.update(e)},e.prototype.handleMouseUp=function(e){t.prototype.handleMouseUp.call(this);var n=this.calculateDistance(e);this.update(n),this.player().LiveDvr().timeShift(n)},e.prototype.stepBack=function(){},e.prototype.stepForward=function(){},e.prototype.updateAriaAttributes=function(t){this.el().setAttribute("aria-valuenow",(100*t).toFixed(2))},e.prototype.getPercent=function(){return this.percent_},e}(Slider$3);LiveSeekBar.prototype.options_={children:["LiveMouseTimeDisplay","LiveTimeShiftBar"],barName:"LiveTimeShiftBar"},videojs.registerComponent("LiveSeekBar",LiveSeekBar);var LiveTimeShiftBar=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.el_.style.width="100%",i}return inherits(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar tcp-dvr-time-shift tcp-live-time-shift",innerHTML:'<span class="vjs-control-text"><span>'+this.localize("Progress")+"</span>: 100%</span>"})},e.prototype.update=function(t,e){var n=(100*e).toFixed(2)+"%";this.el_.style.width=n},e}(Component$12);videojs.registerComponent("LiveTimeShiftBar",LiveTimeShiftBar);var MouseTimeDisplay$3=videojs.getComponent("MouseTimeDisplay"),LiveMouseTimeDisplay=function(t){function e(){return classCallCheck(this,e),possibleConstructorReturn(this,t.apply(this,arguments))}return inherits(e,t),e.prototype.update=function(t,e){var n=this;this.rafId_&&this.cancelAnimationFrame(this.rafId_),this.rafId_=this.requestAnimationFrame(function(){var r=n.player().VttThumbnail().liveDuration,i=videojs.formatTime(e*r,r);n.el_.style.left=t.width*e+"px",n.getChild("timeTooltip").update(t,e,i)})},e}(MouseTimeDisplay$3);videojs.registerComponent("LiveMouseTimeDisplay",LiveMouseTimeDisplay);var Button$5=videojs.getComponent("Button"),LiveButton$1=function(t){function e(){return classCallCheck(this,e),possibleConstructorReturn(this,t.apply(this,arguments))}return inherits(e,t),e.prototype.createEl=function(){var t=Button$5.prototype.createEl.call(this,"button",{className:"vjs-live-control vjs-control"});return this.contentEl_=videojs.dom.createEl("div",{className:"vjs-live-display",innerHTML:this.localize("LIVE")},{"aria-live":"off"}),t.appendChild(this.contentEl_),t},e.prototype.update=function(){},e.prototype.updateControlText=function(t){this.controlText(t?"直播中":"返回直播")},e.prototype.handleClick=function(t){this.player().LiveDvr().seekToLive()},e}(Button$5);LiveButton$1.prototype.controlText_="返回直播",videojs.registerComponent("LiveButton",LiveButton$1);var LARGE_ARRAY_SIZE=200,defineProperty$1=function(){try{var t=_getNative(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),_defineProperty=defineProperty$1,_baseAssignValue=baseAssignValue,objectProto$5=Object.prototype,hasOwnProperty$6=objectProto$5.hasOwnProperty,_assignValue=assignValue,argsTag$1="[object Arguments]",_baseIsArguments=baseIsArguments,objectProto$7=Object.prototype,hasOwnProperty$8=objectProto$7.hasOwnProperty,propertyIsEnumerable=objectProto$7.propertyIsEnumerable,isArguments=_baseIsArguments(function(){return arguments}())?_baseIsArguments:function(t){return isObjectLike_1(t)&&hasOwnProperty$8.call(t,"callee")&&!propertyIsEnumerable.call(t,"callee")},stubFalse_1=stubFalse,isBuffer_1=createCommonjsModule(function(t,e){var n=e&&!e.nodeType&&e,r=n&&!0&&t&&!t.nodeType&&t,i=r&&r.exports===n,o=i?_root.Buffer:undefined,s=o?o.isBuffer:undefined,a=s||stubFalse_1;t.exports=a}),MAX_SAFE_INTEGER$1=9007199254740991,isLength_1=isLength,argsTag$2="[object Arguments]",arrayTag$1="[object Array]",boolTag$1="[object Boolean]",dateTag$1="[object Date]",errorTag$1="[object Error]",funcTag$2="[object Function]",mapTag$1="[object Map]",numberTag$1="[object Number]",objectTag$1="[object Object]",regexpTag$1="[object RegExp]",setTag$1="[object Set]",stringTag$1="[object String]",weakMapTag$1="[object WeakMap]",arrayBufferTag$1="[object ArrayBuffer]",dataViewTag$1="[object DataView]",float32Tag$1="[object Float32Array]",float64Tag$1="[object Float64Array]",int8Tag$1="[object Int8Array]",int16Tag$1="[object Int16Array]",int32Tag$1="[object Int32Array]",uint8Tag$1="[object Uint8Array]",uint8ClampedTag$1="[object Uint8ClampedArray]",uint16Tag$1="[object Uint16Array]",uint32Tag$1="[object Uint32Array]",typedArrayTags={};typedArrayTags[float32Tag$1]=typedArrayTags[float64Tag$1]=typedArrayTags[int8Tag$1]=typedArrayTags[int16Tag$1]=typedArrayTags[int32Tag$1]=typedArrayTags[uint8Tag$1]=typedArrayTags[uint8ClampedTag$1]=typedArrayTags[uint16Tag$1]=typedArrayTags[uint32Tag$1]=!0,typedArrayTags[argsTag$2]=typedArrayTags[arrayTag$1]=typedArrayTags[arrayBufferTag$1]=typedArrayTags[boolTag$1]=typedArrayTags[dataViewTag$1]=typedArrayTags[dateTag$1]=typedArrayTags[errorTag$1]=typedArrayTags[funcTag$2]=typedArrayTags[mapTag$1]=typedArrayTags[numberTag$1]=typedArrayTags[objectTag$1]=typedArrayTags[regexpTag$1]=typedArrayTags[setTag$1]=typedArrayTags[stringTag$1]=typedArrayTags[weakMapTag$1]=!1;var _baseIsTypedArray=baseIsTypedArray,_baseUnary=baseUnary,_nodeUtil=createCommonjsModule(function(t,e){var n=e&&!e.nodeType&&e,r=n&&!0&&t&&!t.nodeType&&t,i=r&&r.exports===n,o=i&&_freeGlobal.process,s=function(){try{var t=r&&r.require&&r.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(e){}}();t.exports=s}),nodeIsTypedArray=_nodeUtil&&_nodeUtil.isTypedArray,isTypedArray=nodeIsTypedArray?_baseUnary(nodeIsTypedArray):_baseIsTypedArray,_overArg=overArg,nativeKeys=_overArg(Object.keys,Object),_cloneBuffer=createCommonjsModule(function(t,e){function n(t,e){if(e)return t.slice();var n=t.length,r=a?a(n):new t.constructor(n);return t.copy(r),r}var r=e&&!e.nodeType&&e,i=r&&!0&&t&&!t.nodeType&&t,o=i&&i.exports===r,s=o?_root.Buffer:undefined,a=s?s.allocUnsafe:undefined;t.exports=n}),getPrototype=_overArg(Object.getPrototypeOf,Object),DataView$1=_getNative(_root,"DataView"),_DataView=DataView$1,Promise$1=_getNative(_root,"Promise"),_Promise=Promise$1,Set=_getNative(_root,"Set"),_Set=Set,WeakMap=_getNative(_root,"WeakMap"),_WeakMap=WeakMap,mapTag$2="[object Map]",promiseTag="[object Promise]",setTag$2="[object Set]",weakMapTag$2="[object WeakMap]",dataViewTag$2="[object DataView]",dataViewCtorString=_toSource(_DataView),mapCtorString=_toSource(_Map),promiseCtorString=_toSource(_Promise),setCtorString=_toSource(_Set),weakMapCtorString=_toSource(_WeakMap),getTag=_baseGetTag;(_DataView&&getTag(new _DataView(new ArrayBuffer(1)))!=dataViewTag$2||_Map&&getTag(new _Map)!=mapTag$2||_Promise&&getTag(_Promise.resolve())!=promiseTag||_Set&&getTag(new _Set)!=setTag$2||_WeakMap&&getTag(new _WeakMap)!=weakMapTag$2)&&(getTag=function(t){var e=_baseGetTag(t),n="[object Object]"==e?t.constructor:undefined,r=n?_toSource(n):"";if(r)switch(r){case dataViewCtorString:return dataViewTag$2;case mapCtorString:return mapTag$2;case promiseCtorString:return promiseTag;case setCtorString:return setTag$2;case weakMapCtorString:return weakMapTag$2}return e});var _getTag=getTag,mapTag$4="[object Map]",_baseIsMap=baseIsMap,nodeIsMap=_nodeUtil&&_nodeUtil.isMap,isMap=nodeIsMap?_baseUnary(nodeIsMap):_baseIsMap,setTag$4="[object Set]",_baseIsSet=baseIsSet,nodeIsSet=_nodeUtil&&_nodeUtil.isSet,isSet=nodeIsSet?_baseUnary(nodeIsSet):_baseIsSet,Plugin$5=videojs.getPlugin("plugin"),LiveDvr=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));i.isInit=!1,i.options=r;var o=i;return n.ready(function(){var t=n.tech(!0),e=t&&t.hlsProvider,r=t&&t.webrtcProvider;(e||r)&&n.one("loadedmetadata",function(e){t.el_.setAttribute("poster",""),o.init()})}),i}return inherits(e,t),e.prototype.init=function(){var t=this,e=this.player;e.on("loadedmetadata",function(){t.durationTimer&&clearInterval(t.durationTimer);var n=e.dvrMode();"dvrLive"===n&&(e.controlBar.getChild("ProgressControl").hide(),e.controlBar.getChild("LiveProgressControl")?e.controlBar.getChild("LiveProgressControl").show():e.controlBar.addChild("LiveProgressControl",{},5),e.controlBar.PDTDisplay.hide(),e.removeClass("vjs-live"),e.addClass("vjs-live-dvr")),"dvrEvent"===n&&(e.controlBar.getChild("ProgressControl").show(),e.controlBar.getChild("LiveProgressControl",{},5).hide(),e.controlBar.PDTDisplay.show(),e.removeClass("vjs-live"),e.removeClass("vjs-live-dvr"))});var n=setInterval(function(){t.liveDuration=e.VttThumbnail().liveDuration,t.liveDuration&&(t.initControl(),t.isInit=!0,clearInterval(n))},500)},e.prototype.initControl=function(){var t=this.player;"dvrLive"===t.dvrMode()&&(t.removeClass("vjs-live"),t.addClass("vjs-live-dvr"),t.controlBar.getChild("ProgressControl").hide(),t.controlBar.getChild("LiveDisplay").hide(),t.controlBar.addChild("LiveProgressControl",{},5),t.controlBar.playbackRateMenuButton.hide(),t.controlBar.durationDisplay.hide(),t.controlBar.timeDivider.hide(),t.controlBar.currentTimeDisplay.show())},e.prototype.timeShift=function(t){var e=this.player,n=e.tech_.currentSource_;if(100===t&&this.options.liveURL){e.src(this.options.liveURL);try{e.controlBar.getChild("LiveProgressControl").LiveSeekBar.LiveTimeShiftBar.el_.style.width="100%"}catch(r){}}else n.src=this.options.shiftURL,e.src(e.tech_.currentSource_.src),e.one("loadedmetadata",function(){var n=e.duration()*t;e.currentTime(n)});e.bigPlayButton.hide(),e.posterImage.hide(),e.tech_.one("hlsManifestParsed",videojs.bind(this,function(){e.play()}))},e}(Plugin$5);videojs.registerPlugin("LiveDvr",LiveDvr);var Menu$4=videojs.getComponent("Menu"),QualitySwitcherMenu=function(t){function e(){return classCallCheck(this,e),possibleConstructorReturn(this,t.apply(this,arguments))}return inherits(e,t),e.prototype.addItem=function(e){t.prototype.addItem.call(this,e)},e}(Menu$4),MenuItem$6=videojs.getComponent("MenuItem"),QualitySwitcherMenuItem=function(t){function e(n,r){return classCallCheck(this,e),possibleConstructorReturn(this,t.call(this,n,r))}return inherits(e,t),e.prototype.handleClick=function(e){if(t.prototype.handleClick.call(this,e),this.updateItems(),this.options_.callback(this.options_),"video"==this.options_.trackType){var n=this.player().controlBar.getChild(this.options_.trackType+"QualitySwitcherMenuButton");n.updateLabel(this.options_),n.unpressButton()}},e.prototype.updateItems=function(){for(var t=this.player().controlBar.getChild(this.options_.trackType+"QualitySwitcherMenuButton"),e=t.getChild(this.options_.trackType+"QualitySwitcherMenu"),n=e.children(),r=0;r<n.length;r++){var i=n[r];this!==i?(i.selected(!1),i.options_.selected=!1):i.options_.selected=!0}},e}(MenuItem$6),MenuButton$2=videojs.getComponent("MenuButton"),Menu$3=videojs.getComponent("Menu"),QualitySwitcherMenuButton=function(t){function e(){return classCallCheck(this,e),possibleConstructorReturn(this,t.apply(this,arguments))}return inherits(e,t),e.prototype.createEl=function(){var e=t.prototype.createEl.call(this);return this.labelEl_=videojs.dom.createEl("div",{className:"tcp-quality-switcher-value",innerHTML:""}),e.appendChild(this.labelEl_),e},e.prototype.createMenu=function(){for(var t=this.options_.qualityList,e=new QualitySwitcherMenu(this.player(),{name:this.options_.trackType+"QualitySwitcherMenu"}),n=void 0,r=t.length-1;r>-1;r--){var i=t[r];n=videojs.mergeOptions(i,{trackType:this.options_.trackType,callback:this.options_.callback,selectable:!0}),e.addItem(new QualitySwitcherMenuItem(this.player(),n)),i.selected&&this.updateLabel(i)}return e},e.prototype.updateLabel=function(t){this.labelEl_.innerHTML="<p>"+this.localize(t.label)+"</p>"},e}(MenuButton$2),Plugin$6=videojs.getPlugin("plugin"),TRACK_TYPES=["video","audio","subtitle"],TRACK_CLASS={video:"tcp-video-quality-switcher",audio:"tcp-audio-quality-switcher",subtitle:"tcp-subtitle-quality-switcher"},log$4=videojs.log,QualitySwitcher=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return i.options=r,n.on("qualitydataloaded",videojs.bind(i,i.init)),i}return inherits(e,t),e.prototype.init=function(t){log$4("QualitySwitcher initializing",t);var e=this.player,n=t.data.qualityData,r=t.data.callbacks;if(this.setOptions({qualityData:n,callbacks:r}),!e.controlBar)return void log$4("QualitySwitcher can not initialize without control bar");for(var i=0;i<TRACK_TYPES.length;i++){var o=TRACK_TYPES[i],s=o+"QualitySwitcherMenuButton",a=e.controlBar.getChild(s);n[o]&&n[o].length>0&&e.controlBar.options_.QualitySwitcherMenuButton&&(a&&a.el()&&(a.dispose(),e.controlBar.removeChild(a)),this.repleaceLabel(o,n),a=new QualitySwitcherMenuButton(e,{name:s,qualityList:n[o],callback:r[o],trackType:o}),a.addClass(TRACK_CLASS[o]),e.controlBar.addChild(a,{},10))}log$4("QualitySwitcher initialized",t,this)},e.prototype.setOptions=function(t){this.options=videojs.mergeOptions(this.options,t)},e.prototype.setVideoQuality=function(t){if(this.options.qualityData&&this.options.callbacks.video){for(var e=this.options.qualityData.video,n=0;n<e.length;n++)e[n].selected&&(e[n].selected=!1),e[n].id===t.id&&(e[n].selected=!0);this.options.callbacks.video(t)}},e.prototype.getVideoQualityData=function(){return this.options.qualityData?this.options.qualityData.video:undefined},e.prototype.repleaceLabel=function(t,e){if(this.options.qualityLabelList){var n=this.options.qualityLabelList[t],r=e[t];if(r&&r.length>0&&n&&n.length>0)for(var i=0;i<r.length;i++){var o=r[i].label;o=o.slice(0,o.length-1);for(var s=0;s<n.length;s++)if(n[s].height==o){r[i].label=n[s].resolutionName;break}}}},e.prototype.reset=function(){for(var t=this.player,e=0;e<TRACK_TYPES.length;e++){var n=TRACK_TYPES[e],r=t.controlBar&&t.controlBar.getChild(n+"QualitySwitcherMenuButton");r&&r.el()&&(r.dispose(),t.controlBar.removeChild(r))}},e}(Plugin$6);videojs.registerPlugin("QualitySwitcher",QualitySwitcher);var Plugin$7=videojs.getPlugin("plugin"),log$5=videojs.log,defaultOptions={labels:{FLU:"流畅",SD:"标清",HD:"高清",FHD:"超清"},showOrder:["FLU","SD","HD","FHD"],defaultRes:"SD"},MultiResolution=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return i.options=r,r.useManualOption&&(i.manualOptions=extend({},r)),i.hasInit=!1,n.on("multiresolutionchange",videojs.bind(i,function(t){t.data&&this.update(data)})),n.on(["resolutionswitching","resolutionswitched"],videojs.bind(i,function(t){"resolutionswitching"==t.type?this.player.addClass("tcp-res-switching"):this.player.removeClass("tcp-res-switching")})),n.ready(videojs.bind(i,function(){var t=n.tech(!0);t&&(t.on("masterplaylistchange",videojs.bind(this,this.onMasterPlaylistChange)),t.on("hlsresolutionswitching",videojs.bind(this,this.onHlsLevelChange)),t.on("hlsresolutionswitched",videojs.bind(this,this.onHlsLevelChange)),t.on("dashqualityswitching",videojs.bind(this,this.onDashQualityChange)),t.on("dashqualityswitched",videojs.bind(this,this.onDashQualityChange))),this.hasInit=!0})),i.init(i.player.options_.multiResolution),i}return inherits(e,t),e.prototype.init=function(t){var e={};this.player.options_.label&&(e.label=this.player.options_.label),this.player.options_.labels&&(e.labels=this.player.options_.label),this.player.options_.showOrder&&(e.showOrder=this.player.options_.showOrder),this.player.options_.defaultRes&&(e.defaultRes=this.player.options_.defaultRes);var n=this.player,r=extend({},defaultOptions,t,this.manualOptions,e),i=r&&r.sources;if(this.options=r,i){log$5("MultiResolution initializing",r);var o=void 0;if(this.currentID=r.defaultRes=i[r.defaultRes]?r.defaultRes:Object.keys(i).shift(),o=i[this.currentID],"mediaLoader"!=n.options_.children[0]||this.hasInit)n.src(o);else{var s;(s=n.options_.sources).push.apply(s,o)}this.hasInit||(this.hasInit=!0),n.ready(videojs.bind(this,function(){n.trigger({type:"qualitydataloaded",data:this.initQualityData(r)}),n.one("loadedmetadata",function(){var t=this.tech(!0);"flash"!=t.name_&&t.el_.getAttribute("poster")&&(t.el_.removeAttribute("poster"),delete t.el_.poster)})})),log$5("MultiResolution initialized")}},e.prototype.reset=function(){this.player.QualitySwitcher().reset()},e.prototype.update=function(t){this.init(t)},e.prototype.store=function(t){if(!t)return this.options;this.options=videojs.mergeOptions(defaultOptions,this.options,t)},e.prototype.onMasterPlaylistChange=function(t){this.player.trigger({type:"qualitydataloaded",data:t.data})},e.prototype.onHlsLevelChange=function(t){"hlsresolutionswitching"==t.type?this.player.trigger({type:"resolutionswitching",data:t.data}):"hlsresolutionswitched"==t.type&&this.player.trigger({type:"resolutionswitched",data:t.data})},e.prototype.onDashQualityChange=function(t){"dashqualityswitching"==t.type?this.player.trigger({type:"resolutionswitching",data:t.data}):"dashqualityswitched"==t.type&&this.player.trigger({type:"resolutionswitched",data:t.data})},e.prototype.switchResolution=function(t){if(this.currentID!=t.id){var e=this.player,n=e.currentTime(),r=(e.paused(),Infinity===e.duration());if(e.trigger({type:"resolutionswitching",data:t}),r)e.bigPlayButton&&e.bigPlayButton.hide(),e.posterImage&&e.posterImage.hide(),e.one("loadstart",function(){e.play(),e.trigger({type:"resolutionswitched",data:t})});else{var i=e.ended(),o=e.playbackRate(),s=e.controlBar&&e.controlBar.progressControl&&e.controlBar.progressControl.seekBar.playProgressBar.el().style.width||0,a=videojs.browser.IS_IOS||videojs.browser.IS_ANDROID?"loadeddata":"loadedmetadata";e.one(a,function(){e.controlBar&&e.controlBar.progressControl&&(e.controlBar.progressControl.seekBar.playProgressBar.el().style.width=s),i||e.currentTime(n),"Flash"==e.techName_?(e.play(),e.tech(!0).trigger("seeked")):(e.play(),e.playbackRate()!=o&&e.playbackRate(o)),e.trigger({type:"resolutionswitched",data:t})}),e.bigPlayButton&&e.bigPlayButton.hide(),e.posterImage&&e.posterImage.hide(),"none"==e.options_.preload&&e.one("suspend",function(){e.load()})}e.src(this.options.sources[t.id]),r&&setTimeout(function(){e.play(),setTimeout(function(){e.play()},900)},100),this.currentID=t.id}},e.prototype.initQualityData=function(t){var e=[],n=(t.sources,t.labels),r=t.showOrder;return r.length>0&&r.forEach(function(r,i){var o={};o.id=r,o.selected=t.defaultRes===r,o.label=n[r]||r,e.push(o)}),{qualityData:{video:e},callbacks:{video:videojs.bind(this,this.switchResolution)}}},e.prototype.sortSourceOrder=function(t){return[]},e}(Plugin$7);videojs.registerPlugin("MultiResolution",MultiResolution);var FlashObj=videojs.getComponent("Flash"),defaultDismiss=!videojs.browser.IS_IPHONE,registerPlugin=videojs.registerPlugin||videojs.plugin,defaults$1={header:"",code:"",message:"",timeout:45e3,dismiss:defaultDismiss,progressDisabled:!1,errors:{1:{type:"MEDIA_ERR_ABORTED"},2:{type:"MEDIA_ERR_NETWORK"},3:{type:"MEDIA_ERR_DECODE"},4:{type:"MEDIA_ERR_SRC_NOT_SUPPORTED"},5:{type:"MEDIA_ERR_ENCRYPTED"},unknown:{type:"MEDIA_ERR_UNKNOWN"},"-1":{type:"PLAYER_ERR_NO_SRC",message:"No video has been loaded."},"-2":{type:"PLAYER_ERR_TIMEOUT",message:"Could not download the video."},10:{type:"SERVER_ERR",message:"Request timed out."},11:{type:"SERVER_ERR",message:"Server is not respond."},12:{type:"DATA_ERR",message:"Server respond error data."},13:{type:"DATA_ERR",message:"No video transcoding information found."},14:{type:"HLS_NETWORK_ERR",message:"A network error caused the media download to fail part-way."},15:{type:"HLS_MEDIA_ERR",message:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support."},16:{type:"HLS_MUX_ERR",message:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support."},17:{type:"HLS_OTHER_ERR",message:"Rise an internal exception when playing HLS."},18:{type:"DRM_ERR",message:"Current browser not support DRM."},20:{type:"PERMISSION_ERR",message:"This website needs a permission to access device motion."},21:{type:"PERMISSION_ERR",message:"This website needs a permission to access device motion."},50:{type:"LICENSE_ERR",message:"License verification failed."},51:{type:"LICENSE_ERR",message:"The license has expired."},52:{type:"LICENSE_ERR",message:"Domain verification failed."},53:{type:"LICENSE_ERR",message:"Time verification failed."},54:{type:"LICENSE_ERR",message:"License type error."},55:{type:"LICENSE_ERR",message:"Lack license url."},56:{type:"LICENSE_ERR",message:"Get license data failed."},60:{type:"SAFECHECK_ERR",message:"Elements check failed."},61:{type:"SAFECHECK_ERR",message:"API check failed."},62:{type:"SAFECHECK_ERR",message:"Environment check failed."},403:{type:"SERVER_ERR",message:"Authentication failed."},500:{type:"SERVER_ERR",message:"Server failed."},1001:{type:"SERVER_ERR",message:"The media file does not exist. Please check if the fileID is correct."},1002:{type:"SERVER_ERR",message:"The trial duration is illegal. The trial duration must be within the video duration."},1003:{type:"SERVER_ERR",message:"Param pcfg is not unique."},1004:{type:"SERVER_ERR",message:"The license has expired. Please check whether the expiration time setting is reasonable."},1005:{type:"SERVER_ERR",message:"Did not find an adaptive stream that can be played."},1006:{type:"SERVER_ERR",message:"Invalid request format, please check the request format."},1007:{type:"SERVER_ERR",message:"AppID is not exist, Please check if the AppID is correct."},1008:{type:"SERVER_ERR",message:"Without anti-leech information."},1009:{type:"SERVER_ERR",message:"psign check failed."},1010:{type:"SERVER_ERR",message:"Other errors."},1011:{type:"SERVER_ERR",message:"Get DRM license url failed"},1012:{type:"SERVER_ERR",message:"Get DRM certificate url failed"},1013:{type:"SERVER_ERR",message:"Psign missing contentInfo error"},1014:{type:"SERVER_ERR",message:"Psign contentInfo.audioVideoType invalid"},1015:{type:"SERVER_ERR",message:"Psign missing rawAdaptiveDefinition error"},1016:{type:"SERVER_ERR",message:"Psign missing drmAdaptiveInfo error"},1017:{type:"SERVER_ERR",message:"Psign missing transcodeDefinition error"},1018:{type:"SERVER_ERR",message:"Psign contentInfo.ResolutionNames json marshal error"},1019:{type:"SERVER_ERR",message:"Get super player config error"},1020:{type:"SERVER_ERR",message:"Get play key info error"},1021:{type:"SERVER_ERR",message:"Qsign invalid"},1022:{type:"SERVER_ERR",message:"Ciphered overlay info invalid"},1023:{type:"SERVER_ERR",message:"Ghost watermark info text is too long"},2001:{type:"SERVER_ERR",message:"System error"},2002:{type:"SERVER_ERR",message:"Panic error"},19:{type:"DATA_ERR",message:"Response data verification failed."},10008:{type:"SERVER_ERR",message:"The media file does not exist. Please check if the fileID is correct."},"-2001":{type:"SERVER_ERR",message:"Current browser not support play this stream, please select another one."},"-2002":{type:"SERVER_ERR",message:"Server respond error data.(eg. stream not exist)"},"-2003":{type:"SERVER_ERR",message:"Video play failed, please refresh to start play again."},"-2004":{type:"SERVER_ERR",message:"Connection to the server has failed and the number of connection retries has exceeded the set value."},"-2005":{type:"SERVER_ERR",message:"Video decoding failure."},PLAYER_ERR_DOMAIN_RESTRICTED:{message:"This video is restricted from playing on your current domain."},PLAYER_ERR_IP_RESTRICTED:{message:"This video is restricted at your current IP address."},PLAYER_ERR_GEO_RESTRICTED:{message:"This video is restricted from playing in your current geographic region."}}},initPlugin=function e(t,n){var r=void 0,i=void 0,o=void 0,s=[];videojs.getComponent("ErrorDisplay").prototype.options_.fillAlways=!1;var a=function(t){n.errors=videojs.mergeOptions(n.errors,t),Object.keys(n.errors).forEach(function(t){var e=n.errors[t];e.type||(e.type=t)})};a();var l=function(){t.clearTimeout(i),o&&(o=!1,t.removeClass("vjs-waiting")),i=t.setTimeout(function(){t.error()||t.paused()||t.ended()||(o=!0,t.addClass("vjs-waiting"))},1e3),t.clearTimeout(r),r=t.setTimeout(function(){t.error()||t.paused()||t.ended()||t.error({code:-2,type:"PLAYER_ERR_TIMEOUT"})},n.timeout),t.error()&&-2===t.error().code&&t.error(null)},c=function(){for(var e=void 0;s.length;)e=s.shift(),t.off(e[0],e[1]);t.clearTimeout(r),t.clearTimeout(i)},u=function(e,n){var r=function(){if(!t.error()){var e=t.$(".vjs-tech");if(e&&"application/x-shockwave-flash"===e.type&&!e.vjs_getProperty)return void t.error({code:-2,type:"PLAYER_ERR_TIMEOUT"});if(t.paused())return l();if(t.ended())return l()}n.call(this)};t.on(e,r),
18
- s.push([e,r])},h=function(){var e=0;c(),l(),u(["timeupdate","adtimeupdate"],function(){var n=t.currentTime();n!==e&&(e=n,l())}),n.progressDisabled||u("progress",l)},p=function(e){var r="",i=t.error(),o=document_1.createElement("div"),s="";if(i){i=videojs.mergeOptions(i,n.errors[i.code||0]),i.message&&(r='<div class="vjs-errors-message">'+t.localize(i.message)+"</div>"),i.code&&(r+='<div class="vjs-errors-code">'+this.localize("Error Code")+" : "+i.code+"</div>"),i.type&&(r+='<div class="vjs-errors-type">'+this.localize("Error Type")+" : "+i.type+"</div>"),"10"==i.code||i.code,i.code,i.code,o.className="vjs-errors-dialog",s='<div class="vjs-errors-content-container">\n '+r+"\n </div>";var a=t.getChild("errorDisplay");a&&a.closeable(!("dismiss"in i)||i.dismiss)?(o.innerHTML=s,a.fillWith(o),a.contentEl().firstChild.appendChild(a.getChild("closeButton").el())):(o.innerHTML=s,a.fillWith(o)),a.one("modalclose",function(){return t.error(null)})}},d=function g(){c(),t.removeClass("vjs-errors"),t.off("dispose",g),t.off(["aderror","error"],p)},f=function(n){d(),e(t,videojs.mergeOptions(defaults$1,n))};f.extend=function(t){return a(t)},f.getAll=function(){return videojs.mergeOptions(n.errors)},f.disableProgress=function(t){n.progressDisabled=t,h()},t.on("dispose",d),t.on(["aderror","error"],p),t.ready(function(){t.addClass("vjs-errors")}),t.errors=f},errors=function(t){initPlugin(this,videojs.mergeOptions(defaults$1,t))};["extend","getAll","disableProgress"].forEach(function(t){errors[t]=function(){videojs.log.warn("The errors."+t+"() method is not available until the plugin has been initialized!")}}),registerPlugin("Errors",errors);var Plugin$8=videojs.getPlugin("plugin"),cgiSeq={},STATUS_CODE_REPORT_URL="//report.huatuo.qq.com/code.cgi",log$6=videojs.log,Reporter=function(t){function e(n,r){classCallCheck(this,e),log$6("Reporter initilaizing");var i=possibleConstructorReturn(this,t.call(this,n));if(!n.options_.plugins.Reporter){var o;return o=!1,possibleConstructorReturn(i,o)}return i.reportContent={status:"idle"},i.mtaReportCache=[],log$6("Reporter initilaized"),i}return inherits(e,t),e.prototype.setStorage=function(t,e){localStorage.setItem(t,e)},e.prototype.getStorage=function(t){localStorage.getItem(t)},e.prototype.sender=function(t){var e=new Image;e.onload=e.onerror=e.onabort=function(){e.onload=e.onerror=e.onabort=null,e=null},e.src=t},e.prototype.initPlayCgiCodeReport=function(){var t=this.player;t.on("playcgistart",videojs.bind(this,this.onPlayCgiStart)),t.on("playcgiend",videojs.bind(this,this.onPlayCgiEnd))},e.prototype.onPlayCgiStart=function(t){cgiSeq[t.data.time]=cgiSeq[t.data.time]||{},cgiSeq[t.data.time].startTime=t.data.time,cgiSeq[t.data.time].url=t.data.url},e.reportPlayMetrics=function(t,e){xhr.post("https://datacenter.live.qcloud.com",{body:JSON.stringify(t)},function(){e&&e()})},e.prototype.onPlayCgiEnd=function(t){if(cgiSeq[t.data.startTime]){var e=t.data,n=void 0,r=void 0,i=void 0;if(e.error)switch(r=2,e.error.message){case"Timeout":n=10;break;case"ServerError":n=11}else 0==e.result.code?(r=1,n=0):(r=3,n=e.result.code),i=e.result.requestId;this.reportPlayCgiToISD("","",r,n,t.data.time-cgiSeq[t.data.startTime].startTime,i,void 0,void 0)}},e.prototype.reportPlayCgiToISD=function(t,e,n,r,i,o,s,a){var l={domain:t||"playvideo.qcloud.com",cgi:e||"/getplayinfo/v2",type:n,code:r,time:i,appid:20370,platform:videojs.browser.IS_IOS?"ios":videojs.browser.IS_ANDROID?"android":"pc",expansion1:o,expansion2:s,expansion3:a};this.sender(unifyProtocol(STATUS_CODE_REPORT_URL)+"?"+serializeParams(l))},e.prototype.reportMTA=function(t,e){window.MtaH5?(this.mtaReportCache.length>0&&(this.mtaReportCache.forEach(function(t){t.call()}),this.mtaReportCache=0),MtaH5.clickStat(t,e)):this.mtaReportCache.push(function(){MtaH5.clickStat(t,e)})},e}(Plugin$8);videojs.registerPlugin("Reporter",Reporter);var store2=createCommonjsModule(function(t){!function(e,n){var r={version:"2.12.0",areas:{},apis:{},inherit:function(t,e){for(var n in t)e.hasOwnProperty(n)||Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n));return e},stringify:function(t){return t===undefined||"function"==typeof t?t+"":JSON.stringify(t)},parse:function(t,e){try{return JSON.parse(t,e||r.revive)}catch(n){return t}},fn:function(t,e){r.storeAPI[t]=e;for(var n in r.apis)r.apis[n][t]=e},get:function(t,e){return t.getItem(e)},set:function(t,e,n){t.setItem(e,n)},remove:function(t,e){t.removeItem(e)},key:function(t,e){return t.key(e)},length:function(t){return t.length},clear:function(t){t.clear()},Store:function(t,e,n){var i=r.inherit(r.storeAPI,function(t,e,n){return 0===arguments.length?i.getAll():"function"==typeof e?i.transact(t,e,n):e!==undefined?i.set(t,e,n):"string"==typeof t||"number"==typeof t?i.get(t):"function"==typeof t?i.each(t):t?i.setAll(t,e):i.clear()});i._id=t;try{e.setItem("__store2_test","ok"),i._area=e,e.removeItem("__store2_test")}catch(o){i._area=r.storage("fake")}return i._ns=n||"",r.areas[t]||(r.areas[t]=i._area),r.apis[i._ns+i._id]||(r.apis[i._ns+i._id]=i),i},storeAPI:{area:function(t,e){var n=this[t];return n&&n.area||(n=r.Store(t,e,this._ns),this[t]||(this[t]=n)),n},namespace:function(t,e){if(!t)return this._ns?this._ns.substring(0,this._ns.length-1):"";var n=t,i=this[n];if(!(i&&i.namespace||(i=r.Store(this._id,this._area,this._ns+n+"."),this[n]||(this[n]=i),e)))for(var o in r.areas)i.area(o,r.areas[o]);return i},isFake:function(){return"fake"===this._area.name},toString:function(){return"store"+(this._ns?"."+this.namespace():"")+"["+this._id+"]"},has:function(t){return this._area.has?this._area.has(this._in(t)):!!(this._in(t)in this._area)},size:function(){return this.keys().length},each:function(t,e){for(var n=0,i=r.length(this._area);n<i;n++){var o=this._out(r.key(this._area,n));if(o!==undefined&&!1===t.call(this,o,this.get(o),e))break;i>r.length(this._area)&&(i--,n--)}return e||this},keys:function(t){return this.each(function(t,e,n){n.push(t)},t||[])},get:function(t,e){var n,i=r.get(this._area,this._in(t));return"function"==typeof e&&(n=e,e=null),null!==i?r.parse(i,n):null!=e?e:i},getAll:function(t){return this.each(function(t,e,n){n[t]=e},t||{})},transact:function(t,e,n){var r=this.get(t,n),i=e(r);return this.set(t,i===undefined?r:i),this},set:function(t,e,n){var i=this.get(t);return null!=i&&!1===n?e:r.set(this._area,this._in(t),r.stringify(e),n)||i},setAll:function(t,e){var n,r;for(var i in t)r=t[i],this.set(i,r,e)!==r&&(n=!0);return n},add:function(t,e){var n=this.get(t);if(n instanceof Array)e=n.concat(e);else if(null!==n){var i=typeof n;if(i===typeof e&&"object"===i){for(var o in e)n[o]=e[o];e=n}else e=n+e}return r.set(this._area,this._in(t),r.stringify(e)),e},remove:function(t,e){var n=this.get(t,e);return r.remove(this._area,this._in(t)),n},clear:function(){return this._ns?this.each(function(t){r.remove(this._area,this._in(t))},1):r.clear(this._area),this},clearAll:function(){var t=this._area;for(var e in r.areas)r.areas.hasOwnProperty(e)&&(this._area=r.areas[e],this.clear());return this._area=t,this},_in:function(t){return"string"!=typeof t&&(t=r.stringify(t)),this._ns?this._ns+t:t},_out:function(t){return this._ns?t&&0===t.indexOf(this._ns)?t.substring(this._ns.length):undefined:t}},storage:function(t){return r.inherit(r.storageAPI,{items:{},name:t})},storageAPI:{length:0,has:function(t){return this.items.hasOwnProperty(t)},key:function(t){var e=0;for(var n in this.items)if(this.has(n)&&t===e++)return n},setItem:function(t,e){this.has(t)||this.length++,this.items[t]=e},removeItem:function(t){this.has(t)&&(delete this.items[t],this.length--)},getItem:function(t){return this.has(t)?this.items[t]:null},clear:function(){for(var t in this.items)this.removeItem(t)}}},i=r.Store("local",function(){try{return localStorage}catch(t){}}());i.local=i,i._=r,i.area("session",function(){try{return sessionStorage}catch(t){}}()),i.area("page",r.storage("page")),"function"==typeof n&&n.amd!==undefined?n("store2",[],function(){return i}):t.exports?t.exports=i:(e.store&&(r.conflict=e.store),e.store=i)}(commonjsGlobal,commonjsGlobal&&commonjsGlobal.define)}),Plugin$9=videojs.getPlugin("plugin"),log$7=videojs.log,ContinuePlay=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return i.options=r,i.init(),i}return inherits(e,t),e.prototype.init=function(t){var e=this.player,n=e.options_,r=void 0;e.off("timeupdate",videojs.bind(this,this.onTimeUpdate)),e.ready(videojs.bind(this,function(){r=n&&n.appID&&n.fileID?n.fileID:this.options.playID,this.playID=r,t&&t.src?this.source=t.src.split("?")[0]:e.cache_&&e.cache_.source&&e.cache_.source.src&&(this.source=e.cache_.source.src.split("?")[0]),(r||this.source)&&(log$7("ContinuePlay initializing"),this.lastTime=store2.get(this.getStoreKey()),e.off("timeupdate",videojs.bind(this,this.onTimeUpdate)),e.on("timeupdate",videojs.bind(this,this.onTimeUpdate)),e.one(this.getTriggerEvent(),videojs.bind(this,this.onPlay)),!this.options.auto&&e.getChild("ContinuePlayTips")&&e.getChild("ContinuePlayTips").close(),log$7("ContinuePlay initialized"),e.trigger({type:"feature",data:"continue"}))}))},e.prototype.onTimeUpdate=function(t){store2.set(this.getStoreKey(),this.player.currentTime())},e.prototype.onPlay=function(t){var e=this.player;Math.round(this.lastTime)>1&&this.player.duration()>1&&this.player.duration()!==Infinity&&Math.round(this.lastTime)!=Math.round(this.player.duration())?this.options.auto?this.start():e.addChild("ContinuePlayTips",videojs.mergeOptions(this.options,{time:this.lastTime,resumeCallback:videojs.bind(this,this.start)})):"Flash"==e.techName_&&Math.round(this.lastTime)>1&&Math.round(this.lastTime)!=Math.round(this.player.duration())&&this.player.duration()!==Infinity&&!this.player.duration()&&e.one("loadedmetadata",videojs.bind(this,this.onPlay))},e.prototype.start=function(){var t=this.player;t.currentTime(this.lastTime),"Flash"==t.techName_&&t.tech(!0).trigger("seeked"),t.trigger({type:"continueplay",data:{lastTime:this.lastTime}})},e.prototype.generatePlayID=function(){},e.prototype.getStoreKey=function(){return"tcplayer-lpt-"+(this.playID||this.source)},e.prototype.getTriggerEvent=function(){var t=this.player,e=t.options_;return e.autoplay&&"Flash"==t.techName_?"loadedmetadata":"playing"},e}(Plugin$9);videojs.registerPlugin("ContinuePlay",ContinuePlay);var defaults$2={align:"top-left",className:"",content:"",debug:!1,showBackground:!0,attachToControlBar:!1,overlays:[]},Component$13=videojs.getComponent("Component"),dom$1=videojs.dom||videojs,registerPlugin$1=videojs.registerPlugin||videojs.plugin,isNumber=function(t){return"number"==typeof t&&t===t},hasNoWhitespace=function(t){return"string"==typeof t&&/^\S+$/.test(t)},Overlay=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return["start","end"].forEach(function(t){var e=i.options_[t];if(isNumber(e))i[t+"Event_"]="timeupdate";else if(hasNoWhitespace(e))i[t+"Event_"]=e;else if("start"===t)throw new Error('invalid "start" option; expected number or string')}),["endListener_","rewindListener_","startListener_"].forEach(function(t){i[t]=function(n){return e.prototype[t].call(i,n)}}),"timeupdate"===i.startEvent_&&i.on(n,"timeupdate",i.rewindListener_),i.debug('created, listening to "'+i.startEvent_+'" for "start" and "'+(i.endEvent_||"nothing")+'" for "end"'),i.hide(),i}return inherits(e,t),e.prototype.createEl=function(){var t=this.options_,e=t.content,n=t.showBackground?"tcp-overlay-background":"tcp-overlay-no-background",r=dom$1.createEl("div",{className:"\n tcp-overlay\n tcp-overlay-"+t.align+"\n "+t.className+"\n "+n+"\n vjs-hidden\n "});return"string"==typeof e?r.innerHTML=e:videojs.browser.IS_IE8||e instanceof window_1.DocumentFragment?r.appendChild(e):dom$1.appendContent(r,e),r},e.prototype.debug=function(){if(this.options_.debug){for(var t=videojs.log,e=t,n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];t.hasOwnProperty(r[0])&&"function"==typeof t[r[0]]&&(e=t[r.shift()]),e.apply(undefined,["overlay#"+this.id()+": "].concat(r))}},e.prototype.hide=function(){return t.prototype.hide.call(this),this.debug("hidden"),this.debug('bound `startListener_` to "'+this.startEvent_+'"'),this.endEvent_&&(this.debug('unbound `endListener_` from "'+this.endEvent_+'"'),this.off(this.player(),this.endEvent_,this.endListener_)),this.options_.once?(videojs.browser.IS_IOS&&videojs.browser.IS_WECHAT?this.player().hasStarted()||this.player().ready(videojs.bind(this,function(){this.startListener_({type:this.startEvent_})})):this.player().hasStarted()||this.on(this.player(),this.startEvent_,this.startListener_),this):("pause"===this.startEvent_?this.on(this.player(),this.startEvent_,this.startOnPause_):this.on(this.player(),this.startEvent_,this.startListener_),this)},e.prototype.startOnPause_=function(t){var e=this.player();"pause"===t.type?e.seeking()||e.ended()||this.startListener_({type:"pause"}):e.paused()&&this.startListener_({type:"pause"})},e.prototype.shouldHide_=function(t,e){var n=this.options_.end;return isNumber(n)?t>=n:n===e},e.prototype.show=function(){return t.prototype.show.call(this),"pause"===this.startEvent_&&this.off(this.player(),this.startEvent_,this.startOnPause_),this.off(this.player(),this.startEvent_,this.startListener_),this.debug("shown"),this.debug('unbound `startListener_` from "'+this.startEvent_+'"'),this.endEvent_&&(this.debug('bound `endListener_` to "'+this.endEvent_+'"'),this.on(this.player(),this.endEvent_,this.endListener_)),this},e.prototype.shouldShow_=function(t,e){var n=this.options_.start,r=this.options_.end;return isNumber(n)?isNumber(r)?t>=n&&t<r:this.hasShownSinceSeek_?Math.floor(t)===n:(this.hasShownSinceSeek_=!0,t>=n):n===e},e.prototype.startListener_=function(t){var e=this.player().currentTime();this.shouldShow_(e,t.type)&&this.show()},e.prototype.endListener_=function(t){var e=this.player().currentTime();this.shouldHide_(e,t.type)&&this.hide()},e.prototype.rewindListener_=function(t){var e=this.player().currentTime(),n=this.previousTime_,r=this.options_.start,i=this.options_.end;e<n&&(this.debug("rewind detected"),isNumber(i)&&!this.shouldShow_(e)?(this.debug("hiding; "+i+" is an integer and overlay should not show at this time"),this.hasShownSinceSeek_=!1,this.hide()):hasNoWhitespace(i)&&e<r&&(this.debug("hiding; show point ("+r+") is before now ("+e+") and end point ("+i+") is an event"),this.hasShownSinceSeek_=!1,this.hide())),this.previousTime_=e},e}(Component$13);videojs.registerComponent("Overlay",Overlay);var plugin=function(t){var e=this,n=videojs.mergeOptions(defaults$2,t);Array.isArray(this.overlays_)&&this.overlays_.forEach(function(t){e.removeChild(t),e.controlBar&&e.controlBar.removeChild(t),t.dispose()});var r=n.overlays;delete n.overlays,this.overlays_=r.map(function(t){var r=videojs.mergeOptions(n,t);return r.attachToControlBar&&e.controlBar&&-1!==r.align.indexOf("bottom")?e.controlBar.addChild("overlay",r):e.addChild("overlay",r)})};registerPlugin$1("Patch",plugin);var Plugin$10=videojs.getPlugin("plugin"),log$8=videojs.log,locations=["start","pause","ended"],startEvent=["loadstart","pause","ended"],endEvent=["play","play","play"],ImagePatch=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.hasInit=!1,i.init(r),i}return inherits(e,t),e.prototype.init=function(t){var e=this,n=this.player,r={showBackground:!1,overlays:[]};Array.isArray(t)&&t.length>0&&(log$8("ImagePatch initializing"),t.forEach(function(t){var n=void 0,i=void 0,o=void 0,s=void 0,a=document.createDocumentFragment();o=document.createElement("a"),o.className="tcp-overlay-link",o.target="_blank",t.link&&(o.href=t.link),t.url&&(s=e.loadImg(unifyProtocol(t.url),videojs.bind(e,e.onImgLoaded)),s.className="tcp-overlay-img",o.appendChild(s),videojs.browser.IS_IE8?(n=document.createElement("div"),n.className="tcp-overlay-table",i=document.createElement("div"),i.className="tcp-overlay-cell",i.appendChild(o),n.appendChild(i),a.appendChild(n)):a.appendChild(o),r.overlays.push({content:a,className:"tcp-image-patch tcp-image-patch-"+locations[t.location],start:startEvent[t.location],end:endEvent[t.location],once:0==t.location,align:"center"}))}),r.overlays.length>0?(n.Patch(r),n.trigger({type:"feature",data:"patch"}),this.hasInit=!0):this.reset(),log$8("ImagePatch initialized"))},e.prototype.loadImg=function(t,e){var n,r,i,o,s,a=new Image;return a.src=t,a.complete?(e&&e.call(e,a),a):(r=a.width,i=a.height,a.onerror=function(){n.end=!0,a=a.onload=a.onerror=null},n=function(){o=a.width,s=a.height,(o!==r||s!==i||o*s>1024)&&(e&&e.call(e,a),n.end=!0)},n(),a.onload=function(){!n.end&&n(),a=a.onload=a.onerror=null},a)},e.prototype.onImgLoaded=function(t){if(videojs.browser.IE_VERSION){var e=parseInt(this.player.el().currentStyle.width),n=parseInt(this.player.el().currentStyle.height);if(t.width>e||t.height>n){var r=e/(t.width/t.height);t.width/t.height>e/n||(t.style.marginTop=(n-r)/2+"px"),t.style.width="100%",t.style.height="auto"}}},e.prototype.reset=function(){this.hasInit&&(log$8("ImagePatch reset"),this.player.Patch(),this.hasInit=!1)},e}(Plugin$10);videojs.registerPlugin("ImagePatch",ImagePatch);var Plugin$11=videojs.getPlugin("plugin"),log$9=videojs.log,ContextMenu=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return i.options=r,log$9("ContextMenu initializing"),i.init(),log$9("ContextMenu initialized"),i}return inherits(e,t),e.prototype.init=function(){this.player.addChild("RightClickPopupMenu",this.options)},e}(Plugin$11);videojs.registerPlugin("ContextMenu",ContextMenu);var Plugin$12=videojs.getPlugin("plugin"),LevelSwitch=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return i.options=r,i.init(),i}return inherits(e,t),e.prototype.init=function(){var t=this.player,e=t.options_.plugins.ContextMenu;e&&e.levelSwitch&&e.levelSwitch.open&&t.addChild("LevelSwitchTips",this.options)},e}(Plugin$12);videojs.registerPlugin("LevelSwitch",LevelSwitch);var getParams$2=getParams,Plugin$13=videojs.getPlugin("plugin"),log$11=videojs.log,defaults$3={width:0,height:0,basePath:""},VttThumbnail=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return i.hasInit=!1,i.spriteData=[],i.firstShowSprite=!0,(r.vttUrl||!0===r.enable)&&n.on("loadedmetadata",function(){i.getSpriteConfig(),i.init(r)}),i}return inherits(e,t),e.prototype.checkEventDvr=function(){var t=this.player.dvrMode();return!!this.player.src()&&("dvrLive"===t||"dvrEvent"===t)},e.prototype.loadTrackFile=function(t){var e=this,n=this.player,r=n.addRemoteTextTrack({src:t.vttUrl,kind:"metadata"},!0);r&&r.addEventListener("load",function(){e.trackInfo=r})},e.prototype.getSpriteConfig=function(){if(!this.checkEventDvr())return!1;var t=this,e=this.player;this.canGetNewSprite=!1;var n=e.src(),r=(getParams$2(n,"tsEnd"),parseInt((new Date).getTime()/1e3),get_1(e,"options_.plugins.Dvr.spriteURL")),i=get_1(e,"options_.plugins.Dvr.startTime"),o=r.indexOf("http://")>-1?"http://":"https://",s=r.replace("https://","").replace("http://","").split("/")[0];xhr({url:r,timeout:3e3},function(e,n,r){if(!r)return!1;t.spriteData=JSON.parse(r),t.lastTime=t.spriteData[t.spriteData.length-1].last_time,t.liveDuration=0,t.spriteData.sort(function(t,e){return t.start_time-e.start_time});for(var a=0;a<t.spriteData.length;a++){var l=t.spriteData[a];0==a&&i>l.start_time?(l.hidden_dur=i-l.start_time,l.play_dur=l.end_time-i,l.hasOwnProperty("duration")&&(l.play_dur=l.duration*l.play_dur/(l.end_time-l.start_time),l.hidden_dur=l.duration-l.play_dur,t.liveDuration+=l.play_dur)):(l.hidden_dur=0,l.play_dur=l.end_time-l.start_time,l.hasOwnProperty("duration")&&(l.play_dur=l.duration,t.liveDuration+=l.play_dur))}t.initLiveDuration=t.liveDuration,t.canGetNewSprite=!0,t.baseHost=o+s,t.prefix=t.baseHost+t.spriteData[t.spriteData.length-1].path,t.durationTimer&&clearInterval(t.durationTimer),t.durationTimer=setInterval(function(){t.player&&!t.player.paused()&&(t.liveDuration=t.liveDuration+1)},1e3)})},e.prototype.init=function(t){if(!videojs.browser.IS_IOS&&!videojs.browser.IS_ANDROID&&this.player.controlBar&&this.player.controlBar.progressControl){if(log$11("VttThumbnail initializing",t),!this.player.controlBar)return void log$11("VttThumbnail can not initialize without control bar");this.options=t;var e=this.player;t.vttUrl&&(this.loadTrackFile(t),defaults$3.basePath=parseBasePath(t.vttUrl)),this.initUI(),this.hasInit=!0,log$11("VttThumbnail initialized"),e.trigger({type:"feature",data:"thumbnail"})}},e.prototype.initTrackFile=function(t){t.track;this.trackInfo=t},e.prototype.initUI=function(){var t=this,e=videojs.dom.createEl("div",{className:"tcp-vtt-thumbnail-container"}),n=videojs.dom.createEl("img",{className:"tcp-vtt-thumbnail-img"});e.appendChild(n),this.containerEl=e,this.imgEl=n,this.cleanTimer&&clearInterval(this.cleanTimer),this.cleanTimer=setInterval(function(){"0"===window.getComputedStyle(t.imgEl).opacity&&(t.containerEl.style.display="none")},200);var r=setInterval(function(){var n=t.player.dvrMode(),i=void 0;(i="dvrLive"===n?t.player.controlBar.getChild("LiveProgressControl"):t.player.controlBar.progressControl)&&(i.el().appendChild(e),i.on("mouseenter",videojs.bind(t,t.onMouseEnter)),i.on("mousemove",videojs.bind(t,t.onMouseMove)),i.on("mouseleave",videojs.bind(t,t.onMouseOut)),clearInterval(r))},500)},e.prototype.onMouseEnter=function(){this.containerEl.style.display="block"},e.prototype.getRelativeOffset=function(t){for(var e=0,n=t,r=0,i=0;i<this.spriteData.length;i++){if(t<e+this.spriteData[i].play_dur){r=i,n=t-e+this.spriteData[i].hidden_dur;break}e+=this.spriteData[i].play_dur}return{relativeOffset:n,gConfigIndex:r}},e.prototype.getSpritePosition=function(t){var e=this.getRelativeOffset(t),n=e.relativeOffset,r=e.gConfigIndex,i=Math.floor(n/60),o=Math.floor(n%60/10);this.prefix=this.baseHost+this.spriteData[r].path;var s=this.baseHost+this.spriteData[r].path+i+".jpg";return s+="?txTimeshift=on",{picUrl:s,xpos:160*Math.floor(o%3),ypos:90*Math.floor(o/3)}},e.prototype.onMouseMove=function(t){var e=void 0,n=void 0,r=void 0,i=void 0,o=void 0,s=void 0,a=void 0,l=void 0,c=0,u=void 0,h=void 0,p=void 0,d=void 0,f=this.player.dvrMode();if(r="dvrLive"===f?this.player.controlBar.getChild("LiveProgressControl"):this.player.controlBar.progressControl,i="dvrLive"===f?r.LiveSeekBar:r.seekBar,o=offsetParent(r.el()).getBoundingClientRect(),s=offsetParent(i.el()).getBoundingClientRect(),e=t.clientX,l="dvrLive"===f?this.liveDuration:this.player.duration(),a=((e-s.left)/i.width()*l).toFixed(3),a>this.initLiveDuration&&this.canGetNewSprite&&this.getSpriteConfig(),!+a)return!1;if("dvrEvent"===f||"dvrLive"===f){var g=player.currentPDT()/100;if(g&&(g>this.lastTime||!this.prefix))return this.getSpriteConfig(),!1;var y=this.getSpritePosition(a);return p={h:90,left:0,src:y.picUrl,w:160,x:y.xpos,y:y.ypos},d=e-s.left+p.w/2-i.width(),d=Math.max(0,d),n=e-o.left-p.w/2-d,n=Math.max(i.el().offsetLeft,n),p.left=n,this.setView(p),!1}if(!this.trackInfo)return!1;for(u=this.trackInfo.track||this.trackInfo;c<u.cues.length;){if(h=u.cues[c],h.startTime<=a&&h.endTime>=a){p=parseImageLink(h.text);break}c++}if(!p)return this.onMouseOut(),!1;d=e-s.left+p.w/2-i.width(),d=Math.max(0,d),n=e-o.left-p.w/2-d,n=Math.max(i.el().offsetLeft,n),p.left=n,this.setView(p)},e.prototype.onMouseOut=function(){this.containerEl.style.display="none"},e.prototype.setView=function(t){var e=this.containerEl,n=this.imgEl,r=this.options;this.firstShowSprite&&(e.style.display="none",this.firstShowSprite=!1),e.style.width==t.w&&e.style.height==t.h||(e.style.width=t.w+"px",e.style.height=t.h+"px"),e.style.left=t.left+"px",n.src!==t.src&&(r.imgUrl&&n.src!=r.imgUrl?n.src=r.imgUrl:n.src=t.src),n.onload=function(){e.style.display="block"},n.onerror=function(){e.style.display="none",setTimeout(function(){e.style.display="none"},200)},n.style.left=-t.x+"px",n.style.top=-t.y+"px",n.style.clip="rect("+t.y+"px,"+(t.w+t.x)+"px,"+(t.y+t.h)+"px,"+t.x+"px)"},e.prototype.reset=function(){if(this.hasInit){log$11("VttThumbnail reset");var t=this.player,e=t.controlBar.progressControl;e.off("mousemove",videojs.bind(this,this.onMouseMove,10)),e.off("mouseleave",videojs.bind(this,this.onMouseOut)),this.hasInit=!1}},e}(Plugin$13),getComputedStyle=function(t,e){return function(n){return window.getComputedStyle?window.getComputedStyle(t,e)[n]:t.currentStyle[n]}},offsetParent=function n(t){return"HTML"!==t.nodeName&&"static"===getComputedStyle(t)("position")?n(t.offsetParent):t},parseImageLink=function(t){var e=void 0,n=void 0,r=void 0;if(-1===(n=t.indexOf("#")))return{src:t,w:0,h:0,x:0,y:0};if(e=t.substring(0,n),/^(http:|https:|\/\/)/.test(e)||(e=defaults$3.basePath+e),r=t.substring(n+1),"xywh="!==r.substring(0,5))return{src:e,w:0,h:0,x:0,y:0};var i=r.substring(5).split(",");return{src:e,w:parseInt(i[2]),h:parseInt(i[3]),x:parseInt(i[0]),y:parseInt(i[1])}},parseBasePath=function(t){/^(\/\/)/.test(t)&&(t="https:"+t);var e=/(\w+):\/\/([^\:|\/]+)(\:\d*)?(.*\/)([^#|\?|\n]+)?(#.*)?(\?.*)?/i,n=t.match(e);if(n&&n[2]&&n[4])return"//"+n[2]+n[4]};videojs.registerPlugin("VttThumbnail",VttThumbnail);var Plugin$14=videojs.getPlugin("plugin"),log$12=videojs.log,PlayerMetrics=function(t){function e(n,r){classCallCheck(this,e),log$12("PlayerMetrics initializing");var i=possibleConstructorReturn(this,t.call(this,n));if(!1===n.options_.reportable){var o;return o=!1,possibleConstructorReturn(i,o)}return i.player=n,i.checkPrevData(),i.initData(),i.registerListener(),log$12("PlayerMetrics initialized"),i}return inherits(e,t),e.prototype.checkPrevData=function(){var t=localStorage.getItem("tcplayer_data");if(t){var e=JSON.parse(t);Reporter.reportPlayMetrics(e,function(){localStorage.removeItem("tcplayer_data")})}},e.prototype.initData=function(){this.bytes_token=guid(),this.vodBaseData={uint32_service:2,uint32_platform:3,bytes_version:String(version),uint64_appid:0,bytes_bizid:this.guid("dev_uuid"),bytes_stream_id:"",uint32_module_id:1011,uint32_data_type:1,uint32_command:40303,uint64_data_time:0,bytes_token:this.bytes_token,token:this.bytes_token,dev_uuid:this.guid("dev_uuid"),str_app_name:"",str_app_version:"",str_stream_url:"",str_brand_type:this.getDevice(),str_device_resolution:screen.width+"_"+screen.height,str_device_type:"",str_package_name:"",str_sdk_name:"TCPlayer",str_user_id:this.guid("dev_uuid"),sys_type:this.getSystem(),sys_version:String(this.getSystemVer()),str_user_agent:USER_AGENT,str_browser_version:String(this.getBrowserVer()),str_browser_model:String(this.getBrowser()),u32_app_id:String(this.player.options_.appID),str_fileid:String(this.player.options_.fileID),u32_network_type:this.getNetworkType()},this.liveBaseData={str_user_id:this.guid("dev_uuid"),dev_uuid:this.guid("dev_uuid"),str_session_id:this.bytes_token,bytes_token:this.bytes_token,str_device_type:"",str_os_info:this.getSystem(),str_package_name:"",u32_network_type:"0xFF"!==this.getNetworkType()?this.getNetworkType():"",u32_server_ip:"",str_stream_url:this.player.cache_.src,u64_timestamp:this.player.startTime,u32_link_type:1,u32_channel_type:1,str_app_version:"",platform:3,uint32_platform:3,str_browser_version:this.getBrowserVer(),str_browser_model:this.getBrowser(),str_user_agent:USER_AGENT,u32_video_drop:"",u32_drop_usage:"",float64_rtt:""},this.features=[],this.afterCanplay=!1,this.videoDuration=0,this.consumeDuration=0,this.playScene=1,this.timing={},this.playStatus={isFirstPlay:!1,pauseDuration:0},this.contentComputTimePoint=[],this.firstFrameDuration=0,this.firstIFrameDuration=0,this.blockInterval=5e3,this.bufferBlock=[],this.u32_drm_type="plain",this.resetLagStatus(),this.resetBlockData()},e.prototype.getComsumeDuration=function(t){var e=getTimeStamp()-this.timing.firstPlaying;this.consumeDuration=e-this.lagStatus.lagDuration-this.playStatus.pauseDuration,t&&this.consumeDuration<0&&(this.consumeDuration=e>0?e:0)},e.prototype.registerListener=function(){var t=this.player;t.on("loadedmetadata",videojs.bind(this,this.onLoadedmetadata)),t.one("canplay",videojs.bind(this,this.oneCanplay)),t.one("play",videojs.bind(this,this.onePlay)),t.on("play",videojs.bind(this,this.onPlay)),t.on("playing",videojs.bind(this,this.onPlaying)),t.on("seeking",videojs.bind(this,this.onSeeking)),t.on("seeked",videojs.bind(this,this.onSeeked)),t.on("error",videojs.bind(this,this.onError)),t.on("resolutionswitching",videojs.bind(this,this.onResolutionSwitching)),t.on("pause",videojs.bind(this,this.onPause)),t.on("playcgiend",videojs.bind(this,this.onPlaycgiend)),t.on("ended",videojs.bind(this,this.onEnded)),t.on("feature",videojs.bind(this,this.onFeature)),t.on("dispose",videojs.bind(this,this.onDispose)),document.addEventListener("visibilitychange",videojs.bind(this,this.onVisibilityChange)),window.addEventListener("pagehide",videojs.bind(this,this.onPageHide))},e.prototype.onPageHide=function(){this.saveData()},e.prototype.onVisibilityChange=function(){"hidden"===document.visibilityState&&this.saveData()},e.prototype.saveData=function(){this.bytes_token&&3!==this.playScene&&this.player&&(this.getComsumeDuration(),this.report(2===this.playScene?40304:40102,{},function(t){localStorage.setItem("tcplayer_data",JSON.stringify(t))}))},e.prototype.onLoadedmetadata=function(){this.player.tech_.webrtcProvider?this.playScene=3:this.playScene=this.player.duration()===Infinity?1:2,this.videoDuration=parseInt(this.player.duration())||0,videojs.bind(this,this.calculateFirstFrameDuration)(),2===this.playScene&&this.report(40303)},e.prototype.oneCanplay=function(){videojs.bind(this,this.calculateFirstFrameDuration)(),1===this.playScene&&this.report(40101)},e.prototype.calculateFirstFrameDuration=function(){var t=getperformance();t.mark&&t.measure&&t.getEntriesByName&&(t.mark("firstIFrameEnd"),t.measure("firstIFrame","firstFrameStart","firstIFrameEnd"),this.firstIFrameDuration=t.getEntriesByName("firstIFrame")[0].duration)},e.prototype.onePlay=function(){var t=this;this.setTimingData({firstPlay:getTimeStamp()});var e=this.player.el_.firstChild;this.bufferStart=e&&e.buffered&&e.buffered.length>0?e.buffered.start(e.buffered.length-1):0,this.bufferBlock=[this.bufferStart];var n=this.player.getVideoPlaybackQuality();this.recvFrames=n.totalVideoFrames,this.renderedFrames=n.totalVideoFrames-n.droppedVideoFrames,this.blockStartTime=getTimeStamp(),this.blockTimer=setInterval(function(){if(2===t.playScene)return!1;if(t.lagStatus.lagging&&t.lagStatus.lagStart){var n=getTimeStamp()-t.lagStatus.lagStart;n>t.blockInterval?t.blockData.lagBlockDuration=t.blockInterval:t.blockData.lagBlockDuration+=n}t.blockStartTime=getTimeStamp();var r=e&&e.buffered&&e.buffered.length>0?e.buffered.end(e.buffered.length-1):0,i=t.player.getVideoPlaybackQuality(),o=i.totalVideoFrames,s=i.totalVideoFrames-i.droppedVideoFrames;Object.assign(t.blockData,{buffer_avg:parseInt(1e3*(r-t.bufferStart)),recv_frames:o-t.recvFrames,render_frames:s-t.renderedFrames}),t.bufferBlock.push(t.blockData.buffer_avg),t.bufferStart=r,t.recvFrames=o,t.renderedFrames=s,t.report(40100)},this.blockInterval)},e.prototype.onDispose=function(){clearInterval(this.blockTimer)},e.prototype.onPlay=function(){this.playStatus.pauseTime&&(this.playStatus.pauseDuration=this.playStatus.pauseDuration+getTimeStamp()-this.playStatus.pauseTime,this.playStatus.pauseTime=0)},e.prototype.onPlaying=function(){var t=this;if(!this.playStatus.isFirstPlay&&(this.playStatus.isFirstPlay=!0,this.setTimingData({firstPlaying:getTimeStamp()}),this.player.on("waiting",function(){t.lagStatus.lagging||t.player.seeking()||t.lagStatus.skip||(t.lagStatus.lagging=!0,t.lagStatus.lagStart=getTimeStamp())}),this.player.currentSource().keySystems)){var e=this.player.currentSource().keySystems;e.plain&&(this.u32_drm_type="plain"),e.SimpleAES&&(this.u32_drm_type="SimpleAES")}
19
- this.lagStatus.lagging&&(this.lagStatus.lagEnd=getTimeStamp())-this.lagStatus.lagStart>this.lagStatus.lagInterval&&(this.lagStatus.lagging=!1,this.lagStatus.lagCount++,this.lagStatus.lagAvg.push(this.lagStatus.lagEnd-this.lagStatus.lagStart),this.lagStatus.lagDuration+=this.lagStatus.lagEnd-this.lagStatus.lagStart,this.lagStatus.lagStart<this.blockStartTime&&(this.blockData.lagBlockDuration=this.lagStatus.lagEnd-this.blockStartTime),this.lagStatus.lagStart>=this.blockStartTime&&(this.blockData.lagBlockDuration+=this.lagStatus.lagEnd-this.lagStatus.lagStart),this.lagStatus.lagEnd=this.lagStatus.lagStart=0,this.lagStatus.isFirstLag||(this.lagStatus.isFirstLag=!0,this.setTimingData({firstLag:getTimeStamp()}))),[60,200,500,1e3].forEach(function(e){t.lagStatus.lagging&&(t.lagStatus.lagEnd=getTimeStamp())-t.lagStatus.lagStart>e&&t.blockData["lagCount_"+e]++}),this.lagStatus.skip=!1},e.prototype.onSeeking=function(){this.contentComputTimePoint.push({type:"end",time:this.player.currentTime()})},e.prototype.onSeeked=function(){this.contentComputTimePoint.push({type:"start",time:this.player.currentTime()})},e.prototype.onError=function(t){this.getComsumeDuration(!0);var e={u64_err_code:t.data.code,str_err_info:t.data.message||(defaults$1.errors[t.data.code]||{}).message},n=(this.player.cache_.src||"").indexOf("vod")>-1||this.player.options_.fileID;t&&t.data&&t.data.code&&(2===this.playScene&&n?this.report(40304,e):this.afterCanplay?this.report(40102,e):this.report(40101,e))},e.prototype.onResolutionSwitching=function(){this.lagStatus.skip=!0},e.prototype.onPause=function(){this.playStatus.pauseTime=getTimeStamp(),this.lagStatus.lagging&&(this.lagStatus.skip=!0)},e.prototype.onPlaycgiend=function(t){var e=this,n=t.data;n.result&&0==n.result.code&&(this.playStatus.requestID=n.result.requestId,setTimeout(function(){if(e.player.currentSources().length>0&&e.player.currentSources()[0].keySystems){var t=e.player.currentSources()[0].keySystems;t["com.widevine.alpha"]&&e.reportMTA("drm",{initialized:"Widevine"}),t["com.apple.fps.1_0"]&&e.reportMTA("drm",{initialized:"FairPlay"})}else e.player.options_.plugins.DRM&&e.player.options_.plugins.DRM.token&&e.reportMTA("drm",{initialized:"SimpleAES"})},0)),this.setTimingData({cgiStart:t.data.startTime,cgiEnd:t.data.time})},e.prototype.onEnded=function(){this.getComsumeDuration(),1===this.playScene?this.report(40102):this.report(40304)},e.prototype.onFeature=function(t){-1==this.features.indexOf(t.data)&&this.features.push(t.data)},e.prototype.guid=function(t){var e=localStorage.getItem(t);return e||(e=guid(),localStorage.setItem(t,e)),e},e.prototype.report=function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},n=arguments[2];if(3===this.playScene)return!1;t&&this["report_"+t](e,n)},e.prototype.report_40101=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(!this.player)return!1;var e={uint64_data_time:getTimeStampBySecond(),str_stream_url:this.player.cache_.src,u64_timestamp:this.player.startTime,u32_dns_time:"",u32_connect_server_time:parseInt(this.firstFrameDuration),u32_video_decode_type:0,u32_first_frame_down:parseInt(this.firstFrameDuration),u32_first_video_decode_time:parseInt(this.firstIFrameDuration),u32_first_i_frame:parseInt(this.firstIFrameDuration),u32_first_audio_frame_down:parseInt(this.firstFrameDuration),u32_first_audio_render_time:parseInt(this.firstIFrameDuration),u64_err_code:t.u64_err_code||"",str_err_info:t.str_err_info||""},n={app_id:0,data:[Object.assign({},this.liveBaseData,e,t)],module_id:1005,command:40101};Reporter.reportPlayMetrics(n)},e.prototype.report_40100=function(t){var e=this,n=this.player||{};this.blockData=this.blockData||{};var r={u32_cpu_usage:"",u32_app_cpu_usage:"",u32_avg_memory:"",u32_avg_cpu_usage:"",str_stream_url:n.cache_&&n.cache_.src,uint64_data_time:getTimeStampBySecond(),u32_recv_av_diff_time:0,u32_play_av_diff_time:0,u64_playtime:getTimeStamp()-this.timing.firstPlaying,u32_audio_decode_type:2,u32_audio_block_count:this.blockData.lagCount_500,u32_audio_cache_time:this.blockData.buffer_avg,u32_audio_drop:"",u32_video_decode_type:0,u32_video_recv_fps:this.blockData.recv_frames,u32_fps:this.blockData.render_frames,u32_video_cache_time:this.blockData.buffer_avg,u32_avg_cache_count:0,u32_video_block_count:this.blockData.lagCount_1000,u32_avg_net_speed:"",u32_video_light_block_count:this.blockData.lagCount_200,u32_video_large_block_count:this.blockData.lagCount_500,u32_audio_jitter_60ms_count:this.blockData.lagCount_60,u32_video_decode_fail:"",u32_audio_decode_fail:"",u32_avg_video_bitrate:0,u32_avg_audio_bitrate:0,u32_block_usage:1e3*parseInt(this.blockData.lagBlockDuration/this.blockInterval)},i={app_id:0,data:[Object.assign({},this.liveBaseData,r,t)],module_id:1005,command:40100};Reporter.reportPlayMetrics(i,function(){e.resetBlockData()})},e.prototype.report_40102=function(){var t=this,e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},n=arguments[1],r=this.player||{},i=0,o=0,s=0;if("{}"!==JSON.stringify(r)){i=this.lagStatus.lagAvg.length>0?this.lagStatus.lagAvg.reduce(function(t,e){return t+e},0)/this.lagStatus.lagAvg.length:0,o=this.bufferBlock.length>0?this.bufferBlock.reduce(function(t,e){return t+e},0)/this.bufferBlock.length:0;s=(r.getVideoPlaybackQuality&&r.getVideoPlaybackQuality()||{}).totalVideoFrames/e.duration}else this.resetLagStatus();var a={uint64_data_time:getTimeStampBySecond(),str_stream_url:r.cache_&&r.cache_.src,u64_timestamp:getTimeStamp(),u32_avg_cpu_usage:"",u32_avg_memory:"",u64_begin_timestamp:r.startTime,u32_result:this.consumeDuration,u64_err_code:e.u64_err_code,u32_speed_cnt:0,u32_avg_cache_time:o,u32_max_load:Math.max.apply(Math,this.lagStatus.lagAvg),u32_audio_block_time:this.lagStatus.lagDuration,u32_avg_load:i,u32_load_cnt:this.lagStatus.lagAvg.length||0,u32_nodata_cnt:this.lagStatus.lagAvg.length||0,u32_first_i_frame:this.firstIFrameDuration,u32_video_width:r.width_,u32_video_height:r.height_,u32_video_avg_fps:s,u32_avg_block_time:i,u64_block_count:this.lagStatus.lagAvg.length||0,u32_video_block_time:this.lagStatus.lagDuration,u64_jitter_cache_max:0,u64_block_duration_max:Math.max.apply(Math,this.lagStatus.lagAvg),u64_jitter_cache_avg:0,u32_ip_count_quic:"",u32_connect_count_quic:"",u32_connect_count_tcp:"",u32_is_real_time:"",u32_first_frame_black:"",u32_delay_report:0},l={app_id:0,data:[Object.assign({},this.liveBaseData,a,e)],module_id:1005,command:40102};return e.u32_delay_report?(localStorage.setItem("tcplayer_data",JSON.stringify(l)),!1):n?(l.data.u32_delay_report=1,n(l)):void Reporter.reportPlayMetrics(l,function(){t.bytes_token=null,localStorage.removeItem("tcplayer_data")})},e.prototype.report_40303=function(){this.setTimingData({initEnd:getTimeStamp()});var t={msg_client_ip:{uint32_ip:""},uint32_service:this.playScene,uint64_data_time:getTimeStampBySecond(),str_stream_url:this.player.cache_.src,uint32_command:40303,u32_app_id:String(this.player.options_.appID),str_fileid:String(this.player.options_.fileID)},e={app_id:0,data:[Object.assign({},this.vodBaseData,t)],module_id:1011,command:40303};Reporter.reportPlayMetrics(e)},e.prototype.report_40304=function(){var t=this,e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},n=arguments[1],r=this.lagStatus.lagAvg.length>0?this.lagStatus.lagAvg.reduce(function(t,e){return t+e},0)/this.lagStatus.lagAvg.length:0,i={u32_app_id:String(this.player.options_.appID),str_fileid:String(this.player.options_.fileID),uint64_data_time:getTimeStampBySecond(),uint32_command:40304,str_stream_url:this.player.cache_.src,u32_timeuse:String(parseInt(this.consumeDuration/1e3)||0),u32_videotime:String(this.videoDuration),u32_avg_load:String(r),u32_load_cnt:String(this.lagStatus.lagCount),u32_max_load:this.lagStatus.lagAvg.length>0?String(Math.max.apply(Math,this.lagStatus.lagAvg)):String(0),u32_avg_block_time:String(this.lagStatus.lagDuration),u32_player_type:String(4),u32_dns_time:"",u32_tcp_did_connect:"",u32_first_video_packet:String(parseInt(this.firstFrameDuration)),u32_first_i_frame:String(parseInt(this.firstIFrameDuration)),u32_server_ip:"",u32_drm_type:this.u32_drm_type,u32_playmode:String(1),u64_err_code:String(e.u64_err_code||""),str_err_info:String(e.str_err_info||""),u32_video_decode_type:String(0),u32_speed:this.player&&String(100*this.player.playbackRate())||"1000"},o={app_id:0,data:[Object.assign({},this.vodBaseData,i)],module_id:1011,command:40304};if(n)return n(o);Reporter.reportPlayMetrics(o,function(){t.bytes_token=null,localStorage.removeItem("tcplayer_data")})},e.prototype.setTimingData=function(t){this.timing=videojs.mergeOptions(this.timing,t)},e.prototype.reset=function(){this.playStatus={isFirstPlay:!1}},e.prototype.resetLagStatus=function(){this.lagStatus={lagCount:0,lagging:!1,lagStart:0,lagEnd:0,lagInterval:500,lagDuration:0,lagAvg:[],isFirstLag:!1,skip:!1}},e.prototype.resetBlockData=function(){this.blockData={lagCount_60:0,lagCount_200:0,lagCount_500:0,lagCount_1000:0,lagBlockDuration:0,buffer_avg:0,recv_frames:0,render_frames:0}},e.prototype.reportMTA=function(t,e){},e.prototype.getSystem=function(){return IS_IOS?"ios":IS_ANDROID?"android":IS_WIN?"win":IS_MAC?"mac":"other"},e.prototype.getSystemVer=function(){var t=this.getSystem();return"ios"==t?IOS_VERSION:"android"==t?ANDROID_VERSION:"win"==t?WIN_VER:"mac"==t?MAC_VER:void 0},e.prototype.getBrowser=function(){return IS_FIREFOX?"firefox":IS_EDGE?"edge":IS_MQQB?"mqq":IS_QQB?"qq":IS_TBS?"tbs":IS_CHROME?"chrome":IE_VERSION?"ie":IS_SAFARI?"safari":"other"},e.prototype.getBrowserVer=function(){var t=this.getBrowser();return"firefox"==t?FIREFOX_VER:"edge"==t?EDGE_VER:"chrome"==t?CHROME_VER:"ie"==t?IE_VERSION:"safari"==t?SAFARI_VER:"qq"==t||"mqq"==t?QQ_VER:"tbs"==t?TBS_VERSION:"other"},e.prototype.getDevice=function(){return IS_IOS?"IPHONE":IS_HUAWEI?"HUAWEI":IS_XIAOMI?"XIAOMI":IS_OPPO?"OPPO":IS_VIVO?"VIVO":IS_SX?"SUMSUNG":IS_CP?"COOLPAD":IS_ONE?"ONEPLUS":IS_ZX?"ZTE":"OTHER"},e.prototype.getMediaType=function(){return this.player.src()&&/\/(.+)\.(.+)\?|\/(.+)\.(.+)/.test(this.player.src()),RegExp.$2||RegExp.$4},e.prototype.getNetworkType=function(){var t=navigator.userAgent,e=t.match(/NetType\/\w+/)?t.match(/NetType\/\w+/)[0]:"NetType/other";e=e.toLowerCase().replace("nettype/","");var n;switch(e){case"wifi":n="1";break;case"4g":n="2";break;case"3g":case"3gnet":n="3";break;case"2g":n="4";break;default:n="0xFF"}return n},e}(Plugin$14);videojs.registerPlugin("PlayerMetrics",PlayerMetrics);var Plugin$15=videojs.getPlugin("plugin"),log$13=videojs.log,ProgressMarker=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return n.ready(videojs.bind(i,i.init)),i}return inherits(e,t),e.prototype.init=function(){var t=this.player;if(t.options_.dots){var e=function r(){Array.isArray(t.options_.dots)&&t.options_.dots.length>0&&(t.options_.dots.forEach(function(e){!e.emitted&&e.timeOffset-1e3*(t.currentTime()||0)<500&&(e.emitted=!0,t.trigger("marker",e.content))}),t.options_.dots[t.options_.dots.length-1].emitted||window.requestAnimationFrame(r))};window.requestAnimationFrame(e)}if(IS_IOS||IS_ANDROID)return!1;if(!t.controlBar||!this.player.controlBar.progressControl)return void log$13("ProgressMarker can not initialize without control bar or progress control");log$13("ProgressMarker initializing");var n=t.controlBar.getChild("ProgressControl").getChild("SeekBar");n.getChild("ProgressMarkerGenerator")&&n.removeChild("ProgressMarkerGenerator"),t.options_.plugins.ProgressMarker&&(n.addChild("ProgressMarkerGenerator"),log$13("ProgressMarker initialized"),t.trigger({type:"feature",data:"marker"}))},e}(Plugin$15);videojs.registerPlugin("ProgressMarker",ProgressMarker);var Component$16=videojs.getComponent("Component"),PlayListItem=function(t){function e(n,r){return classCallCheck(this,e),possibleConstructorReturn(this,t.call(this,n,r))}return inherits(e,t),e.prototype.createEl=function(){var t=this.options_,e=videojs.dom.createEl("div",{className:"tcp-playlist-item"}),n=videojs.dom.createEl("div",{className:"tcp-playlist-item-video",innerHTML:t.img?'<img src="'+t.img+'" class="tcp-playlist-item-img">':'<img src="https://imgcache.qq.com/open_proj/proj_qcloud_v2/mc_2014/video/console/v2/css/img/vod/default-cover.png" height="100" class="tcp-playlist-item-img">'}),r=videojs.dom.createEl("div",{className:"tcp-playlist-item-duration",textContent:this.timeFormat(t.duration)});n.appendChild(r);var i=videojs.dom.createEl("div",{className:"tcp-playlist-item-desc",textContent:t.text});return e.appendChild(n),e.appendChild(i),this.bindEvent(e),e},e.prototype.bindEvent=function(t){var e=this;videojs.on(t,["click"],function(){e.player_.trigger({type:"playItem",data:e.options_})})},e.prototype.timeFormat=function(t){var e="",n=Math.floor(t/3600);0!=n&&(t-=3600*n,n<10&&(n="0"+n),e+=n+":");var r=Math.floor(t/60);return r<10&&(r="0"+r),t-=60*r,t<10&&(t="0"+t),e+=r+":"+t},e}(Component$16);videojs.registerComponent("PlayListItem",PlayListItem);var Component$17=videojs.getComponent("Component"),PlayListTitle=function(t){function e(n,r){return classCallCheck(this,e),possibleConstructorReturn(this,t.call(this,n,r))}return inherits(e,t),e.prototype.createEl=function(){var t=this.options_;return videojs.dom.createEl("div",{className:"tcp-playlist-title",textContent:t.title})},e}(Component$17);videojs.registerComponent("PlayListTitle",PlayListTitle);var Component$15=videojs.getComponent("Component"),PlayListBox=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.init(),i.activeIndex=-1,i}return inherits(e,t),e.prototype.createEl=function(){return videojs.dom.createEl("div",{className:"tcp-playlist-box"})},e.prototype.init=function(){var t=this,e=this.options_.data;this.addChild("PlayListTitle",{title:this.options_.title}),e.forEach(function(e,n){e.index=n,t.addChild("PlayListItem",e)}),this.player_.on("ready",function(){t.options_.loop&&(t.activeIndex=0,t.player_.on("ended",videojs.bind(t,function(){t.player_.trigger({type:"playItem"})})))}),this.player_.on("playItem",function(n){var r=n.data,i=void 0;t.activeIndex=r?r.index:(t.activeIndex+1)%e.length,i=e[t.activeIndex],t.player_.loadVideoByID({fileID:i.fileID,appID:i.appID,psign:i.psign}),t.player_.one("loadedmetadata",videojs.bind(t,function(){t.player_.play()})),document.querySelectorAll(".tcp-playlist-item").forEach(function(t){videojs.dom.removeClass(t,"tcp-playlist-item-active")});var o=document.querySelectorAll(".tcp-playlist-item")[t.activeIndex];videojs.dom.addClass(o,"tcp-playlist-item-active")})},e}(Component$15);videojs.registerComponent("PlayListBox",PlayListBox);var Component$18=videojs.getComponent("Component"),PlayListToggle=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.status=0,i}return inherits(e,t),e.prototype.createEl=function(){var t=videojs.dom.createEl("div",{className:"tcp-playlist-toggle",textContent:"<"});return this.bindEvent(t),t},e.prototype.bindEvent=function(t){var e=this;videojs.on(t,["click"],function(n){e.status=!e.status;var r=document.querySelector(".tcp-playlist");e.status?(t.textContent=">",videojs.dom.addClass(r,"tcp-playlist-open"),videojs.dom.removeClass(r,"tcp-playlist-close")):(videojs.dom.addClass(r,"tcp-playlist-close"),videojs.dom.removeClass(r,"tcp-playlist-open"),t.textContent="<")})},e}(Component$18);videojs.registerComponent("PlayListToggle",PlayListToggle);var Component$14=videojs.getComponent("Component"),PlayList$1=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.init(),i}return inherits(e,t),e.prototype.createEl=function(){return videojs.dom.createEl("div",{className:"tcp-playlist tcp-playlist-close"})},e.prototype.init=function(){this.addChild("PlayListToggle"),this.addChild("PlayListBox",this.options_)},e}(Component$14);videojs.registerComponent("PlayList",PlayList$1);var Button$6=videojs.getComponent("Button"),PlayNextButton=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.addClass(),i}return inherits(e,t),e.prototype.addClass=function(){videojs.dom.addClass(this.el_,"vjs-play-next")},e.prototype.update=function(){},e.prototype.handleClick=function(t){this.player_.trigger({type:"playItem"})},e}(Button$6);PlayNextButton.prototype.controlText_="Play Next",videojs.registerComponent("PlayNextButton",PlayNextButton);var Plugin$16=videojs.getPlugin("plugin"),log$14=videojs.log,PlayList=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return IS_IOS||IS_ANDROID?possibleConstructorReturn(i):(i.options=r,r&&r.data instanceof Array&&r.data.length>0&&n.ready(videojs.bind(i,i.init)),i)}return inherits(e,t),e.prototype.init=function(){log$14("PlayList initializing"),this.player.addChild("PlayList",this.options),this.player.controlBar.addChild("PlayNextButton",{},1),log$14("PlayList initialized"),this.player.trigger({type:"feature",data:"playlist"})},e}(Plugin$16);videojs.registerPlugin("PlayList",PlayList);var Plugin$17=videojs.getPlugin("plugin"),log$15=videojs.log,HLSToken=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return log$15("HLSToken",n,r),i.init(r),i}return inherits(e,t),e.prototype.init=function(t){log$15("HLSToken init",t,this.player);var e=this.player;t.token&&(this.options=t,e.on("playcgiend",videojs.bind(this,function(t){this.modifyData(t.data)})))},e.prototype.modifyData=function(t){var e=this;if(log$15("HLSToken modifyData",t),0===t.result.code){var n=t.result.videoInfo;if(n.masterPlayList){var r=n.masterPlayList.url.split("/");r[r.length-1]="voddrm.token."+this.options.token+"."+r[r.length-1],n.masterPlayList.url=r.join("/")}n.transcodeList&&n.transcodeList.length>0&&(n.transcodeList=n.transcodeList.map(function(t){var n=t.url.split("/");return n[n.length-1]="voddrm.token."+e.options.token+"."+n[n.length-1],t.url=n.join("/"),t}))}},e}(Plugin$17);videojs.registerPlugin("HLSToken",HLSToken);var getMessageContents=function(t){var e=(new window_1.DOMParser).parseFromString(String.fromCharCode.apply(null,new Uint16Array(t)),"application/xml"),n=e.getElementsByTagName("HttpHeaders")[0],r={};if(n)for(var i=n.getElementsByTagName("name"),o=n.getElementsByTagName("value"),s=0;s<i.length;s++)r[i[s].childNodes[0].nodeValue]=o[s].childNodes[0].nodeValue;var a=e.getElementsByTagName("Challenge")[0],l=void 0;return a&&(l=window_1.atob(a.childNodes[0].nodeValue)),{headers:r,message:l}},requestPlayreadyLicense=function(t,e,n){var r=getMessageContents(e),i=r.headers,o=r.message;videojs.xhr({uri:t,method:"post",headers:i,body:o,responseType:"arraybuffer"},n)},getSupportedKeySystem=function(t){var e=void 0;return Object.keys(t).forEach(function(n){var r={},i=t[n].audioContentType,o=t[n].videoContentType;i&&(r.audioCapabilities=[{contentType:i}]),o&&(r.videoCapabilities=[{contentType:o}]),e=e?e["catch"](function(t){return window_1.navigator.requestMediaKeySystemAccess(n,[r])}):window_1.navigator.requestMediaKeySystemAccess(n,[r])}),e},makeNewRequest=function(t){var e=t.mediaKeys,n=t.initDataType,r=t.initData,i=t.options,o=t.getLicense,s=t.removeSession,a=t.eventBus,l=e.createSession();l.addEventListener("message",function(t){o(i,t.message).then(function(t){return l.update(t)})["catch"](videojs.log.error.bind(videojs.log.error,"failed to get and set license"))},!1),l.addEventListener("keystatuseschange",function(t){var e=!1;l.keyStatuses.forEach(function(n,r){switch(a.trigger({keyId:r,status:n,target:l,type:"keystatuschange"}),n){case"expired":e=!0;break;case"internal-error":videojs.log.warn('Key status reported as "internal-error." Leaving the session open since we don\'t have enough details to know if this error is fatal.',t)}}),e&&l.close().then(function(){s(r)})},!1),l.generateRequest(n,r)["catch"](videojs.log.error.bind(videojs.log.error,"Unable to create or initialize key session"))},addSession=function(t){var e=t.video,n=t.initDataType,r=t.initData,i=t.options,o=t.getLicense,s=t.removeSession,a=t.eventBus;e.mediaKeysObject?makeNewRequest({mediaKeys:e.mediaKeysObject,initDataType:n,initData:r,options:i,getLicense:o,removeSession:s,eventBus:a}):e.pendingSessionData.push({initDataType:n,initData:r})},setMediaKeys=function(t){var e=t.video,n=t.certificate,r=t.createdMediaKeys,i=t.options,o=t.getLicense,s=t.removeSession,a=t.eventBus;e.mediaKeysObject=r,n&&r.setServerCertificate(n);for(var l=0;l<e.pendingSessionData.length;l++){var c=e.pendingSessionData[l];makeNewRequest({mediaKeys:e.mediaKeysObject,initDataType:c.initDataType,initData:c.initData,options:i,getLicense:o,removeSession:s,eventBus:a})}return e.pendingSessionData=[],e.setMediaKeys(r)},defaultPlayreadyGetLicense=function(t){return function(e,n,r){requestPlayreadyLicense(t,n,function(t,e,n){if(t)return void r(t);r(null,n)})}},defaultGetLicense=function(t){return function(e,n,r){videojs.xhr({uri:t,method:"POST",responseType:"arraybuffer",body:n,headers:{"Content-type":"application/octet-stream"}},function(t,e,n){if(t)return void r(t);r(null,n)})}},promisifyGetLicense=function(t,e){return function(n,r){return new Promise(function(i,o){t(n,r,function(t,n){e&&e.trigger("licenserequestattempted"),t&&o(t),i(n)})})}},standardizeKeySystemOptions=function(t,e){if("string"==typeof e&&(e={url:e}),!e.url&&!e.getLicense)throw new Error("Neither URL nor getLicense function provided to get license");return e.url&&!e.getLicense&&(e.getLicense="com.microsoft.playready"===t?defaultPlayreadyGetLicense(e.url):defaultGetLicense(e.url)),e},standard5July2016=function(t){var e=t.video,n=t.initDataType,r=t.initData,i=t.options,o=t.removeSession,s=t.eventBus,a=Promise.resolve();if("undefined"==typeof e.mediaKeysObject){e.mediaKeysObject=null,e.pendingSessionData=[];var l=void 0,c=void 0;if(!(a=getSupportedKeySystem(i.keySystems)))return videojs.log.error("No supported key system found"),Promise.resolve();a=a.then(function(t){return new Promise(function(n,r){if(e.keySystem=t.keySystem,c=standardizeKeySystemOptions(t.keySystem,i.keySystems[t.keySystem]),!c.getCertificate)return void n(t);c.getCertificate(i,function(e,i){if(e)return void r(e);l=i,n(t)})})}).then(function(t){return t.createMediaKeys()}).then(function(t){return setMediaKeys({video:e,certificate:l,createdMediaKeys:t,options:i,getLicense:promisifyGetLicense(c.getLicense,s),removeSession:o,eventBus:s})})["catch"](videojs.log.error.bind(videojs.log.error,"Failed to create and initialize a MediaKeys object"))}return a.then(function(){addSession({video:e,initDataType:n,initData:r,options:i,getLicense:e.keySystem?promisifyGetLicense(standardizeKeySystemOptions(e.keySystem,i.keySystems[e.keySystem]).getLicense,s):null,removeSession:o,eventBus:s})})},stringToUint16Array=function(t){for(var e=new ArrayBuffer(2*t.length),n=new Uint16Array(e),r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n},uint8ArrayToString=function(t){return String.fromCharCode.apply(null,new Uint16Array(t.buffer))},getHostnameFromUri=function(t){var e=document_1.createElement("a");return t=t.match(/.*(skd\:\/\/.+)/i)[1],e.href=t,e.hostname},arrayBuffersEqual=function(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(var n=new DataView(t),r=new DataView(e),i=0;i<n.byteLength;i++)if(n.getUint8(i)!==r.getUint8(i))return!1;return!0},arrayBufferFrom=function(t){return t instanceof Uint8Array||t instanceof Uint16Array?t.buffer:t},FAIRPLAY_KEY_SYSTEM="com.apple.fps.1_0",concatInitDataIdAndCertificate=function(t){var e=t.initData,n=t.id,r=t.cert;"string"==typeof n&&(n=stringToUint16Array(n));var i=0,o=new ArrayBuffer(e.byteLength+4+n.byteLength+4+r.byteLength),s=new DataView(o);new Uint8Array(o,i,e.byteLength).set(e),i+=e.byteLength,s.setUint32(i,n.byteLength,!0),i+=4;var a=new Uint16Array(o,i,n.length);return a.set(n),i+=a.byteLength,s.setUint32(i,r.byteLength,!0),i+=4,new Uint8Array(o,i,r.byteLength).set(r),new Uint8Array(o,0,o.byteLength)},addKey=function(t){var e=t.video,n=t.contentId,r=t.initData,i=t.cert,o=t.options,s=t.getLicense,a=t.eventBus;return new Promise(function(t,l){if(e.webkitKeys||e.webkitSetMediaKeys(new window_1.WebKitMediaKeys(FAIRPLAY_KEY_SYSTEM)),!e.webkitKeys)return void l("Could not create MediaKeys");var c=e.webkitKeys.createSession("video/mp4",concatInitDataIdAndCertificate({id:n,initData:r,cert:i}));if(!c)return void l("Could not create key session");c.contentId=n,c.addEventListener("webkitkeymessage",function(t){s(o,n,t,function(t,e){if(a&&a.trigger("licenserequestattempted"),t)return void l(t);c.update(new Uint8Array(e))})}),c.addEventListener("webkitkeyadded",function(e){t(e)}),c.addEventListener("webkitkeyerror",function(t){l(t)})})},defaultGetCertificate=function(t){return function(e,n){videojs.xhr({uri:t,responseType:"arraybuffer"},function(t,e,r){if(t)return void n(t);n(null,new Uint8Array(r))})}},defaultGetContentId=function(t,e){return getHostnameFromUri(uint8ArrayToString(e))},defaultGetLicense$1=function(t){return function(e,n,r,i){videojs.xhr({uri:t,method:"POST",responseType:"arraybuffer",body:r.message,headers:{"Content-type":"application/x-www-form-urlencoded"}},function(t,e,n){if(t)return void i(t);i(null,n)})}},fairplay=function(t){var e=t.video,n=t.initData,r=t.options,i=t.eventBus,o=r.keySystems[FAIRPLAY_KEY_SYSTEM],s=o.getCertificate||defaultGetCertificate(o.certificateUri),a=o.getContentId||defaultGetContentId,l=o.getLicense||defaultGetLicense$1(o.licenseUri);return new Promise(function(t,e){s(r,function(n,r){if(n)return void e(n);t(r)})}).then(function(t){return addKey({video:e,cert:t,initData:n,getLicense:l,options:r,contentId:a(r,n),eventBus:i})})["catch"](function(t){i.player_.error({code:3,message:t})})},PLAYREADY_KEY_SYSTEM="com.microsoft.playready",addKeyToSession=function(t,e,n,r){var i=t.keySystems[PLAYREADY_KEY_SYSTEM];if("function"==typeof i.getKey)return void i.getKey(t,n.destinationURL,n.message.buffer,function(t,n){if(t)return void videojs.log.error("Unable to get key: "+t);e.update(n)});"string"==typeof i&&(i={url:i});var o=i.url||n.destinationURL;requestPlayreadyLicense(o,n.message.buffer,function(t,n){if(r&&r.trigger("licenserequestattempted"),t)return void videojs.log.error("Unable to request key from url: "+o);e.update(new Uint8Array(n.body))})},createSession=function(t,e,n,r){var i=t.msKeys.createSession("video/mp4",e);if(!i)return void videojs.log.error("Could not create key session.");i.addEventListener("mskeymessage",function(t){addKeyToSession(n,i,t,r)}),i.addEventListener("mskeyerror",function(t){videojs.log.error("Unexpected key error from key session with code: "+i.error.code+" and systemCode: "+i.error.systemCode)})},msPrefixed=function(t){var e=t.video,n=t.initData,r=t.options,i=t.eventBus;e.msKeys&&delete e.msKeys;try{e.msSetMediaKeys(new window_1.MSMediaKeys(PLAYREADY_KEY_SYSTEM))}catch(o){return void videojs.log.error("Unable to create media keys for PlayReady key system. Error: "+o.message)}createSession(e,n,r,i)},Plugin$18=videojs.getPlugin("plugin"),hasSession=function(t,e){for(var n=0;n<t.length;n++)if(t[n].initData){var r=arrayBufferFrom(t[n].initData),i=arrayBufferFrom(e);if(arrayBuffersEqual(r,i))return!0}return!1},removeSession=function(t,e){for(var n=0;n<t.length;n++)if(t[n].initData===e)return void t.splice(n,1)},handleEncryptedEvent=function(t,e,n,r){if(!e||!e.keySystems||e.src&&e.src.indexOf("m3u8")>-1)return Promise.resolve();var i=t.initData;return getSupportedKeySystem(e.keySystems).then(function(o){var s=o.keySystem;if(e.keySystems[s]&&e.keySystems[s].pssh&&(i=e.keySystems[s].pssh),!hasSession(n,i)&&i)return n.push({initData:i}),standard5July2016({video:t.target,initDataType:t.initDataType,initData:i,options:e,removeSession:removeSession.bind(null,n),eventBus:r})})},handleWebKitNeedKeyEvent=function(t,e,n){if(e.keySystems&&e.keySystems[FAIRPLAY_KEY_SYSTEM]&&t.initData)return fairplay({video:t.target,initData:t.initData,options:e,eventBus:n})},handleMsNeedKeyEvent=function(t,e,n,r){if(e.keySystems&&e.keySystems[PLAYREADY_KEY_SYSTEM]&&!n.reduce(function(t,e){return t||e.playready},!1)){var i=t.initData;e.keySystems[PLAYREADY_KEY_SYSTEM]&&e.keySystems[PLAYREADY_KEY_SYSTEM].pssh&&(i=e.keySystems[PLAYREADY_KEY_SYSTEM].pssh),i&&(n.push({playready:!0,initData:i}),msPrefixed({video:t.target,initData:i,options:e,eventBus:r}))}},getOptions=function(t){return videojs.mergeOptions(t.currentSource(),t.eme.options)},setupSessions=function(t){var e=t.src();e!==t.eme.activeSrc&&(t.eme.activeSrc=e,t.eme.sessions=[])},onPlayerReady=function(t){"video"===t.$(".vjs-tech").tagName.toLowerCase()&&t.tech_&&(setupSessions(t),t.tech_.el_.addEventListener("encrypted",function(e){if(t.currentSource().keySystems&&t.currentSource().keySystems["com.widevine.alpha"]&&"application/dash+xml"===t.currentSource().type)return!1;setupSessions(t),handleEncryptedEvent(e,getOptions(t),t.eme.sessions,t.tech_)}),t.tech_.el_.addEventListener("webkitneedkey",function(e){setupSessions(t),handleWebKitNeedKeyEvent(e,getOptions(t),t.tech_)}),videojs.browser.IS_EDGE||t.tech_.el_.addEventListener("msneedkey",function(e){setupSessions(t),handleMsNeedKeyEvent(e,getOptions(t),t.eme.sessions,t.tech_)}))},DRM=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return i.options=r,n.ready(function(){return onPlayerReady(n)}),n.eme={initializeMediaKeys:function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:function(){},i=videojs.mergeOptions(n.currentSource(),r,t),o={initDataType:"cenc",initData:null,target:n.tech_.el_};setupSessions(n),n.tech_.el_.setMediaKeys?handleEncryptedEvent(o,i,n.eme.sessions,n.tech_).then(function(){return e()})["catch"](function(t){return e(t)}):n.tech_.el_.msSetMediaKeys&&(handleMsNeedKeyEvent(o,i,n.eme.sessions,n.tech_),e())},options:r},i}return inherits(e,t),e.prototype.setOptions=function(t){this.options=t,this.player.options_.plugins.DRM=t},e}(Plugin$18),registerPlugin$2=videojs.registerPlugin||videojs.plugin;registerPlugin$2("DRM",DRM);var Plugin$19=videojs.getPlugin("plugin"),PDT=function(t){function e(n){classCallCheck(this,e);var r=possibleConstructorReturn(this,t.call(this,n));return n.plugins=n.plugins||{},n.plugins.pdt=!0,r}return inherits(e,t),e}(Plugin$19);videojs.registerPlugin("PDT",PDT);var Plugin$20=videojs.getPlugin("plugin"),dom$2=videojs.dom;if(!window.requestAnimationFrame){var lastTime=0;window.requestAnimationFrame=function(t){var e=(new Date).getTime(),n=Math.max(0,16.7-(e-lastTime)),r=window.setTimeout(function(){t(e+n)},n);return lastTime=e+n,r}}window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)});var DynamicWatermark=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return i.options=r||{},i.options.content&&i.init(),i}return inherits(e,t),e.prototype.dispose=function(){this.stopAnimation(),this.player.$(".tcp-dynamic-watermark-container")&&this.player.el().removeChild(this.containerElement),t.prototype.dispose.call(this)},e.prototype.init=function(){var t=this,e=this.player;this.isFirstShow=!0,this.initUI(),this.initStyle(),this.initSpeed(),e.on("loadedmetadata",function(){t.calculateStyle(),t.setStyle(),dom$2.removeClass(t.containerElement,"vjs-hidden")}),e.one("play",function(){t.encModule=new Enc,t.ghostCycle=t.encModule.calculateGhost(t.player.duration()),t.startAnimation()}),e.on(["fullscreenchange","playerresize"],function(){setTimeout(function(){t.calculateStyle()},200)})},e.prototype.initUI=function(){var t=this.player,e=dom$2.createEl("div",{className:"tcp-dynamic-watermark-container vjs-hidden"}),n=dom$2.createEl("div",{innerHTML:encodeHTML(this.options.content),className:"tcp-dynamic-watermark-content"});if(e.appendChild(n),this.options.keep||t.el().appendChild(e),this.containerElement=e,this.markContentElement=n,
20
- "image"===this.options.type){var r=document.createElement("img");this.options.width&&(r.style.width=this.options.width),this.options.height&&(r.style.height=this.options.height),r.setAttribute("src",this.options.content),this.markContentElement.innerHTML="",this.markContentElement.appendChild(r)}},e.prototype.initStyle=function(){this.style={containerWidth:"",containerHeight:"",containerLeft:"",containerTop:"",contentLeft:80*Math.random(),contentTop:80*Math.random(),margin:0,padding:0,display:"block",visibility:"visible",opacity:.5,position:"absolute",color:"rgba(255, 255, 255)"}},e.prototype.initSpeed=function(){this.speed=this.options.keep&&0===this.options.speed?.2:this.options.speed},e.prototype.calculateStyle=function(){var t=this.player,e=this.style,n=t.videoWidth(),r=t.videoHeight(),i=dom$2.getBoundingClientRect(t.el()),o=i.width,s=i.height,a=(o/s).toFixed(2),l=(n/r).toFixed(2),c=void 0,u=void 0;l<a?(u=s,c=u*l):l>a?(c=o,u=c/l):l==a&&(c=o,u=s),e.containerLeft=(o-c)/2/o*100,e.containerTop=(s-u)/2/s*100,e.containerWidth=c/o*100,e.containerHeight=u/s*100},e.prototype.setStyle=function(){var t=this.containerElement,e=this.markContentElement,n=this.style;t.style.left=n.containerLeft+"%",t.style.top=n.containerTop+"%",t.style.width=n.containerWidth+"%",t.style.height=n.containerHeight+"%",t.style.display=e.style.display=n.display,t.style.visibility=e.style.visibility=n.visibility,t.style.opacity=e.style.opacity=n.opacity,t.style.position=e.style.position=n.position,t.style.margin=e.style.margin=n.margin,t.style.padding=e.style.padding=n.padding,e.style.left=this.options.left||n.contentLeft+"%",e.style.top=this.options.top||n.contentTop+"%",this.options.right&&(e.style.right=this.options.right),this.options.bottom&&(e.style.bottom=this.options.bottom),e.style.color=this.options.color||n.color,this.options.keep||(t.style.opacity=e.style.opacity=this.options.opacity||n.opacity),"text"===this.options.type&&(e.style.fontSize=this.options.fontSize||"12px",e.innerHTML=encodeHTML(this.options.content))},e.prototype.setContent=function(t){this.options.content=t},e.prototype.startAnimation=function(){var t=this;if(!this.rafID){var e=(this.player,this.style),n=this.containerElement,r=this.markContentElement,i=1,o=1,s=Math.random(),a=function l(){try{if(!t.isPauseAnimation){var a=Math.min(1,0===t.speed?0:t.speed?t.speed:.2),c=dom$2.getBoundingClientRect(n),u=dom$2.getBoundingClientRect(r),h=u.left-c.left,p=u.top-c.top;h+=a*i*s,p+=a*o*(1-s),h+u.width>c.width?(i=-1,s=Math.random()):h<0&&(i=1,s=Math.random()),p+u.height>c.height?(o=-1,s=Math.random()):p<0&&(o=1,s=Math.random()),h=Math.min(c.width-u.width,h),p=Math.min(c.height-u.height,p),e.contentLeft=h/c.width*100,e.contentTop=p/c.height*100,t.setStyle(),t.player&&t.encModule.removeWaterMark(t)}}catch(d){t.player&&t.encModule.handleWatermarkElementAdd(t)}if(t.isStopAnimation)return t.isStopAnimation=!1,cancelAnimationFrame(t.rafID),void(t.rafID=null);0!==t.speed&&requestAnimationFrame(l)};this.rafID=requestAnimationFrame(a)}},e.prototype.resumeAnimation=function(){this.isPauseAnimation=!1},e.prototype.pauseAnimation=function(){this.isPauseAnimation=!0},e.prototype.stopAnimation=function(){this.isStopAnimation=!0},e}(Plugin$20);videojs.registerPlugin("DynamicWatermark",DynamicWatermark);var Plugin$21=videojs.getPlugin("plugin"),XP2PHlsjsPlugin=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return i.options=r,i.hlsp2p=null,i}return inherits(e,t),e.prototype.startHLSP2P=function(t,e,n){var r=this,i=this.player.tech_,o=i.options_,s=o.xp2pConfig;if(e.isSupported()&&!window.hlsp2p){for(var a=["videoType","xp2pPackage","xp2pAppId","tencentCloudAppId"],l=a,c=Array.isArray(l),u=0,l=c?l:l[Symbol.iterator]();;){var h;if(c){if(u>=l.length)break;h=l[u++]}else{if(u=l.next(),u.done)break;h=u.value}var p=h;if(s[p]===undefined)return}var d={videoId:o.playerId+"_html5_api",url:o.source.src,videoType:s.videoType,cloudAppId:s.tencentCloudAppId,domain:s.xp2pPackage,xp2pAppId:s.xp2pAppId,p2pStartDelay:1e3},f=HLSP2P.create(t,Object.assign(d,s));f.on(HLSP2P.Events.Rollback,function(t){r.destroy(),n&&n(t)}),this.hlsp2p=f}},e.prototype.destroy=function(){this.hlsp2p&&(this.hlsp2p.destroy(),this.hlsp2p=null,window.hlsp2p=undefined)},e.prototype.dispose=function(){this.destroy()},e}(Plugin$21);videojs.registerPlugin("XP2PHlsjsPlugin",XP2PHlsjsPlugin);var Plugin$22=videojs.getPlugin("plugin"),XP2PFlvjsPlugin=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return i.options=r,i}return inherits(e,t),e.prototype.createLoader=function(t,e,n){var r=this.player.tech();return function(t){function i(e,n){classCallCheck(this,i);var r=possibleConstructorReturn(this,t.call(this));return r._qvbp2p=null,r._receivedLength=0,r._config=n,r}return inherits(i,t),i.isSupported=function(){return e&&e.isSupported()},i.prototype.destroy=function(){this._destroyQVBP2P(),t.prototype.destroy.call(this)},i.prototype.open=function(t){this._createQVBP2P(),this._qvbp2p.on(e.ComEvents.STATE_CHANGE,this._onQVBP2PStateChange.bind(this)),this._qvbp2p.setMediaElement(r.el());var n={src:t.url};this._qvbp2p.loadSource(n)},i.prototype.abort=function(){this._destroyQVBP2P()},i.prototype._onQVBP2PStateChange=function(t,n){var r=e.ComCodes;switch(n.code){case r.RECEIVE_BUFFER:this._receiveBuffer(n.payload);break;case r.ROLLBACK:this._rollback(n)}},i.prototype._receiveBuffer=function(t){var e=this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,e,this._receivedLength)},i.prototype._rollback=function(t){n&&n(t)},i.prototype._createQVBP2P=function(){this._qvbp2p&&this._destroyQVBP2P(),this._qvbp2p=e.create(this._config.xp2pConfig),window.qvbp2p=this._qvbp2p},i.prototype._destroyQVBP2P=function(){this._qvbp2p&&(this._qvbp2p.destroy(),this._qvbp2p=null,window.qvbp2p=null)},i}(t.BaseLoader)},e}(Plugin$22);videojs.registerPlugin("XP2PFlvjsPlugin",XP2PFlvjsPlugin);var defaultConfig$1={enableStashBuffer:!1},Html5FlvJS=function(){function t(e,n,r){var i=this;classCallCheck(this,t);var o=function(){var t=window.flvjs;i.flvjs=t;var o=videojs.mergeOptions(defaultConfig$1,r.flvConfig,{xp2pConfig:r.xp2pConfig}),s=n.player();if(window.QVBP2P&&r.xp2pConfig&&r.xp2pConfig.useXP2P&&s.XP2PFlvjsPlugin){var a=s.XP2PFlvjsPlugin().createLoader(t,window.QVBP2P,function(t){i.dispose(),r.xp2pConfig.useXP2P=!1;var e=i.tech.player(),n=i.tech.currentSource_.src;e.src(n)});i.xp2pFlvLoader=a,o.customLoader=a}var l=new t.createPlayer(Object.assign({isLive:!1,url:e.src,type:"flv"},o),o);i.tech=n,l.on(t.Events.ERROR,videojs.bind(i,i.onError));for(var c in t.Events)!function(e){l.on(t.Events[e],videojs.bind(i,function(t){this.onEvent(e,t)}))}(c);s.trigger({type:"flvInstanceCreated",data:{flv:l}}),l.on(t.Events.STATISTICS_INFO,function(t){var e=(t.bps_audio||0)+(t.bps_video||0);s.trigger({type:"playstatus",data:{type:"flv",decodedFrames:t.decodedFrames,droppedFrames:t.droppedFrames,speed:t.speed.toFixed(0),bitrate:e||0,bpsAudio:t.bps_audio||0,bpsVideo:t.bps_video||0}})}),i.flv=l,i._id=(new Date).getTime(),n.el().srcObject&&(n.el().srcObject=null),l.attachMediaElement(n.el()),l.load()};Promise.all([function(){return r.xp2pConfig&&r.xp2pConfig.useXP2P&&"flv"===r.xp2pConfig.format&&!window.QVBP2P?new Promise(function(t){loadScript(XP2P_FLV_PATH,function(){t()})}):Promise.resolve()}(),function(){return window.flvjs?Promise.resolve():new Promise(function(t){loadScript(FLV_PATH,function(){t()})})}()]).then(function(){o()})}return t.prototype.onError=function(t,e,n){var r=this.tech.player();t===this.flvjs.ErrorTypes.NETWORK_ERROR&&r.error({code:2,source:n}),t===this.flvjs.ErrorTypes.MEDIA_ERROR&&r.error({code:3,source:n})},t.prototype.onEvent=function(t,e){this.tech.player().trigger({type:"FLVJS_EVENT",data:{type:t,data:e}})},t.prototype.dispose=function(){if(this.tech.player().pause(),this.tech.flvProvider)try{this.flv.destroy()}catch(t){}this.tech.flvProvider=null},t}(),flvTypeRE=/^video\/flv$/i,flvExtRE=/.flv(?![^?])/i,flvProtoRE=/^(ws:\/\/)/i,FlvSourceHandler={name:"flvSourceHandler",canHandleSource:function(t){return flvTypeRE.test(t.type)?"probably":flvExtRE.test(t.src)||flvProtoRE.test(t.src)?"maybe":""},handleSource:function(t,e,n){return e.flvProvider&&e.flvProvider.dispose(),e.flvProvider=new Html5FlvJS(t,e,n),e.flvProvider},canPlayType:function(t){if(flvTypeRE.test(t))return"probably"}};TCPlayer.mountFlvProvider=mountFlvProvider,mountFlvProvider();var defaultConfig$2={connectRetryCount:2,connectTimeout:5,receiveVideo:!0,receiveAudio:!0,showLog:!1},WebRTCProvider=function(){function t(e,n,r){var i=this;classCallCheck(this,t);var o=function(){i.tech=n,i.player=i.tech.player(),i.playerMetrics=i.player.PlayerMetrics(),i.report=i.player.options_.reportable;var t=window.TXLivePlayer;i.TXLivePlayer=t;var o=videojs.mergeOptions(defaultConfig$2,r.webrtcConfig);r.xp2pConfig&&"webrtc"===r.xp2pConfig.format&&r.xp2pConfig.useXP2P&&Object.assign(o,{p2pEnable:r.xp2pConfig.useXP2P,p2pConfig:{cloudAppid:r.xp2pConfig.tencentCloudAppId,xp2pAppid:r.xp2pConfig.xp2pAppId,appKey:r.xp2pConfig.xp2pAppKey,xp2pDomain:r.xp2pConfig.xp2pPackage}});var s=new t;i.webrtcConfig=o,s.setPlayerView(n.el()),s.setConfig(o),s.setPlayListener({onPlayEvent:videojs.bind(i,i.onPlayEvent),onPlayStats:videojs.bind(i,i.onPlayStats),onPlayReport:videojs.bind(i,i.onPlayReport),onPlaySEI:videojs.bind(i,i.onPlaySEI)}),s.startPlay(e.src),i.player.trigger({type:"webrtcInstanceCreated",data:{webrtc:s}}),i.webrtcPlayer=s};window.TXLivePlayer?o():loadScript(WEBRTC_PATH,function(){o()})}return t.prototype.onPlayStats=function(t){this.tech.player().trigger({type:"webrtcstats",data:t})},t.prototype.onPlayEvent=function(t,e){var n=this.tech.player();if(n.trigger({type:"debug",data:{code:t,data:e}}),t<-2e3){if(-2003===t&&e&&e.videoActive&&(n.trigger("blocked"),n.trigger({type:"webrtcevent",data:{code:2005}})),-2003===t)return!1;if(-2005===t||-2001===t||-2004===t){n.trigger({type:"debug",data:{message:"debug === webrtc 状态码 "+t+",进入降级逻辑"}});var r=n.options_.webrtcConfig;if(!r||!1!==r.fallback)return this.switchPlaySource(),!1}return n.error({code:t,source:e}),!1}n.trigger({type:"webrtcevent",data:{code:t,data:e}})},t.prototype.onPlayReport=function(t){if(!1===this.report)return!1;if(40101===t.uint32_command){this.tech.player().trigger({type:"debug",data:{code:"report",data:t}}),this.playerMetrics.report_40101(t)}40100===t.uint32_command&&this.playerMetrics.report_40100(t),40102===t.uint32_command&&this.playerMetrics.report_40102(t)},t.prototype.onPlaySEI=function(t){this.tech.player().trigger({type:"webrtcsei",data:t})},t.prototype.dispose=function(){this.webrtcPlayer&&(this.webrtcPlayer.setPlayListener({onPlayEvent:function(){},onPlayStats:function(){}}),this.webrtcPlayer.stopPlay(),this.webrtcPlayer.setPlayerView(videojs.dom.createEl("video"))),this.webrtcPlayer=null},t.prototype.setSource=function(t){var e=this;this.webrtcPlayer.startPlay(t.src),this.tech.player().one("webrtcevent",function(t){-1002===t.data.code&&e.tech.player().play()})},t.prototype.recovery=function(){var t=this,e=this.tech.player(),n=void 0;e.one("waiting",function(){n=setTimeout(function(){e.one("webrtcevent",function(n){if(1004===n.data.code){t.webrtcPlayer&&t.webrtcPlayer.startPlay(e.src()),e.play();var r=function i(t){1002===t.data.code&&(e.play(),e.off("webrtcevent",i))};e.on("webrtcevent",r)}}),t.webrtcPlayer&&t.webrtcPlayer.stopPlay()},2e3)}),e.one("playing",function(){n&&clearTimeout(n)})},t.prototype.switchPlaySource=function(){var t=this.tech.player(),e=void 0,n=this.tech.currentSource_.src;e=this.webrtcConfig&&this.webrtcConfig.fallbackUrl?[{src:this.webrtcConfig.fallbackUrl}]:this.convertProtocol(n),t.trigger({type:"webrtcfallback",data:{target:e[0].src}}),t.bigPlayButton&&t.bigPlayButton.hide(),t.posterImage&&t.posterImage.hide();var r=[];t.options_.hlsConfig&&t.options_.hlsConfig.skipHlsJs?e.forEach(function(t){t.src?r.push({src:t.src,skipHlsJs:!0}):r.push({src:t,skipHlsJs:!0})}):r=[].concat(e),t.src(r);var i=videojs.browser.IS_IOS||videojs.browser.IS_ANDROID?"loadeddata":"loadedmetadata",o=function s(){t.play(),t.one("progress",function(){t.play(),t.off(i,s)})};t.on(i,o)},t.prototype.convertProtocol=function(t){var e=[];if(t.indexOf(".sdp")>-1)t=t.replace(".sdp",".flv"),e.push(t.replace(".sdp",".m3u8"));else{var n=t.replace("webrtc://","https://").replace("?",".flv?");-1===n.indexOf("?")&&-1===n.indexOf(".flv")&&(n+=".flv");var r=t.replace("webrtc://","https://").replace("?",".m3u8?");-1===r.indexOf("?")&&-1===r.indexOf(".m3u8")&&(r+=".m3u8"),e.push(r)}return e},t}(),webrtcTypeRE=/^webrtc/i,webrtcExtRE=/\.sdp/i,webrtcProtoRE=/^(webrtc:\/\/)/i,sourceHandler={name:"webrtcSourceHandler",canHandleSource:function(t){return webrtcTypeRE.test(t.type)?"probably":webrtcExtRE.test(t.src)||webrtcProtoRE.test(t.src)?"maybe":""},handleSource:function(t,e,n){return e.webrtcProvider&&e.webrtcProvider.dispose(),e.webrtcProvider=new WebRTCProvider(t,e,n),e.webrtcProvider},canPlayType:function(t){if(webrtcTypeRE.test(t))return"probably"}};mountWebRTCProvider();for(var Tech$2=videojs.getComponent("Tech"),Dom$1=videojs.dom,Url$1=videojs.url,createTimeRange=videojs.createTimeRange,mergeOptions$1=videojs.mergeOptions,navigator$2=window_1&&window_1.navigator||{},Flash=function(t){function e(n,r,i){classCallCheck(this,e);var o=possibleConstructorReturn(this,t.call(this,n,r,i));return r.source&&o.ready(function(){this.setSource(r.source)},!0),r.startTime&&o.ready(function(){this.load(),this.play(),this.currentTime(r.startTime)},!0),window_1.videojs=window_1.videojs||{},window_1.videojs.Flash=window_1.videojs.Flash||{},window_1.videojs.Flash.onReady=e.onReady,window_1.videojs.Flash.onEvent=e.onEvent,window_1.videojs.Flash.onError=e.onError,o.on("seeked",function(){this.lastSeekTarget_=undefined}),o}return inherits(e,t),e.prototype.createEl=function(){var t=this.options_;t.swf||(t.swf=unifyProtocol("//imgcache.qq.com/open/qcloud/video/tcplayer/player.swf"));var n=t.techId,r=mergeOptions$1({readyFunction:"videojs.Flash.onReady",eventProxyFunction:"videojs.Flash.onEvent",errorEventProxyFunction:"videojs.Flash.onError",autoplay:t.autoplay,preload:t.preload,loop:t.loop,muted:t.muted},t.flashVars),i=mergeOptions$1({wmode:"opaque",bgcolor:"#000000"},t.params),o=mergeOptions$1({id:n,name:n,"class":"vjs-tech"},t.attributes);return this.el_=e.embed(t.swf,r,i,o),this.el_.tech=this,this.el_},e.prototype.play=function(){this.ended()&&this.setCurrentTime(0),this.el_.vjs_play()},e.prototype.pause=function(){this.el_.vjs_pause()},e.prototype.src=function(t){return t===undefined?this.currentSrc():this.setSrc(t)},e.prototype.setSrc=function(t){var e=this;t=Url$1.getAbsoluteURL(t),this.el_.vjs_src(t),this.autoplay()&&this.setTimeout(function(){return e.play()},0)},e.prototype.seeking=function(){return this.lastSeekTarget_!==undefined},e.prototype.setCurrentTime=function(e){var n=this.seekable();n.length&&(e=e>n.start(0)?e:n.start(0),e=e<n.end(n.length-1)?e:n.end(n.length-1),this.lastSeekTarget_=e,this.trigger("seeking"),this.el_.vjs_setProperty("currentTime",e),t.prototype.setCurrentTime.call(this))},e.prototype.currentTime=function(){return this.seeking()?this.lastSeekTarget_||0:this.el_.vjs_getProperty("currentTime")},e.prototype.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.vjs_getProperty("currentSrc")},e.prototype.duration=function(){if(0===this.readyState())return NaN;var t=this.el_.vjs_getProperty("duration");return t>=0?t:Infinity},e.prototype.load=function(){this.el_.vjs_load()},e.prototype.poster=function(){this.el_.vjs_getProperty("poster")},e.prototype.setPoster=function(){},e.prototype.seekable=function(){var t=this.duration();return 0===t?createTimeRange():createTimeRange(0,t)},e.prototype.buffered=function(){var t=this.el_.vjs_getProperty("buffered");return 0===t.length?createTimeRange():createTimeRange(t[0][0],t[0][1])},e.prototype.supportsFullScreen=function(){return!1},e.prototype.enterFullScreen=function(){return!1},e.prototype.getVideoPlaybackQuality=function(){var t=this.el_.vjs_getProperty("getVideoPlaybackQuality");return window_1.performance&&"function"==typeof window_1.performance.now?t.creationTime=window_1.performance.now():window_1.performance&&window_1.performance.timing&&"number"==typeof window_1.performance.timing.navigationStart&&(t.creationTime=window_1.Date.now()-window_1.performance.timing.navigationStart),t},e}(Tech$2),_readWrite=["rtmpConnection","rtmpStream","preload","defaultPlaybackRate","playbackRate","autoplay","loop","controls","volume","muted","defaultMuted"],_readOnly=["networkState","readyState","initialTime","startOffsetTime","paused","ended","videoWidth","videoHeight"],_api=Flash.prototype,i$2=0;i$2<_readWrite.length;i$2++)_createGetter(_readWrite[i$2]),_createSetter(_readWrite[i$2]);for(var _i$1=0;_i$1<_readOnly.length;_i$1++)_createGetter(_readOnly[_i$1]);Flash.isSupported=function(){return Flash.version()[0]>=10},Tech$2.withSourceHandlers(Flash),Flash.nativeSourceHandler={},Flash.nativeSourceHandler.canPlayType=function(t){return t in Flash.formats?"maybe":""},Flash.nativeSourceHandler.canHandleSource=function(t,e){var n=void 0;return n=t.type?t.type.replace(/;.*/,"").toLowerCase():function(t){var e=Url$1.getFileExtension(t);return e?"video/"+e:""}(t.src),Flash.nativeSourceHandler.canPlayType(n)},Flash.nativeSourceHandler.handleSource=function(t,e,n){e.setSrc(t.src)},Flash.nativeSourceHandler.dispose=function(){},Flash.registerSourceHandler(Flash.nativeSourceHandler),Flash.formats={"video/flv":"FLV","video/x-flv":"FLV","video/mp4":"MP4","video/m4v":"MP4"},Flash.onReady=function(t){var e=Dom$1.$("#"+t),n=e&&e.tech;n&&n.el()&&Flash.checkReady(n)},Flash.checkReady=function(t){t.el()&&(t.el().vjs_getProperty?t.triggerReady():this.setTimeout(function(){Flash.checkReady(t)},50))},Flash.onEvent=function(t,e){var n=Dom$1.$("#"+t).tech,r=Array.prototype.slice.call(arguments,2);n.setTimeout(function(){n.trigger(e,r)},1)},Flash.onError=function(t,e){var n=Dom$1.$("#"+t).tech;if("srcnotfound"===e)return n.error(4);n.error("FLASH: "+e)},Flash.version=function(){var t="0,0,0";try{t=new window_1.ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(e){try{navigator$2.mimeTypes["application/x-shockwave-flash"].enabledPlugin&&(t=(navigator$2.plugins["Shockwave Flash 2.0"]||navigator$2.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1])}catch(e){}}return t.split(",")},Flash.embed=function(t,e,n,r){var i=Flash.getEmbedCode(t,e,n,r);return Dom$1.createEl("div",{innerHTML:i}).childNodes[0]},Flash.getEmbedCode=function(t,e,n,r){var i="",o="",s="";return e&&Object.getOwnPropertyNames(e).forEach(function(t){i+=t+"="+e[t]+"&amp;"}),n=mergeOptions$1({movie:t,flashvars:i,allowScriptAccess:"always",allowNetworking:"all"},n),Object.getOwnPropertyNames(n).forEach(function(t){o+='<param name="'+t+'" value="'+n[t]+'" />'}),r=mergeOptions$1({data:t,width:"100%",height:"100%"},r),Object.getOwnPropertyNames(r).forEach(function(t){s+=t+'="'+r[t]+'" '}),'<object type="application/x-shockwave-flash" '+s+">"+o+"</object>"},FlashRtmpDecorator(Flash),Tech$2.getTech("Flash")?(videojs.log.warn("Not using videojs-flash as it appears to already be registered"),videojs.log.warn("videojs-flash should only be used with video.js@6 and above")):videojs.registerTech("Flash",Flash);var FlashlsSourceHandler={},mpegurlRE$1=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i;FlashlsSourceHandler.canPlayType=function(t){return mpegurlRE$1.test(t)?"maybe":""},FlashlsSourceHandler.canHandleSource=function(t,e){return"maybe"===FlashlsSourceHandler.canPlayType(t.type)},FlashlsSourceHandler.handleSource=function(t,e,n){e.setSrc(t.src)},FlashlsSourceHandler.dispose=function(){},videojs.getTech("Flash").registerSourceHandler(FlashlsSourceHandler,0),FlashlsSourceHandler.VERSION="__VERSION__";var Play="播放",Pause="暂停",LIVE="直播",Loaded="加载完毕",Progress="进度",Fullscreen="全屏",Mute="静音",Unmute="取消静音",Subtitles="字幕",Captions="内嵌字幕",Chapters="节目段落",Descriptions="描述",Close="关闭",Replay="重播",Text="文字",White="白",Black="黑",Red="红",Green="绿",Blue="蓝",Yellow="黄",Magenta="紫红",Cyan="青",Background="背景",Window="视窗",Transparent="透明",Opaque="不透明",None="无",Raised="浮雕",Depressed="压低",Uniform="均匀",Dropshadow="下阴影",Casual="舒适",Script="手写体",Reset="重启",Done="完成",auto="自动",Mirror="镜像",CN={Play:Play,Pause:Pause,LIVE:LIVE,Loaded:Loaded,Progress:Progress,Fullscreen:Fullscreen,Mute:Mute,Unmute:Unmute,Subtitles:Subtitles,Captions:Captions,Chapters:Chapters,Descriptions:Descriptions,Close:Close,Replay:Replay,Text:Text,White:White,Black:Black,Red:Red,Green:Green,Blue:Blue,Yellow:Yellow,Magenta:Magenta,Cyan:Cyan,Background:Background,Window:Window,Transparent:Transparent,Opaque:Opaque,None:None,Raised:Raised,Depressed:Depressed,Uniform:Uniform,Dropshadow:Dropshadow,Casual:Casual,Script:Script,Reset:Reset,Done:Done,auto:auto,Mirror:Mirror,"Current Time":"当前时间","Duration Time":"时长","Remaining Time":"剩余时间","Stream Type":"媒体流类型","Non-Fullscreen":"退出全屏","Playback Rate":"播放速度","subtitles off":"关闭字幕","captions off":"关闭内嵌字幕","Close Modal Dialog":"关闭弹窗","descriptions off":"关闭描述","Audio Track":"音轨","You aborted the media playback":"视频播放被终止","A network error caused the media download to fail part-way.":"网络错误导致视频下载中途失败。","The media could not be loaded, either because the server or network failed or because the format is not supported.":"视频因格式不支持或者服务器或网络的问题无法加载。","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"由于视频文件损坏或是该视频使用了你的浏览器不支持的功能,播放终止。","No compatible source was found for this media.":"无法找到此视频兼容的源或者当前环境无法播放该视频。","The media is encrypted and we do not have the keys to decrypt it.":"视频已加密,无法解密。","Play Video":"播放视频","Modal Window":"弹窗","This is a modal window":"这是一个弹窗","This modal can be closed by pressing the Escape key or activating the close button.":"可以按ESC按键或启用关闭按钮来关闭此弹窗。",", opens captions settings dialog":", 开启标题设置弹窗",", opens subtitles settings dialog":", 开启字幕设置弹窗",", opens descriptions settings dialog":", 开启描述设置弹窗",", selected":", 选择","captions settings":"字幕设定","Audio Player":"音频播放器","Video Player":"视频播放器","Progress Bar":"进度小节","Volume Level":"音量","subtitles settings":"字幕设定","descriptions settings":"描述设定","Semi-Transparent":"半透明","Font Size":"字体尺寸","Text Edge Style":"字体边缘样式","Font Family":"字体库","Proportional Sans-Serif":"比例无细体","Monospace Sans-Serif":"单间隔无细体","Proportional Serif":"比例细体","Monospace Serif":"单间隔细体","Small Caps":"小型大写字体","restore all settings to the default values":"恢复全部设定至预设值","Caption Settings Dialog":"字幕设定视窗","Beginning of dialog window. Escape will cancel and close the window.":"开始对话视窗。离开会取消及关闭视窗","End of dialog window.":"结束对话视窗","Request timed out.":"请求超时,请稍后再试。","Could not download the video.":"无法加载视频,请检查网络。","Server is not respond.":"服务器请求失败,请稍后再试。","Server respond error data.":"服务器返回数据有误,请稍后再试。","Last time play at ":"上次看到 ","Resume play":"恢复播放","Powered by Tencent Cloud.":"腾讯云提供技术支持","Rise an internal exception when playing HLS.":"播放 HLS 时出现内部异常。","Authentication failed.":"防盗链参数鉴权失败。","Server failed.":"媒体服务器错误。","Get file error.":"媒体服务器获取文件错误。","The media file does not exist. Please check if the fileID is correct.":"媒体文件不存在,请检查 fileID 是否正确。","No video transcoding information found.":"没有找到视频转码信息。","Current browser not support DRM.":"浏览器不支持当前 DRM 方案。","The trial duration is illegal. The trial duration must be within the video duration.":"试看时长不合法,试看时长要在视频时长范围内。","Param pcfg is not unique.":"pcfg 不唯一。","The license has expired. Please check whether the expiration time setting is reasonable.":"license 过期,请检查过期时间设置是否合理。","Did not find an adaptive stream that can be played.":"没有找到可以播放的自适应码流,<a href='https://cloud.tencent.com/document/product/266/34071' style='color: white;' target='_blank'>查看文档</a>。","Invalid request format, please check the request format.":"请求格式不合法,请检查请求格式。","AppID is not exist, Please check if the AppID is correct.":"AppID 不存在,请检查 AppID 是否正确。","Without anti-leech information.":"没带防盗链检测。","qsign invalid.":"播放参数 qsign 校验失败","psign check failed.":"播放参数 psign 校验失败,<a href='https://cloud.tencent.com/document/product/266/45554' style='color: white' target='_blank'>查看文档</a>。","Other errors.":"其他错误。","Internal error.":"内部错误。","Response data verification failed.":"响应数据校验失败","Video statistic":"视频统计信息","Play Next":"下一个","Current browser not support play this stream, please select another one.":"无法找到此视频兼容的源或者当前环境无法播放该视频,请选择其他视频播放。","Server respond error data.(eg. stream not exist)":"媒体服务器获取数据异常,可能该视频不存在,请选择其他视频播放。","Video play failed, please refresh to start play again.":"视频播放器失败,请刷新并重新播放。","Connection to the server has failed and the number of connection retries has exceeded the set value.":"媒体服务器连接异常,并达到最大重试次数,请检查网络是否正常并刷新重试","Video decoding failure.":"视频解码失败,请选择其他视频播放。"},log=videojs.log;if(Function.prototype.bind&&"object"==("undefined"==typeof console?"undefined":_typeof(console))&&"object"==_typeof(console.log))for(var logFns=["log","info","warn","error","assert","dir","clear","profile","profileEnd"],i=0;i<logFns.length;i++){var method=logFns[i];console[method]=Function.prototype.call.bind(console[method],console)}return videojs.addLanguage("zh-CN",CN),Object.keys(videojs).forEach(function(t){TCPlayer[t]=videojs[t]}),TCPlayer});
15
+ document_1.createElement("track"),document_1.createElement("video-js")),videojs.hooks_={},videojs.hooks=function(t,e){return videojs.hooks_[t]=videojs.hooks_[t]||[],e&&(videojs.hooks_[t]=videojs.hooks_[t].concat(e)),videojs.hooks_[t]},videojs.hook=function(t,e){videojs.hooks(t,e)},videojs.hookOnce=function(t,e){videojs.hooks(t,[].concat(e).map(function(e){return function n(){return videojs.removeHook(t,n),e.apply(undefined,arguments)}}))},videojs.removeHook=function(t,e){var n=videojs.hooks(t).indexOf(e);return!(n<=-1)&&(videojs.hooks_[t]=videojs.hooks_[t].slice(),videojs.hooks_[t].splice(n,1),!0)},!0!==window_1.VIDEOJS_NO_DYNAMIC_STYLE&&isReal()){var style=$(".vjs-styles-defaults");if(!style){style=createStyleElement("vjs-styles-defaults");var head=$("head");head&&head.insertBefore(style,head.firstChild),setTextContent(style,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid {\n padding-top: 56.25%\n }\n ")}}autoSetupTimeout(1,videojs),videojs.VERSION=version,videojs.options=Player.prototype.options_,videojs.getPlayers=function(){return Player.players},videojs.players=Player.players,videojs.getComponent=Component.getComponent,videojs.registerComponent=function(t,e){Tech.isTech(e)&&log$2.warn("The "+t+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"),Component.registerComponent.call(Component,t,e)},videojs.getTech=Tech.getTech,videojs.registerTech=Tech.registerTech,videojs.use=use,videojs.browser=browser,videojs.TOUCH_ENABLED=TOUCH_ENABLED,videojs.extend=extendFn,videojs.mergeOptions=mergeOptions,videojs.bind=bind,videojs.registerPlugin=Plugin.registerPlugin,videojs.plugin=function(t,e){return log$2.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Plugin.registerPlugin(t,e)},videojs.getPlugins=Plugin.getPlugins,videojs.getPlugin=Plugin.getPlugin,videojs.getPluginVersion=Plugin.getPluginVersion,videojs.addLanguage=function(t,e){var n;return t=(""+t).toLowerCase(),videojs.options.languages=mergeOptions(videojs.options.languages,(n={},n[t]=e,n)),videojs.options.languages[t]},videojs.log=log$2,videojs.createTimeRange=videojs.createTimeRanges=createTimeRanges,videojs.formatTime=formatTime,videojs.parseUrl=parseUrl,videojs.isCrossOrigin=isCrossOrigin,videojs.EventTarget=EventTarget,videojs.on=on,videojs.one=one,videojs.off=off,videojs.trigger=trigger,videojs.xhr=xhr,videojs.TextTrack=TextTrack,videojs.AudioTrack=AudioTrack,videojs.VideoTrack=VideoTrack,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(function(t){videojs[t]=function(){return log$2.warn("videojs."+t+"() is deprecated; use videojs.dom."+t+"() instead"),Dom[t].apply(null,arguments)}}),videojs.computedStyle=computedStyle,videojs.dom=Dom,videojs.url=Url;var strictUriEncode=function(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})},getOwnPropertySymbols=Object.getOwnPropertySymbols,hasOwnProperty$5=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable,objectAssign=shouldUseNative()?Object.assign:function(t,e){for(var n,r,i=toObject(t),o=1;o<arguments.length;o++){n=Object(arguments[o]);for(var s in n)hasOwnProperty$5.call(n,s)&&(i[s]=n[s]);if(getOwnPropertySymbols){r=getOwnPropertySymbols(n);for(var a=0;a<r.length;a++)propIsEnumerable.call(n,r[a])&&(i[r[a]]=n[r[a]])}}return i},token="%[a-f0-9]{2}",singleMatcher=new RegExp(token,"gi"),multiMatcher=new RegExp("("+token+")+","gi"),decodeUriComponent=function(t){if("string"!=typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch(e){return customDecodeURIComponent(t)}},extract_1=extract,parse_1=parse,stringify=function(t,e){e=objectAssign({encode:!0,strict:!0,arrayFormat:"none"},e),!1===e.sort&&(e.sort=function(){});var n=encoderForArrayFormat(e);return t?Object.keys(t).sort(e.sort).map(function(r){var i=t[r];if(i===undefined)return"";if(null===i)return encode(r,e);if(Array.isArray(i)){var o=[];return i.slice().forEach(function(t){t!==undefined&&o.push(n(r,t,o.length))}),o.join("&")}return encode(r,e)+"="+encode(i,e)}).filter(function(t){return t.length>0}).join("&"):""},parseUrl$1=function(t,e){return{url:t.split("?")[0]||"",query:parse(extract(t),e)}},queryString={extract:extract_1,parse:parse_1,stringify:stringify,parseUrl:parseUrl$1},count=0,MediaAsyncLoader=function(t){function e(n,r,i){classCallCheck(this,e),log$2("MediaAsyncLoader initializing");var o=mergeOptions({createEl:!1},r),s=possibleConstructorReturn(this,t.call(this,n,o,i));s.enModule=new Enc,n.loadVideoByID=bind(s,s.loadVideoByID);var a=o.playerOptions||o;if(!a.fileID){var l;return l=!1,possibleConstructorReturn(s,l)}return s.playCGIHosts=(a.playCGIHosts||[]).concat([SERVER_PATH,SERVER_PATH_BACKUP]),s.playCGIIndex=0,s.playCGIMerged=!0,s.getInfo(a),log$2("MediaAsyncLoader initialized"),s}return inherits(e,t),e.prototype.getInfo=function(t){t&&t.fileID&&t.appID&&(performance&&"function"==typeof performance.mark&&performance.mark("firstFrameStart"),t.playDefinition?this.getInfoV3(t):t.sign||t.ssign?this.getInfoV2(t):this.getInfoV4(t))},e.prototype.getInfoV2=function(t){var e=this.player(),n=this.assemblyPath("getplayinfo",t.appID,t.fileID),r=t.t,i=t.us,o=t.exper,s=t.sign,a={};t.ssign?a.super_sign=t.ssign:s&&(a={t:r,sign:s},(i||0==i)&&(a.us=i),(o||0==o)&&(a.exper=o,e.trigger({type:"feature",data:"exper"})),e.trigger({type:"feature",data:"key"})),t.playerID&&(a.playerid=t.playerID),this.requestTimestamp=+(new Date).getTime(),e.trigger({type:"playcgistart",data:{time:this.requestTimestamp,url:n}}),log$2("playcgi loading");var l=queryString.stringify(a);l&&(n+=(~n.indexOf("?")?"&":"?")+l,n=n.replace("?&","?")),this.getInfoRetryTimes=0,this.getInfoRequest=function(t){if(!t||!this.playCGIHosts[this.playCGIIndex+1])return!1;n=n.replace(this.playCGIHosts[this.playCGIIndex],this.playCGIHosts[this.playCGIIndex+1]),this.playCGIIndex++,IE_VERSION&&IE_VERSION<10?jsonp(n,{param:a,timeout:3e3,prefix:"TcCallBack"},bind(this,this.onResult)):xhr({url:n,timeout:3e3},bind(this,this.onResult))},this.getInfoRequest()},e.prototype.onResult=function(t,e,n){try{n?e=JSON.parse(n):t||e||(t=new Error("ServerError"))}catch(l){t=new Error("ServerError")}var r=this.player();if(t){if(log$2("playcgi loaded failure"),this.getInfoRetryTimes<3)return this.getInfoRetryTimes++,void this.getInfoRequest();if(this.getInfoRetryTimes<6)return this.getInfoRetryTimes++,void this.getInfoRequest({isBackup:!0});r.trigger({type:"playcgiend",data:{time:+(new Date).getTime(),startTime:this.requestTimestamp,error:t,result:e}});var i=12;switch(t.message){case"XMLHttpRequest timeout":case"Timeout":i=10;break;case"ServerError":i=11}this.player().error({code:i})}else{if(r.trigger({type:"playcgiend",data:{time:+(new Date).getTime(),startTime:this.requestTimestamp,error:t,result:e}}),0!=e.code)return log$2("playcgi loaded failure"),void this.player().error({code:e.code});log$2("playcgi loaded success");var o=e.coverInfo,s=e.videoInfo,a=e.playerInfo;this.setPoster(o),this.setLogo(a),this.setSrc(e),this.setPatch(a),this.setVttThumbnail(e),this.setDots(e),this.setOriginDuration(s),this.setPlayList(a)}},e.prototype.getInfoV3=function(t){var e=this.player(),n=this.assemblyPathV3("getplayinfo",t.appID,t.fileID,t.playDefinition),r=t.t,i=t.us,o=t.rlimit,s=t.sign,a={};t.ssign?a.super_sign=t.ssign:s&&(a={t:r,sign:s},(i||0==i)&&(a.us=i),o&&(a.rlimit=o),e.trigger({type:"feature",data:"key"})),t.playerID&&(a.playerid=t.playerID),this.requestTimestamp=+(new Date).getTime(),e.trigger({type:"playcgistart",data:{time:this.requestTimestamp,url:n}}),log$2("playcgi v3 loading");var l=queryString.stringify(a);l&&(n+=(~n.indexOf("?")?"&":"?")+l,n=n.replace("?&","?")),this.getInfoRetryTimes=0,this.getInfoRequest=function(t){t&&(n=n.replace(SERVER_PATH_V3,SERVER_PATH_BACKUP)),IE_VERSION&&IE_VERSION<10?jsonp(n,{param:a,timeout:3e3,prefix:"TcCallBack"},bind(this,this.onResultV3)):xhr({url:n,timeout:3e3},bind(this,this.onResultV3))},this.getInfoRequest()},e.prototype.onResultV3=function(t,e,n){try{n?e=JSON.parse(n):t||e.body||(t=new Error("ServerError"))}catch(a){t=new Error("ServerError")}var r=this.player();if(t){if(log$2("playcgi v3 loaded failure"),this.getInfoRetryTimes<3)return this.getInfoRetryTimes++,void this.getInfoRequest();if(this.getInfoRetryTimes<6)return this.getInfoRetryTimes++,void this.getInfoRequest({isBackup:!0});r.trigger({type:"playcgiend",data:{time:+(new Date).getTime(),startTime:this.requestTimestamp,error:t,result:e}});var i=12;switch(t.message){case"XMLHttpRequest timeout":case"Timeout":i=10;break;case"ServerError":i=11}this.player().error({code:i})}else{if(r.trigger({type:"playcgiend",data:{time:+(new Date).getTime(),startTime:this.requestTimestamp,error:t,result:e}}),0!=e.code)return log$2("playcgi v3 loaded failure"),void this.player().error({code:e.code});log$2("playcgi v3 loaded success");var o=e.mediaInfo,s=e.playerInfo;this.setPoster({coverUrl:o.basicInfo.coverUrl}),this.setLogo(s),this.setSrcV3(o),this.setPatch(s),this.setVttThumbnail(o),this.setDots(o)}},e.prototype.setSrcV3=function(t,e){var n=this,r=this.player(),i=r.options_.plugins,o=r.DRM().options||i.DRM,s=void 0,a=void 0,l=void 0,c=[],u={},h={};if(e=e||(o?o.skipPlan:""),t.previewStreamingInfo&&t.previewStreamingInfo.previewStreamingList.length>0)t.previewStreamingInfo.previewStreamingList.forEach(function(t,e){t.mineType=n.getMIMEType(t.url),u[getFileExtension(t.url)]=t});else{if(!(t.dynamicStreamingInfo.adaptiveStreamingInfoList&&t.dynamicStreamingInfo.adaptiveStreamingInfoList.length>0))return void this.player().error({code:13,message:"no video stream"});if(t.dynamicStreamingInfo.adaptiveStreamingInfoList.forEach(function(t,e){t.mineType=n.getMIMEType(t.url),h[t.drmType.toLowerCase()||getFileExtension(t.url)]=t}),o&&o.token?(s=o.token,l=o.certificateUri,e=IS_SAFARI&&!l?"fairplay":e,a=window_1.encodeURIComponent(s)):e="all",(IS_CHROME||IS_FIREFOX)&&window_1.navigator.requestMediaKeySystemAccess&&h.widevine&&"widevine"!=e&&"all"!=e?(c.push({src:unifyProtocol(h.widevine.url),type:this.getMIMEType(h.widevine.url),keySystems:{"com.widevine.alpha":{serverURL:LICENSE_PATH+"?token="+a+"&drmType="+h.widevine.drmType}}}),log$2("DRM source widevine",c)):IS_SAFARI&&!IS_MQQB&&h.fairplay&&"fairplay"!=e&&"all"!=e&&(c.push({src:unifyProtocol(h.fairplay.url),type:this.getMIMEType(h.fairplay.url),keySystems:{"com.apple.fps.1_0":{certificateUri:l,licenseUri:LICENSE_PATH+"?token="+a+"&drmType="+h.fairplay.drmType}}}),log$2("DRM source fairplay",c)),h.simpleaes&&"all"!=e){var p=h.simpleaes.url.split("/");p[p.length-1]="voddrm.token."+a+"."+p[p.length-1],c.push({src:unifyProtocol(p.join("/")),type:this.getMIMEType(h.simpleaes.url)}),log$2("DRM source simpleaes",c)}h.m3u8&&c.push({src:unifyProtocol(h.m3u8.url),type:this.getMIMEType(h.m3u8.url)}),h.mpd&&c.push({src:unifyProtocol(h.mpd.url),type:this.getMIMEType(h.mpd.url)})}if(!(c.length>0))return void this.player().error({code:4});r.src(c);var d=function(e){return log$2("DRM init Error",c),5!==e.data.code&&2!==e.data.code||!c[0].keySystems["com.widevine.alpha"]?3===e.data.code&&c[0].keySystems["com.apple.fps.1_0"]?void n.setSrcV3(t,"fairplay"):14===e.data.code||3===e.data.code?void n.setSrcV3(t,"all"):void 0:void n.setSrcV3(t,"widevine")};"all"!==e&&(window_1.setTimeout(function(){r.one("error",d)},0),r.one("playing",function(t){}))},e.prototype.getInfoV4=function(t){var e=this.player(),n=this.assemblyPathV4("getplayinfo",t.appID,t.fileID),r=e.options_,i=t.t,o=t.us,s=t.rlimit,a=t.psign,l=t.exper,c={};t.ssign?c.super_sign=t.ssign:a&&(c={t:i,psign:a},(o||0==o)&&(c.us=o),s&&(c.rlimit=s),l&&(c.exper=l)),t.playerConfig&&(c.pcfg=t.playerConfig),t.playerID&&(c.playerid=t.playerID),this.requestTimestamp=+(new Date).getTime(),e.trigger({type:"playcgistart",data:{time:this.requestTimestamp,url:n}}),log$2("playcgi v4 loading");var u=queryString.stringify(c);u?(n+=(~n.indexOf("?")?"&":"?")+u,n=n.replace("?&","?")):n+=~n.indexOf("?")?"":"?";var h=r&&r.hlsConfig&&(r.hlsConfig.disable||r.hlsConfig.skipHlsJs);n=this.enModule.generatePlayCgiUrl(n,browser,h),this.getInfoRetryTimes=0,this.getInfoRequest=function(t){t&&this.playCGIHosts[this.playCGIIndex+1]&&(n=n.replace(this.playCGIHosts[this.playCGIIndex],this.playCGIHosts[this.playCGIIndex+1]),this.playCGIIndex++),IE_VERSION&&IE_VERSION<10?jsonp(n,{param:c,timeout:3e3,prefix:"TcCallBack"},bind(this,this.onResultV4)):xhr({url:n,timeout:3e3},bind(this,this.onResultV4))},this.getInfoRequest()},e.prototype.onResultV4=function(t,e,n){var r=e,i=r.rawRequest;try{n?e=JSON.parse(n):t||e.body||(t=new Error("ServerError"))}catch(h){t=new Error("ServerError")}var o=this.player();if(t){if(log$2("playcgi v4 loaded failure"),this.getInfoRetryTimes<6)return this.getInfoRetryTimes++,void this.getInfoRequest({isBackup:!0});o.trigger({type:"playcgiend",data:{time:+(new Date).getTime(),startTime:this.requestTimestamp,error:t,result:e}});var s=12;switch(t.message){case"XMLHttpRequest timeout":case"Timeout":s=10;break;case"ServerError":s=11}this.player().error({code:s})}else{if(o.trigger({type:"playcgiend",data:{time:+(new Date).getTime(),startTime:this.requestTimestamp,error:t,result:e,rawRequest:i,overlayIv:this.enModule.overlayIv,overlayKey:this.enModule.overlayKey}}),0!=e.code)return log$2("playcgi v4 loaded failure"),e.code>=2e3&&e.code<3e3&&this.getInfoRetryTimes<6?(this.getInfoRetryTimes++,void this.getInfoRequest({isBackup:!0})):void this.player().error({code:e.code});if(log$2("playcgi v4 loaded success",e),4===e.version){var a=e.media;this.setPoster({coverUrl:a.basicInfo.coverUrl}),this.setSrcV4(a),this.setVttThumbnailV4(a),this.setDots(a),this.setGhostContent(a.ghostWatermarkInfo)}else if(2===e.version){var l=e.coverInfo,c=e.videoInfo,u=e.playerInfo;this.setPoster(l),this.setLogo(u),this.setSrc(e),this.setPatch(u),this.setVttThumbnail(e),this.setDots(e),this.setOriginDuration(c)}}},e.prototype.setSrcV4=function(t,e){var n=this,r=this.player(),i=r.options_,o=void 0,s=r.options_.plugins,a=r.DRM().options||s.DRM,l=[],c="plain";e=e||(a?a.skipPlan:"");var u=[],h=[];if("Original"===t.audioVideoType||"Transcode"===t.audioVideoType)return this.setSrc(t),!1;if(!t.streamingInfo)return void this.player().error({code:13,message:"no stream info"});if(t.streamingInfo){if(t.streamingInfo.drmOutput&&Array.isArray(t.streamingInfo.drmOutput)){for(var p=t.streamingInfo.drmOutput,d=0;d<p.length;d++)h.push(p[d].type);if(IS_ANY_SAFARI&&!IS_MQQB&&-1!==h.indexOf("FairPlay")&&"fairplay"!=e&&"all"!=e){var f=h.indexOf("FairPlay"),g=p[f].subStreams;l.push(g),u.push({src:unifyProtocol(p[f].url),type:this.getMIMEType(p[f].url),qualityLabelList:g,keySystems:{"com.apple.fps.1_0":{certificateUri:t.streamingInfo.fairPlayCertificateUrl||(a||{}).certificateUri,licenseUri:t.streamingInfo.fairplayLicenseUrl}}}),log$2("DRM source fairplay",o)}else if(window_1.navigator.requestMediaKeySystemAccess&&-1!==h.indexOf("Widevine")&&!IS_SAFARI&&"widevine"!==e&&"all"!==e){var y=h.indexOf("Widevine"),v=p[y].subStreams,m=v[v.length-1];("audio"===m.type||0===m.width&&0===m.height)&&v.pop(),l.push(v),u.push({src:unifyProtocol(p[y].url),type:this.getMIMEType(p[y].url),qualityLabelList:v,keySystems:{"com.widevine.alpha":{serverURL:t.streamingInfo.widevineLicenseUrl}}}),log$2("DRM source widevine",o)}if(-1!==h.indexOf("SimpleAES")&&"all"!=e){var _,b=h.indexOf("SimpleAES");c="SimpleAES";var T=p[b].url.split("/");T[T.length-1]="voddrm.token."+t.streamingInfo.drmToken+"."+T[T.length-1],o=T.join("/");var C=p[b].subStreams;l.push(p[b].subStreams),o&&u.push({src:unifyProtocol(o),type:EXT_MIME.m3u8,qualityLabelList:C,keySystems:(_={},_[c]={},_)})}}else if(t.streamingInfo.plainOutput){var E;o=t.streamingInfo.plainOutput.url;var S=t.streamingInfo.plainOutput.subStreams;l.push(t.streamingInfo.plainOutput.subStreams),o&&u.push({src:unifyProtocol(o),type:EXT_MIME.m3u8,qualityLabelList:S,keySystems:(E={},E[c]={},E)})}this.setHlsConfig(i,l[0],!1),u.length>0?r.src(u):0!==h.length?!e&&this.player().error({code:18}):this.player().error({code:13,message:"no stream info"}),this.setQualityLabelList(l[0])}var w=function(e){return log$2("DRM init Error",u),u[0].keySystems["com.widevine.alpha"]?void n.setSrcV4(t,"widevine"):u[0].keySystems["com.apple.fps.1_0"]?void n.setSrcV4(t,"fairplay"):3===e.data.code?void n.setSrcV4(t,"all"):void 0};"all"!==e&&window_1.setTimeout(function(){r.one("error",w)},0)},e.prototype.setHlsConfig=function(t,e,n){var r={};(!IS_ENABLED_MSE||IS_TBS||IS_MQQB||IE_VERSION&&IE_VERSION<11)&&!IS_SIMULATOR||(r={overlayKey:this.enModule&&this.enModule.overlayKey,overlayIv:this.enModule&&this.enModule.overlayIv});t.hlsConfig?(t.hlsConfig.qualityLabelList=e,t.hlsConfig.startLevel||(t.hlsConfig.startLevel=e?e.length-1:5)):t.hlsConfig={qualityLabelList:e,startLevel:e?e.length-1:5},Object.assign(t.hlsConfig,r,{forbid:n})},e.prototype.setQualityLabelList=function(t){this.player().QualitySwitcher().setOptions({qualityLabelList:{video:t}})},e.prototype.setLogo=function(t){var e=this.player();t.logoPic?(e.logoImage.update({img:{url:unifyProtocol(t.logoPic),position:t.logoLocation},link:unifyProtocol(t.logoUrl)}),e.trigger({type:"feature",data:"logo"})):e.logoImage.reset()},e.prototype.setPoster=function(t){var e=this.player();t&&t.coverUrl?e.poster(unifyProtocol(t.coverUrl)):e.options_.playerOptions.poster||e.poster("")},e.prototype.setDots=function(t){var e=this.player();if(e.options_.dots=[],t.keyFrameDescInfo&&t.keyFrameDescInfo.keyFrameDescList&&t.keyFrameDescInfo.keyFrameDescList.length>0){var n=t.keyFrameDescInfo.keyFrameDescList;e.options_.dots=n}var r=e.options_.plugins;r&&r.ProgressMarker&&r.ProgressMarker.markers&&r.ProgressMarker.markers.length>0&&(e.options_.dots=e.options_.dots.concat(r.ProgressMarker.markers)),e.ProgressMarker().init()},e.prototype.setSrc=function(t){var e=this.player(),n=t.videoInfo||{};if("Original"===t.audioVideoType&&(n.sourceVideo=t.originalInfo),"Transcode"===t.audioVideoType&&(n.sourceVideo=t.transcodeInfo),(null!=e.options_.definition||e.options_.definition!=undefined)&&n.transcodeList&&n.transcodeList.length>0){e.trigger({type:"feature",data:"definition"});var r=this.getSrcByDefinition(n,e.options_.definition);if(r)return e.src({src:unifyProtocol(r.url),type:this.getMIMEType(r.url)}),!0}if(e.MultiResolution().reset(),n.masterPlayList){e.src(this.getMasterSouces(n));var i=e.options_.hlsConfig;i?i.forbid=!0:Object.assign(e.options_,{hlsConfig:{forbid:!0}}),this.setQualityLabelList([]),e.MultiResolution().store(this.getMultiResolutionData(t))}else if(n.transcodeList&&n.transcodeList.length>0){var o=this.getMultiResolutionData(t);if(o.showOrder.length>0)e.MultiResolution().init(o);else{var s=n.transcodeList[0].url;e.src({src:unifyProtocol(s),type:this.getMIMEType(s)})}}else n.sourceVideo&&this.getMIMEType(n.sourceVideo.url)?e.src({src:unifyProtocol(n.sourceVideo.url),type:this.getMIMEType(n.sourceVideo.url)}):this.player().error({code:13})},e.prototype.setPatch=function(t){var e=this.player();t.patchInfo?e.ImagePatch().init(t.patchInfo):e.ImagePatch().reset()},e.prototype.setVttThumbnail=function(t){var e=this.player();t.imageSpriteInfo&&t.imageSpriteInfo.imageSpriteList?e.ready(bind(this,function(){e.VttThumbnail().init({vttUrl:unifyProtocol(t.imageSpriteInfo.imageSpriteList[0].webVttUrl)})})):e.VttThumbnail().reset()},e.prototype.setVttThumbnailV4=function(t){var e=this.player();t.imageSpriteInfo&&t.imageSpriteInfo.webVttUrl?e.ready(bind(this,function(){e.VttThumbnail().init({vttUrl:unifyProtocol(t.imageSpriteInfo.webVttUrl)})})):e.VttThumbnail().reset()},e.prototype.setOriginDuration=function(t){var e=this.player();if(e.options_.exper>0){var n=t.sourceVideo?t.sourceVideo.floatDuration:t.transcodeList[0].floatDuration;e.one("play",function(){e.duration(n)})}},e.prototype.setOriginDurationV4=function(t){var e=this,n=this.player();n.cache_.originDuration=t.basicInfo.duration,n.off("durationchange",this.keepOriginDuration),n.one("durationchange",function(t){(!n.duration()||n.duration()>0&&Math.floor(n.cache_.originDuration)!==Math.floor(n.duration()))&&(e.keepOriginDuration(t),n.on("durationchange",e.keepOriginDuration))})},e.prototype.setGhostContent=function(t){if(t){var e=this.player(),n=e&&e.DynamicWatermark();n.options.content=t.text,n.options.keep=!0,n.init()}},e.prototype.keepOriginDuration=function(t){var e=this.player(),n=e.cache_.originDuration;Math.floor(n)!==Math.floor(e.duration())&&(log$2("试看视频"),e.duration(Math.round(n)))},e.prototype.getMasterSouces=function(t){var e=t.masterPlayList,n=[];return n.push({src:unifyProtocol(e.url),type:EXT_MIME.m3u8}),n},e.prototype.getMultiResolutionData=function(t){var e={sources:{},labels:{},showOrder:[],defaultRes:""},n=[],r=t.videoInfo.transcodeList,i=this;return t.playerInfo.videoClassification.forEach(function(t,o){r.length>0&&(r=r.filter(function(r){if(!(t.definitionList.indexOf(r.definition)>-1))return!0;n[t.id]||(e.showOrder.push(t.id),e.labels[t.id]=t.name,n[t.id]=[]),n[t.id].push({src:unifyProtocol(r.url),type:i.getMIMEType(r.url)})}))}),e.sources=n,e.defaultRes=t.playerInfo.defaultVideoClassification||Object.keys(n)[0],e},e.prototype.getSrcByDefinition=function(t,e){var n=t.transcodeList,r=t.sourceVideo;if(0==e)return r;for(var i=0;i<n.length;i++)if(n[i].definition==e)return n[i]},e.prototype.getMIMEType=function(t){var e=EXT_MIME[getFileExtension(t)];return e||(log$2.error("MIME type no found! Ext = "+getFileExtension(t)),"")},e.prototype.assemblyPath=function(t,e,n){var r=window_1.location.protocol;return"http:"!=r&&"https:"!=r&&(r="https:"),r+"//"+SERVER_PATH+"/"+t+"/v2/"+e+"/"+n},e.prototype.assemblyPathV3=function(t,e,n,r){var i=window_1.location.protocol;return"http:"!=i&&"https:"!=i&&(i="https:"),i+"//"+SERVER_PATH_V3+"/"+t+"/v3/"+e+"/"+n+"/"+r},e.prototype.assemblyPathV4=function(t,e,n){var r=window_1.location.protocol;return"http:"!=r&&"https:"!=r&&(r="https:"),r+"//"+this.playCGIHosts[this.playCGIIndex]+"/"+t+"/v4/"+e+"/"+n},e.prototype.customHost=function(t){var e=this.player();e.options_.customHost&&/^(?=^.{3,255}$)[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$/.test(e.options_.customHost)&&(t.masterPlayList&&(t.masterPlayList.url=replaceHost(t.masterPlayList.url,e.options_.customHost)),t.sourceVideo&&(t.sourceVideo.url=replaceHost(t.sourceVideo.url,e.options_.customHost)),t.transcodeList.length>0&&t.transcodeList.forEach(function(t,n){t.url=replaceHost(t.url,e.options_.customHost)}),e.trigger({type:"feature",data:"customHost"}))},e.prototype.loadVideoByID=function(t){var e=this.player();if(e.trigger({type:"loadnewvideo"}),!this.playCGIMerged){var n=e.options_;this.playCGIHosts=(n.playCGIHosts||[]).concat([SERVER_PATH,SERVER_PATH_BACKUP]),this.playCGIIndex=0}e.hasStarted(!1),this.getInfo(t),e.duration(0),e.options_.appID=t.appID,e.options_.fileID=t.fileID,e.options_.psign=t.psign,t.definition&&(e.options_.definition=t.definition),e.bigPlayButton&&e.bigPlayButton.show(),e.options_.plugins.ContinuePlay&&e.ContinuePlay().init()},e.prototype.setPlayList=function(t){this.player().options_.plugins.PlayList||t.playlist&&t.playlist.data instanceof Array&&t.playlist.data.length>0&&this.player_.PlayList(t.playlist)},e}(Component);Component.registerComponent("MediaAsyncLoader",MediaAsyncLoader);var Component$2=videojs.getComponent("Component"),ClickableComponent$2=videojs.getComponent("ClickableComponent"),positionMap=["left-top","left-bottom","right-top","right-bottom"],LogoImage=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return n.on("logochange",videojs.bind(i,function(t){this.update(t.data)})),r.img&&i.update(r),i}return inherits(e,t),e.prototype.createEl=function(){var t=videojs.dom.createEl("div",{className:"tcp-logo vjs-hidden"}),e=videojs.dom.createEl("a",{className:"tcp-logo-link",target:"_blank"}),n=videojs.dom.createEl("img",{className:"tcp-logo-img"});return this.linkEl_=e,this.imgEl_=n,e.appendChild(n),t.appendChild(e),t},e.prototype.update=function(t){var e=t.img,n=t.link;this.setImg(e),this.setHref(n),this.options_=videojs.mergeOptions(this.options_,t),this.show()},e.prototype.setImg=function(t){if(this.imgEl_){this.imgEl_.src=t.url;var e=positionMap[t.position]||t.position||"left-top";videojs.dom.addClass(this.el_,e)}},e.prototype.setHref=function(t){this.linkEl_&&t&&(this.linkEl_.href=t)},e.prototype.reset=function(){this.hide(),this.imgEl_.removeAttribute("src"),this.linkEl_.removeAttribute("href")},e}(ClickableComponent$2);videojs.registerComponent("LogoImage",LogoImage);var Component$3=videojs.getComponent("Component"),Button$2=videojs.getComponent("Button"),ContinuePlayTips=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.init(r),i}return inherits(e,t),e.prototype.createEl=function(){return videojs.dom.createEl("div",{className:"tcp-continue-play-tips"})},e.prototype.close=function(){this.hide()},e.prototype.init=function(t){var e=this.addChild("closeButton",{controlText:"Close"});this.on(e,"close",this.close),this.addChild("ContinuePlayTipsContent",t);var n=this.addChild("ContinuePlayButton",t);this.on(n,["tap","click"],this.close),this.setTimeout(function(){this.close()},3500)},e}(Component$3);videojs.registerComponent("ContinuePlayTips",ContinuePlayTips);var ContinuePlayTipsContent=function(t){function e(n,r){return classCallCheck(this,e),possibleConstructorReturn(this,t.call(this,n,r))}return inherits(e,t),e.prototype.createEl=function(){var t=videojs.dom.createEl("span",{className:"tcp-continue-play-tips-content"}),e=videojs.dom.createEl("span",{className:"tcp-text",textContent:this.localize(this.options_.text||"Last time play at ")}),n=videojs.dom.createEl("span",{className:"tcp-time",textContent:videojs.formatTime(this.options_.time)});return this.textEl_=e,this.timeEl_=n,t.appendChild(e),t.appendChild(n),t},e}(Component$3);videojs.registerComponent("ContinuePlayTipsContent",ContinuePlayTipsContent);var ContinuePlayButton=function(t){function e(n,r){return classCallCheck(this,e),possibleConstructorReturn(this,t.call(this,n,r))}return inherits(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"button",{className:"tcp-continue-play-buttom",textContent:this.localize(this.options_.btnText||"Resume play")})},e.prototype.handleClick=function(){this.options_.resumeCallback.call()},e}(Button$2);videojs.registerComponent("ContinuePlayButton",ContinuePlayButton);var Component$4=videojs.getComponent("Component"),LevelSwitchTips=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.playing=!1,i.timeoutID=undefined,i.levelSwitch=n.options_.plugins.ContextMenu.levelSwitch,i.init(),n.on("playing",videojs.bind(i,function(){i.playing=!0})),n.on("resolutionswitching",videojs.bind(i,function(t){if(i.playing)if(t.data.label)i.switchHandler(i.createSwitching(t.data.label),2e3);else{var e=i.player().QualitySwitcher().options.qualityData;if(e){var n=e.video.filter(function(e){return t.data.newQuality===e.id})[0];i.switchHandler(i.createSwitching(n.label),2e3)}}})),n.on("resolutionswitched",videojs.bind(i,function(){i.playing&&i.switchHandler(i.createSwitched(),2e3)})),n.on("levelSwitchError",videojs.bind(i,function(){i.switchHandler(i.createSwitchError(),2e3)})),i}return inherits(e,t),e.prototype.switchHandler=function(t,e){var n=this;this.timeoutID&&clearTimeout(this.timeoutID),this.textNode.innerText=t,this.show(),this.timeoutID=setTimeout(function(){n.hide()},e)},e.prototype.createEl=function(){var t=videojs.dom.createEl("div",{className:"tcp-switch vjs-hidden"});return this.textNode=videojs.dom.createEl("div",{innerText:""}),t.appendChild(this.textNode),t},e.prototype.init=function(){var t=this.addChild("closeButton",{controlText:"Close"});this.on(t,"close",this.hide)},e.prototype.createSwitching=function(t){return this.levelSwitch.switchingText?this.levelSwitch.switchingText+t:"正在为您切换至"+t},e.prototype.createSwitched=function(){return this.levelSwitch.switchedText?this.levelSwitch.switchedText:"切换成功"},e.prototype.createSwitchError=function(){return this.levelSwitch.switchErrorText?this.levelSwitch.switchErrorText:"切换失败"},e.prototype.show=function(){t.prototype.show.call(this),this.popped=!0},e.prototype.hide=function(){t.prototype.hide.call(this),this.popped=!1},e}(Component$4);videojs.registerComponent("LevelSwitchTips",LevelSwitchTips);var Component$7=videojs.getComponent("Component"),mapKey={fileID:"file ID",requestID:"request ID",mediaType:"media type",mimeType:"mime type",provider:"provider",resolution:"resolution",rate:"rate",frames:"frames",buffer:"buffer",connectionSpeed:"connection speed",info:"info"},VideoTextItem=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.display=!1,i.displayData="loading",i}return inherits(e,t),e.prototype.createEl=function(){var t=videojs.dom.createEl("div",{className:"tcp-statistic-line vjs-hidden"}),e=videojs.dom.createEl("span",{className:"tcp-statistic-title",innerText:mapKey[this.options_.key]+":"}),n=videojs.dom.createEl("span",{className:"tcp-statistic-data",innerText:this.options_.data});return t.appendChild(e),t.appendChild(n),t},e.prototype.updateTextNode_=function(){for(var t=this.el_.lastChild;t.firstChild;)t.removeChild(t.firstChild);this.displayData&&this.show(),this.textNode_=document_1.createTextNode(this.displayData||""),t.appendChild(this.textNode_)},e.prototype.updateContent=function(t){t!==this.displayData&&(this.displayData=t,this.requestAnimationFrame(this.updateTextNode_))},e.prototype.isDisplay=function(){return this.display},e.prototype.show=function(){t.prototype.show.call(this),this.display=!0,this.popped=!0},e.prototype.hide=function(){t.prototype.hide.call(this),this.display=!1,this.popped=!1},e.prototype.reset=function(){t.prototype.hide.call(this),this.display=!1,this.displayData=""},e}(Component$7);videojs.registerComponent("VideoTextItem",VideoTextItem);var defaultConfig={enableRecoverMediaError:!0,recoverMediaErrorMaxRetry:5,fragLoadingMaxRetry:3,abrMaxWithRealBitrate:!0,emeEnabled:!0},Html5HlsJS=function(){function t(e,n,r){var i=this;classCallCheck(this,t);var o={},s=n.player();e.keySystems&&e.keySystems["com.widevine.alpha"]&&e.keySystems["com.widevine.alpha"].serverURL?(r.hlsConfig.widevineLicenseUrl=e.keySystems["com.widevine.alpha"].serverURL,r.hlsConfig.enableWorker=!0,r.hlsConfig.emeEnabled=!0,r.hlsConfig.startLevel=(r.hlsConfig.qualityLabelList||[]).length-1,o=r.hlsConfig):o=n.player_.options_.hlsConfig||r.hlsConfig||{},o.forbid&&(delete o.overlayKey,delete o.overlayIv),this.drmBackup=r.hlsConfig&&r.hlsConfig.drmBackup;var a=function(){var t=window.Hls;s.trigger({type:"debug",data:{message:"debug === 加载hls.js完成,进入初始化 hls 阶段"}});var a=new t(videojs.mergeOptions(defaultConfig,o)),l=n.el();i.Hls=t,i.tech=n,i.hls=a,i.switchStatus="",i.manifests=[],i.subtitlesLoadedCount=0,i.audioTrackLoadedCount=0,i.subtitles=[],i.audioTracks=[],i.hlsjsErrorHandler=i.errorHandlerFactory(),a.on(t.Events.ERROR,i.onError.bind(i)),a.on(t.Events.MANIFEST_PARSED,videojs.bind(i,i.onMetaData)),a.on(t.Events.MANIFEST_LOADED,i.loadSubtiles.bind(i)),a.on(t.Events.MANIFEST_LOADED,i.loadAudioTracks.bind(i)),a.on(t.Events.LEVEL_LOADED,i.onLevelLoaded.bind(i)),s.on("ready",i.addHlsSubtitles.bind(i));for(var c in t.Events)a.on(t.Events[c],videojs.bind(i,i.onEvent));a.attachMedia(l),a.loadSource(e.src),s.trigger({type:"hlsInstanceCreated",data:{hls:a}}),s.trigger({type:"debug",data:{message:"debug === 初始化 hls.js 完成,已传递 hls 地址"}}),setInterval(function(){if(!s.el_)return!1
16
+ ;var t=a.levels[a.currentLevel]&&a.levels[a.currentLevel].realBitrate/1e3,e=s.getVideoPlaybackQuality(),n=e.droppedVideoFrames||0,r=e.totalVideoFrames||0,i="",o=s.tech_.hlsProvider.hls.abrController.bwEstimator;o&&o.getEstimate()&&(i=+(125e-6*o.getEstimate()).toFixed(0)),s.trigger({type:"playstatus",data:{type:"hls",droppedFrames:n,decodedFrames:r,bitrate:t,speed:i}})},1e3),window.Hls&&r.xp2pConfig&&r.xp2pConfig.useXP2P&&s.XP2PHlsjsPlugin&&s.XP2PHlsjsPlugin().startHLSP2P(i.hls,window.HLSP2P,function(t){})};s.trigger({type:"debug",data:{message:"debug === 开始加载hls.js"}}),Promise.all([function(){return r.xp2pConfig&&r.xp2pConfig.useXP2P&&"hls"===r.xp2pConfig.format&&!window.HLSP2P?new Promise(function(t){loadScript(XP2P_HLS_PATH,function(){t()})}):Promise.resolve()}(),function(){return window.Hls?Promise.resolve():new Promise(function(t){loadScript(HLS_PATH,function(){t()})})}()]).then(function(){a()})}return t.prototype.switchQuality=function(t){t.id!=this.hls.currentLevel&&(this.switchStatus="switching",this.switchData=t,this.tech.trigger({type:"hlsresolutionswitching",data:this.switchData}),this.hls.nextLevel=t.id)},t.prototype.dispose=function(){this.hls.destroy()},t.prototype.onSubtitleLoaded=function(t,e){var n=this,r=this.tech.player(),i=this.subtitlesLoadedCount,o=this.subtitles||this.hls.subtitleTracks;this.subtitles[i].url=e.details.fragments[0].url,++this.subtitlesLoadedCount<o.length?this.hls.trigger(this.Hls.Events.SUBTITLE_TRACK_LOADING,{url:o[this.subtitlesLoadedCount].url,id:o[this.subtitlesLoadedCount].id}):r.ready(function(){n.addHlsSubtitles()})},t.prototype.onAudioTrackLoaded=function(t,e){var n=this,r=this.tech.player(),i=this.audioTrackLoadedCount,o=this.hls.audioTracks;this.audioTracks[i].url=e.details.fragments[0].url,++this.audioTrackLoadedCount<o.length?this.hls.trigger(this.Hls.Events.AUDIO_TRACK_LOADING,{url:o[this.audioTrackLoadedCount].url,id:o[this.audioTrackLoadedCount].id}):r.ready(function(){n.addAudioTracks()})},t.prototype.loadAudioTracks=function(){var t=this,e=this.hls.audioTracks;if(e.length){e.forEach(function(e){t.audioTracks.push({id:e.id,name:e.name,lang:e.lang,loaded:!1,"default":e["default"]})});var n=e[0];this.hls.trigger(this.Hls.Events.AUDIO_TRACK_LOADING,{url:n.url,id:n.id}),this.hls.on(this.Hls.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded.bind(this))}},t.prototype.loadSubtiles=function(){var t=this,e=this.hls.subtitleTracks&&this.hls.subtitleTracks.length>0?this.hls.subtitleTracks:this.hls.subtitleTrackController.tracks;if(e.length){e.forEach(function(e){t.subtitles.push({name:e.name,lang:e.lang,loaded:!1,url:e.url,id:e.id})});var n=e[0];this.hls.on(this.Hls.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleLoaded.bind(this)),this.hls.trigger(this.Hls.Events.SUBTITLE_TRACK_LOADING,{url:n.url,id:n.id})}},t.prototype.addAudioTracks=function(){var t=this;this.audioTracks.length&&this.audioTracks.some(function(t){return!t.loaded})&&this.audioTracks.forEach(function(e){var n=t.tech.addAudioTrack({id:e.id,src:e.url,kind:"audio",srclang:e.lang,label:e.name,enabled:e["default"]},!0);n.addEventListener("load",function(){e.loaded=!0})})},t.prototype.addHlsSubtitles=function(){var t=this;this.subtitles.length&&this.subtitles.some(function(t){return!t.loaded})&&this.subtitles.forEach(function(e){var n=t.tech.addRemoteTextTrack({src:e.url,kind:"subtitles",srclang:e.lang,label:e.name},!0);n.addEventListener("load",function(){e.loaded=!0})})},t.prototype.onEvent=function(t,e){this.tech.trigger({type:t,data:e});var n=this.tech.player();switch(t){case this.Hls.Events.MANIFEST_LOADED:this.manifests.push(e.networkDetails.response||e.networkDetails.responseText);break;case this.Hls.Events.LEVEL_SWITCHING:break;case this.Hls.Events.LEVEL_SWITCHED:"switching"==this.switchStatus&&(this.switchStatus="switched",this.tech.trigger({type:"hlsresolutionswitched",data:this.switchData}),this.switchData=null);break;case this.Hls.Events.LEVEL_SWITCH_ERROR:n.trigger({type:"levelSwitchError"})}},t.prototype.onMetaData=function(t,e){var n=[],r=this.hls,i=this;if(e.levels.length>1){var o={id:-1,label:"auto",selected:-1===r.manualLevel};n.push(o),e.levels.forEach(function(t,e){var o={};o.id=e,o.selected=e===r.manualLevel,o.label=i.getLevelLabel(t),n.push(o)});var s={qualityData:{video:n},callbacks:{video:videojs.bind(this,this.switchQuality)}};this.tech.setTimeout(function(){this.trigger({type:"masterplaylistchange",data:s})},1)}},t.prototype.getLevelLabel=function(t){return t.height?t.height+"p":t.width?Math.round(9*t.width/16)+"p":t.bitrate?t.bitrate/1e3+"kbps":0},t.prototype.onLevelLoaded=function(t,e){this._duration=e.details.live?Infinity:e.details.totalduration},t.prototype.onError=function(t,e){var n=this.tech.player();if(e.fatal)switch(e.type){case this.Hls.ErrorTypes.NETWORK_ERROR:n.error({code:14,source:e});break;case this.Hls.ErrorTypes.MEDIA_ERROR:this.hls.config.enableRecoverMediaError?this.hlsjsErrorHandler(e):n.error({code:15,source:e});break;case this.Hls.ErrorTypes.MUX_ERROR:n.error({code:16,source:e});break;case this.Hls.ErrorTypes.OTHER_ERROR:default:n.error({code:17,source:e}),this.drmBackup&&"keySystemError"===e.type&&n.error(null)}else switch(e.details){case this.Hls.ErrorDetails.KEY_LOAD_ERROR:}},t.prototype.errorHandlerFactory=function(){var t=this.hls,e=this.tech.player(),n=null,r=null,i=0;return function(o){var s=Date.now();i==t.config.recoverMediaErrorMaxRetry?e.error({code:15,source:o}):(!n||s-n>2e3?(n=s,t.recoverMediaError()):(!r||s-r>2e3)&&(r=s,t.swapAudioCodec(),t.recoverMediaError()),i++)}},t.prototype.duration=function(){return this._duration},t}(),hlsTypeRE=/^application\/(x-mpegURL|vnd\.apple\.mpegURL)$/i,hlsExtRE=/.m3u8(?![^?])/i,HlsSourceHandler={name:"hlsSourceHandler",canHandleSource:function(t){return t.skipHlsJs||t.keySystems&&t.keySystems["com.apple.fps.1_0"]?"":hlsTypeRE.test(t.type)&&hlsExtRE.test(t.src)?"probably":hlsExtRE.test(t.src)?"maybe":""},handleSource:function(t,e,n){return e.hlsProvider?(e.hlsProvider.dispose(),e.hlsProvider=null):n.hlsConfig&&!1===n.hlsConfig.autoStartLoad&&e.on("play",function(){this.player().hasStarted()||this.hlsProvider.hls.startLoad()}),e.hlsProvider=new Html5HlsJS(t,e,n),e.hlsProvider},canPlayType:function(t){return hlsTypeRE.test(t)?"probably":""}};TCPlayer.mountHlsProvider=mountHlsProvider,mountHlsProvider();var Html5DashJS=function(){function t(e,n,r){var i=this;classCallCheck(this,t);var o=function(){var o=window_1.dashjs;if(i.dashjs=o,r=r||n.options_,i.player=videojs(r.playerId),i.player.dash=i.player.dash||{},i.tech_=n,i.el_=n.el(),i.elParent_=i.el_.parentNode,i.hasFiniteDuration_=!1,e.src){n.isReady_=!1,t.updateSourceData&&(videojs.log.warn('updateSourceData has been deprecated. Please switch to using hook("updatesource", callback).'),e=t.updateSourceData(e)),t.hooks("updatesource").forEach(function(t){e=t(e)});var s=e.src;i.keySystemOptions_=t.buildDashJSProtData(e.keySystemOptions||e.keySystems),i.player.dash.mediaPlayer=o.MediaPlayer().create(),i.mediaPlayer_=i.player.dash.mediaPlayer,t.useVideoJSDebug&&(videojs.log.warn('useVideoJSDebug has been deprecated. Please switch to using hook("beforeinitialize", callback).'),t.useVideoJSDebug(i.mediaPlayer_)),t.beforeInitialize&&(videojs.log.warn('beforeInitialize has been deprecated. Please switch to using hook("beforeinitialize", callback).'),t.beforeInitialize(i.player,i.mediaPlayer_)),t.hooks("beforeinitialize").forEach(function(t){t(i.player,i.mediaPlayer_)}),i.mediaPlayer_.initialize(),i.retriggerError_=function(t){if("capability"===t.error&&"mediasource"===t.event)i.player.error({code:4,message:"The media cannot be played because it requires a feature that your browser does not support."});else if("manifestError"!==t.error||"createParser"!==t.event.id&&"codec"!==t.event.id&&"nostreams"!==t.event.id&&"nostreamscomposed"!==t.event.id&&"parse"!==t.event.id&&"multiplexedrep"!==t.event.id)if("mediasource"===t.error)t.event.match("MEDIA_ERR_ABORTED")?i.player.error({code:1,message:t.event}):t.event.match("MEDIA_ERR_NETWORK")?i.player.error({code:2,message:t.event}):t.event.match("MEDIA_ERR_DECODE")?i.player.error({code:3,message:t.event}):t.event.match("MEDIA_ERR_SRC_NOT_SUPPORTED")?i.player.error({code:4,message:t.event}):t.event.match("MEDIA_ERR_ENCRYPTED")?i.player.error({code:5,message:t.event}):(t.event.match("UNKNOWN"),i.player.error({code:4,message:t.event}));else if("capability"===t.error&&"encryptedmedia"===t.event)i.player.error({code:5,message:"The media cannot be played because it requires encryption features that your browser does not support."});else if("key_session"===t.error)i.player.error({code:5,message:t.event});else if("download"===t.error)i.player.error({code:2,message:"The media playback was aborted because too many consecutive download errors occurred."});else{if("mssError"!==t.error)return;i.player.error({code:3,message:t.event})}else i.player.error({code:4,message:t.event.message});setTimeout(function(){i.mediaPlayer_.reset()},10)},i.mediaPlayer_.on(o.MediaPlayer.events.ERROR,i.retriggerError_),i.getDuration_=function(t){var e=t.data.Period_asArray,n=i.hasFiniteDuration_;t.data.mediaPresentationDuration||e[e.length-1].duration?i.hasFiniteDuration_=!0:i.hasFiniteDuration_=!1,i.hasFiniteDuration_!==n&&i.player.trigger("durationchange")},i.mediaPlayer_.on(o.MediaPlayer.events.MANIFEST_LOADED,i.getDuration_),i.mediaPlayer_.on(o.MediaPlayer.events.STREAM_INITIALIZED,videojs.bind(i,i.onMetaData)),i.currentQuality={video:"",audio:""},Object.keys(o.MediaPlayer.events).forEach(function(t){i.mediaPlayer_.on(o.MediaPlayer.events[t],videojs.bind(i,i.onEvent))}),r.dashConfig&&Object.keys(r.dashConfig).forEach(function(t){var e,n="set"+t.charAt(0).toUpperCase()+t.slice(1),o=r.dashConfig[t];if(i.mediaPlayer_.hasOwnProperty(n)&&(videojs.log.warn("Using dash options in videojs-contrib-dash without the set prefix has been deprecated. Change '"+t+"' to '"+n+"'"),t=n),!i.mediaPlayer_.hasOwnProperty(t))return void videojs.log.warn("Warning: dash configuration option unrecognized: "+t);Array.isArray(o)||(o=[o]),(e=i.mediaPlayer_)[t].apply(e,o)}),i.mediaPlayer_.attachView(i.el_),i.mediaPlayer_.setAutoPlay(!1),setupAudioTracks.call(null,i.player,n),setupTextTracks.call(null,i.player,n,r),i.mediaPlayer_.setProtectionData(i.keySystemOptions_),i.mediaPlayer_.attachSource(s),i.tech_.triggerReady()}};window_1.dashjs?o():loadScript(DASH_PATH,function(){o()})}return t.buildDashJSProtData=function(t){var e={};if(!t)return null;if(Array.isArray(t))for(var n=0;n<t.length;n++){var r=t[n],i=videojs.mergeOptions({},r.options);i.licenseUrl&&(i.serverURL=i.licenseUrl,delete i.licenseUrl),e[r.name]=i}else e=t;return e},t.prototype.dispose=function(){var t=this;this.mediaPlayer_&&(this.mediaPlayer_.off(this.dashjs.MediaPlayer.events.ERROR,this.retriggerError_),this.mediaPlayer_.off(this.dashjs.MediaPlayer.events.MANIFEST_LOADED,this.getDuration_),Object.keys(this.dashjs.MediaPlayer.events).forEach(function(e){t.mediaPlayer_.off(t.dashjs.MediaPlayer.events[e],videojs.bind(t,t.onEvent))}),this.mediaPlayer_.reset()),this.player.dash&&delete this.player.dash},t.prototype.duration=function(){return this.mediaPlayer_?this.mediaPlayer_.isDynamic()&&!this.hasFiniteDuration_?Infinity:this.mediaPlayer_.duration():0},t.hooks=function(e,n){return t.hooks_[e]=t.hooks_[e]||[],n&&(t.hooks_[e]=t.hooks_[e].concat(n)),t.hooks_[e]},t.hook=function(e,n){t.hooks(e,n)},t.removeHook=function(e,n){var r=t.hooks(e).indexOf(n);return-1!==r&&(t.hooks_[e]=t.hooks_[e].slice(),t.hooks_[e].splice(r,1),!0)},t.prototype.onMetaData=function(t){var e=this,n=this.mediaPlayer_,r=n.getBitrateInfoListFor("video"),i=n.getSettings(),o=i.streaming.abr.autoSwitchBitrate.video,s=[];if(r.length>0){s.push({id:-1,label:"auto",selected:o}),r.forEach(function(t,n){s.push({id:n,label:e.getLevelLabel(t),selected:!o&&e.currentQuality.video===n})});var a={qualityData:{video:s},callbacks:{video:videojs.bind(this,this.switchQuality)}};this.tech_.setTimeout(function(){this.trigger({type:"masterplaylistchange",data:a})},1)}},t.prototype.switchQuality=function(t){var e=this.mediaPlayer_;-1===t.id?e.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!0}}}}):t.id!=this.currentQuality[t.trackType]&&(e.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!1}}}}),e.setQualityFor(t.trackType,t.id))},t.prototype.getLevelLabel=function(t){return t.height?t.height+"p":t.width?Math.round(9*t.width/16)+"p":t.bitrate?t.bitrate/1e3+"kbps":0},t.prototype.onEvent=function(t){switch(this.tech_.trigger({type:"dash_"+t.type,data:t}),t.type){case this.dashjs.MediaPlayer.events.QUALITY_CHANGE_REQUESTED:this.tech_.trigger({type:"dashqualityswitching",data:t});break;case this.dashjs.MediaPlayer.events.QUALITY_CHANGE_RENDERED:this.tech_.trigger({type:"dashqualityswitched",data:t}),this.currentQuality[t.mediaType]=t.newQuality}},t}();Html5DashJS.hooks_={};var canHandleKeySystems=function(t){t=JSON.parse(JSON.stringify(t)),Html5DashJS.updateSourceData&&(videojs.log.warn('updateSourceData has been deprecated. Please switch to using hook("updatesource", callback).'),t=Html5DashJS.updateSourceData(t)),Html5DashJS.hooks("updatesource").forEach(function(e){t=e(t)});var e=document_1.createElement("video");return!(t.keySystemOptions&&!window_1.navigator.requestMediaKeySystemAccess&&!e.msSetMediaKeys)};videojs.DashSourceHandler=function(){return{name:"dashSourceHandler",canHandleSource:function(t){var e=/\.mpd/i;return canHandleKeySystems(t)?videojs.DashSourceHandler.canPlayType(t.type)?"probably":e.test(t.src)?"maybe":"":""},handleSource:function(t,e,n){return new Html5DashJS(t,e,n)},canPlayType:function(t){return videojs.DashSourceHandler.canPlayType(t)}}},videojs.DashSourceHandler.canPlayType=function(t){return/^application\/dash\+xml/i.test(t)?"probably":""},TCPlayer.mountDashProvider=mountDashProvider,mountDashProvider(),videojs.Html5DashJS=Html5DashJS;var Component$6=videojs.getComponent("Component"),hlsOption=["fileID","requestID","mediaType","mimeType","provider","resolution","rate","frames","buffer","connectionSpeed"],mp4Option=["fileID","requestID","mediaType","mimeType","resolution","rate","buffer"],dashOption=["fileID","requestID","mediaType","mimeType","resolution","rate","buffer","provider","connectionSpeed"],infoOption=["info"],VideoStatisticWrapper=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.nodelist={},i.status={fileID:"",requestID:"",mediaType:"",mimeType:"",provider:"",resolution:"",rate:"",frames:"",buffer:"",connectionSpeed:"",info:""},n.on("playcgiend",function(){clearTimeout(i.timeoutID),Object.keys(i.status).forEach(function(t){i.nodelist[t].reset()})}),n.on("statistic",videojs.bind(i,function(t){"open"===t.data.action?i.tick():i.clearTimeout(i.timeoutID)})),i.init(),i}return inherits(e,t),e.prototype.tick=function(){var t=this;this.timeoutID=setTimeout(videojs.bind(this,function(){t.tick()}),1e3),this.updatePanel()},e.prototype.createEl=function(){return videojs.dom.createEl("div",{className:"tcp-statistic-wrapper"})},e.prototype.init=function(){var t=this;Object.keys(this.status).forEach(function(e){var n=new VideoTextItem(t,{key:e,data:t.status[e]});t.nodelist[e]=n,t.addChild(n)})},e.prototype.updatePanel=function(){var t=this;if("Html5"===this.player().techName_)switch(this.getStatus(),this.status.mediaType){case"m3u8":hlsOption.forEach(function(e){t.nodelist[e].updateContent(t.status[e])});break;case"mp4":mp4Option.forEach(function(e){t.nodelist[e].updateContent(t.status[e])});break;case"mpd":dashOption.forEach(function(e){t.nodelist[e].updateContent(t.status[e])})}else"Flash"===this.player().techName_&&(this.getFlashStatus(),infoOption.forEach(function(e){"info"===e&&t.nodelist[e].updateContent(t.status[e])}))},e.prototype.getStatus=function(){this.getFileID(),this.getRequestID(),this.getMediaType(),this.getMIMEType(),this.getResolution(),this.getRate(),this.getProvider(),this.getBuffer(),"m3u8"===this.status.mediaType&&(this.getFrames(),this.getConnectionSpeed()),"mpd"===this.status.mediaType&&this.getConnectionSpeed()},e.prototype.getFlashStatus=function(){this.status.mediaType="flash",this.getSupport()},e.prototype.getFileID=function(){var t=this.player().options_.fileID||"";return this.status.fileID=t,t},e.prototype.getRequestID=function(){var t=this.player().PlayerMetrics().playStatus;if(t){var e=t.requestID;return this.status.requestID=e,e}},e.prototype.getMediaType=function(){this.player_.src()&&/\/(.+)\.(.+)\?|\/(.+)\.(.+)/.test(this.player_.src());var t=RegExp.$2||RegExp.$4||"";return this.status.mediaType=t,t},e.prototype.getMIMEType=function(){var t=this.player().src(),e=EXT_MIME[getFileExtension(t)]||"";return this.status.mimeType=e,e},e.prototype.getResolution=function(){var t=this.player_.tech_.el_.videoHeight||0,e=this.player_.tech_.el_.videoWidth||0,n=e+" x "+t;return this.status.resolution=n,n},e.prototype.getRate=function(){var t=this.player().playbackRate()||1;return this.status.rate=t+"x",t},e.prototype.getBuffer=function(){var t=this.player_.bufferedEnd().toFixed(1)||0,e=this.player_.duration().toFixed(1)||0,n=(t/e*100).toFixed(1)+"%",r=t+" / "+e+" ("+n+")";return this.status.buffer=r,r},e.prototype.getSupport=function(){var t=void 0;return t="m3u8"!==this.status.mediaType&&"mp4"!==this.status.mediaType&&"dash"!==this.status.mediaType?"视频统计功能不支持当前视频格式":"",this.status.info=t,t},e.prototype.getProvider=function(){var t=this.player_.tech_.sourceHandler_;return t instanceof Html5HlsJS?(this.status.provider="HlsJS","HlsJS"):t instanceof Html5DashJS?(this.status.provider="DashJS","DashJS"):""},e.prototype.getFrames=function(){var t=this.player_.getVideoPlaybackQuality(),e=(t.droppedVideoFrames||0)+" dropped of "+(t.totalVideoFrames||0);return this.status.frames=e,e},e.prototype.getConnectionSpeed=function(){var t=void 0;if("m3u8"===this.status.mediaType){var e=this.player_.tech_.hlsProvider.hls.abrController._bwEstimator;t=e&&e.getEstimate()?(125e-6*e.getEstimate()).toFixed(0)+"KB/s":"0KB/s",this.status.connectionSpeed=t}if("mpd"===this.status.mediaType){var n=this.player_.dash.mediaPlayer,r=n.getDashMetrics(),i=n.getDashAdapter(),o=n.getActiveStream().getStreamInfo(),s=o.index,a=r.getCurrentRepresentationSwitch("video").to,l=i.getBandwidthForRepresentation(a,s);t=l?(125e-6*l).toFixed(0)+"KB/s":"0KB/s",this.status.connectionSpeed=t}return t},e}(Component$6);videojs.registerComponent("VideoStatisticWrapper",VideoStatisticWrapper);var Component$5=videojs.getComponent("Component"),VideoStatisticPanel=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return n.on("statistic",videojs.bind(i,function(t){"open"===t.data.action?i.show():i.hide()})),n.on("playcgistart",function(){n.trigger({type:"statistic",data:{action:"close"}})}),i.init(),i}return inherits(e,t),e.prototype.createEl=function(){var t=this,e=videojs.dom.createEl("div",{className:"tcp-statistic vjs-hidden"}),n=videojs.dom.createEl("div",{className:"tcp-statistic-close",innerText:"[X]"});return n.addEventListener("click",function(){t.hide(),t.player().trigger({type:"statistic",data:{action:"close"}})}),e.appendChild(n),e},e.prototype.init=function(){this.addChild("VideoStatisticWrapper")},e.prototype.show=function(){t.prototype.show.call(this),this.popped=!0},e.prototype.hide=function(){t.prototype.hide.call(this),this.popped=!1},e}(Component$5);videojs.registerComponent("VideoStatisticPanel",VideoStatisticPanel);var MenuItem$3=videojs.getComponent("MenuItem"),MirrorMenuItem=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.addClass("tc-menu-list"),i.open=!1,i.hasOpen=!1,i.player=n,i.setup(),i}return inherits(e,t),e.prototype.setup=function(){var t=this;this.on(["tap","click"],function(){var e=t.player.tech().el();t.hasOpen||(window.MtaH5&&MtaH5.clickStat("mirror",{appid:t.player.options_.appID,fileid:t.player.options_.fileID}),t.player.trigger({type:"feature",data:"mirror"})),t.open?(videojs.dom.removeClass(e,"tcp-mirror"),videojs.dom.removeClass(t.el_,"tcp-menu-item-select")):(videojs.dom.addClass(e,"tcp-mirror"),videojs.dom.addClass(t.el_,"tcp-menu-item-select"),t.hasOpen=!0),t.open=!t.open})},e}(MenuItem$3);videojs.registerComponent("MirrorMenuItem",MirrorMenuItem);var MenuItem$4=videojs.getComponent("MenuItem"),PoweredByMenuItem=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.addClass("tc-menu-list"),i}return inherits(e,t),e}(MenuItem$4);videojs.registerComponent("PoweredByMenuItem",PoweredByMenuItem);var MenuItem$5=videojs.getComponent("MenuItem"),StatusMenuItem=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.addClass("tc-menu-list"),i.hasOpen=!1,i.player=n,n.on("statistic",videojs.bind(i,function(t){"close"===t.data.action&&(videojs.dom.removeClass(i.el_,"tcp-menu-item-select"),i.hasOpen=!1)})),i.setup(),i}return inherits(e,t),e.prototype.setup=function(){var t=this;this.on(["tap","click"],function(){t.hasOpen?(videojs.dom.removeClass(t.el_,"tcp-menu-item-select"),t.player.trigger({type:"statistic",data:{action:"close"}}),t.hasOpen=!1):(videojs.dom.addClass(t.el_,"tcp-menu-item-select"),t.player.trigger({type:"statistic",data:{action:"open"}}),t.hasOpen=!0,window.MtaH5&&MtaH5.clickStat("mirror",{appid:t.player.options_.appID,fileid:t.player.options_.fileID}),t.player.trigger({type:"feature",data:"statistic"}))})},e}(MenuItem$5);videojs.registerComponent("StatusMenuItem",StatusMenuItem);var Component$8=videojs.getComponent("Component"),Menu$2=videojs.getComponent("Menu"),MenuItem$2=videojs.getComponent("MenuItem"),RightClickPopupMenu=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));i.hide(),i.addChild("PoweredByMenuItem",{label:"Powered by Tencent Cloud."}),!r.statistic||IS_IOS||IS_ANDROID||i.addChild("StatusMenuItem",{label:"Video statistic"}),r.mirror&&i.addChild("MirrorMenuItem",{label:"Mirror"}),n.on("contextmenu",videojs.bind(i,i.onContextmenu)),n.on(["tap","click"],videojs.bind(i,function(t){if(this.popped)return this.hide(),t.stopPropagation(),t.preventDefault(),!1})),videojs.on(document,["tap","click"],videojs.bind(i,function(t){this.popped&&this.hide()}));var o=i;return i.children().forEach(function(t){t.on(["tap","click"],function(){o.hide()})}),i}return inherits(e,t),e.prototype.createEl=function(){var e=t.prototype.createEl.call(this);return videojs.dom.addClass(e,"tcp-right-click-popup-menu"),e},e.prototype.show=function(){t.prototype.show.call(this),this.popped=!0},e.prototype.hide=function(){t.prototype.hide.call(this),this.popped=!1},e.prototype.onContextmenu=function(t){t.preventDefault(),this.show();var e=this.el(),n=t.clientX,r=t.clientY,i=getViewportSize(),o=i.width,s=i.height,a=n+e.offsetWidth-o+5;a=Math.max(0,a);var l=r+e.offsetHeight-s+5;l=Math.max(0,l);var c=this.player().el().getBoundingClientRect();e.style.left=Math.max(0,n-c.left-a)+"px",e.style.top=Math.max(0,r-c.top-l)+"px"},e}(Menu$2);videojs.registerComponent("RightClickPopupMenu",RightClickPopupMenu);var clickableComponent=videojs.getComponent("ClickableComponent"),TimeTooltip$2=videojs.getComponent("TimeTooltip"),Component$9=videojs.getComponent("Component"),dom=videojs.dom,formatTime$2=videojs.formatTime,COMMENT_WIDTH=140,COMMENT_HEIGHT_SINGLE_LINE=23,COMMENT_SHOW_ON_THE_LEFT={POPUP_CONTAINER_OFFSET:-130,POPUP_CONTAINER_OFFSET_WITHOUTGIT:-100,TRIANGLE_OFFEST:96,TRIANGLE_OFFEST_WITHOUTGIF:95},COMMENT_SHOW_ON_THE_RIGHT={TRIANGLE_OFFEST:6,POPUP_CONTAINER_OFFSET:0},ProgressMarkerGenerator=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.duration=0,i.registerListener(),i}return inherits(e,t),e.prototype.registerListener=function(){this.player_.one("canplay",videojs.bind(this,this.resetDotsElement))},e.prototype.resetDotsElement=function(){var t=this.player_;this.duration=t.duration(),dom.emptyEl(this.el_),this.resetEl()},e.prototype.resetEl=function(){this.setUpEl()},e.prototype.dotMouseLeave=function(){var t=event.currentTarget,e=t.getAttribute("container-id");this.getChildById(e).hide()},e.prototype.dotHover=function(){var t=event.currentTarget.parentElement.offsetWidth,e=event.currentTarget.offsetLeft+COMMENT_WIDTH,n=this.getChildById(event.currentTarget.getAttribute("container-id")),r=n.getAttribute("class").search("tcp-without-gif")>=0,i=n.el_.querySelector(".tcp-triangle-both")||n.el_.querySelector(".tcp-triangle");e>t?r?(n.el_.style.left=COMMENT_SHOW_ON_THE_LEFT.POPUP_CONTAINER_OFFSET_WITHOUTGIT+"px",i.style.left=COMMENT_SHOW_ON_THE_LEFT.TRIANGLE_OFFEST_WITHOUTGIF+"%"):(n.el_.style.left=COMMENT_SHOW_ON_THE_LEFT.POPUP_CONTAINER_OFFSET+"px",i.style.left=COMMENT_SHOW_ON_THE_LEFT.TRIANGLE_OFFEST+"%"):event.currentTarget.offsetLeft<=COMMENT_WIDTH&&!r&&(n.el_.style.left=COMMENT_SHOW_ON_THE_RIGHT.POPUP_CONTAINER_OFFSET+"px",i.style.left=COMMENT_SHOW_ON_THE_RIGHT.TRIANGLE_OFFEST+"px");var o=n.getChild("DotImage");if(o){var s=o.el_.getElementsByClassName("tcp-dot-timestamp")[0],a=event.currentTarget.getAttribute("dotinsecond"),l=formatTime$2(a);s.innerHTML=l}n.show()},e.prototype.setChildInTheContainer=function(t,e){var n=t.content&&""!==t.content?decodeURIComponent(t.content.replace(/\+/g," ")):"";if(""!==n){var r=e.addChild("DotComment");r.el_.innerHTML=encodeHTML(n)}if(t.img){e.el_.querySelector(".tcp-triangle").setAttribute("class","tcp-triangle-both");var i=e.addChild("DotImage");if(i.el_.firstChild.setAttribute("src",t.img),""==n)e.addClass("tcp-only-gif"),i.el_.firstChild.className="tcp-image-in-container-only-image";else{this.countContentSize(n)<=20&&(e.addClass("tcp-single-line"),r.el_.style.height=COMMENT_HEIGHT_SINGLE_LINE+"px")}}else if(""!==n){var o=this.countContentSize(n);o<=14?e.addClass("tcp-single-line"):o<=28&&e.addClass("tcp-two-lines"),e.addClass("tcp-without-gif"),r.addClass("tcp-large-comment")}},e.prototype.markSetUp=function(t){var e=t.timeOffset>0?t.timeOffset/1e3:0,n=this.duration?this.duration:0;if(!("number"!=typeof e||e>n)){var r=document.createElement("div");r.className="tcp-dot-basic-style",r.setAttribute("dotinsecond",e.toString()),t["class"]&&(r.className+=" "+t["class"]);var i=this.addChild("PopUpContainer");return r.setAttribute("container-id",i.id_),this.setChildInTheContainer(t,i),r.appendChild(i.el_),r.style.left=e/n*100+"%",r.addEventListener("mouseover",videojs.bind(this,this.dotHover)),r.addEventListener("mouseleave",videojs.bind(this,this.dotMouseLeave)),r}},e.prototype.setUpEl=function(){var e=this,n=this.player_.options_.dots||0,r=this.el_||t.prototype.createEl.call(this);return videojs.dom.addClass(r,"tcp-dot-component"),n&&n instanceof Array&&n.length>0&&n.forEach(function(t){var n=t.content||"";if(n&&""!=n||t.img){var i=e.markSetUp(t);i&&r.appendChild(i)}}),r},e.prototype.countContentSize=function(t){for(var e=0,n=t.length,r=-1,i=0;i<n;i++)r=t.charCodeAt(i),e+=r>=0&&r<=128?1:2;return e},e.prototype.createEl=function(){return this.setUpEl()},e}(clickableComponent);videojs.registerComponent("ProgressMarkerGenerator",ProgressMarkerGenerator);var DotComment=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.addClass("tcp-dot-comment"),i}return inherits(e,t),e}(Component$9);videojs.registerComponent("DotComment",DotComment);var DotImage=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));i.addClass("tcp-dot-image");var o=i.el_||t.prototype.createEl.call(i),s=dom.createEl("img");s.className="tcp-image-in-container",o.appendChild(s);var a=dom.createEl("span");return a.className="tcp-dot-timestamp",a.innerHTML="",o.appendChild(a),i}return inherits(e,t),e}(Component$9);videojs.registerComponent("DotImage",DotImage);var PopUpContainer=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));i.addClass("tcp-popup-container");var o=dom.createEl("div");return o.setAttribute("class","tcp-triangle"),i.el_.appendChild(o),i.hide(),i}return inherits(e,t),e}(TimeTooltip$2);videojs.registerComponent("PopUpContainer",PopUpContainer);var Plugin$2=videojs.getPlugin("plugin"),SpeedUp=function(t){function e(n){classCallCheck(this,e);var r=possibleConstructorReturn(this,t.call(this,n));return r.TARGET_LANTENCY=1,r.MAX_LATENCY=3,r.RATEVALUE=1.1,n.ready(videojs.bind(r,r.init)),r}return inherits(e,t),e.prototype.checkLatency=function(){var t=this.player.bufferedEnd()-this.player.currentTime();t>this.MAX_LATENCY&&this.player.playbackRate(this.RATEVALUE),t<this.TARGET_LANTENCY&&this.player.playbackRate(1)},e.prototype.init=function(){var t=this,e=this.player,n=void 0;e.on("playing",function(){e.duration()===Infinity&&(n=setInterval(t.checkLatency.bind(t),1e3))}),e.on("waiting",function(){t.reset(n)}),e.on("pause",function(){t.reset(n)})},e.prototype.reset=function(t){this.player.playbackRate(1),clearInterval(t)},e}(Plugin$2);videojs.registerPlugin("SpeedUp",SpeedUp);var Button$3=videojs.getComponent("Button"),BigPlayButton$2=videojs.getComponent("BigPlayButton");BigPlayButton$2.prototype.createEl=function(){var t=Button$3.prototype.createEl.call(this),e=getTemplate();return(this.options_.shapeType||this.options_.styleType)&&(e=getTemplate(this.options_.shapeType,this.options_.styleType)),t.appendChild(videojs.dom.createEl("div",{className:"vjs-button-icon",innerHTML:e})),t},BigPlayButton$2.prototype.controlText_="Play";var Component$10=videojs.getComponent("Component"),VideoStatisticWrapper$1=videojs.getComponent("VideoStatisticWrapper"),LoadingSpinner$2=videojs.getComponent("LoadingSpinner");LoadingSpinner$2.prototype.createEl=function(){function t(t,e){var n=new VideoStatisticWrapper$1(t);if(n.getMediaType(),(n.getBuffer()||"").indexOf("100.0%")>-1)return e.innerText="",!1;e.innerText=n.getConnectionSpeed()}var e=this,n=Component$10.prototype.createEl.call(this,"div",{className:"tcp-loading-spinner",dir:"ltr"});if(!this.player_.options_.loadingSpeed)return n;var r=null;return this.player_.on("waiting",function(){r=setInterval(function(){t(e.player_,n)},100)}),this.player_.on("timeupdate",function(){r&&clearInterval(r)}),n};var Plugin$3=videojs.getPlugin("plugin"),log$3=videojs.log,Skin=function(t){function e(n,r){classCallCheck(this,e),log$3("Skin initializing");var i=possibleConstructorReturn(this,t.call(this,n));return i.player.addClass("tcp-skin"),log$3("Skin initialized"),i}return inherits(e,t),e}(Plugin$3);videojs.registerPlugin("Skin",Skin);var now=function(){return _root.Date.now()},now_1=now,reWhitespace=/\s/,_trimmedEndIndex=trimmedEndIndex,reTrimStart=/^\s+/,_baseTrim=baseTrim,NAN=NaN,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt,toNumber_1=toNumber,FUNC_ERROR_TEXT$2="Expected a function",nativeMax=Math.max,nativeMin=Math.min,debounce_1=debounce,FUNC_ERROR_TEXT$1="Expected a function",throttle_1=throttle$1,Component$11=videojs.getComponent("Component"),DvrProgressControl=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.on("mousemove",i.handleMouseMove),i.on("mouseup",i.handleMouseUp),i}return inherits(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control tcp-dvr-progress-control"})},e.prototype.update=function(t){this.getChild("DvrSeekBar").update(t)},e.prototype.handleMouseMove=function(t){var e=this.getChild("DvrSeekBar"),n=e.calculateDistance(t),r=e.getChild("DvrMouseTimeDisplay");r&&r.update(videojs.dom.getBoundingClientRect(e.el()),n)},e.prototype.handleMouseUp=function(t){this.getChild("DvrSeekBar").handleMouseUp(t)},e}(Component$11);DvrProgressControl.prototype.options_={children:["DvrSeekBar"]},videojs.registerComponent("DvrProgressControl",DvrProgressControl)
17
+ ;var Slider$2=videojs.getComponent("Slider"),DvrSeekBar=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.percent_=1,i.update=throttle_1(videojs.bind(i,i.update),50),i.on(n,"seekToLive",videojs.bind(i,function(t){this.update(t.data)})),i}return inherits(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},e.prototype.update=function(t){t!=undefined&&(this.percent_=t,this.bar.update(videojs.dom.getBoundingClientRect(this.el_),t),this.updateAriaAttributes(t))},e.prototype.handleMouseDown=function(e){t.prototype.handleMouseDown.call(this,e),this.isMouseDown=!0},e.prototype.handleMouseMove=function(t){var e=this.calculateDistance(t);this.update(e)},e.prototype.handleMouseUp=function(e){t.prototype.handleMouseUp.call(this);var n=this.calculateDistance(e);this.update(n),this.player().Dvr().timeShift(n)},e.prototype.stepBack=function(){},e.prototype.stepForward=function(){},e.prototype.updateAriaAttributes=function(t){this.el().setAttribute("aria-valuenow",(100*t).toFixed(2))},e.prototype.getPercent=function(){return this.percent_},e}(Slider$2);DvrSeekBar.prototype.options_={children:["DvrMouseTimeDisplay","DvrTimeShiftBar"],barName:"DvrTimeShiftBar"},videojs.registerComponent("DvrSeekBar",DvrSeekBar);var DvrTimeShiftBar=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.el_.style.width="100%",i}return inherits(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar tcp-dvr-time-shift",innerHTML:'<span class="vjs-control-text"><span>'+this.localize("Progress")+"</span>: 100%</span>"})},e.prototype.update=function(t,e){var n=(100*e).toFixed(2)+"%";this.el_.style.width=n},e}(Component$11);videojs.registerComponent("DvrTimeShiftBar",DvrTimeShiftBar);var MouseTimeDisplay$2=videojs.getComponent("MouseTimeDisplay"),DvrMouseTimeDisplay=function(t){function e(){return classCallCheck(this,e),possibleConstructorReturn(this,t.apply(this,arguments))}return inherits(e,t),e.prototype.update=function(t,e){var n=this;this.rafId_&&this.cancelAnimationFrame(this.rafId_),this.rafId_=this.requestAnimationFrame(function(){var r=n.player().Dvr().dvrData.maxTimeShift,i=videojs.formatTime((1-e)*r,r);n.el_.style.left=t.width*e+"px",n.getChild("timeTooltip").update(t,e,i)})},e}(MouseTimeDisplay$2);videojs.registerComponent("DvrMouseTimeDisplay",DvrMouseTimeDisplay);var Button$4=videojs.getComponent("Button"),LiveButton=function(t){function e(){return classCallCheck(this,e),possibleConstructorReturn(this,t.apply(this,arguments))}return inherits(e,t),e.prototype.createEl=function(){var t=Button$4.prototype.createEl.call(this,"button",{className:"vjs-live-control vjs-control"});return this.contentEl_=videojs.dom.createEl("div",{className:"vjs-live-display",innerHTML:this.localize("LIVE")},{"aria-live":"off"}),t.appendChild(this.contentEl_),t},e.prototype.update=function(){},e.prototype.updateControlText=function(t){this.controlText(t?"直播中":"返回直播")},e.prototype.handleClick=function(t){this.player().Dvr().seekToLive()},e}(Button$4);LiveButton.prototype.controlText_="返回直播",videojs.registerComponent("LiveButton",LiveButton);var Plugin$4=videojs.getPlugin("plugin"),Dvr=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));i.isInit=!1,i.options=r;var o=i;return n.ready(function(){var t=n.tech(!0);t&&t.hlsProvider&&n.one("loadedmetadata",function(e){t.el_.setAttribute("poster",""),o.init(),o.options.liveURL&&o.seekToLive()})}),i}return inherits(e,t),e.prototype.init=function(){var t=this.player,e=t.tech(!0).hlsProvider;if(this.parseM3u8(e.manifests[0]),!this.dvrData.startTime&&!this.isInit)return void t.one("loadedmetadata",videojs.bind(this,function(t){this.init()}));this.initControl(),this.delay=getParams("delay",t.tech_.currentSource_.src)||0,this.updateControl(!this.isLive()),t.on("loadedmetadata",videojs.bind(this,function(){this.parseM3u8(e.manifests[0]),this.delay=getParams("delay",t.tech_.currentSource_.src)||0,this.updateControl()})),this.isInit=!0},e.prototype.initControl=function(){var t=this.player;t.addClass("vjs-dvr"),t.controlBar.getChild("ProgressControl").hide(),t.controlBar.getChild("LiveDisplay").hide(),t.controlBar.addChild("DvrProgressControl",{},5),t.controlBar.addChild("liveButton",{},6)},e.prototype.updateControl=function(t){var e=this.player,n=e.controlBar.getChild("ProgressControl"),r=e.controlBar.getChild("LiveDisplay"),i=e.controlBar.getChild("DvrProgressControl"),o=e.controlBar.getChild("LiveButton");e.toggleClass("vjs-dvr-live",this.isLive()),o.updateControlText(this.isLive()),t&&i.update(1-this.delay/this.dvrData.maxTimeShift),this.dvrData.startTime?(i.show(),o.show(),n.hide(),r.hide()):(i.hide(),o.hide(),n.show(),r.show())},e.prototype.seekToLive=function(){this.isLive()||(this.timeShift(1),this.player.trigger({type:"seekToLive",data:1}))},e.prototype.isLive=function(){return!(this.delay>0)},e.prototype.timeShift=function(t){var e=this.player,n=(e.getChild("ControlBar").getChild("LiveButton"),e.tech_.currentSource_),r=Math.floor(this.dvrData.maxTimeShift*(1-t));this.delay=r,0==r&&this.options.liveURL?e.src(this.options.liveURL):(n.src=(this.options.shiftURL||n.src).replace(/delay=*(\d+)/,"delay="+r),e.src(e.tech_.currentSource_.src)),e.bigPlayButton.hide(),e.posterImage.hide(),e.tech_.one("hlsManifestParsed",videojs.bind(this,function(){e.play()}))},e.prototype.parseM3u8=function(t){this.dvrData={};for(var e=new RegExp([/#EXT-TX-TS-START-TIME:*(.+)/.source,/|#EXT-TX-TS-DURATION:*(.+)/.source].join(""),"g"),n=void 0;null!==(n=e.exec(t));)n[1]?this.dvrData.startTime=n[1]:n[2]&&(this.dvrData.duration=n[2]);this.dvrData.startTime&&(this.dvrData.maxTimeShift=Math.min(Math.floor((new Date).getTime()/1e3-this.dvrData.startTime),this.dvrData.duration))},e}(Plugin$4);videojs.registerPlugin("Dvr",Dvr);var Component$12=videojs.getComponent("Component"),LiveProgressControl=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.on("mousemove",i.handleMouseMove),i.on("mouseup",i.handleMouseUp),i.on("loadedmetadata",i.handleInit),i}return inherits(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control tcp-live-progress-control"})},e.prototype.update=function(t){this.getChild("LiveSeekBar").update(t)},e.prototype.handleInit=function(){"dvrLive"!==this.player.dvrMode()?this.hide():(this.player.removeClass("vjs-live"),this.show(),player.controlBar.currentTimeDisplay.show())},e.prototype.handleMouseMove=function(t){var e=this.getChild("LiveSeekBar"),n=e.calculateDistance(t),r=e.getChild("LiveMouseTimeDisplay");r&&r.update(videojs.dom.getBoundingClientRect(e.el()),n)},e.prototype.handleMouseUp=function(t){this.getChild("LiveSeekBar").handleMouseUp(t)},e}(Component$12);LiveProgressControl.prototype.options_={children:["LiveSeekBar"]},videojs.registerComponent("LiveProgressControl",LiveProgressControl);var Slider$3=videojs.getComponent("Slider"),LiveSeekBar=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.percent_=1,i.update=throttle_1(videojs.bind(i,i.update),50),i.on(n,"timeupdate",i.update),i}return inherits(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},e.prototype.update=function(t){t!=undefined&&(this.percent_=t,this.bar.update(videojs.dom.getBoundingClientRect(this.el_),t),this.updateAriaAttributes(t))},e.prototype.handleMouseDown=function(e){t.prototype.handleMouseDown.call(this,e),this.isMouseDown=!0},e.prototype.handleMouseMove=function(t){var e=this.calculateDistance(t);this.update(e)},e.prototype.handleMouseUp=function(e){t.prototype.handleMouseUp.call(this);var n=this.calculateDistance(e);this.update(n),this.player().LiveDvr().timeShift(n)},e.prototype.stepBack=function(){},e.prototype.stepForward=function(){},e.prototype.updateAriaAttributes=function(t){this.el().setAttribute("aria-valuenow",(100*t).toFixed(2))},e.prototype.getPercent=function(){return this.percent_},e}(Slider$3);LiveSeekBar.prototype.options_={children:["LiveMouseTimeDisplay","LiveTimeShiftBar"],barName:"LiveTimeShiftBar"},videojs.registerComponent("LiveSeekBar",LiveSeekBar);var LiveTimeShiftBar=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.el_.style.width="100%",i}return inherits(e,t),e.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar tcp-dvr-time-shift tcp-live-time-shift",innerHTML:'<span class="vjs-control-text"><span>'+this.localize("Progress")+"</span>: 100%</span>"})},e.prototype.update=function(t,e){var n=(100*e).toFixed(2)+"%";this.el_.style.width=n},e}(Component$12);videojs.registerComponent("LiveTimeShiftBar",LiveTimeShiftBar);var MouseTimeDisplay$3=videojs.getComponent("MouseTimeDisplay"),LiveMouseTimeDisplay=function(t){function e(){return classCallCheck(this,e),possibleConstructorReturn(this,t.apply(this,arguments))}return inherits(e,t),e.prototype.update=function(t,e){var n=this;this.rafId_&&this.cancelAnimationFrame(this.rafId_),this.rafId_=this.requestAnimationFrame(function(){var r=n.player().VttThumbnail().liveDuration,i=videojs.formatTime(e*r,r);n.el_.style.left=t.width*e+"px",n.getChild("timeTooltip").update(t,e,i)})},e}(MouseTimeDisplay$3);videojs.registerComponent("LiveMouseTimeDisplay",LiveMouseTimeDisplay);var Button$5=videojs.getComponent("Button"),LiveButton$1=function(t){function e(){return classCallCheck(this,e),possibleConstructorReturn(this,t.apply(this,arguments))}return inherits(e,t),e.prototype.createEl=function(){var t=Button$5.prototype.createEl.call(this,"button",{className:"vjs-live-control vjs-control"});return this.contentEl_=videojs.dom.createEl("div",{className:"vjs-live-display",innerHTML:this.localize("LIVE")},{"aria-live":"off"}),t.appendChild(this.contentEl_),t},e.prototype.update=function(){},e.prototype.updateControlText=function(t){this.controlText(t?"直播中":"返回直播")},e.prototype.handleClick=function(t){this.player().LiveDvr().seekToLive()},e}(Button$5);LiveButton$1.prototype.controlText_="返回直播",videojs.registerComponent("LiveButton",LiveButton$1);var LARGE_ARRAY_SIZE=200,defineProperty$1=function(){try{var t=_getNative(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),_defineProperty=defineProperty$1,_baseAssignValue=baseAssignValue,objectProto$5=Object.prototype,hasOwnProperty$6=objectProto$5.hasOwnProperty,_assignValue=assignValue,argsTag$1="[object Arguments]",_baseIsArguments=baseIsArguments,objectProto$7=Object.prototype,hasOwnProperty$8=objectProto$7.hasOwnProperty,propertyIsEnumerable=objectProto$7.propertyIsEnumerable,isArguments=_baseIsArguments(function(){return arguments}())?_baseIsArguments:function(t){return isObjectLike_1(t)&&hasOwnProperty$8.call(t,"callee")&&!propertyIsEnumerable.call(t,"callee")},stubFalse_1=stubFalse,isBuffer_1=createCommonjsModule(function(t,e){var n=e&&!e.nodeType&&e,r=n&&!0&&t&&!t.nodeType&&t,i=r&&r.exports===n,o=i?_root.Buffer:undefined,s=o?o.isBuffer:undefined,a=s||stubFalse_1;t.exports=a}),MAX_SAFE_INTEGER$1=9007199254740991,isLength_1=isLength,argsTag$2="[object Arguments]",arrayTag$1="[object Array]",boolTag$1="[object Boolean]",dateTag$1="[object Date]",errorTag$1="[object Error]",funcTag$2="[object Function]",mapTag$1="[object Map]",numberTag$1="[object Number]",objectTag$1="[object Object]",regexpTag$1="[object RegExp]",setTag$1="[object Set]",stringTag$1="[object String]",weakMapTag$1="[object WeakMap]",arrayBufferTag$1="[object ArrayBuffer]",dataViewTag$1="[object DataView]",float32Tag$1="[object Float32Array]",float64Tag$1="[object Float64Array]",int8Tag$1="[object Int8Array]",int16Tag$1="[object Int16Array]",int32Tag$1="[object Int32Array]",uint8Tag$1="[object Uint8Array]",uint8ClampedTag$1="[object Uint8ClampedArray]",uint16Tag$1="[object Uint16Array]",uint32Tag$1="[object Uint32Array]",typedArrayTags={};typedArrayTags[float32Tag$1]=typedArrayTags[float64Tag$1]=typedArrayTags[int8Tag$1]=typedArrayTags[int16Tag$1]=typedArrayTags[int32Tag$1]=typedArrayTags[uint8Tag$1]=typedArrayTags[uint8ClampedTag$1]=typedArrayTags[uint16Tag$1]=typedArrayTags[uint32Tag$1]=!0,typedArrayTags[argsTag$2]=typedArrayTags[arrayTag$1]=typedArrayTags[arrayBufferTag$1]=typedArrayTags[boolTag$1]=typedArrayTags[dataViewTag$1]=typedArrayTags[dateTag$1]=typedArrayTags[errorTag$1]=typedArrayTags[funcTag$2]=typedArrayTags[mapTag$1]=typedArrayTags[numberTag$1]=typedArrayTags[objectTag$1]=typedArrayTags[regexpTag$1]=typedArrayTags[setTag$1]=typedArrayTags[stringTag$1]=typedArrayTags[weakMapTag$1]=!1;var _baseIsTypedArray=baseIsTypedArray,_baseUnary=baseUnary,_nodeUtil=createCommonjsModule(function(t,e){var n=e&&!e.nodeType&&e,r=n&&!0&&t&&!t.nodeType&&t,i=r&&r.exports===n,o=i&&_freeGlobal.process,s=function(){try{var t=r&&r.require&&r.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(e){}}();t.exports=s}),nodeIsTypedArray=_nodeUtil&&_nodeUtil.isTypedArray,isTypedArray=nodeIsTypedArray?_baseUnary(nodeIsTypedArray):_baseIsTypedArray,_overArg=overArg,nativeKeys=_overArg(Object.keys,Object),_cloneBuffer=createCommonjsModule(function(t,e){function n(t,e){if(e)return t.slice();var n=t.length,r=a?a(n):new t.constructor(n);return t.copy(r),r}var r=e&&!e.nodeType&&e,i=r&&!0&&t&&!t.nodeType&&t,o=i&&i.exports===r,s=o?_root.Buffer:undefined,a=s?s.allocUnsafe:undefined;t.exports=n}),getPrototype=_overArg(Object.getPrototypeOf,Object),DataView$1=_getNative(_root,"DataView"),_DataView=DataView$1,Promise$1=_getNative(_root,"Promise"),_Promise=Promise$1,Set=_getNative(_root,"Set"),_Set=Set,WeakMap=_getNative(_root,"WeakMap"),_WeakMap=WeakMap,mapTag$2="[object Map]",promiseTag="[object Promise]",setTag$2="[object Set]",weakMapTag$2="[object WeakMap]",dataViewTag$2="[object DataView]",dataViewCtorString=_toSource(_DataView),mapCtorString=_toSource(_Map),promiseCtorString=_toSource(_Promise),setCtorString=_toSource(_Set),weakMapCtorString=_toSource(_WeakMap),getTag=_baseGetTag;(_DataView&&getTag(new _DataView(new ArrayBuffer(1)))!=dataViewTag$2||_Map&&getTag(new _Map)!=mapTag$2||_Promise&&getTag(_Promise.resolve())!=promiseTag||_Set&&getTag(new _Set)!=setTag$2||_WeakMap&&getTag(new _WeakMap)!=weakMapTag$2)&&(getTag=function(t){var e=_baseGetTag(t),n="[object Object]"==e?t.constructor:undefined,r=n?_toSource(n):"";if(r)switch(r){case dataViewCtorString:return dataViewTag$2;case mapCtorString:return mapTag$2;case promiseCtorString:return promiseTag;case setCtorString:return setTag$2;case weakMapCtorString:return weakMapTag$2}return e});var _getTag=getTag,mapTag$4="[object Map]",_baseIsMap=baseIsMap,nodeIsMap=_nodeUtil&&_nodeUtil.isMap,isMap=nodeIsMap?_baseUnary(nodeIsMap):_baseIsMap,setTag$4="[object Set]",_baseIsSet=baseIsSet,nodeIsSet=_nodeUtil&&_nodeUtil.isSet,isSet=nodeIsSet?_baseUnary(nodeIsSet):_baseIsSet,Plugin$5=videojs.getPlugin("plugin"),LiveDvr=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));i.isInit=!1,i.options=r;var o=i;return n.ready(function(){var t=n.tech(!0),e=t&&t.hlsProvider,r=t&&t.webrtcProvider;(e||r)&&n.one("loadedmetadata",function(e){t.el_.setAttribute("poster",""),o.init()})}),i}return inherits(e,t),e.prototype.init=function(){var t=this,e=this.player;e.on("loadedmetadata",function(){t.durationTimer&&clearInterval(t.durationTimer);var n=e.dvrMode();"dvrLive"===n&&(e.controlBar.getChild("ProgressControl").hide(),e.controlBar.getChild("LiveProgressControl")?e.controlBar.getChild("LiveProgressControl").show():e.controlBar.addChild("LiveProgressControl",{},5),e.controlBar.PDTDisplay.hide(),e.removeClass("vjs-live"),e.addClass("vjs-live-dvr")),"dvrEvent"===n&&(e.controlBar.getChild("ProgressControl").show(),e.controlBar.getChild("LiveProgressControl",{},5).hide(),e.controlBar.PDTDisplay.show(),e.removeClass("vjs-live"),e.removeClass("vjs-live-dvr"))});var n=setInterval(function(){t.liveDuration=e.VttThumbnail().liveDuration,t.liveDuration&&(t.initControl(),t.isInit=!0,clearInterval(n))},500)},e.prototype.initControl=function(){var t=this.player;"dvrLive"===t.dvrMode()&&(t.removeClass("vjs-live"),t.addClass("vjs-live-dvr"),t.controlBar.getChild("ProgressControl").hide(),t.controlBar.getChild("LiveDisplay").hide(),t.controlBar.addChild("LiveProgressControl",{},5),t.controlBar.playbackRateMenuButton.hide(),t.controlBar.durationDisplay.hide(),t.controlBar.timeDivider.hide(),t.controlBar.currentTimeDisplay.show())},e.prototype.timeShift=function(t){var e=this.player,n=e.tech_.currentSource_;if(100===t&&this.options.liveURL){e.src(this.options.liveURL);try{e.controlBar.getChild("LiveProgressControl").LiveSeekBar.LiveTimeShiftBar.el_.style.width="100%"}catch(r){}}else n.src=this.options.shiftURL,e.src(e.tech_.currentSource_.src),e.one("loadedmetadata",function(){var n=e.duration()*t;e.currentTime(n)});e.bigPlayButton.hide(),e.posterImage.hide(),e.tech_.one("hlsManifestParsed",videojs.bind(this,function(){e.play()}))},e}(Plugin$5);videojs.registerPlugin("LiveDvr",LiveDvr);var Menu$4=videojs.getComponent("Menu"),QualitySwitcherMenu=function(t){function e(){return classCallCheck(this,e),possibleConstructorReturn(this,t.apply(this,arguments))}return inherits(e,t),e.prototype.addItem=function(e){t.prototype.addItem.call(this,e)},e}(Menu$4),MenuItem$6=videojs.getComponent("MenuItem"),QualitySwitcherMenuItem=function(t){function e(n,r){return classCallCheck(this,e),possibleConstructorReturn(this,t.call(this,n,r))}return inherits(e,t),e.prototype.handleClick=function(e){if(t.prototype.handleClick.call(this,e),this.updateItems(),this.options_.callback(this.options_),"video"==this.options_.trackType){var n=this.player().controlBar.getChild(this.options_.trackType+"QualitySwitcherMenuButton");n.updateLabel(this.options_),n.unpressButton()}},e.prototype.updateItems=function(){for(var t=this.player().controlBar.getChild(this.options_.trackType+"QualitySwitcherMenuButton"),e=t.getChild(this.options_.trackType+"QualitySwitcherMenu"),n=e.children(),r=0;r<n.length;r++){var i=n[r];this!==i?(i.selected(!1),i.options_.selected=!1):i.options_.selected=!0}},e}(MenuItem$6),MenuButton$2=videojs.getComponent("MenuButton"),Menu$3=videojs.getComponent("Menu"),QualitySwitcherMenuButton=function(t){function e(){return classCallCheck(this,e),possibleConstructorReturn(this,t.apply(this,arguments))}return inherits(e,t),e.prototype.createEl=function(){var e=t.prototype.createEl.call(this);return this.labelEl_=videojs.dom.createEl("div",{className:"tcp-quality-switcher-value",innerHTML:""}),e.appendChild(this.labelEl_),e},e.prototype.createMenu=function(){for(var t=this.options_.qualityList,e=new QualitySwitcherMenu(this.player(),{name:this.options_.trackType+"QualitySwitcherMenu"}),n=void 0,r=t.length-1;r>-1;r--){var i=t[r];n=videojs.mergeOptions(i,{trackType:this.options_.trackType,callback:this.options_.callback,selectable:!0}),e.addItem(new QualitySwitcherMenuItem(this.player(),n)),i.selected&&this.updateLabel(i)}return e},e.prototype.updateLabel=function(t){this.labelEl_.innerHTML="<p>"+this.localize(t.label)+"</p>"},e}(MenuButton$2),Plugin$6=videojs.getPlugin("plugin"),TRACK_TYPES=["video","audio","subtitle"],TRACK_CLASS={video:"tcp-video-quality-switcher",audio:"tcp-audio-quality-switcher",subtitle:"tcp-subtitle-quality-switcher"},log$4=videojs.log,QualitySwitcher=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return i.options=r,n.on("qualitydataloaded",videojs.bind(i,i.init)),i}return inherits(e,t),e.prototype.init=function(t){log$4("QualitySwitcher initializing",t);var e=this.player,n=t.data.qualityData,r=t.data.callbacks;if(this.setOptions({qualityData:n,callbacks:r}),!e.controlBar)return void log$4("QualitySwitcher can not initialize without control bar");for(var i=0;i<TRACK_TYPES.length;i++){var o=TRACK_TYPES[i],s=o+"QualitySwitcherMenuButton",a=e.controlBar.getChild(s);n[o]&&n[o].length>0&&e.controlBar.options_.QualitySwitcherMenuButton&&(a&&a.el()&&(a.dispose(),e.controlBar.removeChild(a)),this.repleaceLabel(o,n),a=new QualitySwitcherMenuButton(e,{name:s,qualityList:n[o],callback:r[o],trackType:o}),a.addClass(TRACK_CLASS[o]),e.controlBar.addChild(a,{},10))}log$4("QualitySwitcher initialized",t,this)},e.prototype.setOptions=function(t){this.options=videojs.mergeOptions(this.options,t)},e.prototype.setVideoQuality=function(t){if(this.options.qualityData&&this.options.callbacks.video){for(var e=this.options.qualityData.video,n=0;n<e.length;n++)e[n].selected&&(e[n].selected=!1),e[n].id===t.id&&(e[n].selected=!0);this.options.callbacks.video(t)}},e.prototype.getVideoQualityData=function(){return this.options.qualityData?this.options.qualityData.video:undefined},e.prototype.repleaceLabel=function(t,e){if(this.options.qualityLabelList){var n=this.options.qualityLabelList[t],r=e[t];if(r&&r.length>0&&n&&n.length>0)for(var i=0;i<r.length;i++){var o=r[i].label;o=o.slice(0,o.length-1);for(var s=0;s<n.length;s++)if(n[s].height==o){r[i].label=n[s].resolutionName;break}}}},e.prototype.reset=function(){for(var t=this.player,e=0;e<TRACK_TYPES.length;e++){var n=TRACK_TYPES[e],r=t.controlBar&&t.controlBar.getChild(n+"QualitySwitcherMenuButton");r&&r.el()&&(r.dispose(),t.controlBar.removeChild(r))}},e}(Plugin$6);videojs.registerPlugin("QualitySwitcher",QualitySwitcher);var Plugin$7=videojs.getPlugin("plugin"),log$5=videojs.log,defaultOptions={labels:{FLU:"流畅",SD:"标清",HD:"高清",FHD:"超清"},showOrder:["FLU","SD","HD","FHD"],defaultRes:"SD"},MultiResolution=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return i.options=r,r.useManualOption&&(i.manualOptions=extend({},r)),i.hasInit=!1,n.on("multiresolutionchange",videojs.bind(i,function(t){t.data&&this.update(data)})),n.on(["resolutionswitching","resolutionswitched"],videojs.bind(i,function(t){"resolutionswitching"==t.type?this.player.addClass("tcp-res-switching"):this.player.removeClass("tcp-res-switching")})),n.ready(videojs.bind(i,function(){var t=n.tech(!0);t&&(t.on("masterplaylistchange",videojs.bind(this,this.onMasterPlaylistChange)),t.on("hlsresolutionswitching",videojs.bind(this,this.onHlsLevelChange)),t.on("hlsresolutionswitched",videojs.bind(this,this.onHlsLevelChange)),t.on("dashqualityswitching",videojs.bind(this,this.onDashQualityChange)),t.on("dashqualityswitched",videojs.bind(this,this.onDashQualityChange))),this.hasInit=!0})),i.init(i.player.options_.multiResolution),i}return inherits(e,t),e.prototype.init=function(t){var e={};this.player.options_.label&&(e.label=this.player.options_.label),this.player.options_.labels&&(e.labels=this.player.options_.label),this.player.options_.showOrder&&(e.showOrder=this.player.options_.showOrder),this.player.options_.defaultRes&&(e.defaultRes=this.player.options_.defaultRes);var n=this.player,r=extend({},defaultOptions,t,this.manualOptions,e),i=r&&r.sources;if(this.options=r,i){log$5("MultiResolution initializing",r);var o=void 0;if(this.currentID=r.defaultRes=i[r.defaultRes]?r.defaultRes:Object.keys(i).shift(),o=i[this.currentID],"mediaLoader"!=n.options_.children[0]||this.hasInit)n.src(o);else{var s;(s=n.options_.sources).push.apply(s,o)}this.hasInit||(this.hasInit=!0),n.ready(videojs.bind(this,function(){n.trigger({type:"qualitydataloaded",data:this.initQualityData(r)}),n.one("loadedmetadata",function(){var t=this.tech(!0);"flash"!=t.name_&&t.el_.getAttribute("poster")&&(t.el_.removeAttribute("poster"),delete t.el_.poster)})})),log$5("MultiResolution initialized")}},e.prototype.reset=function(){this.player.QualitySwitcher().reset()},e.prototype.update=function(t){this.init(t)},e.prototype.store=function(t){if(!t)return this.options;this.options=videojs.mergeOptions(defaultOptions,this.options,t)},e.prototype.onMasterPlaylistChange=function(t){this.player.trigger({type:"qualitydataloaded",data:t.data})},e.prototype.onHlsLevelChange=function(t){"hlsresolutionswitching"==t.type?this.player.trigger({type:"resolutionswitching",data:t.data}):"hlsresolutionswitched"==t.type&&this.player.trigger({type:"resolutionswitched",data:t.data})},e.prototype.onDashQualityChange=function(t){"dashqualityswitching"==t.type?this.player.trigger({type:"resolutionswitching",data:t.data}):"dashqualityswitched"==t.type&&this.player.trigger({type:"resolutionswitched",data:t.data})},e.prototype.switchResolution=function(t){if(this.currentID!=t.id){var e=this.player,n=e.currentTime(),r=(e.paused(),Infinity===e.duration());if(e.trigger({type:"resolutionswitching",data:t}),r)e.bigPlayButton&&e.bigPlayButton.hide(),e.posterImage&&e.posterImage.hide(),e.one("loadstart",function(){e.play(),e.trigger({type:"resolutionswitched",data:t})});else{var i=e.ended(),o=e.playbackRate(),s=e.controlBar&&e.controlBar.progressControl&&e.controlBar.progressControl.seekBar.playProgressBar.el().style.width||0,a=videojs.browser.IS_IOS||videojs.browser.IS_ANDROID?"loadeddata":"loadedmetadata";e.one(a,function(){e.controlBar&&e.controlBar.progressControl&&(e.controlBar.progressControl.seekBar.playProgressBar.el().style.width=s),i||e.currentTime(n),"Flash"==e.techName_?(e.play(),e.tech(!0).trigger("seeked")):(e.play(),e.playbackRate()!=o&&e.playbackRate(o)),e.trigger({type:"resolutionswitched",data:t})}),e.bigPlayButton&&e.bigPlayButton.hide(),e.posterImage&&e.posterImage.hide(),"none"==e.options_.preload&&e.one("suspend",function(){e.load()})}e.src(this.options.sources[t.id]),r&&setTimeout(function(){e.play(),setTimeout(function(){e.play()},900)},100),this.currentID=t.id}},e.prototype.initQualityData=function(t){var e=[],n=(t.sources,t.labels),r=t.showOrder;return r.length>0&&r.forEach(function(r,i){var o={};o.id=r,o.selected=t.defaultRes===r,o.label=n[r]||r,e.push(o)}),{qualityData:{video:e},callbacks:{video:videojs.bind(this,this.switchResolution)}}},e.prototype.sortSourceOrder=function(t){return[]},e}(Plugin$7);videojs.registerPlugin("MultiResolution",MultiResolution);var FlashObj=videojs.getComponent("Flash"),defaultDismiss=!videojs.browser.IS_IPHONE,registerPlugin=videojs.registerPlugin||videojs.plugin,defaults$1={header:"",code:"",message:"",timeout:45e3,dismiss:defaultDismiss,progressDisabled:!1,errors:{1:{type:"MEDIA_ERR_ABORTED"},2:{type:"MEDIA_ERR_NETWORK"},3:{type:"MEDIA_ERR_DECODE"},4:{type:"MEDIA_ERR_SRC_NOT_SUPPORTED"},5:{type:"MEDIA_ERR_ENCRYPTED"},unknown:{type:"MEDIA_ERR_UNKNOWN"},"-1":{type:"PLAYER_ERR_NO_SRC",message:"No video has been loaded."},"-2":{type:"PLAYER_ERR_TIMEOUT",message:"Could not download the video."},10:{type:"SERVER_ERR",message:"Request timed out."},11:{type:"SERVER_ERR",message:"Server is not respond."},12:{type:"DATA_ERR",message:"Server respond error data."},13:{type:"DATA_ERR",message:"No video transcoding information found."},14:{type:"HLS_NETWORK_ERR",message:"A network error caused the media download to fail part-way."},15:{type:"HLS_MEDIA_ERR",message:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support."},16:{type:"HLS_MUX_ERR",message:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support."},17:{type:"HLS_OTHER_ERR",message:"Rise an internal exception when playing HLS."},18:{type:"DRM_ERR",message:"Current browser not support DRM."},20:{type:"PERMISSION_ERR",message:"This website needs a permission to access device motion."},21:{type:"PERMISSION_ERR",message:"This website needs a permission to access device motion."},50:{type:"LICENSE_ERR",message:"License verification failed."},51:{type:"LICENSE_ERR",message:"The license has expired."},52:{type:"LICENSE_ERR",message:"Domain verification failed."},53:{type:"LICENSE_ERR",message:"Time verification failed."},54:{type:"LICENSE_ERR",message:"License type error."},55:{type:"LICENSE_ERR",message:"Lack license url."},56:{type:"LICENSE_ERR",message:"Get license data failed."},60:{type:"SAFECHECK_ERR",message:"Elements check failed."},61:{type:"SAFECHECK_ERR",message:"API check failed."},62:{type:"SAFECHECK_ERR",message:"Environment check failed."},403:{type:"SERVER_ERR",message:"Authentication failed."},500:{type:"SERVER_ERR",message:"Server failed."},1001:{type:"SERVER_ERR",message:"The media file does not exist. Please check if the fileID is correct."},1002:{type:"SERVER_ERR",message:"The trial duration is illegal. The trial duration must be within the video duration."},1003:{type:"SERVER_ERR",message:"Param pcfg is not unique."},1004:{type:"SERVER_ERR",message:"The license has expired. Please check whether the expiration time setting is reasonable."},1005:{type:"SERVER_ERR",message:"Did not find an adaptive stream that can be played."},1006:{type:"SERVER_ERR",message:"Invalid request format, please check the request format."},1007:{type:"SERVER_ERR",message:"AppID is not exist, Please check if the AppID is correct."},1008:{type:"SERVER_ERR",message:"Without anti-leech information."},1009:{type:"SERVER_ERR",message:"psign check failed."},1010:{type:"SERVER_ERR",message:"Other errors."},1011:{type:"SERVER_ERR",message:"Get DRM license url failed"},1012:{type:"SERVER_ERR",message:"Get DRM certificate url failed"},1013:{type:"SERVER_ERR",message:"Psign missing contentInfo error"},1014:{type:"SERVER_ERR",message:"Psign contentInfo.audioVideoType invalid"},1015:{type:"SERVER_ERR",message:"Psign missing rawAdaptiveDefinition error"},1016:{type:"SERVER_ERR",message:"Psign missing drmAdaptiveInfo error"},1017:{type:"SERVER_ERR",message:"Psign missing transcodeDefinition error"},1018:{type:"SERVER_ERR",message:"Psign contentInfo.ResolutionNames json marshal error"},1019:{type:"SERVER_ERR",message:"Get super player config error"},1020:{type:"SERVER_ERR",message:"Get play key info error"},1021:{type:"SERVER_ERR",message:"Qsign invalid"},1022:{type:"SERVER_ERR",message:"Ciphered overlay info invalid"},1023:{type:"SERVER_ERR",message:"Ghost watermark info text is too long"},2001:{type:"SERVER_ERR",message:"System error"},2002:{type:"SERVER_ERR",message:"Panic error"},19:{type:"DATA_ERR",message:"Response data verification failed."},10008:{type:"SERVER_ERR",message:"The media file does not exist. Please check if the fileID is correct."},"-2001":{type:"SERVER_ERR",message:"Current browser not support play this stream, please select another one."},"-2002":{type:"SERVER_ERR",message:"Server respond error data.(eg. stream not exist)"},"-2003":{type:"SERVER_ERR",message:"Video play failed, please refresh to start play again."},"-2004":{type:"SERVER_ERR",message:"Connection to the server has failed and the number of connection retries has exceeded the set value."},"-2005":{type:"SERVER_ERR",message:"Video decoding failure."},PLAYER_ERR_DOMAIN_RESTRICTED:{message:"This video is restricted from playing on your current domain."},PLAYER_ERR_IP_RESTRICTED:{message:"This video is restricted at your current IP address."},PLAYER_ERR_GEO_RESTRICTED:{message:"This video is restricted from playing in your current geographic region."}}},initPlugin=function e(t,n){var r=void 0,i=void 0,o=void 0,s=[];videojs.getComponent("ErrorDisplay").prototype.options_.fillAlways=!1;var a=function(t){n.errors=videojs.mergeOptions(n.errors,t),Object.keys(n.errors).forEach(function(t){var e=n.errors[t];e.type||(e.type=t)})};a();var l=function(){t.clearTimeout(i),o&&(o=!1,t.removeClass("vjs-waiting")),i=t.setTimeout(function(){t.error()||t.paused()||t.ended()||(o=!0,t.addClass("vjs-waiting"))},1e3),t.clearTimeout(r),r=t.setTimeout(function(){t.error()||t.paused()||t.ended()||t.error({code:-2,type:"PLAYER_ERR_TIMEOUT"})},n.timeout),t.error()&&-2===t.error().code&&t.error(null)},c=function(){
18
+ for(var e=void 0;s.length;)e=s.shift(),t.off(e[0],e[1]);t.clearTimeout(r),t.clearTimeout(i)},u=function(e,n){var r=function(){if(!t.error()){var e=t.$(".vjs-tech");if(e&&"application/x-shockwave-flash"===e.type&&!e.vjs_getProperty)return void t.error({code:-2,type:"PLAYER_ERR_TIMEOUT"});if(t.paused())return l();if(t.ended())return l()}n.call(this)};t.on(e,r),s.push([e,r])},h=function(){var e=0;c(),l(),u(["timeupdate","adtimeupdate"],function(){var n=t.currentTime();n!==e&&(e=n,l())}),n.progressDisabled||u("progress",l)},p=function(e){var r="",i=t.error(),o=document_1.createElement("div"),s="";if(i){i=videojs.mergeOptions(i,n.errors[i.code||0]),i.message&&(r='<div class="vjs-errors-message">'+t.localize(i.message)+"</div>"),i.code&&(r+='<div class="vjs-errors-code">'+this.localize("Error Code")+" : "+i.code+"</div>"),i.type&&(r+='<div class="vjs-errors-type">'+this.localize("Error Type")+" : "+i.type+"</div>"),"10"==i.code||i.code,i.code,i.code,o.className="vjs-errors-dialog",s='<div class="vjs-errors-content-container">\n '+r+"\n </div>";var a=t.getChild("errorDisplay");a&&a.closeable(!("dismiss"in i)||i.dismiss)?(o.innerHTML=s,a.fillWith(o),a.contentEl().firstChild.appendChild(a.getChild("closeButton").el())):(o.innerHTML=s,a.fillWith(o)),a.one("modalclose",function(){return t.error(null)})}},d=function g(){c(),t.removeClass("vjs-errors"),t.off("dispose",g),t.off(["aderror","error"],p)},f=function(n){d(),e(t,videojs.mergeOptions(defaults$1,n))};f.extend=function(t){return a(t)},f.getAll=function(){return videojs.mergeOptions(n.errors)},f.disableProgress=function(t){n.progressDisabled=t,h()},t.on("dispose",d),t.on(["aderror","error"],p),t.ready(function(){t.addClass("vjs-errors")}),t.errors=f},errors=function(t){initPlugin(this,videojs.mergeOptions(defaults$1,t))};["extend","getAll","disableProgress"].forEach(function(t){errors[t]=function(){videojs.log.warn("The errors."+t+"() method is not available until the plugin has been initialized!")}}),registerPlugin("Errors",errors);var Plugin$8=videojs.getPlugin("plugin"),cgiSeq={},STATUS_CODE_REPORT_URL="//report.huatuo.qq.com/code.cgi",log$6=videojs.log,Reporter=function(t){function e(n,r){classCallCheck(this,e),log$6("Reporter initilaizing");var i=possibleConstructorReturn(this,t.call(this,n));if(!n.options_.plugins.Reporter){var o;return o=!1,possibleConstructorReturn(i,o)}return i.reportContent={status:"idle"},i.mtaReportCache=[],log$6("Reporter initilaized"),i}return inherits(e,t),e.prototype.setStorage=function(t,e){localStorage.setItem(t,e)},e.prototype.getStorage=function(t){localStorage.getItem(t)},e.prototype.sender=function(t){var e=new Image;e.onload=e.onerror=e.onabort=function(){e.onload=e.onerror=e.onabort=null,e=null},e.src=t},e.prototype.initPlayCgiCodeReport=function(){var t=this.player;t.on("playcgistart",videojs.bind(this,this.onPlayCgiStart)),t.on("playcgiend",videojs.bind(this,this.onPlayCgiEnd))},e.prototype.onPlayCgiStart=function(t){cgiSeq[t.data.time]=cgiSeq[t.data.time]||{},cgiSeq[t.data.time].startTime=t.data.time,cgiSeq[t.data.time].url=t.data.url},e.reportPlayMetrics=function(t,e){xhr.post("https://datacenter.live.qcloud.com",{body:JSON.stringify(t)},function(){e&&e()})},e.prototype.onPlayCgiEnd=function(t){if(cgiSeq[t.data.startTime]){var e=t.data,n=void 0,r=void 0,i=void 0;if(e.error)switch(r=2,e.error.message){case"Timeout":n=10;break;case"ServerError":n=11}else 0==e.result.code?(r=1,n=0):(r=3,n=e.result.code),i=e.result.requestId;this.reportPlayCgiToISD("","",r,n,t.data.time-cgiSeq[t.data.startTime].startTime,i,void 0,void 0)}},e.prototype.reportPlayCgiToISD=function(t,e,n,r,i,o,s,a){var l={domain:t||"playvideo.qcloud.com",cgi:e||"/getplayinfo/v2",type:n,code:r,time:i,appid:20370,platform:videojs.browser.IS_IOS?"ios":videojs.browser.IS_ANDROID?"android":"pc",expansion1:o,expansion2:s,expansion3:a};this.sender(unifyProtocol(STATUS_CODE_REPORT_URL)+"?"+serializeParams(l))},e.prototype.reportMTA=function(t,e){window.MtaH5?(this.mtaReportCache.length>0&&(this.mtaReportCache.forEach(function(t){t.call()}),this.mtaReportCache=0),MtaH5.clickStat(t,e)):this.mtaReportCache.push(function(){MtaH5.clickStat(t,e)})},e}(Plugin$8);videojs.registerPlugin("Reporter",Reporter);var store2=createCommonjsModule(function(t){!function(e,n){var r={version:"2.12.0",areas:{},apis:{},inherit:function(t,e){for(var n in t)e.hasOwnProperty(n)||Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n));return e},stringify:function(t){return t===undefined||"function"==typeof t?t+"":JSON.stringify(t)},parse:function(t,e){try{return JSON.parse(t,e||r.revive)}catch(n){return t}},fn:function(t,e){r.storeAPI[t]=e;for(var n in r.apis)r.apis[n][t]=e},get:function(t,e){return t.getItem(e)},set:function(t,e,n){t.setItem(e,n)},remove:function(t,e){t.removeItem(e)},key:function(t,e){return t.key(e)},length:function(t){return t.length},clear:function(t){t.clear()},Store:function(t,e,n){var i=r.inherit(r.storeAPI,function(t,e,n){return 0===arguments.length?i.getAll():"function"==typeof e?i.transact(t,e,n):e!==undefined?i.set(t,e,n):"string"==typeof t||"number"==typeof t?i.get(t):"function"==typeof t?i.each(t):t?i.setAll(t,e):i.clear()});i._id=t;try{e.setItem("__store2_test","ok"),i._area=e,e.removeItem("__store2_test")}catch(o){i._area=r.storage("fake")}return i._ns=n||"",r.areas[t]||(r.areas[t]=i._area),r.apis[i._ns+i._id]||(r.apis[i._ns+i._id]=i),i},storeAPI:{area:function(t,e){var n=this[t];return n&&n.area||(n=r.Store(t,e,this._ns),this[t]||(this[t]=n)),n},namespace:function(t,e){if(!t)return this._ns?this._ns.substring(0,this._ns.length-1):"";var n=t,i=this[n];if(!(i&&i.namespace||(i=r.Store(this._id,this._area,this._ns+n+"."),this[n]||(this[n]=i),e)))for(var o in r.areas)i.area(o,r.areas[o]);return i},isFake:function(){return"fake"===this._area.name},toString:function(){return"store"+(this._ns?"."+this.namespace():"")+"["+this._id+"]"},has:function(t){return this._area.has?this._area.has(this._in(t)):!!(this._in(t)in this._area)},size:function(){return this.keys().length},each:function(t,e){for(var n=0,i=r.length(this._area);n<i;n++){var o=this._out(r.key(this._area,n));if(o!==undefined&&!1===t.call(this,o,this.get(o),e))break;i>r.length(this._area)&&(i--,n--)}return e||this},keys:function(t){return this.each(function(t,e,n){n.push(t)},t||[])},get:function(t,e){var n,i=r.get(this._area,this._in(t));return"function"==typeof e&&(n=e,e=null),null!==i?r.parse(i,n):null!=e?e:i},getAll:function(t){return this.each(function(t,e,n){n[t]=e},t||{})},transact:function(t,e,n){var r=this.get(t,n),i=e(r);return this.set(t,i===undefined?r:i),this},set:function(t,e,n){var i=this.get(t);return null!=i&&!1===n?e:r.set(this._area,this._in(t),r.stringify(e),n)||i},setAll:function(t,e){var n,r;for(var i in t)r=t[i],this.set(i,r,e)!==r&&(n=!0);return n},add:function(t,e){var n=this.get(t);if(n instanceof Array)e=n.concat(e);else if(null!==n){var i=typeof n;if(i===typeof e&&"object"===i){for(var o in e)n[o]=e[o];e=n}else e=n+e}return r.set(this._area,this._in(t),r.stringify(e)),e},remove:function(t,e){var n=this.get(t,e);return r.remove(this._area,this._in(t)),n},clear:function(){return this._ns?this.each(function(t){r.remove(this._area,this._in(t))},1):r.clear(this._area),this},clearAll:function(){var t=this._area;for(var e in r.areas)r.areas.hasOwnProperty(e)&&(this._area=r.areas[e],this.clear());return this._area=t,this},_in:function(t){return"string"!=typeof t&&(t=r.stringify(t)),this._ns?this._ns+t:t},_out:function(t){return this._ns?t&&0===t.indexOf(this._ns)?t.substring(this._ns.length):undefined:t}},storage:function(t){return r.inherit(r.storageAPI,{items:{},name:t})},storageAPI:{length:0,has:function(t){return this.items.hasOwnProperty(t)},key:function(t){var e=0;for(var n in this.items)if(this.has(n)&&t===e++)return n},setItem:function(t,e){this.has(t)||this.length++,this.items[t]=e},removeItem:function(t){this.has(t)&&(delete this.items[t],this.length--)},getItem:function(t){return this.has(t)?this.items[t]:null},clear:function(){for(var t in this.items)this.removeItem(t)}}},i=r.Store("local",function(){try{return localStorage}catch(t){}}());i.local=i,i._=r,i.area("session",function(){try{return sessionStorage}catch(t){}}()),i.area("page",r.storage("page")),"function"==typeof n&&n.amd!==undefined?n("store2",[],function(){return i}):t.exports?t.exports=i:(e.store&&(r.conflict=e.store),e.store=i)}(commonjsGlobal,commonjsGlobal&&commonjsGlobal.define)}),Plugin$9=videojs.getPlugin("plugin"),log$7=videojs.log,ContinuePlay=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return i.options=r,i.init(),i}return inherits(e,t),e.prototype.init=function(t){var e=this.player,n=e.options_,r=void 0;e.off("timeupdate",videojs.bind(this,this.onTimeUpdate)),e.ready(videojs.bind(this,function(){r=n&&n.appID&&n.fileID?n.fileID:this.options.playID,this.playID=r,t&&t.src?this.source=t.src.split("?")[0]:e.cache_&&e.cache_.source&&e.cache_.source.src&&(this.source=e.cache_.source.src.split("?")[0]),(r||this.source)&&(log$7("ContinuePlay initializing"),this.lastTime=store2.get(this.getStoreKey()),e.off("timeupdate",videojs.bind(this,this.onTimeUpdate)),e.on("timeupdate",videojs.bind(this,this.onTimeUpdate)),e.one(this.getTriggerEvent(),videojs.bind(this,this.onPlay)),!this.options.auto&&e.getChild("ContinuePlayTips")&&e.getChild("ContinuePlayTips").close(),log$7("ContinuePlay initialized"),e.trigger({type:"feature",data:"continue"}))}))},e.prototype.onTimeUpdate=function(t){store2.set(this.getStoreKey(),this.player.currentTime())},e.prototype.onPlay=function(t){var e=this.player;Math.round(this.lastTime)>1&&this.player.duration()>1&&this.player.duration()!==Infinity&&Math.round(this.lastTime)!=Math.round(this.player.duration())?this.options.auto?this.start():e.addChild("ContinuePlayTips",videojs.mergeOptions(this.options,{time:this.lastTime,resumeCallback:videojs.bind(this,this.start)})):"Flash"==e.techName_&&Math.round(this.lastTime)>1&&Math.round(this.lastTime)!=Math.round(this.player.duration())&&this.player.duration()!==Infinity&&!this.player.duration()&&e.one("loadedmetadata",videojs.bind(this,this.onPlay))},e.prototype.start=function(){var t=this.player;t.currentTime(this.lastTime),"Flash"==t.techName_&&t.tech(!0).trigger("seeked"),t.trigger({type:"continueplay",data:{lastTime:this.lastTime}})},e.prototype.generatePlayID=function(){},e.prototype.getStoreKey=function(){return"tcplayer-lpt-"+(this.playID||this.source)},e.prototype.getTriggerEvent=function(){var t=this.player,e=t.options_;return e.autoplay&&"Flash"==t.techName_?"loadedmetadata":"playing"},e}(Plugin$9);videojs.registerPlugin("ContinuePlay",ContinuePlay);var defaults$2={align:"top-left",className:"",content:"",debug:!1,showBackground:!0,attachToControlBar:!1,overlays:[]},Component$13=videojs.getComponent("Component"),dom$1=videojs.dom||videojs,registerPlugin$1=videojs.registerPlugin||videojs.plugin,isNumber=function(t){return"number"==typeof t&&t===t},hasNoWhitespace=function(t){return"string"==typeof t&&/^\S+$/.test(t)},Overlay=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return["start","end"].forEach(function(t){var e=i.options_[t];if(isNumber(e))i[t+"Event_"]="timeupdate";else if(hasNoWhitespace(e))i[t+"Event_"]=e;else if("start"===t)throw new Error('invalid "start" option; expected number or string')}),["endListener_","rewindListener_","startListener_"].forEach(function(t){i[t]=function(n){return e.prototype[t].call(i,n)}}),"timeupdate"===i.startEvent_&&i.on(n,"timeupdate",i.rewindListener_),i.debug('created, listening to "'+i.startEvent_+'" for "start" and "'+(i.endEvent_||"nothing")+'" for "end"'),i.hide(),i}return inherits(e,t),e.prototype.createEl=function(){var t=this.options_,e=t.content,n=t.showBackground?"tcp-overlay-background":"tcp-overlay-no-background",r=dom$1.createEl("div",{className:"\n tcp-overlay\n tcp-overlay-"+t.align+"\n "+t.className+"\n "+n+"\n vjs-hidden\n "});return"string"==typeof e?r.innerHTML=e:videojs.browser.IS_IE8||e instanceof window_1.DocumentFragment?r.appendChild(e):dom$1.appendContent(r,e),r},e.prototype.debug=function(){if(this.options_.debug){for(var t=videojs.log,e=t,n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];t.hasOwnProperty(r[0])&&"function"==typeof t[r[0]]&&(e=t[r.shift()]),e.apply(undefined,["overlay#"+this.id()+": "].concat(r))}},e.prototype.hide=function(){return t.prototype.hide.call(this),this.debug("hidden"),this.debug('bound `startListener_` to "'+this.startEvent_+'"'),this.endEvent_&&(this.debug('unbound `endListener_` from "'+this.endEvent_+'"'),this.off(this.player(),this.endEvent_,this.endListener_)),this.options_.once?(videojs.browser.IS_IOS&&videojs.browser.IS_WECHAT?this.player().hasStarted()||this.player().ready(videojs.bind(this,function(){this.startListener_({type:this.startEvent_})})):this.player().hasStarted()||this.on(this.player(),this.startEvent_,this.startListener_),this):("pause"===this.startEvent_?this.on(this.player(),this.startEvent_,this.startOnPause_):this.on(this.player(),this.startEvent_,this.startListener_),this)},e.prototype.startOnPause_=function(t){var e=this.player();"pause"===t.type?e.seeking()||e.ended()||this.startListener_({type:"pause"}):e.paused()&&this.startListener_({type:"pause"})},e.prototype.shouldHide_=function(t,e){var n=this.options_.end;return isNumber(n)?t>=n:n===e},e.prototype.show=function(){return t.prototype.show.call(this),"pause"===this.startEvent_&&this.off(this.player(),this.startEvent_,this.startOnPause_),this.off(this.player(),this.startEvent_,this.startListener_),this.debug("shown"),this.debug('unbound `startListener_` from "'+this.startEvent_+'"'),this.endEvent_&&(this.debug('bound `endListener_` to "'+this.endEvent_+'"'),this.on(this.player(),this.endEvent_,this.endListener_)),this},e.prototype.shouldShow_=function(t,e){var n=this.options_.start,r=this.options_.end;return isNumber(n)?isNumber(r)?t>=n&&t<r:this.hasShownSinceSeek_?Math.floor(t)===n:(this.hasShownSinceSeek_=!0,t>=n):n===e},e.prototype.startListener_=function(t){var e=this.player().currentTime();this.shouldShow_(e,t.type)&&this.show()},e.prototype.endListener_=function(t){var e=this.player().currentTime();this.shouldHide_(e,t.type)&&this.hide()},e.prototype.rewindListener_=function(t){var e=this.player().currentTime(),n=this.previousTime_,r=this.options_.start,i=this.options_.end;e<n&&(this.debug("rewind detected"),isNumber(i)&&!this.shouldShow_(e)?(this.debug("hiding; "+i+" is an integer and overlay should not show at this time"),this.hasShownSinceSeek_=!1,this.hide()):hasNoWhitespace(i)&&e<r&&(this.debug("hiding; show point ("+r+") is before now ("+e+") and end point ("+i+") is an event"),this.hasShownSinceSeek_=!1,this.hide())),this.previousTime_=e},e}(Component$13);videojs.registerComponent("Overlay",Overlay);var plugin=function(t){var e=this,n=videojs.mergeOptions(defaults$2,t);Array.isArray(this.overlays_)&&this.overlays_.forEach(function(t){e.removeChild(t),e.controlBar&&e.controlBar.removeChild(t),t.dispose()});var r=n.overlays;delete n.overlays,this.overlays_=r.map(function(t){var r=videojs.mergeOptions(n,t);return r.attachToControlBar&&e.controlBar&&-1!==r.align.indexOf("bottom")?e.controlBar.addChild("overlay",r):e.addChild("overlay",r)})};registerPlugin$1("Patch",plugin);var Plugin$10=videojs.getPlugin("plugin"),log$8=videojs.log,locations=["start","pause","ended"],startEvent=["loadstart","pause","ended"],endEvent=["play","play","play"],ImagePatch=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.hasInit=!1,i.init(r),i}return inherits(e,t),e.prototype.init=function(t){var e=this,n=this.player,r={showBackground:!1,overlays:[]};Array.isArray(t)&&t.length>0&&(log$8("ImagePatch initializing"),t.forEach(function(t){var n=void 0,i=void 0,o=void 0,s=void 0,a=document.createDocumentFragment();o=document.createElement("a"),o.className="tcp-overlay-link",o.target="_blank",t.link&&(o.href=t.link),t.url&&(s=e.loadImg(unifyProtocol(t.url),videojs.bind(e,e.onImgLoaded)),s.className="tcp-overlay-img",o.appendChild(s),videojs.browser.IS_IE8?(n=document.createElement("div"),n.className="tcp-overlay-table",i=document.createElement("div"),i.className="tcp-overlay-cell",i.appendChild(o),n.appendChild(i),a.appendChild(n)):a.appendChild(o),r.overlays.push({content:a,className:"tcp-image-patch tcp-image-patch-"+locations[t.location],start:startEvent[t.location],end:endEvent[t.location],once:0==t.location,align:"center"}))}),r.overlays.length>0?(n.Patch(r),n.trigger({type:"feature",data:"patch"}),this.hasInit=!0):this.reset(),log$8("ImagePatch initialized"))},e.prototype.loadImg=function(t,e){var n,r,i,o,s,a=new Image;return a.src=t,a.complete?(e&&e.call(e,a),a):(r=a.width,i=a.height,a.onerror=function(){n.end=!0,a=a.onload=a.onerror=null},n=function(){o=a.width,s=a.height,(o!==r||s!==i||o*s>1024)&&(e&&e.call(e,a),n.end=!0)},n(),a.onload=function(){!n.end&&n(),a=a.onload=a.onerror=null},a)},e.prototype.onImgLoaded=function(t){if(videojs.browser.IE_VERSION){var e=parseInt(this.player.el().currentStyle.width),n=parseInt(this.player.el().currentStyle.height);if(t.width>e||t.height>n){var r=e/(t.width/t.height);t.width/t.height>e/n||(t.style.marginTop=(n-r)/2+"px"),t.style.width="100%",t.style.height="auto"}}},e.prototype.reset=function(){this.hasInit&&(log$8("ImagePatch reset"),this.player.Patch(),this.hasInit=!1)},e}(Plugin$10);videojs.registerPlugin("ImagePatch",ImagePatch);var Plugin$11=videojs.getPlugin("plugin"),log$9=videojs.log,ContextMenu=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return i.options=r,log$9("ContextMenu initializing"),i.init(),log$9("ContextMenu initialized"),i}return inherits(e,t),e.prototype.init=function(){this.player.addChild("RightClickPopupMenu",this.options)},e}(Plugin$11);videojs.registerPlugin("ContextMenu",ContextMenu);var Plugin$12=videojs.getPlugin("plugin"),LevelSwitch=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return i.options=r,i.init(),i}return inherits(e,t),e.prototype.init=function(){var t=this.player,e=t.options_.plugins.ContextMenu;e&&e.levelSwitch&&e.levelSwitch.open&&t.addChild("LevelSwitchTips",this.options)},e}(Plugin$12);videojs.registerPlugin("LevelSwitch",LevelSwitch);var getParams$2=getParams,Plugin$13=videojs.getPlugin("plugin"),log$11=videojs.log,defaults$3={width:0,height:0,basePath:""},VttThumbnail=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return i.hasInit=!1,i.spriteData=[],i.firstShowSprite=!0,(r.vttUrl||!0===r.enable)&&n.on("loadedmetadata",function(){i.getSpriteConfig(),i.init(r)}),i}return inherits(e,t),e.prototype.checkEventDvr=function(){var t=this.player.dvrMode();return!!this.player.src()&&("dvrLive"===t||"dvrEvent"===t)},e.prototype.loadTrackFile=function(t){var e=this,n=this.player,r=n.addRemoteTextTrack({src:t.vttUrl,kind:"metadata"},!0);r&&r.addEventListener("load",function(){e.trackInfo=r})},e.prototype.getSpriteConfig=function(){if(!this.checkEventDvr())return!1;var t=this,e=this.player;this.canGetNewSprite=!1;var n=e.src(),r=(getParams$2(n,"tsEnd"),parseInt((new Date).getTime()/1e3),get_1(e,"options_.plugins.Dvr.spriteURL")),i=get_1(e,"options_.plugins.Dvr.startTime"),o=r.indexOf("http://")>-1?"http://":"https://",s=r.replace("https://","").replace("http://","").split("/")[0];xhr({url:r,timeout:3e3},function(e,n,r){if(!r)return!1;t.spriteData=JSON.parse(r),t.lastTime=t.spriteData[t.spriteData.length-1].last_time,t.liveDuration=0,t.spriteData.sort(function(t,e){return t.start_time-e.start_time});for(var a=0;a<t.spriteData.length;a++){var l=t.spriteData[a];0==a&&i>l.start_time?(l.hidden_dur=i-l.start_time,l.play_dur=l.end_time-i,l.hasOwnProperty("duration")&&(l.play_dur=l.duration*l.play_dur/(l.end_time-l.start_time),l.hidden_dur=l.duration-l.play_dur,t.liveDuration+=l.play_dur)):(l.hidden_dur=0,l.play_dur=l.end_time-l.start_time,l.hasOwnProperty("duration")&&(l.play_dur=l.duration,t.liveDuration+=l.play_dur))}t.initLiveDuration=t.liveDuration,t.canGetNewSprite=!0,t.baseHost=o+s,t.prefix=t.baseHost+t.spriteData[t.spriteData.length-1].path,t.durationTimer&&clearInterval(t.durationTimer),t.durationTimer=setInterval(function(){t.player&&!t.player.paused()&&(t.liveDuration=t.liveDuration+1)},1e3)})},e.prototype.init=function(t){if(!videojs.browser.IS_IOS&&!videojs.browser.IS_ANDROID&&this.player.controlBar&&this.player.controlBar.progressControl){if(log$11("VttThumbnail initializing",t),!this.player.controlBar)return void log$11("VttThumbnail can not initialize without control bar");this.options=t;var e=this.player;t.vttUrl&&(this.loadTrackFile(t),defaults$3.basePath=parseBasePath(t.vttUrl)),this.initUI(),this.hasInit=!0,log$11("VttThumbnail initialized"),e.trigger({type:"feature",data:"thumbnail"})}},e.prototype.initTrackFile=function(t){t.track;this.trackInfo=t},e.prototype.initUI=function(){var t=this,e=videojs.dom.createEl("div",{className:"tcp-vtt-thumbnail-container"}),n=videojs.dom.createEl("img",{className:"tcp-vtt-thumbnail-img"});e.appendChild(n),this.containerEl=e,this.imgEl=n,this.cleanTimer&&clearInterval(this.cleanTimer),this.cleanTimer=setInterval(function(){"0"===window.getComputedStyle(t.imgEl).opacity&&(t.containerEl.style.display="none")},200);var r=setInterval(function(){var n=t.player.dvrMode(),i=void 0;(i="dvrLive"===n?t.player.controlBar.getChild("LiveProgressControl"):t.player.controlBar.progressControl)&&(i.el().appendChild(e),i.on("mouseenter",videojs.bind(t,t.onMouseEnter)),i.on("mousemove",videojs.bind(t,t.onMouseMove)),i.on("mouseleave",videojs.bind(t,t.onMouseOut)),clearInterval(r))},500)},e.prototype.onMouseEnter=function(){this.containerEl.style.display="block"},e.prototype.getRelativeOffset=function(t){for(var e=0,n=t,r=0,i=0;i<this.spriteData.length;i++){if(t<e+this.spriteData[i].play_dur){r=i,n=t-e+this.spriteData[i].hidden_dur;break}e+=this.spriteData[i].play_dur}return{relativeOffset:n,gConfigIndex:r}},e.prototype.getSpritePosition=function(t){var e=this.getRelativeOffset(t),n=e.relativeOffset,r=e.gConfigIndex,i=Math.floor(n/60),o=Math.floor(n%60/10);this.prefix=this.baseHost+this.spriteData[r].path;var s=this.baseHost+this.spriteData[r].path+i+".jpg";return s+="?txTimeshift=on",{picUrl:s,xpos:160*Math.floor(o%3),ypos:90*Math.floor(o/3)}},e.prototype.onMouseMove=function(t){var e=void 0,n=void 0,r=void 0,i=void 0,o=void 0,s=void 0,a=void 0,l=void 0,c=0,u=void 0,h=void 0,p=void 0,d=void 0,f=this.player.dvrMode();if(r="dvrLive"===f?this.player.controlBar.getChild("LiveProgressControl"):this.player.controlBar.progressControl,i="dvrLive"===f?r.LiveSeekBar:r.seekBar,o=offsetParent(r.el()).getBoundingClientRect(),s=offsetParent(i.el()).getBoundingClientRect(),e=t.clientX,l="dvrLive"===f?this.liveDuration:this.player.duration(),a=((e-s.left)/i.width()*l).toFixed(3),a>this.initLiveDuration&&this.canGetNewSprite&&this.getSpriteConfig(),!+a)return!1;if("dvrEvent"===f||"dvrLive"===f){var g=player.currentPDT()/100;if(g&&(g>this.lastTime||!this.prefix))return this.getSpriteConfig(),!1;var y=this.getSpritePosition(a);return p={h:90,left:0,src:y.picUrl,w:160,x:y.xpos,y:y.ypos},d=e-s.left+p.w/2-i.width(),d=Math.max(0,d),n=e-o.left-p.w/2-d,n=Math.max(i.el().offsetLeft,n),p.left=n,this.setView(p),!1}if(!this.trackInfo)return!1;for(u=this.trackInfo.track||this.trackInfo;c<u.cues.length;){if(h=u.cues[c],h.startTime<=a&&h.endTime>=a){p=parseImageLink(h.text);break}c++}if(!p)return this.onMouseOut(),!1;d=e-s.left+p.w/2-i.width(),d=Math.max(0,d),n=e-o.left-p.w/2-d,n=Math.max(i.el().offsetLeft,n),p.left=n,this.setView(p)},e.prototype.onMouseOut=function(){this.containerEl.style.display="none"},e.prototype.setView=function(t){var e=this.containerEl,n=this.imgEl,r=this.options;this.firstShowSprite&&(e.style.display="none",this.firstShowSprite=!1),e.style.width==t.w&&e.style.height==t.h||(e.style.width=t.w+"px",e.style.height=t.h+"px"),e.style.left=t.left+"px",n.src!==t.src&&(r.imgUrl&&n.src!=r.imgUrl?n.src=r.imgUrl:n.src=t.src),n.onload=function(){e.style.display="block"},n.onerror=function(){e.style.display="none",setTimeout(function(){e.style.display="none"},200)},n.style.left=-t.x+"px",n.style.top=-t.y+"px",n.style.clip="rect("+t.y+"px,"+(t.w+t.x)+"px,"+(t.y+t.h)+"px,"+t.x+"px)"},e.prototype.reset=function(){if(this.hasInit){log$11("VttThumbnail reset");var t=this.player,e=t.controlBar.progressControl;e.off("mousemove",videojs.bind(this,this.onMouseMove,10)),e.off("mouseleave",videojs.bind(this,this.onMouseOut)),this.hasInit=!1}},e}(Plugin$13),getComputedStyle=function(t,e){return function(n){return window.getComputedStyle?window.getComputedStyle(t,e)[n]:t.currentStyle[n]}},offsetParent=function n(t){return"HTML"!==t.nodeName&&"static"===getComputedStyle(t)("position")?n(t.offsetParent):t},parseImageLink=function(t){var e=void 0,n=void 0,r=void 0;if(-1===(n=t.indexOf("#")))return{src:t,w:0,h:0,x:0,y:0};if(e=t.substring(0,n),/^(http:|https:|\/\/)/.test(e)||(e=defaults$3.basePath+e),r=t.substring(n+1),"xywh="!==r.substring(0,5))return{src:e,w:0,h:0,x:0,y:0};var i=r.substring(5).split(",");return{src:e,w:parseInt(i[2]),h:parseInt(i[3]),x:parseInt(i[0]),y:parseInt(i[1])}},parseBasePath=function(t){/^(\/\/)/.test(t)&&(t="https:"+t);var e=/(\w+):\/\/([^\:|\/]+)(\:\d*)?(.*\/)([^#|\?|\n]+)?(#.*)?(\?.*)?/i,n=t.match(e);if(n&&n[2]&&n[4])return"//"+n[2]+n[4]};videojs.registerPlugin("VttThumbnail",VttThumbnail);var Plugin$14=videojs.getPlugin("plugin"),log$12=videojs.log,PlayerMetrics=function(t){function e(n,r){classCallCheck(this,e),log$12("PlayerMetrics initializing");var i=possibleConstructorReturn(this,t.call(this,n));if(!1===n.options_.reportable){var o;return o=!1,possibleConstructorReturn(i,o)}return i.player=n,i.checkPrevData(),i.initData(),i.registerListener(),log$12("PlayerMetrics initialized"),i}return inherits(e,t),e.prototype.checkPrevData=function(){var t=localStorage.getItem("tcplayer_data");if(t){var e=JSON.parse(t);Reporter.reportPlayMetrics(e,function(){localStorage.removeItem("tcplayer_data")})}},e.prototype.initData=function(){this.bytes_token=guid(),this.vodBaseData={uint32_service:2,uint32_platform:3,bytes_version:String(version),uint64_appid:0,bytes_bizid:this.guid("dev_uuid"),bytes_stream_id:"",uint32_module_id:1011,uint32_data_type:1,uint32_command:40303,uint64_data_time:0,bytes_token:this.bytes_token,token:this.bytes_token,dev_uuid:this.guid("dev_uuid"),str_app_name:"",str_app_version:"",str_stream_url:"",str_brand_type:this.getDevice(),str_device_resolution:screen.width+"_"+screen.height,str_device_type:"",str_package_name:"",str_sdk_name:"TCPlayer",str_user_id:this.guid("dev_uuid"),sys_type:this.getSystem(),sys_version:String(this.getSystemVer()),str_user_agent:USER_AGENT,str_browser_version:String(this.getBrowserVer()),str_browser_model:String(this.getBrowser()),u32_app_id:String(this.player.options_.appID),str_fileid:String(this.player.options_.fileID),u32_network_type:this.getNetworkType()},this.liveBaseData={str_user_id:this.guid("dev_uuid"),dev_uuid:this.guid("dev_uuid"),str_session_id:this.bytes_token,bytes_token:this.bytes_token,str_device_type:"",str_os_info:this.getSystem(),str_package_name:"",u32_network_type:"0xFF"!==this.getNetworkType()?this.getNetworkType():"",u32_server_ip:"",str_stream_url:this.player.cache_.src,u64_timestamp:this.player.startTime,u32_link_type:1,u32_channel_type:1,str_app_version:"",platform:3,uint32_platform:3,str_browser_version:this.getBrowserVer(),str_browser_model:this.getBrowser(),str_user_agent:USER_AGENT,u32_video_drop:"",u32_drop_usage:"",float64_rtt:""},this.features=[],this.afterCanplay=!1,this.videoDuration=0,this.consumeDuration=0,this.playScene=1,this.timing={},this.playStatus={isFirstPlay:!1,pauseDuration:0},this.contentComputTimePoint=[],this.firstFrameDuration=0,this.firstIFrameDuration=0,this.blockInterval=5e3,this.bufferBlock=[],this.u32_drm_type="plain",this.resetLagStatus(),this.resetBlockData()},e.prototype.getComsumeDuration=function(t){var e=getTimeStamp()-this.timing.firstPlaying;this.consumeDuration=e-this.lagStatus.lagDuration-this.playStatus.pauseDuration,t&&this.consumeDuration<0&&(this.consumeDuration=e>0?e:0)},e.prototype.registerListener=function(){var t=this.player;t.on("loadedmetadata",videojs.bind(this,this.onLoadedmetadata)),t.one("canplay",videojs.bind(this,this.oneCanplay)),t.one("play",videojs.bind(this,this.onePlay)),t.on("play",videojs.bind(this,this.onPlay)),t.on("playing",videojs.bind(this,this.onPlaying)),t.on("seeking",videojs.bind(this,this.onSeeking)),t.on("seeked",videojs.bind(this,this.onSeeked)),t.on("error",videojs.bind(this,this.onError)),t.on("resolutionswitching",videojs.bind(this,this.onResolutionSwitching)),t.on("pause",videojs.bind(this,this.onPause)),t.on("playcgiend",videojs.bind(this,this.onPlaycgiend)),t.on("ended",videojs.bind(this,this.onEnded)),t.on("feature",videojs.bind(this,this.onFeature)),t.on("dispose",videojs.bind(this,this.onDispose)),document.addEventListener("visibilitychange",videojs.bind(this,this.onVisibilityChange)),window.addEventListener("pagehide",videojs.bind(this,this.onPageHide))},e.prototype.onPageHide=function(){this.saveData()},e.prototype.onVisibilityChange=function(){"hidden"===document.visibilityState&&this.saveData()},e.prototype.saveData=function(){this.bytes_token&&3!==this.playScene&&this.player&&(this.getComsumeDuration(),this.report(2===this.playScene?40304:40102,{},function(t){localStorage.setItem("tcplayer_data",JSON.stringify(t))}))},e.prototype.onLoadedmetadata=function(){this.player.tech_.webrtcProvider?this.playScene=3:this.playScene=this.player.duration()===Infinity?1:2,this.videoDuration=parseInt(this.player.duration())||0,videojs.bind(this,this.calculateFirstFrameDuration)(),2===this.playScene&&this.report(40303)},e.prototype.oneCanplay=function(){videojs.bind(this,this.calculateFirstFrameDuration)(),1===this.playScene&&this.report(40101)},e.prototype.calculateFirstFrameDuration=function(){var t=getperformance();t.mark&&t.measure&&t.getEntriesByName&&(t.mark("firstIFrameEnd"),t.measure("firstIFrame","firstFrameStart","firstIFrameEnd"),this.firstIFrameDuration=t.getEntriesByName("firstIFrame")[0].duration)},e.prototype.onePlay=function(){var t=this;this.setTimingData({firstPlay:getTimeStamp()});var e=this.player.el_.firstChild;this.bufferStart=e&&e.buffered&&e.buffered.length>0?e.buffered.start(e.buffered.length-1):0,this.bufferBlock=[this.bufferStart];var n=this.player.getVideoPlaybackQuality();this.recvFrames=n.totalVideoFrames,this.renderedFrames=n.totalVideoFrames-n.droppedVideoFrames,this.blockStartTime=getTimeStamp(),this.blockTimer=setInterval(function(){if(2===t.playScene)return!1;if(t.lagStatus.lagging&&t.lagStatus.lagStart){var n=getTimeStamp()-t.lagStatus.lagStart;n>t.blockInterval?t.blockData.lagBlockDuration=t.blockInterval:t.blockData.lagBlockDuration+=n}t.blockStartTime=getTimeStamp();var r=e&&e.buffered&&e.buffered.length>0?e.buffered.end(e.buffered.length-1):0,i=t.player.getVideoPlaybackQuality(),o=i.totalVideoFrames,s=i.totalVideoFrames-i.droppedVideoFrames;Object.assign(t.blockData,{buffer_avg:parseInt(1e3*(r-t.bufferStart)),recv_frames:o-t.recvFrames,render_frames:s-t.renderedFrames}),t.bufferBlock.push(t.blockData.buffer_avg),t.bufferStart=r,t.recvFrames=o,t.renderedFrames=s,t.report(40100)},this.blockInterval)},e.prototype.onDispose=function(){clearInterval(this.blockTimer)},e.prototype.onPlay=function(){this.playStatus.pauseTime&&(this.playStatus.pauseDuration=this.playStatus.pauseDuration+getTimeStamp()-this.playStatus.pauseTime,this.playStatus.pauseTime=0)},e.prototype.onPlaying=function(){var t=this;if(!this.playStatus.isFirstPlay&&(this.playStatus.isFirstPlay=!0,this.setTimingData({firstPlaying:getTimeStamp()}),this.player.on("waiting",function(){
19
+ t.lagStatus.lagging||t.player.seeking()||t.lagStatus.skip||(t.lagStatus.lagging=!0,t.lagStatus.lagStart=getTimeStamp())}),this.player.currentSource().keySystems)){var e=this.player.currentSource().keySystems;e.plain&&(this.u32_drm_type="plain"),e.SimpleAES&&(this.u32_drm_type="SimpleAES")}this.lagStatus.lagging&&(this.lagStatus.lagEnd=getTimeStamp())-this.lagStatus.lagStart>this.lagStatus.lagInterval&&(this.lagStatus.lagging=!1,this.lagStatus.lagCount++,this.lagStatus.lagAvg.push(this.lagStatus.lagEnd-this.lagStatus.lagStart),this.lagStatus.lagDuration+=this.lagStatus.lagEnd-this.lagStatus.lagStart,this.lagStatus.lagStart<this.blockStartTime&&(this.blockData.lagBlockDuration=this.lagStatus.lagEnd-this.blockStartTime),this.lagStatus.lagStart>=this.blockStartTime&&(this.blockData.lagBlockDuration+=this.lagStatus.lagEnd-this.lagStatus.lagStart),this.lagStatus.lagEnd=this.lagStatus.lagStart=0,this.lagStatus.isFirstLag||(this.lagStatus.isFirstLag=!0,this.setTimingData({firstLag:getTimeStamp()}))),[60,200,500,1e3].forEach(function(e){t.lagStatus.lagging&&(t.lagStatus.lagEnd=getTimeStamp())-t.lagStatus.lagStart>e&&t.blockData["lagCount_"+e]++}),this.lagStatus.skip=!1},e.prototype.onSeeking=function(){this.contentComputTimePoint.push({type:"end",time:this.player.currentTime()})},e.prototype.onSeeked=function(){this.contentComputTimePoint.push({type:"start",time:this.player.currentTime()})},e.prototype.onError=function(t){this.getComsumeDuration(!0);var e={u64_err_code:t.data.code,str_err_info:t.data.message||(defaults$1.errors[t.data.code]||{}).message},n=(this.player.cache_.src||"").indexOf("vod")>-1||this.player.options_.fileID;t&&t.data&&t.data.code&&(2===this.playScene&&n?this.report(40304,e):this.afterCanplay?this.report(40102,e):this.report(40101,e))},e.prototype.onResolutionSwitching=function(){this.lagStatus.skip=!0},e.prototype.onPause=function(){this.playStatus.pauseTime=getTimeStamp(),this.lagStatus.lagging&&(this.lagStatus.skip=!0)},e.prototype.onPlaycgiend=function(t){var e=this,n=t.data;n.result&&0==n.result.code&&(this.playStatus.requestID=n.result.requestId,setTimeout(function(){if(e.player.currentSources().length>0&&e.player.currentSources()[0].keySystems){var t=e.player.currentSources()[0].keySystems;t["com.widevine.alpha"]&&e.reportMTA("drm",{initialized:"Widevine"}),t["com.apple.fps.1_0"]&&e.reportMTA("drm",{initialized:"FairPlay"})}else e.player.options_.plugins.DRM&&e.player.options_.plugins.DRM.token&&e.reportMTA("drm",{initialized:"SimpleAES"})},0)),this.setTimingData({cgiStart:t.data.startTime,cgiEnd:t.data.time})},e.prototype.onEnded=function(){this.getComsumeDuration(),1===this.playScene?this.report(40102):this.report(40304)},e.prototype.onFeature=function(t){-1==this.features.indexOf(t.data)&&this.features.push(t.data)},e.prototype.guid=function(t){var e=localStorage.getItem(t);return e||(e=guid(),localStorage.setItem(t,e)),e},e.prototype.report=function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},n=arguments[2];if(3===this.playScene)return!1;t&&this["report_"+t](e,n)},e.prototype.report_40101=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(!this.player)return!1;var e={uint64_data_time:getTimeStampBySecond(),str_stream_url:this.player.cache_.src,u64_timestamp:this.player.startTime,u32_dns_time:"",u32_connect_server_time:parseInt(this.firstFrameDuration),u32_video_decode_type:0,u32_first_frame_down:parseInt(this.firstFrameDuration),u32_first_video_decode_time:parseInt(this.firstIFrameDuration),u32_first_i_frame:parseInt(this.firstIFrameDuration),u32_first_audio_frame_down:parseInt(this.firstFrameDuration),u32_first_audio_render_time:parseInt(this.firstIFrameDuration),u64_err_code:t.u64_err_code||"",str_err_info:t.str_err_info||""},n={app_id:0,data:[Object.assign({},this.liveBaseData,e,t)],module_id:1005,command:40101};Reporter.reportPlayMetrics(n)},e.prototype.report_40100=function(t){var e=this,n=this.player||{};this.blockData=this.blockData||{};var r={u32_cpu_usage:"",u32_app_cpu_usage:"",u32_avg_memory:"",u32_avg_cpu_usage:"",str_stream_url:n.cache_&&n.cache_.src,uint64_data_time:getTimeStampBySecond(),u32_recv_av_diff_time:0,u32_play_av_diff_time:0,u64_playtime:getTimeStamp()-this.timing.firstPlaying,u32_audio_decode_type:2,u32_audio_block_count:this.blockData.lagCount_500,u32_audio_cache_time:this.blockData.buffer_avg,u32_audio_drop:"",u32_video_decode_type:0,u32_video_recv_fps:this.blockData.recv_frames,u32_fps:this.blockData.render_frames,u32_video_cache_time:this.blockData.buffer_avg,u32_avg_cache_count:0,u32_video_block_count:this.blockData.lagCount_1000,u32_avg_net_speed:"",u32_video_light_block_count:this.blockData.lagCount_200,u32_video_large_block_count:this.blockData.lagCount_500,u32_audio_jitter_60ms_count:this.blockData.lagCount_60,u32_video_decode_fail:"",u32_audio_decode_fail:"",u32_avg_video_bitrate:0,u32_avg_audio_bitrate:0,u32_block_usage:1e3*parseInt(this.blockData.lagBlockDuration/this.blockInterval)},i={app_id:0,data:[Object.assign({},this.liveBaseData,r,t)],module_id:1005,command:40100};Reporter.reportPlayMetrics(i,function(){e.resetBlockData()})},e.prototype.report_40102=function(){var t=this,e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},n=arguments[1],r=this.player||{},i=0,o=0,s=0;if("{}"!==JSON.stringify(r)){i=this.lagStatus.lagAvg.length>0?this.lagStatus.lagAvg.reduce(function(t,e){return t+e},0)/this.lagStatus.lagAvg.length:0,o=this.bufferBlock.length>0?this.bufferBlock.reduce(function(t,e){return t+e},0)/this.bufferBlock.length:0;s=(r.getVideoPlaybackQuality&&r.getVideoPlaybackQuality()||{}).totalVideoFrames/e.duration}else this.resetLagStatus();var a={uint64_data_time:getTimeStampBySecond(),str_stream_url:r.cache_&&r.cache_.src,u64_timestamp:getTimeStamp(),u32_avg_cpu_usage:"",u32_avg_memory:"",u64_begin_timestamp:r.startTime,u32_result:this.consumeDuration,u64_err_code:e.u64_err_code,u32_speed_cnt:0,u32_avg_cache_time:o,u32_max_load:Math.max.apply(Math,this.lagStatus.lagAvg),u32_audio_block_time:this.lagStatus.lagDuration,u32_avg_load:i,u32_load_cnt:this.lagStatus.lagAvg.length||0,u32_nodata_cnt:this.lagStatus.lagAvg.length||0,u32_first_i_frame:this.firstIFrameDuration,u32_video_width:r.width_,u32_video_height:r.height_,u32_video_avg_fps:s,u32_avg_block_time:i,u64_block_count:this.lagStatus.lagAvg.length||0,u32_video_block_time:this.lagStatus.lagDuration,u64_jitter_cache_max:0,u64_block_duration_max:Math.max.apply(Math,this.lagStatus.lagAvg),u64_jitter_cache_avg:0,u32_ip_count_quic:"",u32_connect_count_quic:"",u32_connect_count_tcp:"",u32_is_real_time:"",u32_first_frame_black:"",u32_delay_report:0},l={app_id:0,data:[Object.assign({},this.liveBaseData,a,e)],module_id:1005,command:40102};return e.u32_delay_report?(localStorage.setItem("tcplayer_data",JSON.stringify(l)),!1):n?(l.data.u32_delay_report=1,n(l)):void Reporter.reportPlayMetrics(l,function(){t.bytes_token=null,localStorage.removeItem("tcplayer_data")})},e.prototype.report_40303=function(){this.setTimingData({initEnd:getTimeStamp()});var t={msg_client_ip:{uint32_ip:""},uint32_service:this.playScene,uint64_data_time:getTimeStampBySecond(),str_stream_url:this.player.cache_.src,uint32_command:40303,u32_app_id:String(this.player.options_.appID),str_fileid:String(this.player.options_.fileID)},e={app_id:0,data:[Object.assign({},this.vodBaseData,t)],module_id:1011,command:40303};Reporter.reportPlayMetrics(e)},e.prototype.report_40304=function(){var t=this,e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},n=arguments[1],r=this.lagStatus.lagAvg.length>0?this.lagStatus.lagAvg.reduce(function(t,e){return t+e},0)/this.lagStatus.lagAvg.length:0,i={u32_app_id:String(this.player.options_.appID),str_fileid:String(this.player.options_.fileID),uint64_data_time:getTimeStampBySecond(),uint32_command:40304,str_stream_url:this.player.cache_.src,u32_timeuse:String(parseInt(this.consumeDuration/1e3)||0),u32_videotime:String(this.videoDuration),u32_avg_load:String(r),u32_load_cnt:String(this.lagStatus.lagCount),u32_max_load:this.lagStatus.lagAvg.length>0?String(Math.max.apply(Math,this.lagStatus.lagAvg)):String(0),u32_avg_block_time:String(this.lagStatus.lagDuration),u32_player_type:String(4),u32_dns_time:"",u32_tcp_did_connect:"",u32_first_video_packet:String(parseInt(this.firstFrameDuration)),u32_first_i_frame:String(parseInt(this.firstIFrameDuration)),u32_server_ip:"",u32_drm_type:this.u32_drm_type,u32_playmode:String(1),u64_err_code:String(e.u64_err_code||""),str_err_info:String(e.str_err_info||""),u32_video_decode_type:String(0),u32_speed:this.player&&String(100*this.player.playbackRate())||"1000"},o={app_id:0,data:[Object.assign({},this.vodBaseData,i)],module_id:1011,command:40304};if(n)return n(o);Reporter.reportPlayMetrics(o,function(){t.bytes_token=null,localStorage.removeItem("tcplayer_data")})},e.prototype.setTimingData=function(t){this.timing=videojs.mergeOptions(this.timing,t)},e.prototype.reset=function(){this.playStatus={isFirstPlay:!1}},e.prototype.resetLagStatus=function(){this.lagStatus={lagCount:0,lagging:!1,lagStart:0,lagEnd:0,lagInterval:500,lagDuration:0,lagAvg:[],isFirstLag:!1,skip:!1}},e.prototype.resetBlockData=function(){this.blockData={lagCount_60:0,lagCount_200:0,lagCount_500:0,lagCount_1000:0,lagBlockDuration:0,buffer_avg:0,recv_frames:0,render_frames:0}},e.prototype.reportMTA=function(t,e){},e.prototype.getSystem=function(){return IS_IOS?"ios":IS_ANDROID?"android":IS_WIN?"win":IS_MAC?"mac":"other"},e.prototype.getSystemVer=function(){var t=this.getSystem();return"ios"==t?IOS_VERSION:"android"==t?ANDROID_VERSION:"win"==t?WIN_VER:"mac"==t?MAC_VER:void 0},e.prototype.getBrowser=function(){return IS_FIREFOX?"firefox":IS_EDGE?"edge":IS_MQQB?"mqq":IS_QQB?"qq":IS_TBS?"tbs":IS_CHROME?"chrome":IE_VERSION?"ie":IS_SAFARI?"safari":"other"},e.prototype.getBrowserVer=function(){var t=this.getBrowser();return"firefox"==t?FIREFOX_VER:"edge"==t?EDGE_VER:"chrome"==t?CHROME_VER:"ie"==t?IE_VERSION:"safari"==t?SAFARI_VER:"qq"==t||"mqq"==t?QQ_VER:"tbs"==t?TBS_VERSION:"other"},e.prototype.getDevice=function(){return IS_IOS?"IPHONE":IS_HUAWEI?"HUAWEI":IS_XIAOMI?"XIAOMI":IS_OPPO?"OPPO":IS_VIVO?"VIVO":IS_SX?"SUMSUNG":IS_CP?"COOLPAD":IS_ONE?"ONEPLUS":IS_ZX?"ZTE":"OTHER"},e.prototype.getMediaType=function(){return this.player.src()&&/\/(.+)\.(.+)\?|\/(.+)\.(.+)/.test(this.player.src()),RegExp.$2||RegExp.$4},e.prototype.getNetworkType=function(){var t=navigator.userAgent,e=t.match(/NetType\/\w+/)?t.match(/NetType\/\w+/)[0]:"NetType/other";e=e.toLowerCase().replace("nettype/","");var n;switch(e){case"wifi":n="1";break;case"4g":n="2";break;case"3g":case"3gnet":n="3";break;case"2g":n="4";break;default:n="0xFF"}return n},e}(Plugin$14);videojs.registerPlugin("PlayerMetrics",PlayerMetrics);var Plugin$15=videojs.getPlugin("plugin"),log$13=videojs.log,ProgressMarker=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return n.ready(videojs.bind(i,i.init)),i}return inherits(e,t),e.prototype.init=function(){var t=this.player;if(t.options_.dots){var e=function r(){Array.isArray(t.options_.dots)&&t.options_.dots.length>0&&(t.options_.dots.forEach(function(e){!e.emitted&&e.timeOffset-1e3*(t.currentTime()||0)<500&&(e.emitted=!0,t.trigger("marker",e.content))}),t.options_.dots[t.options_.dots.length-1].emitted||window.requestAnimationFrame(r))};window.requestAnimationFrame(e)}if(IS_IOS||IS_ANDROID)return!1;if(!t.controlBar||!this.player.controlBar.progressControl)return void log$13("ProgressMarker can not initialize without control bar or progress control");log$13("ProgressMarker initializing");var n=t.controlBar.getChild("ProgressControl").getChild("SeekBar");n.getChild("ProgressMarkerGenerator")&&n.removeChild("ProgressMarkerGenerator"),t.options_.plugins.ProgressMarker&&(n.addChild("ProgressMarkerGenerator"),log$13("ProgressMarker initialized"),t.trigger({type:"feature",data:"marker"}))},e}(Plugin$15);videojs.registerPlugin("ProgressMarker",ProgressMarker);var Component$16=videojs.getComponent("Component"),PlayListItem=function(t){function e(n,r){return classCallCheck(this,e),possibleConstructorReturn(this,t.call(this,n,r))}return inherits(e,t),e.prototype.createEl=function(){var t=this.options_,e=videojs.dom.createEl("div",{className:"tcp-playlist-item"}),n=videojs.dom.createEl("div",{className:"tcp-playlist-item-video",innerHTML:t.img?'<img src="'+t.img+'" class="tcp-playlist-item-img">':'<img src="https://imgcache.qq.com/open_proj/proj_qcloud_v2/mc_2014/video/console/v2/css/img/vod/default-cover.png" height="100" class="tcp-playlist-item-img">'}),r=videojs.dom.createEl("div",{className:"tcp-playlist-item-duration",textContent:this.timeFormat(t.duration)});n.appendChild(r);var i=videojs.dom.createEl("div",{className:"tcp-playlist-item-desc",textContent:t.text});return e.appendChild(n),e.appendChild(i),this.bindEvent(e),e},e.prototype.bindEvent=function(t){var e=this;videojs.on(t,["click"],function(){e.player_.trigger({type:"playItem",data:e.options_})})},e.prototype.timeFormat=function(t){var e="",n=Math.floor(t/3600);0!=n&&(t-=3600*n,n<10&&(n="0"+n),e+=n+":");var r=Math.floor(t/60);return r<10&&(r="0"+r),t-=60*r,t<10&&(t="0"+t),e+=r+":"+t},e}(Component$16);videojs.registerComponent("PlayListItem",PlayListItem);var Component$17=videojs.getComponent("Component"),PlayListTitle=function(t){function e(n,r){return classCallCheck(this,e),possibleConstructorReturn(this,t.call(this,n,r))}return inherits(e,t),e.prototype.createEl=function(){var t=this.options_;return videojs.dom.createEl("div",{className:"tcp-playlist-title",textContent:t.title})},e}(Component$17);videojs.registerComponent("PlayListTitle",PlayListTitle);var Component$15=videojs.getComponent("Component"),PlayListBox=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.init(),i.activeIndex=-1,i}return inherits(e,t),e.prototype.createEl=function(){return videojs.dom.createEl("div",{className:"tcp-playlist-box"})},e.prototype.init=function(){var t=this,e=this.options_.data;this.addChild("PlayListTitle",{title:this.options_.title}),e.forEach(function(e,n){e.index=n,t.addChild("PlayListItem",e)}),this.player_.on("ready",function(){t.options_.loop&&(t.activeIndex=0,t.player_.on("ended",videojs.bind(t,function(){t.player_.trigger({type:"playItem"})})))}),this.player_.on("playItem",function(n){var r=n.data,i=void 0;t.activeIndex=r?r.index:(t.activeIndex+1)%e.length,i=e[t.activeIndex],t.player_.loadVideoByID({fileID:i.fileID,appID:i.appID,psign:i.psign}),t.player_.one("loadedmetadata",videojs.bind(t,function(){t.player_.play()})),document.querySelectorAll(".tcp-playlist-item").forEach(function(t){videojs.dom.removeClass(t,"tcp-playlist-item-active")});var o=document.querySelectorAll(".tcp-playlist-item")[t.activeIndex];videojs.dom.addClass(o,"tcp-playlist-item-active")})},e}(Component$15);videojs.registerComponent("PlayListBox",PlayListBox);var Component$18=videojs.getComponent("Component"),PlayListToggle=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.status=0,i}return inherits(e,t),e.prototype.createEl=function(){var t=videojs.dom.createEl("div",{className:"tcp-playlist-toggle",textContent:"<"});return this.bindEvent(t),t},e.prototype.bindEvent=function(t){var e=this;videojs.on(t,["click"],function(n){e.status=!e.status;var r=document.querySelector(".tcp-playlist");e.status?(t.textContent=">",videojs.dom.addClass(r,"tcp-playlist-open"),videojs.dom.removeClass(r,"tcp-playlist-close")):(videojs.dom.addClass(r,"tcp-playlist-close"),videojs.dom.removeClass(r,"tcp-playlist-open"),t.textContent="<")})},e}(Component$18);videojs.registerComponent("PlayListToggle",PlayListToggle);var Component$14=videojs.getComponent("Component"),PlayList$1=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.init(),i}return inherits(e,t),e.prototype.createEl=function(){return videojs.dom.createEl("div",{className:"tcp-playlist tcp-playlist-close"})},e.prototype.init=function(){this.addChild("PlayListToggle"),this.addChild("PlayListBox",this.options_)},e}(Component$14);videojs.registerComponent("PlayList",PlayList$1);var Button$6=videojs.getComponent("Button"),PlayNextButton=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n,r));return i.addClass(),i}return inherits(e,t),e.prototype.addClass=function(){videojs.dom.addClass(this.el_,"vjs-play-next")},e.prototype.update=function(){},e.prototype.handleClick=function(t){this.player_.trigger({type:"playItem"})},e}(Button$6);PlayNextButton.prototype.controlText_="Play Next",videojs.registerComponent("PlayNextButton",PlayNextButton);var Plugin$16=videojs.getPlugin("plugin"),log$14=videojs.log,PlayList=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return IS_IOS||IS_ANDROID?possibleConstructorReturn(i):(i.options=r,r&&r.data instanceof Array&&r.data.length>0&&n.ready(videojs.bind(i,i.init)),i)}return inherits(e,t),e.prototype.init=function(){log$14("PlayList initializing"),this.player.addChild("PlayList",this.options),this.player.controlBar.addChild("PlayNextButton",{},1),log$14("PlayList initialized"),this.player.trigger({type:"feature",data:"playlist"})},e}(Plugin$16);videojs.registerPlugin("PlayList",PlayList);var Plugin$17=videojs.getPlugin("plugin"),log$15=videojs.log,HLSToken=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return log$15("HLSToken",n,r),i.init(r),i}return inherits(e,t),e.prototype.init=function(t){log$15("HLSToken init",t,this.player);var e=this.player;t.token&&(this.options=t,e.on("playcgiend",videojs.bind(this,function(t){this.modifyData(t.data)})))},e.prototype.modifyData=function(t){var e=this;if(log$15("HLSToken modifyData",t),0===t.result.code){var n=t.result.videoInfo;if(n.masterPlayList){var r=n.masterPlayList.url.split("/");r[r.length-1]="voddrm.token."+this.options.token+"."+r[r.length-1],n.masterPlayList.url=r.join("/")}n.transcodeList&&n.transcodeList.length>0&&(n.transcodeList=n.transcodeList.map(function(t){var n=t.url.split("/");return n[n.length-1]="voddrm.token."+e.options.token+"."+n[n.length-1],t.url=n.join("/"),t}))}},e}(Plugin$17);videojs.registerPlugin("HLSToken",HLSToken);var getMessageContents=function(t){var e=(new window_1.DOMParser).parseFromString(String.fromCharCode.apply(null,new Uint16Array(t)),"application/xml"),n=e.getElementsByTagName("HttpHeaders")[0],r={};if(n)for(var i=n.getElementsByTagName("name"),o=n.getElementsByTagName("value"),s=0;s<i.length;s++)r[i[s].childNodes[0].nodeValue]=o[s].childNodes[0].nodeValue;var a=e.getElementsByTagName("Challenge")[0],l=void 0;return a&&(l=window_1.atob(a.childNodes[0].nodeValue)),{headers:r,message:l}},requestPlayreadyLicense=function(t,e,n){var r=getMessageContents(e),i=r.headers,o=r.message;videojs.xhr({uri:t,method:"post",headers:i,body:o,responseType:"arraybuffer"},n)},getSupportedKeySystem=function(t){var e=void 0;return Object.keys(t).forEach(function(n){var r={},i=t[n].audioContentType,o=t[n].videoContentType;i&&(r.audioCapabilities=[{contentType:i}]),o&&(r.videoCapabilities=[{contentType:o}]),e=e?e["catch"](function(t){return window_1.navigator.requestMediaKeySystemAccess(n,[r])}):window_1.navigator.requestMediaKeySystemAccess(n,[r])}),e},makeNewRequest=function(t){var e=t.mediaKeys,n=t.initDataType,r=t.initData,i=t.options,o=t.getLicense,s=t.removeSession,a=t.eventBus,l=e.createSession();l.addEventListener("message",function(t){o(i,t.message).then(function(t){return l.update(t)})["catch"](videojs.log.error.bind(videojs.log.error,"failed to get and set license"))},!1),l.addEventListener("keystatuseschange",function(t){var e=!1;l.keyStatuses.forEach(function(n,r){switch(a.trigger({keyId:r,status:n,target:l,type:"keystatuschange"}),n){case"expired":e=!0;break;case"internal-error":videojs.log.warn('Key status reported as "internal-error." Leaving the session open since we don\'t have enough details to know if this error is fatal.',t)}}),e&&l.close().then(function(){s(r)})},!1),l.generateRequest(n,r)["catch"](videojs.log.error.bind(videojs.log.error,"Unable to create or initialize key session"))},addSession=function(t){var e=t.video,n=t.initDataType,r=t.initData,i=t.options,o=t.getLicense,s=t.removeSession,a=t.eventBus;e.mediaKeysObject?makeNewRequest({mediaKeys:e.mediaKeysObject,initDataType:n,initData:r,options:i,getLicense:o,removeSession:s,eventBus:a}):e.pendingSessionData.push({initDataType:n,initData:r})},setMediaKeys=function(t){var e=t.video,n=t.certificate,r=t.createdMediaKeys,i=t.options,o=t.getLicense,s=t.removeSession,a=t.eventBus;e.mediaKeysObject=r,n&&r.setServerCertificate(n);for(var l=0;l<e.pendingSessionData.length;l++){var c=e.pendingSessionData[l];makeNewRequest({mediaKeys:e.mediaKeysObject,initDataType:c.initDataType,initData:c.initData,options:i,getLicense:o,removeSession:s,eventBus:a})}return e.pendingSessionData=[],e.setMediaKeys(r)},defaultPlayreadyGetLicense=function(t){return function(e,n,r){requestPlayreadyLicense(t,n,function(t,e,n){if(t)return void r(t);r(null,n)})}},defaultGetLicense=function(t){return function(e,n,r){videojs.xhr({uri:t,method:"POST",responseType:"arraybuffer",body:n,headers:{"Content-type":"application/octet-stream"}},function(t,e,n){if(t)return void r(t);r(null,n)})}},promisifyGetLicense=function(t,e){return function(n,r){return new Promise(function(i,o){t(n,r,function(t,n){e&&e.trigger("licenserequestattempted"),t&&o(t),i(n)})})}},standardizeKeySystemOptions=function(t,e){if("string"==typeof e&&(e={url:e}),!e.url&&!e.getLicense)throw new Error("Neither URL nor getLicense function provided to get license");return e.url&&!e.getLicense&&(e.getLicense="com.microsoft.playready"===t?defaultPlayreadyGetLicense(e.url):defaultGetLicense(e.url)),e},standard5July2016=function(t){var e=t.video,n=t.initDataType,r=t.initData,i=t.options,o=t.removeSession,s=t.eventBus,a=Promise.resolve();if("undefined"==typeof e.mediaKeysObject){e.mediaKeysObject=null,e.pendingSessionData=[];var l=void 0,c=void 0;if(!(a=getSupportedKeySystem(i.keySystems)))return videojs.log.error("No supported key system found"),Promise.resolve();a=a.then(function(t){return new Promise(function(n,r){if(e.keySystem=t.keySystem,c=standardizeKeySystemOptions(t.keySystem,i.keySystems[t.keySystem]),!c.getCertificate)return void n(t);c.getCertificate(i,function(e,i){if(e)return void r(e);l=i,n(t)})})}).then(function(t){return t.createMediaKeys()}).then(function(t){return setMediaKeys({video:e,certificate:l,createdMediaKeys:t,options:i,getLicense:promisifyGetLicense(c.getLicense,s),removeSession:o,eventBus:s})})["catch"](videojs.log.error.bind(videojs.log.error,"Failed to create and initialize a MediaKeys object"))}return a.then(function(){addSession({video:e,initDataType:n,initData:r,options:i,getLicense:e.keySystem?promisifyGetLicense(standardizeKeySystemOptions(e.keySystem,i.keySystems[e.keySystem]).getLicense,s):null,removeSession:o,eventBus:s})})},stringToUint16Array=function(t){for(var e=new ArrayBuffer(2*t.length),n=new Uint16Array(e),r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n},uint8ArrayToString=function(t){return String.fromCharCode.apply(null,new Uint16Array(t.buffer))},getHostnameFromUri=function(t){var e=document_1.createElement("a");return t=t.match(/.*(skd\:\/\/.+)/i)[1],e.href=t,e.hostname},arrayBuffersEqual=function(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(var n=new DataView(t),r=new DataView(e),i=0;i<n.byteLength;i++)if(n.getUint8(i)!==r.getUint8(i))return!1;return!0},arrayBufferFrom=function(t){return t instanceof Uint8Array||t instanceof Uint16Array?t.buffer:t},FAIRPLAY_KEY_SYSTEM="com.apple.fps.1_0",concatInitDataIdAndCertificate=function(t){var e=t.initData,n=t.id,r=t.cert;"string"==typeof n&&(n=stringToUint16Array(n));var i=0,o=new ArrayBuffer(e.byteLength+4+n.byteLength+4+r.byteLength),s=new DataView(o);new Uint8Array(o,i,e.byteLength).set(e),i+=e.byteLength,s.setUint32(i,n.byteLength,!0),i+=4;var a=new Uint16Array(o,i,n.length);return a.set(n),i+=a.byteLength,s.setUint32(i,r.byteLength,!0),i+=4,new Uint8Array(o,i,r.byteLength).set(r),new Uint8Array(o,0,o.byteLength)},addKey=function(t){var e=t.video,n=t.contentId,r=t.initData,i=t.cert,o=t.options,s=t.getLicense,a=t.eventBus;return new Promise(function(t,l){if(e.webkitKeys||e.webkitSetMediaKeys(new window_1.WebKitMediaKeys(FAIRPLAY_KEY_SYSTEM)),!e.webkitKeys)return void l("Could not create MediaKeys");var c=e.webkitKeys.createSession("video/mp4",concatInitDataIdAndCertificate({id:n,initData:r,cert:i}));if(!c)return void l("Could not create key session");c.contentId=n,c.addEventListener("webkitkeymessage",function(t){s(o,n,t,function(t,e){if(a&&a.trigger("licenserequestattempted"),t)return void l(t);c.update(new Uint8Array(e))})}),c.addEventListener("webkitkeyadded",function(e){t(e)}),c.addEventListener("webkitkeyerror",function(t){l(t)})})},defaultGetCertificate=function(t){return function(e,n){videojs.xhr({uri:t,responseType:"arraybuffer"},function(t,e,r){if(t)return void n(t);n(null,new Uint8Array(r))})}},defaultGetContentId=function(t,e){return getHostnameFromUri(uint8ArrayToString(e))},defaultGetLicense$1=function(t){return function(e,n,r,i){videojs.xhr({uri:t,method:"POST",responseType:"arraybuffer",body:r.message,headers:{"Content-type":"application/x-www-form-urlencoded"}},function(t,e,n){if(t)return void i(t);i(null,n)})}},fairplay=function(t){var e=t.video,n=t.initData,r=t.options,i=t.eventBus,o=r.keySystems[FAIRPLAY_KEY_SYSTEM],s=o.getCertificate||defaultGetCertificate(o.certificateUri),a=o.getContentId||defaultGetContentId,l=o.getLicense||defaultGetLicense$1(o.licenseUri);return new Promise(function(t,e){s(r,function(n,r){if(n)return void e(n);t(r)})}).then(function(t){return addKey({video:e,cert:t,initData:n,getLicense:l,options:r,contentId:a(r,n),eventBus:i})})["catch"](function(t){i.player_.error({code:3,message:t})})},PLAYREADY_KEY_SYSTEM="com.microsoft.playready",addKeyToSession=function(t,e,n,r){var i=t.keySystems[PLAYREADY_KEY_SYSTEM];if("function"==typeof i.getKey)return void i.getKey(t,n.destinationURL,n.message.buffer,function(t,n){if(t)return void videojs.log.error("Unable to get key: "+t);e.update(n)});"string"==typeof i&&(i={url:i});var o=i.url||n.destinationURL;requestPlayreadyLicense(o,n.message.buffer,function(t,n){if(r&&r.trigger("licenserequestattempted"),t)return void videojs.log.error("Unable to request key from url: "+o);e.update(new Uint8Array(n.body))})},createSession=function(t,e,n,r){var i=t.msKeys.createSession("video/mp4",e);if(!i)return void videojs.log.error("Could not create key session.");i.addEventListener("mskeymessage",function(t){addKeyToSession(n,i,t,r)}),i.addEventListener("mskeyerror",function(t){videojs.log.error("Unexpected key error from key session with code: "+i.error.code+" and systemCode: "+i.error.systemCode)})},msPrefixed=function(t){var e=t.video,n=t.initData,r=t.options,i=t.eventBus;e.msKeys&&delete e.msKeys;try{e.msSetMediaKeys(new window_1.MSMediaKeys(PLAYREADY_KEY_SYSTEM))}catch(o){return void videojs.log.error("Unable to create media keys for PlayReady key system. Error: "+o.message)}createSession(e,n,r,i)},Plugin$18=videojs.getPlugin("plugin"),hasSession=function(t,e){for(var n=0;n<t.length;n++)if(t[n].initData){var r=arrayBufferFrom(t[n].initData),i=arrayBufferFrom(e);if(arrayBuffersEqual(r,i))return!0}return!1},removeSession=function(t,e){for(var n=0;n<t.length;n++)if(t[n].initData===e)return void t.splice(n,1)},handleEncryptedEvent=function(t,e,n,r){if(!e||!e.keySystems||e.src&&e.src.indexOf("m3u8")>-1)return Promise.resolve();var i=t.initData;return getSupportedKeySystem(e.keySystems).then(function(o){var s=o.keySystem;if(e.keySystems[s]&&e.keySystems[s].pssh&&(i=e.keySystems[s].pssh),!hasSession(n,i)&&i)return n.push({initData:i}),standard5July2016({video:t.target,initDataType:t.initDataType,initData:i,options:e,removeSession:removeSession.bind(null,n),eventBus:r})})},handleWebKitNeedKeyEvent=function(t,e,n){if(e.keySystems&&e.keySystems[FAIRPLAY_KEY_SYSTEM]&&t.initData)return fairplay({video:t.target,initData:t.initData,options:e,eventBus:n})},handleMsNeedKeyEvent=function(t,e,n,r){if(e.keySystems&&e.keySystems[PLAYREADY_KEY_SYSTEM]&&!n.reduce(function(t,e){return t||e.playready},!1)){var i=t.initData;e.keySystems[PLAYREADY_KEY_SYSTEM]&&e.keySystems[PLAYREADY_KEY_SYSTEM].pssh&&(i=e.keySystems[PLAYREADY_KEY_SYSTEM].pssh),i&&(n.push({playready:!0,initData:i}),msPrefixed({video:t.target,initData:i,options:e,eventBus:r}))}},getOptions=function(t){return videojs.mergeOptions(t.currentSource(),t.eme.options)},setupSessions=function(t){var e=t.src();e!==t.eme.activeSrc&&(t.eme.activeSrc=e,t.eme.sessions=[])},onPlayerReady=function(t){"video"===t.$(".vjs-tech").tagName.toLowerCase()&&t.tech_&&(setupSessions(t),t.tech_.el_.addEventListener("encrypted",function(e){if(t.currentSource().keySystems&&t.currentSource().keySystems["com.widevine.alpha"]&&"application/dash+xml"===t.currentSource().type)return!1;setupSessions(t),handleEncryptedEvent(e,getOptions(t),t.eme.sessions,t.tech_)}),t.tech_.el_.addEventListener("webkitneedkey",function(e){setupSessions(t),handleWebKitNeedKeyEvent(e,getOptions(t),t.tech_)}),videojs.browser.IS_EDGE||t.tech_.el_.addEventListener("msneedkey",function(e){setupSessions(t),handleMsNeedKeyEvent(e,getOptions(t),t.eme.sessions,t.tech_)}))},DRM=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return i.options=r,n.ready(function(){return onPlayerReady(n)}),n.eme={initializeMediaKeys:function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:function(){},i=videojs.mergeOptions(n.currentSource(),r,t),o={initDataType:"cenc",initData:null,target:n.tech_.el_};setupSessions(n),n.tech_.el_.setMediaKeys?handleEncryptedEvent(o,i,n.eme.sessions,n.tech_).then(function(){return e()})["catch"](function(t){return e(t)}):n.tech_.el_.msSetMediaKeys&&(handleMsNeedKeyEvent(o,i,n.eme.sessions,n.tech_),e())},options:r},i}return inherits(e,t),e.prototype.setOptions=function(t){this.options=t,this.player.options_.plugins.DRM=t},e}(Plugin$18),registerPlugin$2=videojs.registerPlugin||videojs.plugin;registerPlugin$2("DRM",DRM);var Plugin$19=videojs.getPlugin("plugin"),PDT=function(t){function e(n){classCallCheck(this,e);var r=possibleConstructorReturn(this,t.call(this,n));return n.plugins=n.plugins||{},n.plugins.pdt=!0,r}return inherits(e,t),e}(Plugin$19);videojs.registerPlugin("PDT",PDT);var Plugin$20=videojs.getPlugin("plugin"),dom$2=videojs.dom;if(!window.requestAnimationFrame){var lastTime=0;window.requestAnimationFrame=function(t){var e=(new Date).getTime(),n=Math.max(0,16.7-(e-lastTime)),r=window.setTimeout(function(){t(e+n)},n);return lastTime=e+n,r}}window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)});var DynamicWatermark=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return i.options=r||{},i.options.content&&i.init(),i}return inherits(e,t),e.prototype.dispose=function(){this.stopAnimation(),this.player.$(".tcp-dynamic-watermark-container")&&this.player.el().removeChild(this.containerElement),t.prototype.dispose.call(this)},e.prototype.init=function(){var t=this,e=this.player;this.isFirstShow=!0,this.initUI(),this.initStyle(),this.initSpeed(),e.on("loadedmetadata",function(){t.calculateStyle(),t.setStyle(),dom$2.removeClass(t.containerElement,"vjs-hidden")}),e.one("play",function(){t.encModule=new Enc,t.ghostCycle=t.encModule.calculateGhost(t.player.duration()),t.startAnimation()}),e.on(["fullscreenchange","playerresize"],function(){setTimeout(function(){t.calculateStyle()},200)})},e.prototype.initUI=function(){var t=this.player,e=dom$2.createEl("div",{
20
+ className:"tcp-dynamic-watermark-container vjs-hidden"}),n=dom$2.createEl("div",{innerHTML:encodeHTML(this.options.content),className:"tcp-dynamic-watermark-content"});if(e.appendChild(n),this.options.keep||t.el().appendChild(e),this.containerElement=e,this.markContentElement=n,"image"===this.options.type){var r=document.createElement("img");this.options.width&&(r.style.width=this.options.width),this.options.height&&(r.style.height=this.options.height),r.setAttribute("src",this.options.content),this.markContentElement.innerHTML="",this.markContentElement.appendChild(r)}},e.prototype.initStyle=function(){this.style={containerWidth:"",containerHeight:"",containerLeft:"",containerTop:"",contentLeft:80*Math.random(),contentTop:80*Math.random(),margin:0,padding:0,display:"block",visibility:"visible",opacity:.5,position:"absolute",color:"rgba(255, 255, 255)"}},e.prototype.initSpeed=function(){this.speed=this.options.keep&&0===this.options.speed?.2:this.options.speed},e.prototype.calculateStyle=function(){var t=this.player,e=this.style,n=t.videoWidth(),r=t.videoHeight(),i=dom$2.getBoundingClientRect(t.el()),o=i.width,s=i.height,a=(o/s).toFixed(2),l=(n/r).toFixed(2),c=void 0,u=void 0;l<a?(u=s,c=u*l):l>a?(c=o,u=c/l):l==a&&(c=o,u=s),e.containerLeft=(o-c)/2/o*100,e.containerTop=(s-u)/2/s*100,e.containerWidth=c/o*100,e.containerHeight=u/s*100},e.prototype.setStyle=function(){var t=this.containerElement,e=this.markContentElement,n=this.style;t.style.left=n.containerLeft+"%",t.style.top=n.containerTop+"%",t.style.width=n.containerWidth+"%",t.style.height=n.containerHeight+"%",t.style.display=e.style.display=n.display,t.style.visibility=e.style.visibility=n.visibility,t.style.opacity=e.style.opacity=n.opacity,t.style.position=e.style.position=n.position,t.style.margin=e.style.margin=n.margin,t.style.padding=e.style.padding=n.padding,e.style.left=this.options.left||n.contentLeft+"%",e.style.top=this.options.top||n.contentTop+"%",this.options.right&&(e.style.right=this.options.right),this.options.bottom&&(e.style.bottom=this.options.bottom),e.style.color=this.options.color||n.color,this.options.keep||(t.style.opacity=e.style.opacity=this.options.opacity||n.opacity),"text"===this.options.type&&(e.style.fontSize=this.options.fontSize||"12px",e.innerHTML=encodeHTML(this.options.content))},e.prototype.setContent=function(t){this.options.content=t},e.prototype.startAnimation=function(){var t=this;if(!this.rafID){var e=(this.player,this.style),n=this.containerElement,r=this.markContentElement,i=1,o=1,s=Math.random(),a=function l(){try{if(!t.isPauseAnimation){var a=Math.min(1,0===t.speed?0:t.speed?t.speed:.2),c=dom$2.getBoundingClientRect(n),u=dom$2.getBoundingClientRect(r),h=u.left-c.left,p=u.top-c.top;h+=a*i*s,p+=a*o*(1-s),h+u.width>c.width?(i=-1,s=Math.random()):h<0&&(i=1,s=Math.random()),p+u.height>c.height?(o=-1,s=Math.random()):p<0&&(o=1,s=Math.random()),h=Math.min(c.width-u.width,h),p=Math.min(c.height-u.height,p),e.contentLeft=h/c.width*100,e.contentTop=p/c.height*100,t.setStyle(),t.player&&t.encModule.removeWaterMark(t)}}catch(d){t.player&&t.encModule.handleWatermarkElementAdd(t)}if(t.isStopAnimation)return t.isStopAnimation=!1,cancelAnimationFrame(t.rafID),void(t.rafID=null);0!==t.speed&&requestAnimationFrame(l)};this.rafID=requestAnimationFrame(a)}},e.prototype.resumeAnimation=function(){this.isPauseAnimation=!1},e.prototype.pauseAnimation=function(){this.isPauseAnimation=!0},e.prototype.stopAnimation=function(){this.isStopAnimation=!0},e}(Plugin$20);videojs.registerPlugin("DynamicWatermark",DynamicWatermark);var Plugin$21=videojs.getPlugin("plugin"),XP2PHlsjsPlugin=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return i.options=r,i.hlsp2p=null,i}return inherits(e,t),e.prototype.startHLSP2P=function(t,e,n){var r=this,i=this.player.tech_,o=i.options_,s=o.xp2pConfig;if(e.isSupported()&&!window.hlsp2p){for(var a=["videoType","xp2pPackage","xp2pAppId","tencentCloudAppId"],l=a,c=Array.isArray(l),u=0,l=c?l:l[Symbol.iterator]();;){var h;if(c){if(u>=l.length)break;h=l[u++]}else{if(u=l.next(),u.done)break;h=u.value}var p=h;if(s[p]===undefined)return}var d={videoId:o.playerId+"_html5_api",url:o.source.src,videoType:s.videoType,cloudAppId:s.tencentCloudAppId,domain:s.xp2pPackage,xp2pAppId:s.xp2pAppId,p2pStartDelay:1e3},f=HLSP2P.create(t,Object.assign(d,s));f.on(HLSP2P.Events.Rollback,function(t){r.destroy(),n&&n(t)}),this.hlsp2p=f}},e.prototype.destroy=function(){this.hlsp2p&&(this.hlsp2p.destroy(),this.hlsp2p=null,window.hlsp2p=undefined)},e.prototype.dispose=function(){this.destroy()},e}(Plugin$21);videojs.registerPlugin("XP2PHlsjsPlugin",XP2PHlsjsPlugin);var Plugin$22=videojs.getPlugin("plugin"),XP2PFlvjsPlugin=function(t){function e(n,r){classCallCheck(this,e);var i=possibleConstructorReturn(this,t.call(this,n));return i.options=r,i}return inherits(e,t),e.prototype.createLoader=function(t,e,n){var r=this.player.tech();return function(t){function i(e,n){classCallCheck(this,i);var r=possibleConstructorReturn(this,t.call(this));return r._qvbp2p=null,r._receivedLength=0,r._config=n,r}return inherits(i,t),i.isSupported=function(){return e&&e.isSupported()},i.prototype.destroy=function(){this._destroyQVBP2P(),t.prototype.destroy.call(this)},i.prototype.open=function(t){this._createQVBP2P(),this._qvbp2p.on(e.ComEvents.STATE_CHANGE,this._onQVBP2PStateChange.bind(this)),this._qvbp2p.setMediaElement(r.el());var n={src:t.url};this._qvbp2p.loadSource(n)},i.prototype.abort=function(){this._destroyQVBP2P()},i.prototype._onQVBP2PStateChange=function(t,n){var r=e.ComCodes;switch(n.code){case r.RECEIVE_BUFFER:this._receiveBuffer(n.payload);break;case r.ROLLBACK:this._rollback(n)}},i.prototype._receiveBuffer=function(t){var e=this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,e,this._receivedLength)},i.prototype._rollback=function(t){n&&n(t)},i.prototype._createQVBP2P=function(){this._qvbp2p&&this._destroyQVBP2P(),this._qvbp2p=e.create(this._config.xp2pConfig),window.qvbp2p=this._qvbp2p},i.prototype._destroyQVBP2P=function(){this._qvbp2p&&(this._qvbp2p.destroy(),this._qvbp2p=null,window.qvbp2p=null)},i}(t.BaseLoader)},e}(Plugin$22);videojs.registerPlugin("XP2PFlvjsPlugin",XP2PFlvjsPlugin);var defaultConfig$1={enableStashBuffer:!1},Html5FlvJS=function(){function t(e,n,r){var i=this;classCallCheck(this,t);var o=function(){var t=window.flvjs;i.flvjs=t;var o=videojs.mergeOptions(defaultConfig$1,r.flvConfig,{xp2pConfig:r.xp2pConfig}),s=n.player();if(window.QVBP2P&&r.xp2pConfig&&r.xp2pConfig.useXP2P&&s.XP2PFlvjsPlugin){var a=s.XP2PFlvjsPlugin().createLoader(t,window.QVBP2P,function(t){i.dispose(),r.xp2pConfig.useXP2P=!1;var e=i.tech.player(),n=i.tech.currentSource_.src;e.src(n)});i.xp2pFlvLoader=a,o.customLoader=a}var l=new t.createPlayer(Object.assign({isLive:!1,url:e.src,type:"flv"},o),o);i.tech=n,l.on(t.Events.ERROR,videojs.bind(i,i.onError));for(var c in t.Events)!function(e){l.on(t.Events[e],videojs.bind(i,function(t){this.onEvent(e,t)}))}(c);s.trigger({type:"flvInstanceCreated",data:{flv:l}}),l.on(t.Events.STATISTICS_INFO,function(t){var e=(t.bps_audio||0)+(t.bps_video||0);s.trigger({type:"playstatus",data:{type:"flv",decodedFrames:t.decodedFrames,droppedFrames:t.droppedFrames,speed:t.speed.toFixed(0),bitrate:e||0,bpsAudio:t.bps_audio||0,bpsVideo:t.bps_video||0}})}),i.flv=l,i._id=(new Date).getTime(),n.el().srcObject&&(n.el().srcObject=null),l.attachMediaElement(n.el()),l.load()};Promise.all([function(){return r.xp2pConfig&&r.xp2pConfig.useXP2P&&"flv"===r.xp2pConfig.format&&!window.QVBP2P?new Promise(function(t){loadScript(XP2P_FLV_PATH,function(){t()})}):Promise.resolve()}(),function(){return window.flvjs?Promise.resolve():new Promise(function(t){loadScript(FLV_PATH,function(){t()})})}()]).then(function(){o()})}return t.prototype.onError=function(t,e,n){var r=this.tech.player();t===this.flvjs.ErrorTypes.NETWORK_ERROR&&r.error({code:2,source:n}),t===this.flvjs.ErrorTypes.MEDIA_ERROR&&r.error({code:3,source:n})},t.prototype.onEvent=function(t,e){this.tech.player().trigger({type:"FLVJS_EVENT",data:{type:t,data:e}})},t.prototype.dispose=function(){if(this.tech.player().pause(),this.tech.flvProvider)try{this.flv.destroy()}catch(t){}this.tech.flvProvider=null},t}(),flvTypeRE=/^video\/flv$/i,flvExtRE=/.flv(?![^?])/i,flvProtoRE=/^(ws:\/\/)/i,FlvSourceHandler={name:"flvSourceHandler",canHandleSource:function(t){return flvTypeRE.test(t.type)?"probably":flvExtRE.test(t.src)||flvProtoRE.test(t.src)?"maybe":""},handleSource:function(t,e,n){return e.flvProvider&&e.flvProvider.dispose(),e.flvProvider=new Html5FlvJS(t,e,n),e.flvProvider},canPlayType:function(t){if(flvTypeRE.test(t))return"probably"}};TCPlayer.mountFlvProvider=mountFlvProvider,mountFlvProvider();var defaultConfig$2={connectRetryCount:2,connectTimeout:5,receiveVideo:!0,receiveAudio:!0,showLog:!1},WebRTCProvider=function(){function t(e,n,r){var i=this;classCallCheck(this,t);var o=function(){i.tech=n,i.player=i.tech.player(),i.playerMetrics=i.player.PlayerMetrics(),i.report=i.player.options_.reportable;var t=window.TXLivePlayer;i.TXLivePlayer=t;var o=videojs.mergeOptions(defaultConfig$2,r.webrtcConfig);r.xp2pConfig&&"webrtc"===r.xp2pConfig.format&&r.xp2pConfig.useXP2P&&Object.assign(o,{p2pEnable:r.xp2pConfig.useXP2P,p2pConfig:{cloudAppid:r.xp2pConfig.tencentCloudAppId,xp2pAppid:r.xp2pConfig.xp2pAppId,appKey:r.xp2pConfig.xp2pAppKey,xp2pDomain:r.xp2pConfig.xp2pPackage}});var s=new t;i.webrtcConfig=o,s.setPlayerView(n.el()),s.setConfig(o),s.setPlayListener({onPlayEvent:videojs.bind(i,i.onPlayEvent),onPlayStats:videojs.bind(i,i.onPlayStats),onPlayReport:videojs.bind(i,i.onPlayReport),onPlaySEI:videojs.bind(i,i.onPlaySEI)}),s.startPlay(e.src),i.player.trigger({type:"webrtcInstanceCreated",data:{webrtc:s}}),i.webrtcPlayer=s};window.TXLivePlayer?o():loadScript(WEBRTC_PATH,function(){o()})}return t.prototype.onPlayStats=function(t){this.tech.player().trigger({type:"webrtcstats",data:t})},t.prototype.onPlayEvent=function(t,e){var n=this.tech.player();if(n.trigger({type:"debug",data:{code:t,data:e}}),t<-2e3){if(-2003===t&&e&&e.videoActive&&(n.trigger("blocked"),n.trigger({type:"webrtcevent",data:{code:2005}})),-2003===t)return!1;if(-2005===t||-2001===t||-2004===t){n.trigger({type:"debug",data:{message:"debug === webrtc 状态码 "+t+",进入降级逻辑"}});var r=n.options_.webrtcConfig;if(!r||!1!==r.fallback)return this.switchPlaySource(),!1}return n.error({code:t,source:e}),!1}n.trigger({type:"webrtcevent",data:{code:t,data:e}})},t.prototype.onPlayReport=function(t){if(!1===this.report)return!1;if(40101===t.uint32_command){this.tech.player().trigger({type:"debug",data:{code:"report",data:t}}),this.playerMetrics.report_40101(t)}40100===t.uint32_command&&this.playerMetrics.report_40100(t),40102===t.uint32_command&&this.playerMetrics.report_40102(t)},t.prototype.onPlaySEI=function(t){this.tech.player().trigger({type:"webrtcsei",data:t})},t.prototype.dispose=function(){this.webrtcPlayer&&(this.webrtcPlayer.setPlayListener({onPlayEvent:function(){},onPlayStats:function(){}}),this.webrtcPlayer.stopPlay(),this.webrtcPlayer.setPlayerView(videojs.dom.createEl("video"))),this.webrtcPlayer=null},t.prototype.setSource=function(t){var e=this;this.webrtcPlayer.startPlay(t.src),this.tech.player().one("webrtcevent",function(t){-1002===t.data.code&&e.tech.player().play()})},t.prototype.recovery=function(){var t=this,e=this.tech.player(),n=void 0;e.one("waiting",function(){n=setTimeout(function(){e.one("webrtcevent",function(n){if(1004===n.data.code){t.webrtcPlayer&&t.webrtcPlayer.startPlay(e.src()),e.play();var r=function i(t){1002===t.data.code&&(e.play(),e.off("webrtcevent",i))};e.on("webrtcevent",r)}}),t.webrtcPlayer&&t.webrtcPlayer.stopPlay()},2e3)}),e.one("playing",function(){n&&clearTimeout(n)})},t.prototype.switchPlaySource=function(){var t=this.tech.player(),e=void 0,n=this.tech.currentSource_.src;e=this.webrtcConfig&&this.webrtcConfig.fallbackUrl?[{src:this.webrtcConfig.fallbackUrl}]:this.convertProtocol(n),t.trigger({type:"webrtcfallback",data:{target:e[0].src}}),t.bigPlayButton&&t.bigPlayButton.hide(),t.posterImage&&t.posterImage.hide();var r=[];t.options_.hlsConfig&&t.options_.hlsConfig.skipHlsJs?e.forEach(function(t){t.src?r.push({src:t.src,skipHlsJs:!0}):r.push({src:t,skipHlsJs:!0})}):r=[].concat(e),t.src(r);var i=videojs.browser.IS_IOS||videojs.browser.IS_ANDROID?"loadeddata":"loadedmetadata",o=function s(){t.play(),t.one("progress",function(){t.play(),t.off(i,s)})};t.on(i,o)},t.prototype.convertProtocol=function(t){var e=[];if(t.indexOf(".sdp")>-1)t=t.replace(".sdp",".flv"),e.push(t.replace(".sdp",".m3u8"));else{var n=t.replace("webrtc://","https://").replace("?",".flv?");-1===n.indexOf("?")&&-1===n.indexOf(".flv")&&(n+=".flv");var r=t.replace("webrtc://","https://").replace("?",".m3u8?");-1===r.indexOf("?")&&-1===r.indexOf(".m3u8")&&(r+=".m3u8"),e.push(r)}return e},t}(),webrtcTypeRE=/^webrtc/i,webrtcExtRE=/\.sdp/i,webrtcProtoRE=/^(webrtc:\/\/)/i,sourceHandler={name:"webrtcSourceHandler",canHandleSource:function(t){return webrtcTypeRE.test(t.type)?"probably":webrtcExtRE.test(t.src)||webrtcProtoRE.test(t.src)?"maybe":""},handleSource:function(t,e,n){return e.webrtcProvider&&e.webrtcProvider.dispose(),e.webrtcProvider=new WebRTCProvider(t,e,n),e.webrtcProvider},canPlayType:function(t){if(webrtcTypeRE.test(t))return"probably"}};mountWebRTCProvider();for(var Tech$2=videojs.getComponent("Tech"),Dom$1=videojs.dom,Url$1=videojs.url,createTimeRange=videojs.createTimeRange,mergeOptions$1=videojs.mergeOptions,navigator$2=window_1&&window_1.navigator||{},Flash=function(t){function e(n,r,i){classCallCheck(this,e);var o=possibleConstructorReturn(this,t.call(this,n,r,i));return r.source&&o.ready(function(){this.setSource(r.source)},!0),r.startTime&&o.ready(function(){this.load(),this.play(),this.currentTime(r.startTime)},!0),window_1.videojs=window_1.videojs||{},window_1.videojs.Flash=window_1.videojs.Flash||{},window_1.videojs.Flash.onReady=e.onReady,window_1.videojs.Flash.onEvent=e.onEvent,window_1.videojs.Flash.onError=e.onError,o.on("seeked",function(){this.lastSeekTarget_=undefined}),o}return inherits(e,t),e.prototype.createEl=function(){var t=this.options_;t.swf||(t.swf=unifyProtocol("//imgcache.qq.com/open/qcloud/video/tcplayer/player.swf"));var n=t.techId,r=mergeOptions$1({readyFunction:"videojs.Flash.onReady",eventProxyFunction:"videojs.Flash.onEvent",errorEventProxyFunction:"videojs.Flash.onError",autoplay:t.autoplay,preload:t.preload,loop:t.loop,muted:t.muted},t.flashVars),i=mergeOptions$1({wmode:"opaque",bgcolor:"#000000"},t.params),o=mergeOptions$1({id:n,name:n,"class":"vjs-tech"},t.attributes);return this.el_=e.embed(t.swf,r,i,o),this.el_.tech=this,this.el_},e.prototype.play=function(){this.ended()&&this.setCurrentTime(0),this.el_.vjs_play()},e.prototype.pause=function(){this.el_.vjs_pause()},e.prototype.src=function(t){return t===undefined?this.currentSrc():this.setSrc(t)},e.prototype.setSrc=function(t){var e=this;t=Url$1.getAbsoluteURL(t),this.el_.vjs_src(t),this.autoplay()&&this.setTimeout(function(){return e.play()},0)},e.prototype.seeking=function(){return this.lastSeekTarget_!==undefined},e.prototype.setCurrentTime=function(e){var n=this.seekable();n.length&&(e=e>n.start(0)?e:n.start(0),e=e<n.end(n.length-1)?e:n.end(n.length-1),this.lastSeekTarget_=e,this.trigger("seeking"),this.el_.vjs_setProperty("currentTime",e),t.prototype.setCurrentTime.call(this))},e.prototype.currentTime=function(){return this.seeking()?this.lastSeekTarget_||0:this.el_.vjs_getProperty("currentTime")},e.prototype.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.vjs_getProperty("currentSrc")},e.prototype.duration=function(){if(0===this.readyState())return NaN;var t=this.el_.vjs_getProperty("duration");return t>=0?t:Infinity},e.prototype.load=function(){this.el_.vjs_load()},e.prototype.poster=function(){this.el_.vjs_getProperty("poster")},e.prototype.setPoster=function(){},e.prototype.seekable=function(){var t=this.duration();return 0===t?createTimeRange():createTimeRange(0,t)},e.prototype.buffered=function(){var t=this.el_.vjs_getProperty("buffered");return 0===t.length?createTimeRange():createTimeRange(t[0][0],t[0][1])},e.prototype.supportsFullScreen=function(){return!1},e.prototype.enterFullScreen=function(){return!1},e.prototype.getVideoPlaybackQuality=function(){var t=this.el_.vjs_getProperty("getVideoPlaybackQuality");return window_1.performance&&"function"==typeof window_1.performance.now?t.creationTime=window_1.performance.now():window_1.performance&&window_1.performance.timing&&"number"==typeof window_1.performance.timing.navigationStart&&(t.creationTime=window_1.Date.now()-window_1.performance.timing.navigationStart),t},e}(Tech$2),_readWrite=["rtmpConnection","rtmpStream","preload","defaultPlaybackRate","playbackRate","autoplay","loop","controls","volume","muted","defaultMuted"],_readOnly=["networkState","readyState","initialTime","startOffsetTime","paused","ended","videoWidth","videoHeight"],_api=Flash.prototype,i$2=0;i$2<_readWrite.length;i$2++)_createGetter(_readWrite[i$2]),_createSetter(_readWrite[i$2]);for(var _i$1=0;_i$1<_readOnly.length;_i$1++)_createGetter(_readOnly[_i$1]);Flash.isSupported=function(){return Flash.version()[0]>=10},Tech$2.withSourceHandlers(Flash),Flash.nativeSourceHandler={},Flash.nativeSourceHandler.canPlayType=function(t){return t in Flash.formats?"maybe":""},Flash.nativeSourceHandler.canHandleSource=function(t,e){var n=void 0;return n=t.type?t.type.replace(/;.*/,"").toLowerCase():function(t){var e=Url$1.getFileExtension(t);return e?"video/"+e:""}(t.src),Flash.nativeSourceHandler.canPlayType(n)},Flash.nativeSourceHandler.handleSource=function(t,e,n){e.setSrc(t.src)},Flash.nativeSourceHandler.dispose=function(){},Flash.registerSourceHandler(Flash.nativeSourceHandler),Flash.formats={"video/flv":"FLV","video/x-flv":"FLV","video/mp4":"MP4","video/m4v":"MP4"},Flash.onReady=function(t){var e=Dom$1.$("#"+t),n=e&&e.tech;n&&n.el()&&Flash.checkReady(n)},Flash.checkReady=function(t){t.el()&&(t.el().vjs_getProperty?t.triggerReady():this.setTimeout(function(){Flash.checkReady(t)},50))},Flash.onEvent=function(t,e){var n=Dom$1.$("#"+t).tech,r=Array.prototype.slice.call(arguments,2);n.setTimeout(function(){n.trigger(e,r)},1)},Flash.onError=function(t,e){var n=Dom$1.$("#"+t).tech;if("srcnotfound"===e)return n.error(4);n.error("FLASH: "+e)},Flash.version=function(){var t="0,0,0";try{t=new window_1.ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(e){try{navigator$2.mimeTypes["application/x-shockwave-flash"].enabledPlugin&&(t=(navigator$2.plugins["Shockwave Flash 2.0"]||navigator$2.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1])}catch(e){}}return t.split(",")},Flash.embed=function(t,e,n,r){var i=Flash.getEmbedCode(t,e,n,r);return Dom$1.createEl("div",{innerHTML:i}).childNodes[0]},Flash.getEmbedCode=function(t,e,n,r){var i="",o="",s="";return e&&Object.getOwnPropertyNames(e).forEach(function(t){i+=t+"="+e[t]+"&amp;"}),n=mergeOptions$1({movie:t,flashvars:i,allowScriptAccess:"always",allowNetworking:"all"},n),Object.getOwnPropertyNames(n).forEach(function(t){o+='<param name="'+t+'" value="'+n[t]+'" />'}),r=mergeOptions$1({data:t,width:"100%",height:"100%"},r),Object.getOwnPropertyNames(r).forEach(function(t){s+=t+'="'+r[t]+'" '}),'<object type="application/x-shockwave-flash" '+s+">"+o+"</object>"},FlashRtmpDecorator(Flash),Tech$2.getTech("Flash")?(videojs.log.warn("Not using videojs-flash as it appears to already be registered"),videojs.log.warn("videojs-flash should only be used with video.js@6 and above")):videojs.registerTech("Flash",Flash);var FlashlsSourceHandler={},mpegurlRE$1=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i;FlashlsSourceHandler.canPlayType=function(t){return mpegurlRE$1.test(t)?"maybe":""},FlashlsSourceHandler.canHandleSource=function(t,e){return"maybe"===FlashlsSourceHandler.canPlayType(t.type)},FlashlsSourceHandler.handleSource=function(t,e,n){e.setSrc(t.src)},FlashlsSourceHandler.dispose=function(){},videojs.getTech("Flash").registerSourceHandler(FlashlsSourceHandler,0),FlashlsSourceHandler.VERSION="__VERSION__";var Play="播放",Pause="暂停",LIVE="直播",Loaded="加载完毕",Progress="进度",Fullscreen="全屏",Mute="静音",Unmute="取消静音",Subtitles="字幕",Captions="内嵌字幕",Chapters="节目段落",Descriptions="描述",Close="关闭",Replay="重播",Text="文字",White="白",Black="黑",Red="红",Green="绿",Blue="蓝",Yellow="黄",Magenta="紫红",Cyan="青",Background="背景",Window="视窗",Transparent="透明",Opaque="不透明",None="无",Raised="浮雕",Depressed="压低",Uniform="均匀",Dropshadow="下阴影",Casual="舒适",Script="手写体",Reset="重启",Done="完成",auto="自动",Mirror="镜像",CN={Play:Play,Pause:Pause,LIVE:LIVE,Loaded:Loaded,Progress:Progress,Fullscreen:Fullscreen,Mute:Mute,Unmute:Unmute,Subtitles:Subtitles,Captions:Captions,Chapters:Chapters,Descriptions:Descriptions,Close:Close,Replay:Replay,Text:Text,White:White,Black:Black,Red:Red,Green:Green,Blue:Blue,Yellow:Yellow,Magenta:Magenta,Cyan:Cyan,Background:Background,Window:Window,Transparent:Transparent,Opaque:Opaque,None:None,Raised:Raised,Depressed:Depressed,Uniform:Uniform,Dropshadow:Dropshadow,Casual:Casual,Script:Script,Reset:Reset,Done:Done,auto:auto,Mirror:Mirror,"Current Time":"当前时间","Duration Time":"时长","Remaining Time":"剩余时间","Stream Type":"媒体流类型","Non-Fullscreen":"退出全屏","Playback Rate":"播放速度","subtitles off":"关闭字幕","captions off":"关闭内嵌字幕","Close Modal Dialog":"关闭弹窗","descriptions off":"关闭描述","Audio Track":"音轨","You aborted the media playback":"视频播放被终止","A network error caused the media download to fail part-way.":"网络错误导致视频下载中途失败。","The media could not be loaded, either because the server or network failed or because the format is not supported.":"视频因格式不支持或者服务器或网络的问题无法加载。","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"由于视频文件损坏或是该视频使用了你的浏览器不支持的功能,播放终止。","No compatible source was found for this media.":"无法找到此视频兼容的源或者当前环境无法播放该视频。","The media is encrypted and we do not have the keys to decrypt it.":"视频已加密,无法解密。","Play Video":"播放视频","Modal Window":"弹窗","This is a modal window":"这是一个弹窗","This modal can be closed by pressing the Escape key or activating the close button.":"可以按ESC按键或启用关闭按钮来关闭此弹窗。",", opens captions settings dialog":", 开启标题设置弹窗",", opens subtitles settings dialog":", 开启字幕设置弹窗",", opens descriptions settings dialog":", 开启描述设置弹窗",", selected":", 选择","captions settings":"字幕设定","Audio Player":"音频播放器","Video Player":"视频播放器","Progress Bar":"进度小节","Volume Level":"音量","subtitles settings":"字幕设定","descriptions settings":"描述设定","Semi-Transparent":"半透明","Font Size":"字体尺寸","Text Edge Style":"字体边缘样式","Font Family":"字体库","Proportional Sans-Serif":"比例无细体","Monospace Sans-Serif":"单间隔无细体","Proportional Serif":"比例细体","Monospace Serif":"单间隔细体","Small Caps":"小型大写字体","restore all settings to the default values":"恢复全部设定至预设值","Caption Settings Dialog":"字幕设定视窗","Beginning of dialog window. Escape will cancel and close the window.":"开始对话视窗。离开会取消及关闭视窗","End of dialog window.":"结束对话视窗","Request timed out.":"请求超时,请稍后再试。","Could not download the video.":"无法加载视频,请检查网络。","Server is not respond.":"服务器请求失败,请稍后再试。","Server respond error data.":"服务器返回数据有误,请稍后再试。","Last time play at ":"上次看到 ","Resume play":"恢复播放","Powered by Tencent Cloud.":"腾讯云提供技术支持","Rise an internal exception when playing HLS.":"播放 HLS 时出现内部异常。","Authentication failed.":"防盗链参数鉴权失败。","Server failed.":"媒体服务器错误。","Get file error.":"媒体服务器获取文件错误。","The media file does not exist. Please check if the fileID is correct.":"媒体文件不存在,请检查 fileID 是否正确。","No video transcoding information found.":"没有找到视频转码信息。","Current browser not support DRM.":"浏览器不支持当前 DRM 方案。","The trial duration is illegal. The trial duration must be within the video duration.":"试看时长不合法,试看时长要在视频时长范围内。","Param pcfg is not unique.":"pcfg 不唯一。","The license has expired. Please check whether the expiration time setting is reasonable.":"license 过期,请检查过期时间设置是否合理。","Did not find an adaptive stream that can be played.":"没有找到可以播放的自适应码流,<a href='https://cloud.tencent.com/document/product/266/34071' style='color: white;' target='_blank'>查看文档</a>。","Invalid request format, please check the request format.":"请求格式不合法,请检查请求格式。","AppID is not exist, Please check if the AppID is correct.":"AppID 不存在,请检查 AppID 是否正确。","Without anti-leech information.":"没带防盗链检测。","qsign invalid.":"播放参数 qsign 校验失败","psign check failed.":"播放参数 psign 校验失败,<a href='https://cloud.tencent.com/document/product/266/45554' style='color: white' target='_blank'>查看文档</a>。","Other errors.":"其他错误。","Internal error.":"内部错误。","Response data verification failed.":"响应数据校验失败","Video statistic":"视频统计信息","Play Next":"下一个","Current browser not support play this stream, please select another one.":"无法找到此视频兼容的源或者当前环境无法播放该视频,请选择其他视频播放。","Server respond error data.(eg. stream not exist)":"媒体服务器获取数据异常,可能该视频不存在,请选择其他视频播放。","Video play failed, please refresh to start play again.":"视频播放器失败,请刷新并重新播放。","Connection to the server has failed and the number of connection retries has exceeded the set value.":"媒体服务器连接异常,并达到最大重试次数,请检查网络是否正常并刷新重试","Video decoding failure.":"视频解码失败,请选择其他视频播放。"},log=videojs.log;if(Function.prototype.bind&&"object"==("undefined"==typeof console?"undefined":_typeof(console))&&"object"==_typeof(console.log))for(var logFns=["log","info","warn","error","assert","dir","clear","profile","profileEnd"],i=0;i<logFns.length;i++){var method=logFns[i];console[method]=Function.prototype.call.bind(console[method],console)}return videojs.addLanguage("zh-CN",CN),Object.keys(videojs).forEach(function(t){TCPlayer[t]=videojs[t]}),TCPlayer});