mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-27 00:09:31 -05:00
8 lines
198 KiB
JavaScript
8 lines
198 KiB
JavaScript
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.videojs=e()}(this,function(){function t(t,e){return e={exports:{}},t(e,e.exports),e.exports}function e(t,e){Ye(t).forEach(function(r){return e(t[r],r)})}function r(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Ye(t).reduce(function(r,n){return e(r,t[n],n)},r)}function n(t){for(var r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return Object.assign?Object.assign.apply(Object,[t].concat(n)):(n.forEach(function(r){r&&e(r,function(e,r){t[r]=e})}),t)}function i(t){return!!t&&"object"===(void 0===t?"undefined":We(t))}function o(t){return i(t)&&"[object Object]"===$e.call(t)&&t.constructor===Object}function s(t){return t.replace(/\n\r?\s*/g,"")}function a(t,e){if(!t||!e)return"";if("function"==typeof fe.getComputedStyle){var r=fe.getComputedStyle(t);return r?r[e]:""}return t.currentStyle[e]||""}function l(t){return"string"==typeof t&&/\S/.test(t)}function c(t){if(/\s/.test(t))throw new Error("class has illegal whitespace characters")}function u(t){return new RegExp("(^|\\s)"+t+"($|\\s)")}function h(){return _e===fe.document&&void 0!==_e.createElement}function p(t){return i(t)&&1===t.nodeType}function d(){try{return fe.parent!==fe.self}catch(t){return!0}}function f(t){return function(e,r){if(!l(e))return _e[t](null);l(r)&&(r=_e.querySelector(r));var n=p(r)?r:_e;return n[t]&&n[t](e)}}function v(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments[3],i=_e.createElement(t);return Object.getOwnPropertyNames(e).forEach(function(t){var r=e[t];-1!==t.indexOf("aria-")||"role"===t||"type"===t?(tr.warn(er(rr,t,r)),i.setAttribute(t,r)):"textContent"===t?y(i,r):i[t]=r}),Object.getOwnPropertyNames(r).forEach(function(t){i.setAttribute(t,r[t])}),n&&D(i,n),i}function y(t,e){return void 0===t.textContent?t.innerText=e:t.textContent=e,t}function g(t,e){e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}function m(t,e){return c(e),t.classList?t.classList.contains(e):u(e).test(t.className)}function _(t,e){return t.classList?t.classList.add(e):m(t,e)||(t.className=(t.className+" "+e).trim()),t}function b(t,e){return t.classList?t.classList.remove(e):(c(e),t.className=t.className.split(/\s+/).filter(function(t){return t!==e}).join(" ")),t}function T(t,e,r){var n=m(t,e);if("function"==typeof r&&(r=r(t,e)),"boolean"!=typeof r&&(r=!n),r!==n)return r?_(t,e):b(t,e),t}function C(t,e){Object.getOwnPropertyNames(e).forEach(function(r){var n=e[r];null===n||void 0===n||!1===n?t.removeAttribute(r):t.setAttribute(r,!0===n?"":n)})}function k(t){var e={};if(t&&t.attributes&&t.attributes.length>0)for(var r=t.attributes,n=r.length-1;n>=0;n--){var i=r[n].name,o=r[n].value;"boolean"!=typeof t[i]&&-1===",autoplay,controls,playsinline,loop,muted,default,defaultMuted,".indexOf(","+i+",")||(o=null!==o),e[i]=o}return e}function E(t,e){return t.getAttribute(e)}function w(t,e,r){t.setAttribute(e,r)}function S(t,e){t.removeAttribute(e)}function x(){_e.body.focus(),_e.onselectstart=function(){return!1}}function j(){_e.onselectstart=function(){return!0}}function A(t){if(t&&t.getBoundingClientRect&&t.parentNode){var e=t.getBoundingClientRect(),r={};return["bottom","height","left","right","top","width"].forEach(function(t){void 0!==e[t]&&(r[t]=e[t])}),r.height||(r.height=parseFloat(a(t,"height"))),r.width||(r.width=parseFloat(a(t,"width"))),r}}function P(t){var e=void 0;if(t.getBoundingClientRect&&t.parentNode&&(e=t.getBoundingClientRect()),!e)return{left:0,top:0};var r=_e.documentElement,n=_e.body,i=r.clientLeft||n.clientLeft||0,o=fe.pageXOffset||n.scrollLeft,s=e.left+o-i,a=r.clientTop||n.clientTop||0,l=fe.pageYOffset||n.scrollTop,c=e.top+l-a;return{left:Math.round(s),top:Math.round(c)}}function O(t,e){var r={},n=P(t),i=t.offsetWidth,o=t.offsetHeight,s=n.top,a=n.left,l=e.pageY,c=e.pageX;return e.changedTouches&&(c=e.changedTouches[0].pa
|
|||
|
},rr=Ke(["Setting attributes in the second argument of createEl()\n has been deprecated. Use the third argument instead.\n createEl(type, properties, attributes). Attempting to set "," to ","."],["Setting attributes in the second argument of createEl()\n has been deprecated. Use the third argument instead.\n createEl(type, properties, attributes). Attempting to set "," to ","."]),nr=f("querySelector"),ir=f("querySelectorAll"),or=(Object.freeze||Object)({isReal:h,isEl:p,isInFrame:d,createEl:v,textContent:y,prependTo:g,hasClass:m,addClass:_,removeClass:b,toggleClass:T,setAttributes:C,getAttributes:k,getAttribute:E,setAttribute:w,removeAttribute:S,blockTextSelection:x,unblockTextSelection:j,getBoundingClientRect:A,findPosition:P,getPointerPosition:O,isTextNode:M,emptyEl:N,normalizeContent:I,appendContent:D,insertContent:L,isSingleLeftClick:R,$:nr,$$:ir}),sr=1,ar={},lr="vdata"+(new Date).getTime(),cr=!1;!function(){try{var t=Object.defineProperty({},"passive",{get:function(){cr=!0}});fe.addEventListener("test",null,t),fe.removeEventListener("test",null,t)}catch(t){}}();var ur=["touchstart","touchmove"],hr=(Object.freeze||Object)({fixEvent:U,on:X,off:q,trigger:K,one:$}),pr=!1,dr=void 0,fr=function(){if(h()&&!1!==dr.options.autoSetup){var t=_e.getElementsByTagName("video"),e=_e.getElementsByTagName("audio"),r=_e.getElementsByTagName("video-js"),n=[];if(t&&t.length>0)for(var i=0,o=t.length;i<o;i++)n.push(t[i]);if(e&&e.length>0)for(var s=0,a=e.length;s<a;s++)n.push(e[s]);if(r&&r.length>0)for(var l=0,c=r.length;l<c;l++)n.push(r[l]);if(n&&n.length>0)for(var u=0,p=n.length;u<p;u++){var d=n[u];if(!d||!d.getAttribute){Y(1);break}if(void 0===d.player){var f=d.getAttribute("data-setup");null!==f&&dr(d)}}else pr||Y(1)}};h()&&"complete"===_e.readyState?pr=!0:$(fe,"load",function(){pr=!0});var vr=function(t){var e=_e.createElement("style");return e.className=t,e},yr=function(t,e){t.styleSheet?t.styleSheet.cssText=e:t.textContent=e},gr=function(t,e,r){e.guid||(e.guid=B());var n=function(){return e.apply(t,arguments)};return n.guid=r?r+"_"+e.guid:e.guid,n},mr=function(t,e){var r=Date.now();return function(){var n=Date.now();n-r>=e&&(t.apply(void 0,arguments),r=n)}},_r=function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:fe,i=void 0;return function(){var o=this,s=arguments,a=function(){i=null,a=null,r||t.apply(o,s)};!i&&r&&t.apply(o,s),n.clearTimeout(i),i=n.setTimeout(a,e)}},br=function(){};br.prototype.allowedEvents_={},br.prototype.on=function(t,e){var r=this.addEventListener;this.addEventListener=function(){},X(this,t,e),this.addEventListener=r},br.prototype.addEventListener=br.prototype.on,br.prototype.off=function(t,e){q(this,t,e)},br.prototype.removeEventListener=br.prototype.off,br.prototype.one=function(t,e){var r=this.addEventListener;this.addEventListener=function(){},$(this,t,e),this.addEventListener=r},br.prototype.trigger=function(t){var e=t.type||t;"string"==typeof t&&(t={type:e}),t=U(t),this.allowedEvents_[e]&&this["on"+e]&&this["on"+e](t),K(this,t)},br.prototype.dispatchEvent=br.prototype.trigger;var Tr=function(t){return t instanceof br||!!t.eventBusEl_&&["on","one","off","trigger"].every(function(e){return"function"==typeof t[e]})},Cr=function(t){return"string"==typeof t&&/\S/.test(t)||Array.isArray(t)&&!!t.length},kr=function(t){if(!t.nodeName&&!Tr(t))throw new Error("Invalid target; must be a DOM node or evented object.")},Er=function(t){if(!Cr(t))throw new Error("Invalid event type; must be a non-empty string or array.")},wr=function(t){if("function"!=typeof t)throw new Error("Invalid listener; must be a function.")},Sr=function(t,e){var r=e.length<3||e[0]===t||e[0]===t.eventBusEl_,n=void 0,i=void 0,o=void 0;return r?(n=t.eventBusEl_,e.length>=3&&e.shift(),i=e[0],o=e[1]):(n=e[0],i=e[1],o=e[2]),kr(n),Er(i),wr(o),o=gr(t,o),{isTargetingSelf:r,target:n,type:i,listener:o}},xr=function(t,e,r,n){kr(t),t.nodeName?hr[e](t,r,n):t[e](r,n)},jr={on:function(){for(var t=this,e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];var i=Sr(this,r),
|
|||
|
if(!this.loaded_)return null;if(0===this.cues.length)return h;for(var t=this.tech_.currentTime(),e=[],r=0,n=this.cues.length;r<n;r++){var i=this.cues[r];i.startTime<=t&&i.endTime>=t?e.push(i):i.startTime===i.endTime&&i.startTime<=t&&i.startTime+.5>=t&&e.push(i)}if(p=!1,e.length!==this.activeCues_.length)p=!0;else for(var o=0;o<e.length;o++)-1===this.activeCues_.indexOf(e[o])&&(p=!0);return this.activeCues_=e,h.setCues_(this.activeCues_),h},set:function(){}}),o.src?(l.src=o.src,kn(o.src,l)):l.loaded_=!0,n=l,qe(r,n)}return Xe(e,t),e.prototype.addCue=function(t){var e=t;if(fe.vttjs&&!(t instanceof fe.vttjs.VTTCue)){e=new fe.vttjs.VTTCue(t.startTime,t.endTime,t.text);for(var r in t)r in e||(e[r]=t[r]);e.id=t.id,e.originalCue_=t}for(var n=this.tech_.textTracks(),i=0;i<n.length;i++)n[i]!==this&&n[i].removeCue(e);this.cues_.push(e),this.cues.setCues_(this.cues_)},e.prototype.removeCue=function(t){for(var e=this.cues_.length;e--;){var r=this.cues_[e];if(r===t||r.originalCue_&&r.originalCue_===t){this.cues_.splice(e,1),this.cues.setCues_(this.cues_);break}}},e}(on);En.prototype.allowedEvents_={cuechange:"cuechange"};var wn=function(t){function e(){var r,n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Ue(this,e);var o=tt(i,{kind:en[i.kind]||""}),s=r=qe(this,t.call(this,o)),a=!1;if(Le)for(var l in e.prototype)"constructor"!==l&&(s[l]=e.prototype[l]);return Object.defineProperty(s,"enabled",{get:function(){return a},set:function(t){"boolean"==typeof t&&t!==a&&(a=t,this.trigger("enabledchange"))}}),o.enabled&&(s.enabled=o.enabled),s.loaded_=!0,n=s,qe(r,n)}return Xe(e,t),e}(on),Sn=function(t){function e(){var r,n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Ue(this,e);var o=tt(i,{kind:tn[i.kind]||""}),s=r=qe(this,t.call(this,o)),a=!1;if(Le)for(var l in e.prototype)"constructor"!==l&&(s[l]=e.prototype[l]);return Object.defineProperty(s,"selected",{get:function(){return a},set:function(t){"boolean"==typeof t&&t!==a&&(a=t,this.trigger("selectedchange"))}}),o.selected&&(s.selected=o.selected),n=s,qe(r,n)}return Xe(e,t),e}(on),xn=0,jn=2,An=function(t){function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Ue(this,e);var n=qe(this,t.call(this)),i=void 0,o=n;if(Le){o=_e.createElement("custom");for(var s in e.prototype)"constructor"!==s&&(o[s]=e.prototype[s])}var a=new En(r);if(o.kind=a.kind,o.src=a.src,o.srclang=a.language,o.label=a.label,o.default=a.default,Object.defineProperty(o,"readyState",{get:function(){return i}}),Object.defineProperty(o,"track",{get:function(){return a}}),i=xn,a.addEventListener("loadeddata",function(){i=jn,o.trigger({type:"load",target:o})}),Le){var l;return l=o,qe(n,l)}return n}return Xe(e,t),e}(br);An.prototype.allowedEvents_={load:"load"},An.NONE=xn,An.LOADING=1,An.LOADED=jn,An.ERROR=3;var Pn={audio:{ListClass:$r,TrackClass:wn,capitalName:"Audio"},video:{ListClass:Gr,TrackClass:Sn,capitalName:"Video"},text:{ListClass:Jr,TrackClass:En,capitalName:"Text"}};Object.keys(Pn).forEach(function(t){Pn[t].getterName=t+"Tracks",Pn[t].privateName=t+"Tracks_"});var On={remoteText:{ListClass:Jr,TrackClass:En,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:Qr,TrackClass:An,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},Mn=tt(Pn,On);On.names=Object.keys(On),Pn.names=Object.keys(Pn),Mn.names=[].concat(On.names).concat(Pn.names);var Nn=Object.create||function(){function t(){}return function(e){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return t.prototype=e,new t}}();Ct.prototype=Nn(Error.prototype),Ct.prototype.constructor=Ct,Ct.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},Et.prototype={set:function(t,e){this.get(t)||""===e||(this.values[t]=e)},get:function(t,e,r){return r?this.has(t)?this.values[t]:e[r]:this.has(t)?this.values[t]:e},has:function(t){return t in this.values},alt:function(t,e,r){for(var n=0;n<r.length;++n)if(e===r[n]){this.se
|
|||
|
return"vjs-big-play-button"},e.prototype.handleClick=function(t){var e=this.player_.play();if(this.mouseused_&&t.clientX&&t.clientY)return void ct(e);var r=this.player_.getChild("controlBar"),n=r&&r.getChild("playToggle");if(!n)return void this.player_.focus();var i=function(){return n.focus()};lt(e)?e.then(i,function(){}):this.setTimeout(i,1)},e.prototype.handleKeyPress=function(e){this.mouseused_=!1,t.prototype.handleKeyPress.call(this,e)},e.prototype.handleMouseDown=function(t){this.mouseused_=!0},e}(ui);hi.prototype.controlText_="Play Video",Pr.registerComponent("BigPlayButton",hi);var pi=function(t){function e(r,n){Ue(this,e);var i=qe(this,t.call(this,r,n));return i.controlText(n&&n.controlText||i.localize("Close")),i}return Xe(e,t),e.prototype.buildCSSClass=function(){return"vjs-close-button "+t.prototype.buildCSSClass.call(this)},e.prototype.handleClick=function(t){this.trigger({type:"close",bubbles:!1})},e}(ui);Pr.registerComponent("CloseButton",pi);var di=function(t){function e(r,n){Ue(this,e);var i=qe(this,t.call(this,r,n));return i.on(r,"play",i.handlePlay),i.on(r,"pause",i.handlePause),i.on(r,"ended",i.handleEnded),i}return Xe(e,t),e.prototype.buildCSSClass=function(){return"vjs-play-control "+t.prototype.buildCSSClass.call(this)},e.prototype.handleClick=function(t){this.player_.paused()?this.player_.play():this.player_.pause()},e.prototype.handleSeeked=function(t){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(t):this.handlePlay(t)},e.prototype.handlePlay=function(t){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},e.prototype.handlePause=function(t){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},e.prototype.handleEnded=function(t){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",this.handleSeeked)},e}(ui);di.prototype.controlText_="Play",Pr.registerComponent("PlayToggle",di);var fi=function(t,e){t=t<0?0:t;var r=Math.floor(t%60),n=Math.floor(t/60%60),i=Math.floor(t/3600),o=Math.floor(e/60%60),s=Math.floor(e/3600);return(isNaN(t)||t===1/0)&&(i=n=r="-"),i=i>0||s>0?i+":":"",n=((i||o>=10)&&n<10?"0"+n:n)+":",r=r<10?"0"+r:r,i+n+r},vi=fi,yi=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return vi(t,e)},gi=function(t){function e(r,n){Ue(this,e);var i=qe(this,t.call(this,r,n));return i.throttledUpdateContent=mr(gr(i,i.updateContent),25),i.on(r,"timeupdate",i.throttledUpdateContent),i}return Xe(e,t),e.prototype.createEl=function(e){var r=this.buildCSSClass(),n=t.prototype.createEl.call(this,"div",{className:r+" vjs-time-control vjs-control",innerHTML:'<span class="vjs-control-text">'+this.localize(this.labelText_)+" </span>"});return this.contentEl_=v("span",{className:r+"-display"},{"aria-live":"off"}),this.updateTextNode_(),n.appendChild(this.contentEl_),n},e.prototype.dispose=function(){this.contentEl_=null,this.textNode_=null,t.prototype.dispose.call(this)},e.prototype.updateTextNode_=function(){if(this.contentEl_){for(;this.contentEl_.firstChild;)this.contentEl_.removeChild(this.contentEl_.firstChild);this.textNode_=_e.createTextNode(this.formattedTime_||this.formatTime_(0)),this.contentEl_.appendChild(this.textNode_)}},e.prototype.formatTime_=function(t){return yi(t)},e.prototype.updateFormattedTime_=function(t){var e=this.formatTime_(t);e!==this.formattedTime_&&(this.formattedTime_=e,this.requestAnimationFrame(this.updateTextNode_))},e.prototype.updateContent=function(t){},e}(Pr);gi.prototype.labelText_="Time",gi.prototype.controlText_="Time",Pr.registerComponent("TimeDisplay",gi);var mi=function(t){function e(r,n){Ue(this,e);var i=qe(this,t.call(this,r,n));return i.on(r,"ended",i.handleEnded),i}return Xe(e,t),e.prototype.buildCSSClass=function(){return"vjs-current-time"},e.prototype.updateContent=function(t){var e=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();this.updateFormattedTime_(e)},e.prototype.handleEnded=function(t){this.player_.duration(
|
|||
|
o.addEventListener("selectedlanguagechange",l),s.on("dispose",function(){r.off(["loadstart","texttrackchange"],a),o.removeEventListener("change",a),o.removeEventListener("selectedlanguagechange",l)}),void 0===o.onchange){var c=void 0;s.on(["tap","click"],function(){if("object"!==We(fe.Event))try{c=new fe.Event("change")}catch(t){}c||(c=_e.createEvent("Event"),c.initEvent("change",!0,!0)),o.dispatchEvent(c)})}return s.handleTracksChange(),s}return Xe(e,t),e.prototype.handleClick=function(e){var r=this.track.kind,n=this.track.kinds,i=this.player_.textTracks();if(n||(n=[r]),t.prototype.handleClick.call(this,e),i)for(var o=0;o<i.length;o++){var s=i[o];s===this.track&&n.indexOf(s.kind)>-1?"showing"!==s.mode&&(s.mode="showing"):"disabled"!==s.mode&&(s.mode="disabled")}},e.prototype.handleTracksChange=function(t){var e="showing"===this.track.mode;e!==this.isSelected_&&this.selected(e)},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}(Vi);Pr.registerComponent("TextTrackMenuItem",zi);var Wi=function(t){function e(r,n){return Ue(this,e),n.track={player:r,kind:n.kind,kinds:n.kinds,default:!1,mode:"disabled"},n.kinds||(n.kinds=[n.kind]),n.label?n.track.label=n.label:n.track.label=n.kinds.join(" and ")+" off",n.selectable=!0,n.multiSelectable=!1,qe(this,t.call(this,r,n))}return Xe(e,t),e.prototype.handleTracksChange=function(t){for(var e=this.player().textTracks(),r=!0,n=0,i=e.length;n<i;n++){var o=e[n];if(this.options_.kinds.indexOf(o.kind)>-1&&"showing"===o.mode){r=!1;break}}r!==this.isSelected_&&this.selected(r)},e.prototype.handleSelectedLanguageChange=function(t){for(var e=this.player().textTracks(),r=!0,n=0,i=e.length;n<i;n++){var o=e[n];if(["captions","descriptions","subtitles"].indexOf(o.kind)>-1&&"showing"===o.mode){r=!1;break}}r&&(this.player_.cache_.selectedLanguage={enabled:!1})},e}(zi);Pr.registerComponent("OffTextTrackMenuItem",Wi);var Ui=function(t){function e(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Ue(this,e),n.tracks=r.textTracks(),qe(this,t.call(this,r,n))}return Xe(e,t),e.prototype.createItems=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zi,r=void 0;this.label_&&(r=this.label_+" off"),t.push(new Wi(this.player_,{kinds:this.kinds_,kind:this.kind_,label:r})),this.hideThreshold_+=1;var n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var i=0;i<n.length;i++){var o=n[i];if(this.kinds_.indexOf(o.kind)>-1){var s=new e(this.player_,{track:o,selectable:!0,multiSelectable:!1});s.addClass("vjs-"+o.kind+"-menu-item"),t.push(s)}}return t},e}(Hi);Pr.registerComponent("TextTrackButton",Ui);var Xi=function(t){function e(r,n){Ue(this,e);var i=n.track,o=n.cue,s=r.currentTime();n.selectable=!0,n.multiSelectable=!1,n.label=o.text,n.selected=o.startTime<=s&&s<o.endTime;var a=qe(this,t.call(this,r,n));return a.track=i,a.cue=o,i.addEventListener("cuechange",gr(a,a.update)),a}return Xe(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,r=this.player_.currentTime();this.selected(e.startTime<=r&&r<e.endTime)},e}(Vi);Pr.registerComponent("ChaptersTrackMenuItem",Xi);var qi=function(t){function e(r,n,i){return Ue(this,e),qe(this,t.call(this,r,n,i))}return Xe(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.findChap
|
|||
|
return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},e.prototype.setControls=function(t){this.el_.controls=!!t},e.prototype.addTextTrack=function(e,r,n){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,r,n):t.prototype.addTextTrack.call(this,e,r,n)},e.prototype.createRemoteTextTrack=function(e){if(!this.featuresNativeTextTracks)return t.prototype.createRemoteTextTrack.call(this,e);var r=_e.createElement("track");return e.kind&&(r.kind=e.kind),e.label&&(r.label=e.label),(e.language||e.srclang)&&(r.srclang=e.language||e.srclang),e.default&&(r.default=e.default),e.id&&(r.id=e.id),e.src&&(r.src=e.src),r},e.prototype.addRemoteTextTrack=function(e,r){var n=t.prototype.addRemoteTextTrack.call(this,e,r);return this.featuresNativeTextTracks&&this.el().appendChild(n),n},e.prototype.removeRemoteTextTrack=function(e){if(t.prototype.removeRemoteTextTrack.call(this,e),this.featuresNativeTextTracks)for(var r=this.$$("track"),n=r.length;n--;)e!==r[n]&&e!==r[n].track||this.el().removeChild(r[n])},e.prototype.getVideoPlaybackQuality=function(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var t={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(t.droppedVideoFrames=this.el().webkitDroppedFrameCount,t.totalVideoFrames=this.el().webkitDecodedFrameCount),fe.performance&&"function"==typeof fe.performance.now?t.creationTime=fe.performance.now():fe.performance&&fe.performance.timing&&"number"==typeof fe.performance.timing.navigationStart&&(t.creationTime=fe.Date.now()-fe.performance.timing.navigationStart),t},e}(Kn);if(h()){Oo.TEST_VID=_e.createElement("video");var Mo=_e.createElement("track");Mo.kind="captions",Mo.srclang="en",Mo.label="English",Oo.TEST_VID.appendChild(Mo)}Oo.isSupported=function(){try{Oo.TEST_VID.volume=.5}catch(t){return!1}return!(!Oo.TEST_VID||!Oo.TEST_VID.canPlayType)},Oo.canPlayType=function(t){return Oo.TEST_VID.canPlayType(t)},Oo.canPlaySource=function(t,e){return Oo.canPlayType(t.type)},Oo.canControlVolume=function(){try{var t=Oo.TEST_VID.volume;return Oo.TEST_VID.volume=t/2+.1,t!==Oo.TEST_VID.volume}catch(t){return!1}},Oo.canMuteVolume=function(){try{var t=Oo.TEST_VID.muted;return Oo.TEST_VID.muted=!t,Oo.TEST_VID.muted?w(Oo.TEST_VID,"muted","muted"):S(Oo.TEST_VID,"muted"),t!==Oo.TEST_VID.muted}catch(t){return!1}},Oo.canControlPlaybackRate=function(){if(je&&Ie&&De<58)return!1;try{var t=Oo.TEST_VID.playbackRate;return Oo.TEST_VID.playbackRate=t/2+.1,t!==Oo.TEST_VID.playbackRate}catch(t){return!1}},Oo.canOverrideAttributes=function(){if(Le)return!1;try{var t=function(){};Object.defineProperty(_e.createElement("video"),"src",{get:t,set:t}),Object.defineProperty(_e.createElement("audio"),"src",{get:t,set:t}),Object.defineProperty(_e.createElement("video"),"innerHTML",{get:t,set:t}),Object.defineProperty(_e.createElement("audio"),"innerHTML",{get:t,set:t})}catch(t){return!1}return!0},Oo.supportsNativeTextTracks=function(){return Fe||Se&&Ie},Oo.supportsNativeVideoTracks=function(){return!(!Oo.TEST_VID||!Oo.TEST_VID.videoTracks)},Oo.supportsNativeAudioTracks=function(){return!(!Oo.TEST_VID||!Oo.TEST_VID.audioTracks)},Oo.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],Oo.prototype.featuresVolumeControl=Oo.canControlVolume(),Oo.prototype.featuresMuteControl=Oo.canMuteVolume(),Oo.prototype.featuresPlaybackRate=Oo.canControlPlaybackRate(),Oo.prototype.featuresSourceset=Oo.canOverrideAttributes(),Oo.prototype.movingMediaElementInDOM=!Se,Oo.prototype.featuresFullscreenResize=!0,Oo.prototype.featuresProgressEvents=!0,Oo.prototype.featuresTimeupdateEvents=!0,Oo.prototype.featuresNativeTextTracks=Oo.supportsNativeTextTracks(),Oo.prototype.featuresNativeVideoTracks=Oo.supportsNativeVideoTracks(),Oo.prototype.featuresNativeAudioTracks=Oo.supportsNativeAudioTracks();var No=Oo.TEST_VID&&Oo.TEST_V
|
|||
|
e.prototype.reportUserActivity=function(t){this.userActivity_=!0},e.prototype.userActive=function(t){if(void 0===t)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,r=void 0,n=gr(this,this.reportUserActivity),i=function(t){t.screenX===e&&t.screenY===r||(e=t.screenX,r=t.screenY,n())},o=function(){n(),this.clearInterval(t),t=this.setInterval(n,250)},s=function(e){n(),this.clearInterval(t)};this.on("mousedown",o),this.on("mousemove",i),this.on("mouseup",s),this.on("keydown",n),this.on("keyup",n);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 void 0!==t?void this.techCall_("setPlaybackRate",t):this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1},e.prototype.defaultPlaybackRate=function(t){return void 0!==t?this.techCall_("setDefaultPlaybackRate",t):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},e.prototype.isAudio=function(t){return void 0!==t?void(this.isAudio_=!!t):!!this.isAudio_},e.prototype.addTextTrack=function(t,e,r){if(this.tech_)return this.tech_.addTextTrack(t,e,r)},e.prototype.addRemoteTextTrack=function(t,e){if(this.tech_)return this.tech_.addRemoteTextTrack(t,e)},e.prototype.removeRemoteTextTrack=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.track,r=void 0===e?arguments[0]:e;if(this.tech_)return this.tech_.removeRemoteTextTrack(r)},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(void 0===t)return this.language_;this.language_=String(t).toLowerCase()},e.prototype.languages=function(){return tt(e.prototype.options_.languages,this.languages_)},e.prototype.toJSON=function(){var t=tt(this.options_),e=t.tracks;t.tracks=[];for(var r=0;r<e.length;r++){var n=e[r];n=tt(n),n.player=void 0,t.tracks[r]=n}return t},e.prototype.createModal=function(t,e){var r=this;e=e||{},e.content=t||"";var n=new Ur(this,e);return this.addChild(n),n.on("dispose",function(){r.removeChild(n)}),n.open(),n},e.getTagSettings=function(t){var e={sources:[],tracks:[]},r=k(t),i=r["data-setup"];if(m(t,"vjs-fluid")&&(r.fluid=!0),null!==i){var o=Br(i||"{}"),s=o[0],a=o[1];s&&tr.error(s),n(r,a)}if(n(e,r),t.hasChildNodes())for(var l=t.childNodes,c=0,u=l.length;c<u;c++){var h=l[c],p=h.nodeName.toLowerCase();"source"===p?e.sources.push(k(h)):"track"===p&&e.tracks.push(k(h))}return e},e.prototype.flexNotSupported_=function(){var t=_e.createElement("i");return!("flexBasis"in t.style||"webkitFlexBasis"in t.style||"mozFlexBasis"in t.style||"msFlexBasis"in t.style||"msFlexOrder"in t.style)},e}(Pr);Mn.names.forEach(function(t){var e=Mn[t];Fo.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}}),Fo.players={};var Ho=fe.navigator;Fo.prototype.options_={techOrder:Kn.defaultTechOrder_,html5:{},flash:{},inactivityTimeout:2e3,playbackRates:[],children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","controlBar","errorDisplay","textTrackSettings"],language:Ho&&(Ho.languages&&Ho.languages[0]||Ho.userLanguage||Ho.language)||"e
|