web-assets/videojs/v8/alt/video.core.min.js

30 lines
253 KiB
JavaScript
Raw Permalink Normal View History

/**
* @license
* Video.js 8.17.4 <http://videojs.com/>
* Copyright Brightcove, Inc. <https://www.brightcove.com/>
* Available under Apache License Version 2.0
* <https://github.com/videojs/video.js/blob/main/LICENSE>
*
* Includes vtt.js <https://github.com/mozilla/vtt.js>
* Available under Apache License Version 2.0
* <https://github.com/mozilla/vtt.js/blob/main/LICENSE>
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).videojs=t()}(this,function(){var N="8.17.4";let B={},F=function(e,t){return B[e]=B[e]||[],t&&(B[e]=B[e].concat(t)),B[e]};function R(e,t){return!((t=F(e).indexOf(t))<=-1||(B[e]=B[e].slice(),B[e].splice(t,1),0))}let H={prefixed:!0};var z=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],V=z[0];let q;for(let e=0;e<z.length;e++)if(z[e][1]in document){q=z[e];break}if(q){for(let e=0;e<q.length;e++)H[V[e]]=q[e];H.prefixed=q[0]!==V[0]}let d=[];function U(e){return n(e)?Object.keys(e):[]}let o=function i(r,n=":",a=""){let t="info",s;function o(...e){s("log",t,e)}var l,h,c;return s=(l=r,c=a,(t,s,i)=>{var e,s=h.levels[s],r=new RegExp(`^(${s})$`);let n=l;if("log"!==t&&i.unshift(t.toUpperCase()+":"),c&&(n="%c"+l,i.unshift(c)),i.unshift(n+":"),d&&(d.push([].concat(i)),e=d.length-1e3,d.splice(0,0<e?e:0)),window.console){let e=window.console[t];(e=e||"debug"!==t?e:window.console.info||window.console.log)&&s&&r.test(t)&&e[Array.isArray(i)?"apply":"call"](window.console,i)}}),(h=o).createLogger=(e,t,s)=>i(r+` ${t=void 0!==t?t:n} `+e,t,void 0!==s?s:a),o.createNewLogger=(e,t,s)=>i(e,t,s),o.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:t},o.level=e=>{if("string"==typeof e){if(!o.levels.hasOwnProperty(e))throw new Error(`"${e}" in not a valid log level`);t=e}return t},(o.history=()=>d?[].concat(d):[]).filter=t=>(d||[]).filter(e=>new RegExp(`.*${t}.*`).test(e[0])),o.history.clear=()=>{d&&(d.length=0)},o.history.disable=()=>{null!==d&&(d.length=0,d=null)},o.history.enable=()=>{null===d&&(d=[])},o.error=(...e)=>s("error",t,e),o.warn=(...e)=>s("warn",t,e),o.debug=(...e)=>s("debug",t,e),o}("VIDEOJS"),W=o.createLogger,$=Object.prototype.toString;function K(t,s){U(t).forEach(e=>s(t[e],e))}function X(s,i,e=0){return U(s).reduce((e,t)=>i(e,s[t],t),e)}function n(e){return!!e&&"object"==typeof e}function G(e){return n(e)&&"[object Object]"===$.call(e)&&e.constructor===Object}function h(...e){let s={};return e.forEach(e=>{e&&K(e,(e,t)=>{G(e)?(G(s[t])||(s[t]={}),s[t]=h(s[t],e)):s[t]=e})}),s}function Y(e={}){var t,s,i=[];for(t in e)e.hasOwnProperty(t)&&(s=e[t],i.push(s));return i}function Q(t,s,i,e=!0){let r=e=>Object.defineProperty(t,s,{value:e,enumerable:!0,writable:!0});var n={configurable:!0,enumerable:!0,get(){var e=i();return r(e),e}};return e&&(n.set=r),Object.defineProperty(t,s,n)}let J=Object.freeze({__proto__:null,each:K,reduce:X,isObject:n,isPlain:G,merge:h,values:Y,defineLazyProperty:Q}),Z=!1,ee=null,l=!1,te,se=!1,ie=!1,re=!1,c=!1,ne=null,ae=null;var e=Boolean(window.cast&&window.cast.framework&&window.cast.framework.CastReceiverContext);let oe=null,le=!1,he=!1,ce=!1,de=!1,ue=!1,pe=!1,ge=!1,me=Boolean(be()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch));var ve,t=window.navigator&&window.navigator.userAgentData;if(t&&t.platform&&t.brands&&(l="Android"===t.platform,ie=Boolean(t.brands.find(e=>"Microsoft Edge"===e.brand)),re=Boolean(t.brands.find(e=>"Chromium"===e.brand)),c=!ie&&re,ne=ae=(t.brands.find(e=>"Chromium"===e.brand)||{}).version||null,he="Windows"===t.platform),!re){let s=window.navigator&&window.navigator.userAgent||"";Z=/iPod/i.test(s),ee=(t=s.match(/OS (\d+)_/i))&&t[1]?t[1]:null,l=/Android/i.test(s),te=(t=s.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i))?(ds=t[1]&&parseFloat(t[1]),ve=t[2]&&parseFloat(t[2]),ds&&ve?parseFloat(t[1]+"."+t[2]):ds||null):null,se=/Firefox/i.test(s),ie=/Edg/i.test(s),re=/Chrome/i.test(s)||/CriOS/i.test(s),c=!ie&&re,ne=ae=(ve=s.match(/(Chrome|CriOS)\/(\d+)/))&&ve[2]?parseFloat(ve[2]):null,oe=function(){v
.${i} {
width: ${e}px;
height: ${t}px;
}
.${i}.vjs-fluid:not(.vjs-audio-only-mode) {
padding-top: ${100*r}%;
}
`)}}loadTech_(e,t){this.tech_&&this.unloadTech_();var s=f(e),i=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==s&&this.tag&&(P.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=s,this.isReady_=!1;let r=this.autoplay(),n={source:t,autoplay:r="string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay?!1:r,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+`_${i}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};E.names.forEach(e=>{e=E[e];n[e.getterName]=this[e.privateName]}),Object.assign(n,this.options_[s]),Object.assign(n,this.options_[i]),Object.assign(n,this.options_[e.toLowerCase()]),this.tag&&(n.tag=this.tag),t&&t.src===this.cache_.src&&0<this.cache_.currentTime&&(n.startTime=this.cache_.currentTime);i=P.getTech(e);if(!i)throw new Error(`No Tech named '${s}' exists! '${s}' should be registered using videojs.registerTech()'`);this.tech_=new i(n),this.tech_.ready(_(this,this.handleTechReady_),!0),qt(this.textTracksJson_||[],this.tech_),ln.forEach(t=>{this.on(this.tech_,t,e=>this[`handleTech${f(t)}_`](e))}),Object.keys(hn).forEach(t=>{this.on(this.tech_,t,e=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${hn[t]}_`].bind(this),event:e}):this[`handleTech${hn[t]}_`](e)})}),this.on(this.tech_,"loadstart",e=>this.handleTechLoadStart_(e)),this.on(this.tech_,"sourceset",e=>this.handleTechSourceset_(e)),this.on(this.tech_,"waiting",e=>this.handleTechWaiting_(e)),this.on(this.tech_,"ended",e=>this.handleTechEnded_(e)),this.on(this.tech_,"seeking",e=>this.handleTechSeeking_(e)),this.on(this.tech_,"play",e=>this.handleTechPlay_(e)),this.on(this.tech_,"pause",e=>this.handleTechPause_(e)),this.on(this.tech_,"durationchange",e=>this.handleTechDurationChange_(e)),this.on(this.tech_,"fullscreenchange",(e,t)=>this.handleTechFullscreenChange_(e,t)),this.on(this.tech_,"fullscreenerror",(e,t)=>this.handleTechFullscreenError_(e,t)),this.on(this.tech_,"enterpictureinpicture",e=>this.handleTechEnterPictureInPicture_(e)),this.on(this.tech_,"leavepictureinpicture",e=>this.handleTechLeavePictureInPicture_(e)),this.on(this.tech_,"error",e=>this.handleTechError_(e)),this.on(this.tech_,"posterchange",e=>this.handleTechPosterChange_(e)),this.on(this.tech_,"textdata",e=>this.handleTechTextData_(e)),this.on(this.tech_,"ratechange",e=>this.handleTechRateChange_(e)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===s&&this.tag||Ee(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){E.names.forEach(e=>{e=E[e];this[e.privateName]=this[e.getterName]()}),this.textTracksJson_=Vt(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return void 0===e&&o.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_}version(){return{"video.js":N}}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_
.video-js {
width: 300px;
height: 150px;
}
.vjs-fluid:not(.vjs-audio-only-mode) {
padding-top: 56.25%
}
`)),et(1,L),L.VERSION=N,L.options=M.prototype.options_,L.getPlayers=()=>M.players,L.getPlayer=e=>{var t=M.players;let s;if("string"==typeof e){var i=Cn(e),r=t[i];if(r)return r;s=$e("#"+i)}else s=e;if(Te(s)){var{player:r,playerId:i}=s;if(r||t[i])return r||t[i]}},L.getAllPlayers=()=>Object.keys(M.players).map(e=>M.players[e]).filter(Boolean),L.players=M.players,L.getComponent=y.getComponent,L.registerComponent=(e,t)=>(P.isTech(t)&&o.warn(`The ${e} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),y.registerComponent.call(y,e,t)),L.getTech=P.getTech,L.registerTech=P.registerTech,L.use=function(e,t){oi[e]=oi[e]||[],oi[e].push(t)},Object.defineProperty(L,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(L.middleware,"TERMINATOR",{value:hi,writeable:!1,enumerable:!0}),L.browser=fe,L.obj=J,L.mergeOptions=D(9,"videojs.mergeOptions","videojs.obj.merge",h),L.defineLazyProperty=D(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Q),L.bind=D(9,"videojs.bind","native Function.prototype.bind",_),L.registerPlugin=O.registerPlugin,L.deregisterPlugin=O.deregisterPlugin,L.plugin=(e,t)=>(o.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),O.registerPlugin(e,t)),L.getPlugins=O.getPlugins,L.getPlugin=O.getPlugin,L.getPluginVersion=O.getPluginVersion,L.addLanguage=function(e,t){return e=(""+e).toLowerCase(),L.options.languages=h(L.options.languages,{[e]:t}),L.options.languages[e]},L.log=o,L.createLogger=W,L.time=t,L.createTimeRange=D(9,"videojs.createTimeRange","videojs.time.createTimeRanges",b),L.createTimeRanges=D(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",b),L.formatTime=D(9,"videojs.formatTime","videojs.time.formatTime",Bt),L.setFormatTime=D(9,"videojs.setFormatTime","videojs.time.setFormatTime",Lt),L.resetFormatTime=D(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",Nt),L.parseUrl=D(9,"videojs.parseUrl","videojs.url.parseUrl",rs),L.isCrossOrigin=D(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",as),L.EventTarget=s,L.any=dt,L.on=r,L.one=ct,L.off=v,L.trigger=ht,L.xhr=bs,L.TextTrack=Ps,L.AudioTrack=js,L.VideoTrack=Is,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(e=>{L[e]=function(){return o.warn(`videojs.${e}() is deprecated; use videojs.dom.${e}() instead`),Ye[e].apply(null,arguments)}}),L.computedStyle=D(9,"videojs.computedStyle","videojs.dom.computedStyle",Xe),L.dom=Ye,L.fn=gt,L.num=Os,L.str=It,L.url=ls,L.Error={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"},L});