30 lines
234 KiB
JavaScript
30 lines
234 KiB
JavaScript
|
/**
|
||
|
* @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 L="8.17.4";let s={},F=function(e,t){return s[e]=s[e]||[],t&&(s[e]=s[e].concat(t)),s[e]};function B(e,t){return!((t=F(e).indexOf(t))<=-1||(s[e]=s[e].slice(),s[e].splice(t,1),0))}let R={prefixed:!0};var H=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],z=H[0];let V;for(let e=0;e<H.length;e++)if(H[e][1]in document){V=H[e];break}if(V){for(let e=0;e<V.length;e++)R[z[e]]=V[e];R.prefixed=V[0]!==z[0]}let d=[];function q(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"),U=o.createLogger,$=Object.prototype.toString;function W(t,s){q(t).forEach(e=>s(t[e],e))}function K(s,i,e=0){return q(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&&W(e,(e,t)=>{G(e)?(G(s[t])||(s[t]={}),s[t]=h(s[t],e)):s[t]=e})}),s}function X(e={}){var t,s,i=[];for(t in e)e.hasOwnProperty(t)&&(s=e[t],i.push(s));return i}function Y(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 Q=Object.freeze({__proto__:null,each:W,reduce:K,isObject:n,isPlain:G,merge:h,values:X,defineLazyProperty:Y}),J=!1,Z=null,l=!1,ee,te=!1,se=!1,ie=!1,c=!1,re=null,ne=null;var e=Boolean(window.cast&&window.cast.framework&&window.cast.framework.CastReceiverContext);let ae=null,oe=!1,le=!1,he=!1,ce=!1,de=!1,ue=!1,pe=!1,ge=Boolean(fe()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch));var me,t=window.navigator&&window.navigator.userAgentData;if(t&&t.platform&&t.brands&&(l="Android"===t.platform,se=Boolean(t.brands.find(e=>"Microsoft Edge"===e.brand)),ie=Boolean(t.brands.find(e=>"Chromium"===e.brand)),c=!se&&ie,re=ne=(t.brands.find(e=>"Chromium"===e.brand)||{}).version||null,le="Windows"===t.platform),!ie){let s=window.navigator&&window.navigator.userAgent||"";J=/iPod/i.test(s),Z=(t=s.match(/OS (\d+)_/i))&&t[1]?t[1]:null,l=/Android/i.test(s),ee=(t=s.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i))?(ls=t[1]&&parseFloat(t[1]),me=t[2]&&parseFloat(t[2]),ls&&me?parseFloat(t[1]+"."+t[2]):ls||null):null,te=/Firefox/i.test(s),se=/Edg/i.test(s),ie=/Chrome/i.test(s)||/CriOS/i.test(s),c=!se&&ie,re=ne=(me=s.match(/(Chrome|CriOS)\/(\d+)/))&&me[2]?parseFloat(me[2]):null,ae=function(){var
|
||
|
.${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};x.names.forEach(e=>{e=x[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(v(this,this.handleTechReady_),!0),zt(this.textTracksJson_||[],this.tech_),Ar.forEach(t=>{this.on(this.tech_,t,e=>this[`handleTech${f(t)}_`](e))}),Object.keys(Or).forEach(t=>{this.on(this.tech_,t,e=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${Or[t]}_`].bind(this),event:e}):this[`handleTech${Or[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||we(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){x.names.forEach(e=>{e=x[e];this[e.privateName]=this[e.getterName]()}),this.textTracksJson_=Ht(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":L}}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%
|
||
|
}
|
||
|
`)),Ze(1,N),N.VERSION=L,N.options=A.prototype.options_,N.getPlayers=()=>A.players,N.getPlayer=e=>{var t=A.players;let s;if("string"==typeof e){var i=Wr(e),r=t[i];if(r)return r;s=$e("#"+i)}else s=e;if(be(s)){var{player:r,playerId:i}=s;if(r||t[i])return r||t[i]}},N.getAllPlayers=()=>Object.keys(A.players).map(e=>A.players[e]).filter(Boolean),N.players=A.players,N.getComponent=b.getComponent,N.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)`),b.registerComponent.call(b,e,t)),N.getTech=P.getTech,N.registerTech=P.registerTech,N.use=function(e,t){Ms[e]=Ms[e]||[],Ms[e].push(t)},Object.defineProperty(N,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(N.middleware,"TERMINATOR",{value:Os,writeable:!1,enumerable:!0}),N.browser=ve,N.obj=Q,N.mergeOptions=D(9,"videojs.mergeOptions","videojs.obj.merge",h),N.defineLazyProperty=D(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Y),N.bind=D(9,"videojs.bind","native Function.prototype.bind",v),N.registerPlugin=O.registerPlugin,N.deregisterPlugin=O.deregisterPlugin,N.plugin=(e,t)=>(o.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),O.registerPlugin(e,t)),N.getPlugins=O.getPlugins,N.getPlugin=O.getPlugin,N.getPluginVersion=O.getPluginVersion,N.addLanguage=function(e,t){return e=(""+e).toLowerCase(),N.options.languages=h(N.options.languages,{[e]:t}),N.options.languages[e]},N.log=o,N.createLogger=U,N.time=t,N.createTimeRange=D(9,"videojs.createTimeRange","videojs.time.createTimeRanges",T),N.createTimeRanges=D(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",T),N.formatTime=D(9,"videojs.formatTime","videojs.time.formatTime",Nt),N.setFormatTime=D(9,"videojs.setFormatTime","videojs.time.setFormatTime",Ot),N.resetFormatTime=D(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",Dt),N.parseUrl=D(9,"videojs.parseUrl","videojs.url.parseUrl",ss),N.isCrossOrigin=D(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",rs),N.EventTarget=i,N.any=ct,N.on=r,N.one=ht,N.off=_,N.trigger=lt,N.xhr=vs,N.TextTrack=Ss,N.AudioTrack=Es,N.VideoTrack=xs,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(e=>{N[e]=function(){return o.warn(`videojs.${e}() is deprecated; use videojs.dom.${e}() instead`),Xe[e].apply(null,arguments)}}),N.computedStyle=D(9,"videojs.computedStyle","videojs.dom.computedStyle",Ke),N.dom=Xe,N.fn=pt,N.num=e,N.str=Pt,N.url=as,N.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"},N});
|