cloudinary-video-player 4.1.6-edge.2 → 4.1.6-edge.20
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.
- package/dist/309.min.js +2 -2
- package/dist/526.min.js +3 -3
- package/dist/689.min.js +2 -2
- package/dist/801.min.js +3 -3
- package/dist/adaptive-streaming.js +4 -4
- package/dist/adaptive-streaming.min.js +3 -3
- package/dist/chapters.js +2 -2
- package/dist/chapters.min.js +2 -2
- package/dist/cld-player-core.js +7 -7
- package/dist/cld-player-core.min.js +3 -3
- package/dist/cld-poster-url.js +2 -2
- package/dist/cld-poster-url.min.js +2 -2
- package/dist/cld-video-player.css +2 -2
- package/dist/cld-video-player.js +7 -7
- package/dist/cld-video-player.light.js +7 -7
- package/dist/cld-video-player.light.min.js +3 -3
- package/dist/cld-video-player.min.css +2 -2
- package/dist/cld-video-player.min.js +3 -3
- package/dist/colors.js +2 -2
- package/dist/colors.min.js +2 -2
- package/dist/dash.js +2 -2
- package/dist/dash.min.js +2 -2
- package/dist/debug.js +2 -2
- package/dist/debug.min.js +2 -2
- package/dist/ima.js +2 -2
- package/dist/ima.min.js +2 -2
- package/dist/interaction-areas.js +2 -2
- package/dist/interaction-areas.min.js +2 -2
- package/dist/node_modules_lodash_throttle_js.js +2 -2
- package/dist/player-full.js +7 -7
- package/dist/player-full.min.js +3 -3
- package/dist/player.css +2 -2
- package/dist/player.js +2 -2
- package/dist/player.min.css +2 -2
- package/dist/player.min.js +2 -2
- package/dist/playlist.js +2 -2
- package/dist/playlist.min.js +2 -2
- package/dist/recommendations-overlay.js +2 -2
- package/dist/recommendations-overlay.min.js +2 -2
- package/dist/share.js +2 -2
- package/dist/share.min.js +2 -2
- package/dist/shoppable.js +2 -2
- package/dist/shoppable.min.js +2 -2
- package/dist/utils_fetch-config_js.js +2 -2
- package/dist/utils_schedule_js.js +2 -2
- package/lib/adaptive-streaming.js +7 -2
- package/lib/cld-video-player.min.css +2 -2
- package/lib/index2.js +1 -1
- package/lib/player.min.css +2 -2
- package/lib/video-player.js +7 -4
- package/package.json +1 -1
package/dist/689.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Cloudinary Video Player v4.1.6-edge.
|
|
3
|
-
* Built on 2026-11-
|
|
2
|
+
* Cloudinary Video Player v4.1.6-edge.20
|
|
3
|
+
* Built on 2026-11-08T10:03:45.014Z
|
|
4
4
|
* https://github.com/cloudinary/cloudinary-video-player
|
|
5
5
|
*/
|
|
6
6
|
"use strict";(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[689],{5689(e,t,o){o.d(t,{scheduleBootstrap:()=>u,shouldUseScheduleBootstrap:()=>n});var r=o(9606);const n=e=>{const t=e?.schedule,o=t?.weekly;return Array.isArray(o)&&o.length>0&&!l(t,new Date)},u=async(e,t,n)=>{const u=(0,r.yn)(e),s=(e=>e?.cloudName||e?.cloud_name||e?.cloudinaryConfig?.cloud_name)(t),a=(e=>e?.publicId||e?.sourceOptions?.publicId)(t);if(!s||!a)throw new Error("schedule.weekly requires cloudName and publicId when outside schedule");const{buildPosterUrl:i}=await o.e(172).then(o.bind(o,4705)),l=i(s,a,t?.cloudinaryConfig||{cloud_name:s}),d=!1!==t?.fluid,{videoElement:c,hadControls:y}=(0,r.cm)(u,l,{fluid:d,width:t?.width,height:t?.height,cropMode:t?.sourceOptions?.cropMode,sourceOptions:t?.sourceOptions,aspectRatio:t?.aspectRatio});(e=>{if(!1!==(e?.sourceOptions?.allowUsageReport??e?.allowUsageReport))try{const t=new URLSearchParams({scheduleImageRendered:"true",cloudName:e?.cloudName||e?.cloudinaryConfig?.cloud_name||""}).toString();fetch(`https://analytics-api-s.cloudinary.com/video_player_source?${t}`)}catch{}})(t);const h={source:()=>h,loadPlayer:()=>(y&&c.setAttribute("controls",""),(0,r.Yx)({videoElement:c,options:t,ready:n}))};return h},s={sunday:0,sun:0,monday:1,mon:1,tuesday:2,tue:2,tues:2,wednesday:3,wed:3,thursday:4,thu:4,thur:4,thurs:4,friday:5,fri:5,saturday:6,sat:6},a=e=>{if("string"!=typeof e)return null;const t=e.toLowerCase().trim();return s[t]??null},i=e=>{if("string"!=typeof e)return null;const t=e.trim().match(/^(\d{1,2}):(\d{2})$/);if(!t)return null;const o=parseInt(t[1],10),r=parseInt(t[2],10);return o<0||o>23||r<0||r>59?null:60*o+r},l=(e,t)=>{const o=e?.weekly;if(!Array.isArray(o)||0===o.length)return!0;const r=1440*t.getDay()+60*t.getHours()+t.getMinutes();for(const e of o){const t=a(e.day);if(null===t)continue;const o=i(e.start);if(null===o||"number"!=typeof e.duration||e.duration<=0)continue;if((r-(1440*t+o)+10080)%10080<60*e.duration)return!0}return!1}}}]);
|
package/dist/801.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Cloudinary Video Player v4.1.6-edge.
|
|
3
|
-
* Built on 2026-11-
|
|
2
|
+
* Cloudinary Video Player v4.1.6-edge.20
|
|
3
|
+
* Built on 2026-11-08T10:03:45.014Z
|
|
4
4
|
* https://github.com/cloudinary/cloudinary-video-player
|
|
5
5
|
*/
|
|
6
|
-
"use strict";(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[76,801],{6801(i,t,e){e.r(t),e.d(t,{createPlayerWithConfig:()=>k,createVideoPlayer:()=>D,default:()=>L});var s=e(6673),o=e.n(s),r=e(1698),n=e(5685),a=e.n(n),h=e(2832),l=e.n(h),d=e(7171),u=e.n(d),c=e(8446),p=e.n(c),v=e(8953),y=e.n(v),j=e(7571),g=e.n(j),_=(e(223),e(8273)),f=e(5104),m=e(7668),O=e(3105),T=e(8513),S=e(5381),C=e(8838),A=e(608),I=e(5779),P=e(1104),b=e(918),E=e(5770),R=e(4242),V=e(7311);Object.keys(_.A).forEach(i=>{o().registerPlugin(i,_.A[i])}),(0,C.go)();class w{static all(i){for(var t=arguments.length,e=new Array(t>1?t-1:0),s=1;s<t;s++)e[s-1]=arguments[s];return[...document.querySelectorAll(i)].map(i=>new w(i,...e))}get playerOptions(){return this.options.playerOptions}constructor(i,t,e){this.videoElement=i,this.options=(0,C.DS)(t),this._videojsOptions=this.options.videojsOptions,this.videoElement.classList.add("video-js"),f.A.fontFace(this.videoElement,this.playerOptions.fontFace),"init"===this._videojsOptions.bigPlayButton&&(this.videoElement.classList.add("vjs-big-play-button-init-only"),this._videojsOptions.bigPlayButton=!0),this.videojs=o()(this.videoElement,this._videojsOptions),(0,O.A)(this,this.videojs),this._isPlayerConfigValid=!0,this.playerOptions.debug&&(0,I.I6)(this.options).then(i=>{if(!i)return this._isPlayerConfigValid=!1,void this.videojs.error("invalid player configuration")}),this._videojsOptions.muted&&this.videojs.volume(.4),this.playerOptions.fluid&&this.fluid(this.playerOptions.fluid),this._setCssClasses(),this._initPlugins(),this._initJumpButtons(),this._initPictureInPicture(),this._initBigPauseButton(),this._setVideoJsListeners(e)}getVPInstanceId(){return this.vpInstanceId||(this.vpInstanceId=(0,r.A)()),this.vpInstanceId}_sendInternalAnalytics(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=Object.assign({},this.playerOptions,this.options.videojsOptions,i);if(t.sourceOptions?.allowUsageReport)try{const i=t._internalAnalyticsMetadata??{},e=(0,b.o)(t),s=new URLSearchParams(e).toString(),o=new URLSearchParams({vpVersion:"4.1.6-edge.2",vpInstanceId:this.getVPInstanceId(),cloudName:t.cloudinary.cloud_name,...i}).toString();fetch(`https://analytics-api-s.cloudinary.com/video_player_source?${s}&${o}`)}catch(i){console.warn(i)}}_resetReTryVideoState=()=>{this.reTryVideoStateRetriesCount=0,this.videojs.clearTimeout(this.reTryVideoStateTimeoutId)};_handleRefresh=()=>{this.videojs.error(null);const i=this.currentPublicId()||this.currentSourceUrl();i&&this.source(i,this.playerOptions.sourceOptions||{})};_setVideoJsListeners(i){this.videojs.on(P.f.ERROR,()=>{const i=this.videojs.error();if(i){const t=this._isPlayerConfigValid&&this.videojs.cloudinary.currentSourceType();[3===i.code&&o().browser.IS_SAFARI,4===i.code].includes(!0)&&[P.x.AUDIO,P.x.VIDEO].includes(t)?this.isLiveStream?(this.videojs.error({code:E.bo.CUSTOM,message:"Live Stream not started"}),this.reloadVideoUntilAvailable()):this.videojs.setTimeout(()=>{this.videojs.error()===i&&(this.videojs.error(null),f.A.handleCldError(this,this.playerOptions))},0):this._resetReTryVideoState()}}),this.videojs.tech_.on(P.f.RETRY_PLAYLIST,()=>{l()(this.videojs,"hls.stats.mediaRequestsErrored",0)>0&&(this._resetReTryVideoState(),f.A.handleCldError(this,this.playerOptions))}),this.videojs.on(P.f.PLAY,this._resetReTryVideoState),this.videojs.on(P.f.CAN_PLAY_THROUGH,this._resetReTryVideoState),this.videojs.on(P.f.CLD_SOURCE_CHANGED,this._onSourceChange.bind(this)),this.videojs.on(P.f.REFRESH,this._handleRefresh.bind(this)),this.videojs.ready(()=>{this._onReady(),this._applyVolumeBarAriaLiveFix(),i&&i(this)})}_initPlugins(){this._initIma(),this._initAutoplay(),this._initContextMenu(),this._initPerSrcBehaviors(),this._initCloudinary(),this._initAnalytics(),this._initCloudinaryAnalytics(),this._initFloatingPlayer(),this._initShare(),this._initColors(),this._initTextTracks(),this._initHighlightsGraph(),this._initSeekThumbs(),this._initChapters(),this._initInteractionAreas(),this._initSourceSwitcher()}_isFullScreen(){return this.videojs.player().isFullscreen()}_initIma(){this.playerOptions.ads&&0!==Object.keys(this.playerOptions.ads).length&&_.A.imaPlugin(this.videojs,this.playerOptions)}setTextTracks(i){if(this.textTracksManager.removeAllTextTracks(),i){const t=Object.keys(i),e=[];for(const s of t)if("options"!==s){const t=Array.isArray(i[s])?i[s]:[i[s]];for(const i of t)e.push({...i,kind:s,label:i.label,srclang:i.language,default:!!i.default,src:i.url})}this.textTracksManager.addTextTracks(e),i.options&&this.videojs.styledTextTracks&&this.videojs.styledTextTracks(i.options)}}_initSeekThumbs(){this.playerOptions.seekThumbnails&&this.videojs.on(P.f.CLD_SOURCE_CHANGED,(i,t)=>{let{source:e}=t;if(!e||e.getType()===P.x.AUDIO||"live"===e.resourceConfig().type||(0,E.iT)(e.publicId())||this.videojs.activePlugins_&&this.videojs.activePlugins_.vr)return;const s=e.publicId(),o=(0,E.hS)(Object.assign({},e.transformation())),r=[...Array.isArray(o)?o:[o],{flags:["sprite"]}],n=e.config().url(`${s}.vtt`,{transformation:r}).replace(/\.json$/,""),a=(0,V.N)(n,e.queryParams());p()(this.videojs.vttThumbnails)?this.videojs.vttThumbnails({src:a}):this.videojs.vttThumbnails.src(a)})}_initHighlightsGraph(){this.playerOptions.aiHighlightsGraph&&this.videojs.on(P.f.CLD_SOURCE_CHANGED,(i,t)=>{let{source:e}=t;if(!e||e.getType()===P.x.AUDIO||(0,E.iT)(e.publicId()))return;const s=e.publicId(),o=u()(e.transformation(),["start_offset","end_offset","duration"]),r=Object.assign({},o);r.effect="preview",r.flags=r.flags||[],r.flags.push("getinfo");const n=e.config().url(`${s}`,{transformation:r}).replace(/\.json$/,""),a=(0,V.N)(n,e.queryParams());p()(this.videojs.aiHighlightsGraph)?this.videojs.aiHighlightsGraph({src:a}):this.videojs.aiHighlightsGraph.src(a)})}_initChapters(){!this.playerOptions.chaptersButton&&this.videojs.controlBar&&this.videojs.controlBar.removeChild("chaptersButton"),this.videojs.on(P.f.CLD_SOURCE_CHANGED,(i,t)=>{let{source:e}=t;a()(e?._chapters)&&!0!==e?._chapters||!this.videojs.chapters?this.videojs.chapters?.resetPlugin&&this.videojs.chapters.resetPlugin():p()(this.videojs.chapters)?this.videojs.chapters(e._chapters):this.videojs.chapters.src(e._chapters)})}_initInteractionAreas(){this.videojs.on(P.f.READY,async()=>{this.options.videojsOptions.interactionDisplay&&this.videojs.interactionAreas&&this.videojs.interactionAreas(this,this.playerOptions,this._videojsOptions)})}_initShare(){this.videojs.on(P.f.CLD_SOURCE_CHANGED,(i,t)=>{let{source:e}=t;this.videojs.share&&(e?._download&&p()(this.videojs.share)&&this.videojs.share({download:!0}),p()(this.videojs.share)||(e?._download?this.videojs.share.addDownloadButton?.():this.videojs.share.removeDownloadButton?.()))})}_initColors(){this.playerOptions.colors&&this.videojs.colors({colors:this.playerOptions.colors})}_initTextTracks(){this.textTracksManager=this.videojs.textTracksManager(),this.videojs.on(P.f.CLD_SOURCE_CHANGED,(i,t)=>{let{source:e}=t;e?._textTracks&&this.setTextTracks(e._textTracks)})}_initPerSrcBehaviors(){this.videojs.perSourceBehaviors&&this.videojs.perSourceBehaviors()}_initJumpButtons(){!this.playerOptions.showJumpControls&&this.videojs.controlBar&&(this.videojs.controlBar.removeChild("JumpForwardButton"),this.videojs.controlBar.removeChild("JumpBackButton"))}_initPictureInPicture(){!this.playerOptions.pictureInPictureToggle&&this.videojs.controlBar&&this.videojs.controlBar.removeChild("pictureInPictureToggle")}_initBigPauseButton(){(o().browser.IS_IOS||o().browser.IS_ANDROID)&&this.videojs.addChild("BigPauseButton")}_initCloudinary(){const i=this.playerOptions.cloudinary;i.chainTarget=this,!1!==i.secure&&(0,E.lP)(i,{secure:!0});const t={cloudinaryConfig:i,...this.playerOptions.sourceOptions};this.videojs.cloudinary(t)}_initAnalytics(){const i=this.playerOptions.analytics;if(window.gtag||!i){if(i){const t="object"==typeof i?i:{};this.videojs.analytics(t)}}else console.error("Google Analytics script (gtag) is missing.")}_initCloudinaryAnalytics(){if(!!this.playerOptions.cloudinaryAnalytics){this.videojs.videoElement=this.videoElement;const i=y()(this.playerOptions.cloudinaryAnalytics)?this.playerOptions.cloudinaryAnalytics:{};this.videojs.cloudinaryAnalytics(i)}}_initSourceSwitcher(){if(this.sourceSwitcher=this.videojs.sourceSwitcher(),this.videojs.on(P.f.CLD_SOURCE_CHANGED,(i,t)=>{let{source:e}=t;const s=e.videoSources?.(),o=!!Array.isArray(s)&&!!s.length;if(this.videojs.controlBar){const i=o?"show":"hide",t=this.videojs.controlBar.getChild("sourceSwitcherButton");t&&"function"==typeof t?.[i]&&t[i]()}if(o){const i=s.findIndex(i=>{let{publicId:t}=i;return t===e.publicId()});this.sourceSwitcher.reInit({sources:s,selectedIndex:-1===i?0:i,onSourceChange:i=>{let{publicId:t,...e}=i;return this.source(t,{...e,videoSources:s})}})}}),Array.isArray(this.playerOptions.sourceOptions?.videoSources)&&this.playerOptions.sourceOptions?.videoSources.length){const{publicId:i,label:t,...e}=this.playerOptions.sourceOptions.videoSources[0];this.source(i,{...e,videoSources:this.playerOptions.sourceOptions.videoSources})}}reTryVideoStateUntilAvailable(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.POSITIVE_INFINITY,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3;if("number"!=typeof this.reTryVideoStateRetriesCount&&(this.reTryVideoStateRetriesCount=0),(0,R.h)(this.videojs.readyState()))this.reTryVideoStateRetriesCount=0;else if(this.reTryVideoStateRetriesCount<i)this.reTryVideoStateRetriesCount++,this.reTryVideoStateTimeoutId=this.videojs.setTimeout(()=>this.reTryVideoStateUntilAvailable(i,t),t);else{let i=new Error("Video is not ready please try later");this.videojs.trigger("error",i)}}_resetReloadVideo=()=>{this.reloadVideoRetriesCount=0,this.videojs.clearTimeout(this.reloadVideoTimeoutId)};reloadVideoUntilAvailable(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.POSITIVE_INFINITY,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3;"number"!=typeof this.reloadVideoRetriesCount&&(this.reloadVideoRetriesCount=0),this.reloadVideoRetriesCount<i?(this.reloadVideoRetriesCount++,this.reloadVideoTimeoutId=this.videojs.setTimeout(()=>{const e=this.currentSourceUrl();(0,R.O)(e,this.isLiveStream?"live":"default").then(()=>this.source(e)).catch(()=>this.reloadVideoUntilAvailable(i,t))},t)):this.videojs.trigger("error",new Error("Sorry, we could not load your video"))}_initAutoplay(){"on-scroll"===this.playerOptions.autoplayMode&&this.videojs.autoplayOnScroll()}_initContextMenu(){this.playerOptions.hideContextMenu||this.videojs.contextMenu(m.A.contextMenu)}_initFloatingPlayer(){this.playerOptions.floatingWhenNotVisible!==A.rT.NONE&&this.videojs.floatingPlayer({floatTo:this.playerOptions.floatingWhenNotVisible})}_setCssClasses(){this.videojs.addClass(f.A.CLASS_PREFIX),this.videojs.addClass(f.A.playerClassPrefix(this.videojs)),f.A.setSkinClassPrefix(this.videojs,f.A.skinClassPrefix(this.videojs))}_onReady(){this._setExtendedEvents();const i=this.playerOptions.sourceOptions.source||this.playerOptions.sourceOptions.publicId;if(i){const t=Object.assign({},this.playerOptions.sourceOptions);this.source(i,t)}}_applyVolumeBarAriaLiveFix(){const i=this.videojs.$(".vjs-volume-bar");i&&i.removeAttribute("aria-live")}_onSourceChange(i,t){let{source:e,sourceOptions:s}=t;this._sendInternalAnalytics({...s&&{sourceOptions:s}}),this.isLiveStream="live"===e?.resourceConfig()?.type}_setExtendedEvents(){const i=[];this.playerOptions.playedEventPercents&&i.push({type:P.f.PERCENTS_PLAYED,percents:this.playerOptions.playedEventPercents}),this.playerOptions.playedEventTimes&&i.push({type:P.f.TIME_PLAYED,times:this.playerOptions.playedEventTimes});const t=new T.A(this.videojs,{events:i});Object.keys(t.events).forEach(i=>{t.on(i,(t,e)=>{this.videojs.trigger({type:i,eventData:e})})})}cloudinaryConfig(i){return this.videojs.cloudinary.cloudinaryConfig(i)}currentPublicId(){return this.videojs.cloudinary.currentPublicId()}currentSourceUrl(){return this.videojs.currentSource().src}currentPoster(){return this.videojs.cloudinary.currentPoster()}source(i){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(({publicId:i,options:t}=(0,E.a5)(i,t)),!this._isPlayerConfigValid)return;if(this.playerOptions.debug&&(t.debug=!0,(0,I.Is)(t).then(i=>{i||this.videojs.error("invalid source configuration")})),i instanceof S.A)return this.videojs.cloudinary.source(i,t);t={...this.playerOptions.sourceOptions||{},...t},t.shoppable&&this.videojs.shoppable&&this.videojs.shoppable(this.videojs,t),this._resetReloadVideo(),this._resetReTryVideoState();const e=this.videojs.options_.maxTries||3,s=this.videojs.options_.videoTimeout||55e3;return this.reTryVideoStateUntilAvailable(e,s),this.videojs.cloudinary.source(i,t)}posterOptions(i){return this.videojs.cloudinary.posterOptions(i)}skin(i){return void 0!==i&&g()(i)&&f.A.setSkinClassPrefix(this.videojs,i),f.A.skinClassPrefix(this.videojs)}playlist(i){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.playerOptions.playlistWidget={...this.playerOptions.playlistWidget||{show:!1},playlist:!0},t=Object.assign({},t,{playlistWidget:this.playerOptions.playlistWidget}),this.videojs.one(P.f.READY,async()=>{(await this.videojs.playlist(t))(i,t)}),this.videojs.cloudinary.playlist?this.videojs.cloudinary.playlist(i,t):this}playlistByTag(i){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.playerOptions.playlistWidget={...this.playerOptions.playlistWidget||{show:!1},playlistByTag:!0},t=Object.assign({},t,{playlistWidget:this.playerOptions.playlistWidget}),new Promise(e=>{this.videojs.one(P.f.READY,async()=>{(await this.videojs.playlist(t))(await this.sourcesByTag(i,t),t),e(this)})})}sourcesByTag(i){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.videojs.cloudinary.sourcesByTag(i,t)}fluid(i){return void 0===i?this.videojs.fluid():(i?this.videojs.addClass(A.gi):this.videojs.removeClass(A.gi),this.videojs.fluid(i),this.videojs.trigger(P.f.FLUID,i),this)}play(){return this.playWasCalled=!0,this.videojs.play(),this}stop(){return this.pause(),this.currentTime(0),this}playPrevious(){return this.playlist().playPrevious(),this}playNext(){return this.playlist().playNext(),this}transformation(i){return this.videojs.cloudinary.transformation(i)}sourceTypes(i){return this.videojs.cloudinary.sourceTypes(i)}sourceTransformation(i){return this.videojs.cloudinary.sourceTransformation(i)}autoShowRecommendations(i){return this.videojs.cloudinary.autoShowRecommendations(i)}duration(){return this.videojs.duration()}height(i){return i?(this.videojs.height(i),this):this.videojs.height()}width(i){return i?(this.videojs.width(i),this):this.videojs.width()}volume(i){return i?(this.videojs.volume(i),this):this.videojs.volume()}mute(){return this.isMuted()||this.videojs.muted(!0),this}unmute(){return this.isMuted()&&this.videojs.muted(!1),this}isMuted(){return this.videojs.muted()}pause(){return this.videojs.pause(),this}currentTime(i){return i||0===i?(this.videojs.currentTime(i),this):this.videojs.currentTime()}maximize(){return this.isMaximized()||this.videojs.requestFullscreen(),this}exitMaximize(){return this.isMaximized()&&this.videojs.exitFullscreen(),this}isMaximized(){return this.videojs.isFullscreen()}dispose(){this.videojs.dispose()}controls(i){return void 0===i?this.videojs.controls():(this.videojs.controls(i),this)}ima(){return{playAd:this.videojs.ima.playAd}}loop(i){return void 0===i?this.videojs.loop():(this.videojs.loop(i),this)}el(){return this.videojs.el()}}const x=i=>o().obj.merge({},m.A,i),B=function(i){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const e=(0,C.iG)(i);return{videoElement:e,options:(0,C.Wi)(e,t)}},D=function(i){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=arguments.length>2?arguments[2]:void 0;const{videoElement:s,options:o}=B(i,t);return o.profile&&console.warn("Profile option requires async initialization. Use cloudinary.player() instead of cloudinary.videoPlayer()"),new w(s,x(o),e)},k=(i,t,e)=>{const{videoElement:s,options:o}=B(i,t);return new w(s,x(o),e)},L=88==e.j?w:null}}]);
|
|
6
|
+
"use strict";(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[76,801],{6801(i,t,e){e.r(t),e.d(t,{createPlayerWithConfig:()=>k,createVideoPlayer:()=>D,default:()=>L});var s=e(6673),o=e.n(s),r=e(1698),n=e(5685),a=e.n(n),h=e(2832),l=e.n(h),d=e(7171),u=e.n(d),c=e(8446),p=e.n(c),v=e(8953),y=e.n(v),j=e(7571),g=e.n(j),_=(e(223),e(8273)),f=e(5104),m=e(7668),O=e(3105),T=e(8513),S=e(5381),C=e(8838),A=e(608),I=e(5779),P=e(1104),b=e(918),E=e(5770),R=e(4242),V=e(7311);Object.keys(_.A).forEach(i=>{o().registerPlugin(i,_.A[i])}),(0,C.go)();class w{static all(i){for(var t=arguments.length,e=new Array(t>1?t-1:0),s=1;s<t;s++)e[s-1]=arguments[s];return[...document.querySelectorAll(i)].map(i=>new w(i,...e))}get playerOptions(){return this.options.playerOptions}constructor(i,t,e){this.videoElement=i,this.options=(0,C.DS)(t),this._videojsOptions=this.options.videojsOptions,this.videoElement.classList.add("video-js"),f.A.fontFace(this.videoElement,this.playerOptions.fontFace),"init"===this._videojsOptions.bigPlayButton&&(this.videoElement.classList.add("vjs-big-play-button-init-only"),this._videojsOptions.bigPlayButton=!0),this.videojs=o()(this.videoElement,this._videojsOptions),(0,O.A)(this,this.videojs),this._isPlayerConfigValid=!0,this.playerOptions.debug&&(0,I.I6)(this.options).then(i=>{if(!i)return this._isPlayerConfigValid=!1,void this.videojs.error("invalid player configuration")}),this._videojsOptions.muted&&this.videojs.volume(.4),this.playerOptions.fluid&&this.fluid(this.playerOptions.fluid),this._setCssClasses(),this._initPlugins(),this._initJumpButtons(),this._initPictureInPicture(),this._initBigPauseButton(),this._setVideoJsListeners(e)}getVPInstanceId(){return this.vpInstanceId||(this.vpInstanceId=(0,r.A)()),this.vpInstanceId}_sendInternalAnalytics(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=Object.assign({},this.playerOptions,this.options.videojsOptions,i);if(t.sourceOptions?.allowUsageReport)try{const i=t._internalAnalyticsMetadata??{},e=(0,b.o)(t),s=new URLSearchParams(e).toString(),o=new URLSearchParams({vpVersion:"4.1.6-edge.20",vpInstanceId:this.getVPInstanceId(),cloudName:t.cloudinary.cloud_name,...i}).toString();fetch(`https://analytics-api-s.cloudinary.com/video_player_source?${s}&${o}`)}catch(i){console.warn(i)}}_resetReTryVideoState=()=>{this.reTryVideoStateRetriesCount=0,this.videojs.clearTimeout(this.reTryVideoStateTimeoutId)};_handleRefresh=()=>{this.videojs.error(null);const i=this.currentPublicId()||this.currentSourceUrl();i&&this.source(i,this.playerOptions.sourceOptions||{})};_setVideoJsListeners(i){this.videojs.on(P.f.ERROR,()=>{const i=this.videojs.error();if(i){const t=this._isPlayerConfigValid&&this.videojs.cloudinary.currentSourceType();[3===i.code&&o().browser.IS_SAFARI,4===i.code].includes(!0)&&[P.x.AUDIO,P.x.VIDEO].includes(t)?this.isLiveStream?(this.videojs.error({code:E.bo.CUSTOM,message:"Live Stream not started"}),this.reloadVideoUntilAvailable()):this.videojs.setTimeout(()=>{this.videojs.error()===i&&(this.videojs.error(null),f.A.handleCldError(this,this.playerOptions))},0):this._resetReTryVideoState()}}),this.videojs.tech_.on(P.f.RETRY_PLAYLIST,()=>{l()(this.videojs,"hls.stats.mediaRequestsErrored",0)>0&&(this._resetReTryVideoState(),f.A.handleCldError(this,this.playerOptions))}),this.videojs.on(P.f.PLAY,this._resetReTryVideoState),this.videojs.on(P.f.CAN_PLAY_THROUGH,this._resetReTryVideoState),this.videojs.on(P.f.CLD_SOURCE_CHANGED,this._onSourceChange.bind(this)),this.videojs.on(P.f.REFRESH,this._handleRefresh.bind(this)),this.videojs.ready(()=>{this._onReady(),this._applyVolumeBarAriaLiveFix(),i&&i(this)})}_initPlugins(){this._initIma(),this._initAutoplay(),this._initContextMenu(),this._initPerSrcBehaviors(),this._initCloudinary(),this._initAnalytics(),this._initCloudinaryAnalytics(),this._initFloatingPlayer(),this._initShare(),this._initColors(),this._initTextTracks(),this._initHighlightsGraph(),this._initSeekThumbs(),this._initChapters(),this._initInteractionAreas(),this._initSourceSwitcher()}_isFullScreen(){return this.videojs.player().isFullscreen()}_initIma(){this.playerOptions.ads&&0!==Object.keys(this.playerOptions.ads).length&&_.A.imaPlugin(this.videojs,this.playerOptions)}setTextTracks(i){if(this.textTracksManager.removeAllTextTracks(),i){const t=Object.keys(i),e=[];for(const s of t)if("options"!==s){const t=Array.isArray(i[s])?i[s]:[i[s]];for(const i of t)e.push({...i,kind:s,label:i.label,srclang:i.language,default:!!i.default,src:i.url})}this.textTracksManager.addTextTracks(e),i.options&&this.videojs.styledTextTracks&&this.videojs.styledTextTracks(i.options)}}_initSeekThumbs(){this.playerOptions.seekThumbnails&&this.videojs.on(P.f.CLD_SOURCE_CHANGED,(i,t)=>{let{source:e}=t;if(!e||e.getType()===P.x.AUDIO||"live"===e.resourceConfig().type||(0,E.iT)(e.publicId())||this.videojs.activePlugins_&&this.videojs.activePlugins_.vr)return;const s=e.publicId(),o=(0,E.hS)(Object.assign({},e.transformation())),r=[...Array.isArray(o)?o:[o],{flags:["sprite"]}],n=e.config().url(`${s}.vtt`,{transformation:r}).replace(/\.json$/,""),a=(0,V.N)(n,e.queryParams());p()(this.videojs.vttThumbnails)?this.videojs.vttThumbnails({src:a}):this.videojs.vttThumbnails.src(a)})}_initHighlightsGraph(){this.playerOptions.aiHighlightsGraph&&this.videojs.on(P.f.CLD_SOURCE_CHANGED,(i,t)=>{let{source:e}=t;if(!e||e.getType()===P.x.AUDIO||(0,E.iT)(e.publicId()))return;const s=e.publicId(),o=u()(e.transformation(),["start_offset","end_offset","duration"]),r=Object.assign({},o);r.effect="preview",r.flags=r.flags||[],r.flags.push("getinfo");const n=e.config().url(`${s}`,{transformation:r}).replace(/\.json$/,""),a=(0,V.N)(n,e.queryParams());p()(this.videojs.aiHighlightsGraph)?this.videojs.aiHighlightsGraph({src:a}):this.videojs.aiHighlightsGraph.src(a)})}_initChapters(){!this.playerOptions.chaptersButton&&this.videojs.controlBar&&this.videojs.controlBar.removeChild("chaptersButton"),this.videojs.on(P.f.CLD_SOURCE_CHANGED,(i,t)=>{let{source:e}=t;a()(e?._chapters)&&!0!==e?._chapters||!this.videojs.chapters?this.videojs.chapters?.resetPlugin&&this.videojs.chapters.resetPlugin():p()(this.videojs.chapters)?this.videojs.chapters(e._chapters):this.videojs.chapters.src(e._chapters)})}_initInteractionAreas(){this.videojs.on(P.f.READY,async()=>{this.options.videojsOptions.interactionDisplay&&this.videojs.interactionAreas&&this.videojs.interactionAreas(this,this.playerOptions,this._videojsOptions)})}_initShare(){this.videojs.on(P.f.CLD_SOURCE_CHANGED,(i,t)=>{let{source:e}=t;this.videojs.share&&(e?._download&&p()(this.videojs.share)&&this.videojs.share({download:!0}),p()(this.videojs.share)||(e?._download?this.videojs.share.addDownloadButton?.():this.videojs.share.removeDownloadButton?.()))})}_initColors(){this.playerOptions.colors&&this.videojs.colors({colors:this.playerOptions.colors})}_initTextTracks(){this.textTracksManager=this.videojs.textTracksManager(),this.videojs.on(P.f.CLD_SOURCE_CHANGED,(i,t)=>{let{source:e}=t;e?._textTracks&&this.setTextTracks(e._textTracks)})}_initPerSrcBehaviors(){this.videojs.perSourceBehaviors&&this.videojs.perSourceBehaviors()}_initJumpButtons(){!this.playerOptions.showJumpControls&&this.videojs.controlBar&&(this.videojs.controlBar.removeChild("JumpForwardButton"),this.videojs.controlBar.removeChild("JumpBackButton"))}_initPictureInPicture(){!this.playerOptions.pictureInPictureToggle&&this.videojs.controlBar&&this.videojs.controlBar.removeChild("pictureInPictureToggle")}_initBigPauseButton(){(o().browser.IS_IOS||o().browser.IS_ANDROID)&&this.videojs.addChild("BigPauseButton")}_initCloudinary(){const i=this.playerOptions.cloudinary;i.chainTarget=this,!1!==i.secure&&(0,E.lP)(i,{secure:!0});const t={cloudinaryConfig:i,...this.playerOptions.sourceOptions};this.videojs.cloudinary(t)}_initAnalytics(){const i=this.playerOptions.analytics;if(window.gtag||!i){if(i){const t="object"==typeof i?i:{};this.videojs.analytics(t)}}else console.error("Google Analytics script (gtag) is missing.")}_initCloudinaryAnalytics(){if(!!this.playerOptions.cloudinaryAnalytics){this.videojs.videoElement=this.videoElement;const i=y()(this.playerOptions.cloudinaryAnalytics)?this.playerOptions.cloudinaryAnalytics:{};this.videojs.cloudinaryAnalytics(i)}}_initSourceSwitcher(){if(this.sourceSwitcher=this.videojs.sourceSwitcher(),this.videojs.on(P.f.CLD_SOURCE_CHANGED,(i,t)=>{let{source:e}=t;const s=e.videoSources?.(),o=!!Array.isArray(s)&&!!s.length;if(this.videojs.controlBar){const i=o?"show":"hide",t=this.videojs.controlBar.getChild("sourceSwitcherButton");t&&"function"==typeof t?.[i]&&t[i]()}if(o){const i=s.findIndex(i=>{let{publicId:t}=i;return t===e.publicId()});this.sourceSwitcher.reInit({sources:s,selectedIndex:-1===i?0:i,onSourceChange:i=>{let{publicId:t,...e}=i;return this.source(t,{...e,videoSources:s})}})}}),Array.isArray(this.playerOptions.sourceOptions?.videoSources)&&this.playerOptions.sourceOptions?.videoSources.length){const{publicId:i,label:t,...e}=this.playerOptions.sourceOptions.videoSources[0];this.source(i,{...e,videoSources:this.playerOptions.sourceOptions.videoSources})}}reTryVideoStateUntilAvailable(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.POSITIVE_INFINITY,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3;if("number"!=typeof this.reTryVideoStateRetriesCount&&(this.reTryVideoStateRetriesCount=0),(0,R.h)(this.videojs.readyState()))this.reTryVideoStateRetriesCount=0;else if(this.reTryVideoStateRetriesCount<i)this.reTryVideoStateRetriesCount++,this.reTryVideoStateTimeoutId=this.videojs.setTimeout(()=>this.reTryVideoStateUntilAvailable(i,t),t);else{let i=new Error("Video is not ready please try later");this.videojs.trigger("error",i)}}_resetReloadVideo=()=>{this.reloadVideoRetriesCount=0,this.videojs.clearTimeout(this.reloadVideoTimeoutId)};reloadVideoUntilAvailable(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.POSITIVE_INFINITY,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3;"number"!=typeof this.reloadVideoRetriesCount&&(this.reloadVideoRetriesCount=0),this.reloadVideoRetriesCount<i?(this.reloadVideoRetriesCount++,this.reloadVideoTimeoutId=this.videojs.setTimeout(()=>{const e=this.currentSourceUrl();(0,R.O)(e,this.isLiveStream?"live":"default").then(()=>this.source(e)).catch(()=>this.reloadVideoUntilAvailable(i,t))},t)):this.videojs.trigger("error",new Error("Sorry, we could not load your video"))}_initAutoplay(){"on-scroll"===this.playerOptions.autoplayMode&&this.videojs.autoplayOnScroll()}_initContextMenu(){this.playerOptions.hideContextMenu||this.videojs.contextMenu(m.A.contextMenu)}_initFloatingPlayer(){this.playerOptions.floatingWhenNotVisible!==A.rT.NONE&&this.videojs.floatingPlayer({floatTo:this.playerOptions.floatingWhenNotVisible})}_setCssClasses(){this.videojs.addClass(f.A.CLASS_PREFIX),this.videojs.addClass(f.A.playerClassPrefix(this.videojs)),f.A.setSkinClassPrefix(this.videojs,f.A.skinClassPrefix(this.videojs))}_onReady(){this._setExtendedEvents();const i=this.playerOptions.sourceOptions.source||this.playerOptions.sourceOptions.publicId;if(i){const t=Object.assign({},this.playerOptions.sourceOptions);this.source(i,t)}}_applyVolumeBarAriaLiveFix(){const i=this.videojs.$(".vjs-volume-bar");i&&i.removeAttribute("aria-live")}_onSourceChange(i,t){let{source:e,sourceOptions:s}=t;this._sendInternalAnalytics({...s&&{sourceOptions:s}}),this.isLiveStream="live"===e?.resourceConfig()?.type}_setExtendedEvents(){const i=[];this.playerOptions.playedEventPercents&&i.push({type:P.f.PERCENTS_PLAYED,percents:this.playerOptions.playedEventPercents}),this.playerOptions.playedEventTimes&&i.push({type:P.f.TIME_PLAYED,times:this.playerOptions.playedEventTimes});const t=new T.A(this.videojs,{events:i});Object.keys(t.events).forEach(i=>{t.on(i,(t,e)=>{this.videojs.trigger({type:i,eventData:e},e)})})}cloudinaryConfig(i){return this.videojs.cloudinary.cloudinaryConfig(i)}currentPublicId(){return this.videojs.cloudinary.currentPublicId()}currentSourceUrl(){return this.videojs.currentSource().src}currentPoster(){return this.videojs.cloudinary.currentPoster()}source(i){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(({publicId:i,options:t}=(0,E.a5)(i,t)),!this._isPlayerConfigValid)return;if(this.playerOptions.debug&&(t.debug=!0,(0,I.Is)(t).then(i=>{i||this.videojs.error("invalid source configuration")})),i instanceof S.A)return this.videojs.cloudinary.source(i,t);t={...this.playerOptions.sourceOptions||{},...t},t.shoppable&&this.videojs.shoppable&&this.videojs.shoppable(this.videojs,t),this._resetReloadVideo(),this._resetReTryVideoState();const e=this.videojs.options_.maxTries||3,s=this.videojs.options_.videoTimeout||55e3;return this.reTryVideoStateUntilAvailable(e,s),this.videojs.cloudinary.source(i,t)}posterOptions(i){return this.videojs.cloudinary.posterOptions(i)}skin(i){return void 0!==i&&g()(i)&&f.A.setSkinClassPrefix(this.videojs,i),f.A.skinClassPrefix(this.videojs)}playlist(i){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.playerOptions.playlistWidget={...this.playerOptions.playlistWidget||{show:!1},playlist:!0},t=Object.assign({},t,{playlistWidget:this.playerOptions.playlistWidget}),this.videojs.one(P.f.READY,async()=>{(await this.videojs.playlist(t))(i,t)}),this.videojs.cloudinary.playlist?this.videojs.cloudinary.playlist(i,t):this}playlistByTag(i){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.playerOptions.playlistWidget={...this.playerOptions.playlistWidget||{show:!1},playlistByTag:!0},t=Object.assign({},t,{playlistWidget:this.playerOptions.playlistWidget}),new Promise(e=>{this.videojs.one(P.f.READY,async()=>{(await this.videojs.playlist(t))(await this.sourcesByTag(i,t),t),e(this)})})}sourcesByTag(i){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.videojs.cloudinary.sourcesByTag(i,t)}fluid(i){return void 0===i?this.videojs.fluid():(i?this.videojs.addClass(A.gi):this.videojs.removeClass(A.gi),this.videojs.fluid(i),this.videojs.trigger(P.f.FLUID,i),this)}play(){return this.playWasCalled=!0,this.videojs.play(),this}stop(){return this.pause(),this.currentTime(0),this}playPrevious(){return this.playlist().playPrevious(),this}playNext(){return this.playlist().playNext(),this}transformation(i){return this.videojs.cloudinary.transformation(i)}sourceTypes(i){return this.videojs.cloudinary.sourceTypes(i)}sourceTransformation(i){return this.videojs.cloudinary.sourceTransformation(i)}autoShowRecommendations(i){return this.videojs.cloudinary.autoShowRecommendations(i)}duration(){return this.videojs.duration()}height(i){return i?(this.videojs.height(i),this):this.videojs.height()}width(i){return i?(this.videojs.width(i),this):this.videojs.width()}volume(i){return i?(this.videojs.volume(i),this):this.videojs.volume()}mute(){return this.isMuted()||this.videojs.muted(!0),this}unmute(){return this.isMuted()&&this.videojs.muted(!1),this}isMuted(){return this.videojs.muted()}pause(){return this.videojs.pause(),this}currentTime(i){return i||0===i?(this.videojs.currentTime(i),this):this.videojs.currentTime()}maximize(){return this.isMaximized()||this.videojs.requestFullscreen(),this}exitMaximize(){return this.isMaximized()&&this.videojs.exitFullscreen(),this}isMaximized(){return this.videojs.isFullscreen()}dispose(){this.videojs.dispose()}controls(i){return void 0===i?this.videojs.controls():(this.videojs.controls(i),this)}ima(){return{playAd:this.videojs.ima.playAd}}loop(i){return void 0===i?this.videojs.loop():(this.videojs.loop(i),this)}el(){return this.videojs.el()}}const x=i=>o().obj.merge({},m.A,i),B=function(i){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const e=(0,C.iG)(i);return{videoElement:e,options:(0,C.Wi)(e,t)}},D=function(i){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=arguments.length>2?arguments[2]:void 0;const{videoElement:s,options:o}=B(i,t);return o.profile&&console.warn("Profile option requires async initialization. Use cloudinary.player() instead of cloudinary.videoPlayer()"),new w(s,x(o),e)},k=(i,t,e)=>{const{videoElement:s,options:o}=B(i,t);return new w(s,x(o),e)},L=88==e.j?w:null}}]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Cloudinary Video Player v4.1.6-edge.
|
|
3
|
-
* Built on 2026-11-
|
|
2
|
+
* Cloudinary Video Player v4.1.6-edge.20
|
|
3
|
+
* Built on 2026-11-08T10:03:57.903Z
|
|
4
4
|
* https://github.com/cloudinary/cloudinary-video-player
|
|
5
5
|
*/
|
|
6
6
|
/*
|
|
@@ -31,7 +31,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
31
31
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
32
32
|
|
|
33
33
|
"use strict";
|
|
34
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ adaptiveStreamingPlugin)\n/* harmony export */ });\n/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! video.js */ \"../node_modules/video.js/dist/alt/video.core-exposed.js\");\n/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(video_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var hls_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! hls.js */ \"../node_modules/hls.js/dist/hls.mjs\");\n/* harmony import */ var videojs_contrib_quality_levels__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! videojs-contrib-quality-levels */ \"../node_modules/videojs-contrib-quality-levels/dist/videojs-contrib-quality-levels.js\");\n/* harmony import */ var videojs_contrib_quality_levels__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(videojs_contrib_quality_levels__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var videojs_contrib_quality_menu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! videojs-contrib-quality-menu */ \"../node_modules/videojs-contrib-quality-menu/dist/videojs-contrib-quality-menu.es.js\");\n/* harmony import */ var _videojs_contrib_hlsjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./videojs-contrib-hlsjs */ \"./plugins/adaptive-streaming/videojs-contrib-hlsjs.js\");\n/* harmony import */ var _quality_levels__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./quality-levels */ \"./plugins/adaptive-streaming/quality-levels.js\");\n/* harmony import */ var _abr_strategies__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./abr-strategies */ \"./plugins/adaptive-streaming/abr-strategies.js\");\n\n\n\n\n\n\n\nasync function adaptiveStreamingPlugin(player, options) {\n const config = {\n ..._abr_strategies__WEBPACK_IMPORTED_MODULE_6__.abrStrategies[options.strategy],\n // iOS reports HEVC renditions as not smooth despite HW decoding, so hls.js pins the lowest level.\n // Rely on measured frame drops instead. Other platforms keep the hls.js defaults.\n ...((video_js__WEBPACK_IMPORTED_MODULE_0___default().browser).IS_IOS && {\n useMediaCapabilities: false,\n capLevelOnFPSDrop: true\n }),\n videoPreference: _abr_strategies__WEBPACK_IMPORTED_MODULE_6__.hdrSupported ? {\n preferHDR: true\n } : undefined\n };\n\n //
|
|
34
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ adaptiveStreamingPlugin)\n/* harmony export */ });\n/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! video.js */ \"../node_modules/video.js/dist/alt/video.core-exposed.js\");\n/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(video_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var hls_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! hls.js */ \"../node_modules/hls.js/dist/hls.mjs\");\n/* harmony import */ var videojs_contrib_quality_levels__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! videojs-contrib-quality-levels */ \"../node_modules/videojs-contrib-quality-levels/dist/videojs-contrib-quality-levels.js\");\n/* harmony import */ var videojs_contrib_quality_levels__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(videojs_contrib_quality_levels__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var videojs_contrib_quality_menu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! videojs-contrib-quality-menu */ \"../node_modules/videojs-contrib-quality-menu/dist/videojs-contrib-quality-menu.es.js\");\n/* harmony import */ var _videojs_contrib_hlsjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./videojs-contrib-hlsjs */ \"./plugins/adaptive-streaming/videojs-contrib-hlsjs.js\");\n/* harmony import */ var _quality_levels__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./quality-levels */ \"./plugins/adaptive-streaming/quality-levels.js\");\n/* harmony import */ var _abr_strategies__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./abr-strategies */ \"./plugins/adaptive-streaming/abr-strategies.js\");\n\n\n\n\n\n\n\nasync function adaptiveStreamingPlugin(player, options) {\n const config = {\n ..._abr_strategies__WEBPACK_IMPORTED_MODULE_6__.abrStrategies[options.strategy],\n // iOS reports HEVC renditions as not smooth despite HW decoding, so hls.js pins the lowest level.\n // Rely on measured frame drops instead. Other platforms keep the hls.js defaults.\n ...((video_js__WEBPACK_IMPORTED_MODULE_0___default().browser).IS_IOS && {\n useMediaCapabilities: false,\n capLevelOnFPSDrop: true\n }),\n videoPreference: _abr_strategies__WEBPACK_IMPORTED_MODULE_6__.hdrSupported ? {\n preferHDR: true\n } : undefined\n };\n\n // withCredentials support: hls.js via xhrSetup, dash.js via tech options\n if (options.withCredentials) {\n config.xhrSetup = function (xhr) {\n xhr.withCredentials = true;\n };\n // No request type sets dash.js's default, covering the manifest and all segments\n player.tech_.options_.dash = {\n ...player.tech_.options_.dash,\n setXHRWithCredentialsForType: [undefined, true]\n };\n }\n player.tech_.options_.hlsjsConfig = config;\n player.on('loadstart', () => (0,_quality_levels__WEBPACK_IMPORTED_MODULE_5__.qualityLevels)(player, options).init());\n player.qualityMenu();\n player.adaptiveStreamingLoaded = true;\n}\n\n//# sourceURL=webpack:///./plugins/adaptive-streaming/adaptive-streaming.js?\n}");
|
|
35
35
|
|
|
36
36
|
/***/ },
|
|
37
37
|
|
|
@@ -42,7 +42,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
42
42
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
43
43
|
|
|
44
44
|
"use strict";
|
|
45
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ qualityLevels: () => (/* binding */ qualityLevels)\n/* harmony export */ });\n/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! video.js */ \"../node_modules/video.js/dist/alt/video.core-exposed.js\");\n/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(video_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var hls_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! hls.js */ \"../node_modules/hls.js/dist/hls.mjs\");\n\n\nconst qualityLevels = (player, options) => {\n const levelToRenditionHls = level => {\n let levelUrl = Array.isArray(level.url) && level.url.length > 1 ? level.url[level.urlId] : level.url;\n let rendition = {\n id: levelUrl,\n width: level.width,\n height: level.height,\n bandwidth: level.bitrate,\n // bitrate => bandwidth\n frameRate: 0,\n enabled: enableRendition => {\n var tech = player.tech({\n IWillNotUseThisInPlugins: true\n });\n if (typeof tech.sourceHandler_ != 'undefined' && typeof tech.sourceHandler_.hls != 'undefined' && tech.sourceHandler_.hls != null) {\n const hls = tech.sourceHandler_.hls;\n const levelIndex = hls.levels.findIndex(l => (Array.isArray(l.url) && l.url.length > 1 ? l.url[l.urlId] : l.url) === levelUrl);\n if (levelIndex >= 0 && enableRendition) {\n hls.currentLevel = levelIndex;\n }\n }\n return enableRendition;\n }\n };\n return rendition;\n };\n const levelToRenditionDash = level => ({\n id: level.id,\n width: level.width,\n height: level.height,\n bandwidth: level.bandwidth,\n enabled: enableRendition => {\n const dash = player.dash;\n if (dash && dash.mediaPlayer) {\n if (enableRendition) {\n dash.mediaPlayer.updateSettings({\n streaming: {\n abr: {\n autoSwitchBitrate: {\n video: false,\n audio: false\n }\n }\n }\n });\n // Find the correct quality index by resolution\n const targetQualityIndex = findDashQualityIndex(level.width, level.height);\n if (targetQualityIndex >= 0) {\n dash.mediaPlayer.setQualityFor('video', targetQualityIndex);\n // Set audio quality if mapping exists\n if (dash.audioMapper && dash.audioMapper[targetQualityIndex] !== undefined) {\n dash.mediaPlayer.setQualityFor('audio', dash.audioMapper[targetQualityIndex]);\n }\n }\n }\n }\n return enableRendition;\n }\n });\n const getRenditionsDash = () => {\n var dash = player.dash;\n if (typeof dash != 'undefined' && dash != null && typeof dash.mediaPlayer != 'undefined' && dash.mediaPlayer != null) {\n var streamInfo = dash.mediaPlayer.getActiveStream().getStreamInfo();\n var dashAdapter = dash.mediaPlayer.getDashAdapter();\n if (dashAdapter && streamInfo) {\n const periodIdx = streamInfo.index;\n var adaptation = dashAdapter.getAdaptationForType(periodIdx, 'video', streamInfo);\n }\n return adaptation.Representation_asArray;\n }\n return [];\n };\n\n // Helper function to find DASH quality index by resolution\n const findDashQualityIndex = (targetWidth, targetHeight) => {\n var dash = player.dash;\n if (dash && dash.mediaPlayer) {\n const availableQualities = dash.mediaPlayer.getBitrateInfoListFor('video');\n const targetQuality = availableQualities.find(q => q.width === targetWidth && q.height === targetHeight);\n return targetQuality ? targetQuality.qualityIndex : -1;\n }\n return -1;\n };\n\n // Clean up quality levels and reset state for new source\n const cleanupQualityLevels = () => {\n let qualityLevels = player.qualityLevels;\n if (typeof qualityLevels === 'function') {\n qualityLevels = player.qualityLevels();\n // Clear all existing quality levels\n qualityLevels.dispose();\n debugLog('Quality levels cleaned up for new source');\n }\n\n // Clean up audio tracks from previous source\n const audioTrackList = player.audioTracks();\n if (audioTrackList && audioTrackList.length > 0) {\n // Remove all existing audio tracks\n for (let i = audioTrackList.length - 1; i >= 0; i--) {\n audioTrackList.removeTrack(audioTrackList[i]);\n }\n debugLog('Audio tracks cleaned up for new source');\n }\n\n // Clean up DASH-specific state\n const dash = player.dash;\n if (dash && dash.audioMapper) {\n delete dash.audioMapper;\n debugLog('DASH audio mapper cleaned up for new source');\n }\n\n // Reset previous resolution for qualitychanged events\n previousResolution = null;\n };\n\n // Update the QualityLevels list of renditions\n const populateLevels = (levels, abrType) => {\n // Clean up existing quality levels before adding new ones\n cleanupQualityLevels();\n let qualityLevels = player.qualityLevels;\n if (typeof qualityLevels === 'function') {\n qualityLevels = player.qualityLevels();\n debugLog('QualityLevels', qualityLevels);\n switch (abrType) {\n case 'hls':\n for (let l = 0; l < levels.length; l++) {\n let level = levels[l];\n let rendition = levelToRenditionHls(level);\n qualityLevels.addQualityLevel(rendition);\n }\n break;\n case 'dash':\n {\n // Set up audio mapping for DASH\n const dash = player.dash;\n if (!dash) break;\n const videoRates = levels;\n const audioRates = dash.mediaPlayer.getBitrateInfoListFor('audio') || [];\n const normalizeFactor = videoRates.length > 0 ? videoRates[videoRates.length - 1].bandwidth : 1;\n dash.audioMapper = videoRates.map(rate => Math.round(rate.bandwidth / normalizeFactor * (audioRates.length - 1)));\n for (let l = 0; l < levels.length; l++) {\n let level = levels[l];\n let rendition = levelToRenditionDash(level);\n qualityLevels.addQualityLevel(rendition);\n }\n break;\n }\n default:\n return;\n }\n } else {\n console.warn('QualityLevels not supported');\n }\n };\n let previousResolution = null; // for qualitychanged event data\n\n // Update the selected rendition\n const populateQualityLevelsChange = currentLevel => {\n let qualityLevels = player.qualityLevels;\n if (typeof qualityLevels === 'function') {\n qualityLevels = player.qualityLevels();\n if (qualityLevels.length == 0) {\n console.warn('ERROR - no quality levels found! Patching populate levels first');\n var tech = player.tech({\n IWillNotUseThisInPlugins: true\n });\n if (typeof tech.sourceHandler_ != 'undefined' && typeof tech.sourceHandler_.hls != 'undefined' && tech.sourceHandler_.hls != null) {\n const hls = tech.sourceHandler_.hls;\n populateLevels(hls.levels, 'hls');\n }\n }\n qualityLevels.selectedIndex_ = currentLevel;\n qualityLevels.trigger({\n type: 'change',\n selectedIndex: currentLevel\n });\n }\n };\n\n // Custom 'qualitychanged' event\n const populateQualityChangedEvent = currentLevel => {\n if (currentLevel < 0) {\n return;\n }\n let qualityLevels = player.qualityLevels;\n let level = null;\n // Using videojs-contrib-quality-levels\n if (typeof qualityLevels === 'function') {\n qualityLevels = player.qualityLevels();\n level = qualityLevels.levels_[currentLevel];\n debugLog('Custom qualitychanged', 'using videojs-contrib-quality-levels');\n } else {\n // hls.js directly\n var tech = player.tech({\n IWillNotUseThisInPlugins: true\n });\n if (typeof tech.sourceHandler_ != 'undefined' && typeof tech.sourceHandler_.hls != 'undefined' && tech.sourceHandler_.hls != null) {\n const hls = tech.sourceHandler_.hls;\n level = hls.levels[currentLevel];\n debugLog('Custom qualitychanged', 'using hls.js directly');\n if (currentLevel !== hls.currentLevel) {\n debugLog('ERROR - new level differs from hls.js');\n }\n } else {\n // dash.js directly\n var dash = player.dash;\n if (typeof dash != 'undefined' && dash != null && typeof dash.mediaPlayer != 'undefined' && dash.mediaPlayer != null) {\n let renditions = getRenditionsDash();\n level = renditions[currentLevel];\n debugLog('Custom qualitychanged', 'using dash.js directly');\n }\n }\n }\n\n // Add null check for level\n if (!level) {\n debugLog('Warning: Level is undefined in populateQualityChangedEvent', {\n currentLevel\n });\n return;\n }\n let currentRes = {\n width: level.width,\n height: level.height\n };\n if (previousResolution !== currentRes) {\n let data = {\n from: previousResolution,\n to: currentRes\n };\n // Trigger custom 'qualitychanged' event on videojs\n player.trigger({\n type: 'qualitychanged',\n eventData: data\n });\n }\n previousResolution = currentRes;\n\n // Add detailed logging of current rendition\n debugLog('Current Rendition', {\n index: currentLevel,\n resolution: `${level.width}x${level.height}`,\n bitrate: `${Math.round(level.bitrate / 1000)} kbps`,\n url: Array.isArray(level.url) ? level.url[level.urlId] : level.url,\n details: level\n });\n };\n const debugLog = (label, data) => {\n if (options.debug) {\n console.log(`%c ${label}`, 'background: #3498db; color: white; padding: 2px 4px; border-radius: 2px;', data);\n }\n };\n const logAudioTrackInfo = () => {\n var tech = player.tech({\n IWillNotUseThisInPlugins: true\n });\n if (typeof tech.sourceHandler_ != 'undefined' && typeof tech.sourceHandler_.hls != 'undefined' && tech.sourceHandler_.hls != null) {\n const hls = tech.sourceHandler_.hls;\n const audioTrackId = hls.audioTrack;\n const len = hls.audioTracks.length;\n for (let i = 0; i < len; i++) {\n if (audioTrackId === i) {\n debugLog(`audio track [${i}] ${hls.audioTracks[i].name} - enabled`, hls.audioTracks[i]);\n } else {\n debugLog(`audio track [${i}] ${hls.audioTracks[i].name} - disabled`, hls.audioTracks[i]);\n }\n }\n }\n };\n\n // Helper to synchronise Video.js AudioTrackList with hls.js active track\n const updateVjsAudioTracksEnabled = activeIndex => {\n const list = player.audioTracks();\n if (!list) return;\n for (let i = 0; i < list.length; i++) {\n list[i].enabled = i === activeIndex;\n }\n // Sync complete – log for debug\n logAudioTrackInfo();\n };\n\n // Flush buffered audio by performing a tiny seek outside current range\n const flushBufferedAudio = () => {\n try {\n const cur = player.currentTime();\n const delta = 0.5; // 500 ms gap to escape current buffer\n const target = Math.min(cur + delta, player.duration() - 0.1);\n player.currentTime(target);\n player.currentTime(cur);\n } catch (e) {\n debugLog('Error while flushing buffered audio', e);\n }\n };\n\n // Force hls.js to switch track and immediately start loading fragments for it\n const selectAudioTrack = index => {\n var tech = player.tech({\n IWillNotUseThisInPlugins: true\n });\n if (typeof tech.sourceHandler_ != 'undefined' && typeof tech.sourceHandler_.hls != 'undefined' && tech.sourceHandler_.hls != null) {\n const hls = tech.sourceHandler_.hls;\n if (hls.audioTrack === index) {\n return;\n }\n hls.audioTrack = index;\n // Quickly restart loading to fill the buffer of the new audio group\n if (hls.media) {\n try {\n hls.stopLoad();\n hls.startLoad(0);\n } catch (e) {\n debugLog('Error while reloading after audioTrack switch', e);\n }\n }\n logAudioTrackInfo();\n // will flush once switch is confirmed (AUDIO_TRACK_SWITCHED)\n hls.once(hls_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Events.AUDIO_TRACK_SWITCHED, () => {\n flushBufferedAudio();\n });\n }\n };\n\n // Audio track handling\n const addAudioTrackVideojs = (track, hls) => {\n const vjsTrack = new (video_js__WEBPACK_IMPORTED_MODULE_0___default().AudioTrack)({\n id: `${track.type}-id_${track.id}-groupId_${track.groupId}-${track.name}`,\n kind: 'translation',\n label: track.name,\n language: track.lang,\n enabled: hls.audioTrack === hls.audioTracks.indexOf(track),\n default: track.default\n });\n\n // Add the track to the player's audio track list.\n player.audioTracks().addTrack(vjsTrack);\n };\n const initAudioTrackInfo = () => {\n var tech = player.tech({\n IWillNotUseThisInPlugins: true\n });\n if (typeof tech.sourceHandler_ != 'undefined' && typeof tech.sourceHandler_.hls != 'undefined' && tech.sourceHandler_.hls != null) {\n const hls = tech.sourceHandler_.hls;\n const len = hls.audioTracks.length;\n for (let i = 0; i < len; i++) {\n addAudioTrackVideojs(hls.audioTracks[i], hls);\n }\n }\n\n // Listen to the \"change\" event.\n var audioTrackList = player.audioTracks();\n audioTrackList.addEventListener('change', function () {\n var tech = player.tech({\n IWillNotUseThisInPlugins: true\n });\n if (typeof tech.sourceHandler_ != 'undefined' && typeof tech.sourceHandler_.hls != 'undefined' && tech.sourceHandler_.hls != null) {\n for (var i = 0; i < audioTrackList.length; i++) {\n var track = audioTrackList[i];\n if (track.enabled) {\n selectAudioTrack(i);\n return;\n }\n }\n }\n });\n };\n\n // Map hls.js events to QualityLevels\n const initQualityLevels = () => {\n var tech = player.tech({\n IWillNotUseThisInPlugins: true\n });\n if (typeof tech == 'undefined') {\n console.warn('ERROR - tech not found!');\n }\n\n // HLS\n if (typeof tech.sourceHandler_ != 'undefined' && typeof tech.sourceHandler_.hls != 'undefined' && tech.sourceHandler_.hls != null) {\n const hls = tech.sourceHandler_.hls;\n const manifestLoadedHandler = (eventName, data) => {\n debugLog(`HLS event: ${eventName}`, data);\n populateLevels(hls.levels, 'hls');\n initAudioTrackInfo();\n hls.off(hls_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Events.MANIFEST_LOADED, manifestLoadedHandler);\n };\n\n // If manifest is already loaded, populate levels immediately.\n if (hls.levels && hls.levels.length > 0) {\n manifestLoadedHandler('MANUAL_MANIFEST_LOADED', {});\n } else {\n hls.on(hls_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Events.MANIFEST_LOADED, manifestLoadedHandler);\n }\n hls.on(hls_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Events.LEVEL_SWITCHED, (eventName, data) => {\n debugLog(`HLS event: ${eventName}`, data);\n populateQualityLevelsChange(data.level);\n populateQualityChangedEvent(data.level);\n });\n hls.on(hls_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Events.AUDIO_TRACK_SWITCHED, (eventName, data) => {\n debugLog(`HLS event: ${eventName}`, data);\n // Make sure Video.js AudioTracks reflect the newly-selected HLS track\n if (typeof data.id !== 'undefined') {\n updateVjsAudioTracksEnabled(data.id);\n }\n // Ensure buffer flushed when switch originates from hls.js (e.g. default track)\n flushBufferedAudio();\n });\n hls.on(hls_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Events.ERROR, (eventName, data) => {\n debugLog(`HLS event: ${eventName}`, data);\n if (data.fatal) {\n player.error({\n code: 4,\n // MEDIA_ERR_SRC_NOT_SUPPORTED will trigger Utils.handleCldError\n ...data\n });\n }\n });\n } else {\n // DASH\n var dash = player.dash;\n if (typeof dash != 'undefined' && dash != null && typeof dash.mediaPlayer != 'undefined' && dash.mediaPlayer != null) {\n let renditions = getRenditionsDash();\n populateLevels(renditions, 'dash');\n dash.mediaPlayer.on('qualityChangeRendered', evt => {\n const currentVideoQuality = dash.mediaPlayer.getQualityFor('video');\n const availableQualities = dash.mediaPlayer.getBitrateInfoListFor('video');\n const currentQualityInfo = availableQualities[currentVideoQuality];\n const renditionIndex = findDashQualityIndex(currentQualityInfo.width, currentQualityInfo.height);\n if (renditionIndex >= 0) {\n debugLog(`DASH event: ${evt.type}`, evt, renditions[renditionIndex]);\n populateQualityLevelsChange(renditionIndex);\n populateQualityChangedEvent(renditionIndex);\n } else {\n console.warn('Could not find matching rendition for DASH quality change');\n }\n });\n }\n }\n };\n return {\n init: initQualityLevels\n };\n};\n\n\n//# sourceURL=webpack:///./plugins/adaptive-streaming/quality-levels.js?\n}");
|
|
45
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ qualityLevels: () => (/* binding */ qualityLevels)\n/* harmony export */ });\n/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! video.js */ \"../node_modules/video.js/dist/alt/video.core-exposed.js\");\n/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(video_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var hls_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! hls.js */ \"../node_modules/hls.js/dist/hls.mjs\");\n\n\nconst qualityLevels = (player, options) => {\n const levelToRenditionHls = level => {\n let levelUrl = Array.isArray(level.url) && level.url.length > 1 ? level.url[level.urlId] : level.url;\n let rendition = {\n id: levelUrl,\n width: level.width,\n height: level.height,\n bandwidth: level.bitrate,\n // bitrate => bandwidth\n frameRate: 0,\n enabled: enableRendition => {\n var tech = player.tech({\n IWillNotUseThisInPlugins: true\n });\n if (typeof tech.sourceHandler_ != 'undefined' && typeof tech.sourceHandler_.hls != 'undefined' && tech.sourceHandler_.hls != null) {\n const hls = tech.sourceHandler_.hls;\n const levelIndex = hls.levels.findIndex(l => (Array.isArray(l.url) && l.url.length > 1 ? l.url[l.urlId] : l.url) === levelUrl);\n if (levelIndex >= 0 && enableRendition) {\n hls.currentLevel = levelIndex;\n }\n }\n return enableRendition;\n }\n };\n return rendition;\n };\n const levelToRenditionDash = level => ({\n id: level.id,\n width: level.width,\n height: level.height,\n bandwidth: level.bandwidth,\n enabled: enableRendition => {\n const dash = player.dash;\n if (dash && dash.mediaPlayer) {\n if (enableRendition) {\n dash.mediaPlayer.updateSettings({\n streaming: {\n abr: {\n autoSwitchBitrate: {\n video: false,\n audio: false\n }\n }\n }\n });\n // Find the correct quality index by resolution\n const targetQualityIndex = findDashQualityIndex(level.width, level.height);\n if (targetQualityIndex >= 0) {\n dash.mediaPlayer.setQualityFor('video', targetQualityIndex);\n // Set audio quality if mapping exists\n if (dash.audioMapper && dash.audioMapper[targetQualityIndex] !== undefined) {\n dash.mediaPlayer.setQualityFor('audio', dash.audioMapper[targetQualityIndex]);\n }\n }\n }\n }\n return enableRendition;\n }\n });\n const getRenditionsDash = () => {\n var dash = player.dash;\n if (typeof dash != 'undefined' && dash != null && typeof dash.mediaPlayer != 'undefined' && dash.mediaPlayer != null) {\n var streamInfo = dash.mediaPlayer.getActiveStream().getStreamInfo();\n var dashAdapter = dash.mediaPlayer.getDashAdapter();\n if (dashAdapter && streamInfo) {\n const periodIdx = streamInfo.index;\n var adaptation = dashAdapter.getAdaptationForType(periodIdx, 'video', streamInfo);\n }\n return adaptation.Representation_asArray;\n }\n return [];\n };\n\n // Helper function to find DASH quality index by resolution\n const findDashQualityIndex = (targetWidth, targetHeight) => {\n var dash = player.dash;\n if (dash && dash.mediaPlayer) {\n const availableQualities = dash.mediaPlayer.getBitrateInfoListFor('video');\n const targetQuality = availableQualities.find(q => q.width === targetWidth && q.height === targetHeight);\n return targetQuality ? targetQuality.qualityIndex : -1;\n }\n return -1;\n };\n\n // Clean up quality levels and reset state for new source\n const cleanupQualityLevels = () => {\n let qualityLevels = player.qualityLevels;\n if (typeof qualityLevels === 'function') {\n qualityLevels = player.qualityLevels();\n // Clear all existing quality levels\n qualityLevels.dispose();\n debugLog('Quality levels cleaned up for new source');\n }\n\n // Clean up audio tracks from previous source\n const audioTrackList = player.audioTracks();\n if (audioTrackList && audioTrackList.length > 0) {\n // Remove all existing audio tracks\n for (let i = audioTrackList.length - 1; i >= 0; i--) {\n audioTrackList.removeTrack(audioTrackList[i]);\n }\n debugLog('Audio tracks cleaned up for new source');\n }\n\n // Clean up DASH-specific state\n const dash = player.dash;\n if (dash && dash.audioMapper) {\n delete dash.audioMapper;\n debugLog('DASH audio mapper cleaned up for new source');\n }\n\n // Reset previous resolution for qualitychanged events\n previousResolution = null;\n };\n\n // Update the QualityLevels list of renditions\n const populateLevels = (levels, abrType) => {\n // Clean up existing quality levels before adding new ones\n cleanupQualityLevels();\n let qualityLevels = player.qualityLevels;\n if (typeof qualityLevels === 'function') {\n qualityLevels = player.qualityLevels();\n debugLog('QualityLevels', qualityLevels);\n switch (abrType) {\n case 'hls':\n for (let l = 0; l < levels.length; l++) {\n let level = levels[l];\n let rendition = levelToRenditionHls(level);\n qualityLevels.addQualityLevel(rendition);\n }\n break;\n case 'dash':\n {\n // Set up audio mapping for DASH\n const dash = player.dash;\n if (!dash) break;\n const videoRates = levels;\n const audioRates = dash.mediaPlayer.getBitrateInfoListFor('audio') || [];\n const normalizeFactor = videoRates.length > 0 ? videoRates[videoRates.length - 1].bandwidth : 1;\n dash.audioMapper = videoRates.map(rate => Math.round(rate.bandwidth / normalizeFactor * (audioRates.length - 1)));\n for (let l = 0; l < levels.length; l++) {\n let level = levels[l];\n let rendition = levelToRenditionDash(level);\n qualityLevels.addQualityLevel(rendition);\n }\n break;\n }\n default:\n return;\n }\n } else {\n console.warn('QualityLevels not supported');\n }\n };\n let previousResolution = null; // for qualitychanged event data\n\n // Update the selected rendition\n const populateQualityLevelsChange = currentLevel => {\n let qualityLevels = player.qualityLevels;\n if (typeof qualityLevels === 'function') {\n qualityLevels = player.qualityLevels();\n if (qualityLevels.length == 0) {\n console.warn('ERROR - no quality levels found! Patching populate levels first');\n var tech = player.tech({\n IWillNotUseThisInPlugins: true\n });\n if (typeof tech.sourceHandler_ != 'undefined' && typeof tech.sourceHandler_.hls != 'undefined' && tech.sourceHandler_.hls != null) {\n const hls = tech.sourceHandler_.hls;\n populateLevels(hls.levels, 'hls');\n }\n }\n qualityLevels.selectedIndex_ = currentLevel;\n qualityLevels.trigger({\n type: 'change',\n selectedIndex: currentLevel\n });\n }\n };\n\n // Custom 'qualitychanged' event\n const populateQualityChangedEvent = currentLevel => {\n if (currentLevel < 0) {\n return;\n }\n let qualityLevels = player.qualityLevels;\n let level = null;\n // Using videojs-contrib-quality-levels\n if (typeof qualityLevels === 'function') {\n qualityLevels = player.qualityLevels();\n level = qualityLevels.levels_[currentLevel];\n debugLog('Custom qualitychanged', 'using videojs-contrib-quality-levels');\n } else {\n // hls.js directly\n var tech = player.tech({\n IWillNotUseThisInPlugins: true\n });\n if (typeof tech.sourceHandler_ != 'undefined' && typeof tech.sourceHandler_.hls != 'undefined' && tech.sourceHandler_.hls != null) {\n const hls = tech.sourceHandler_.hls;\n level = hls.levels[currentLevel];\n debugLog('Custom qualitychanged', 'using hls.js directly');\n if (currentLevel !== hls.currentLevel) {\n debugLog('ERROR - new level differs from hls.js');\n }\n } else {\n // dash.js directly\n var dash = player.dash;\n if (typeof dash != 'undefined' && dash != null && typeof dash.mediaPlayer != 'undefined' && dash.mediaPlayer != null) {\n let renditions = getRenditionsDash();\n level = renditions[currentLevel];\n debugLog('Custom qualitychanged', 'using dash.js directly');\n }\n }\n }\n\n // Add null check for level\n if (!level) {\n debugLog('Warning: Level is undefined in populateQualityChangedEvent', {\n currentLevel\n });\n return;\n }\n let currentRes = {\n width: level.width,\n height: level.height\n };\n if (previousResolution !== currentRes) {\n let data = {\n from: previousResolution,\n to: currentRes\n };\n // Trigger custom 'qualitychanged' event on videojs\n player.trigger({\n type: 'qualitychanged',\n eventData: data\n }, data);\n }\n previousResolution = currentRes;\n\n // Add detailed logging of current rendition\n debugLog('Current Rendition', {\n index: currentLevel,\n resolution: `${level.width}x${level.height}`,\n bitrate: `${Math.round(level.bitrate / 1000)} kbps`,\n url: Array.isArray(level.url) ? level.url[level.urlId] : level.url,\n details: level\n });\n };\n const debugLog = (label, data) => {\n if (options.debug) {\n console.log(`%c ${label}`, 'background: #3498db; color: white; padding: 2px 4px; border-radius: 2px;', data);\n }\n };\n const logAudioTrackInfo = () => {\n var tech = player.tech({\n IWillNotUseThisInPlugins: true\n });\n if (typeof tech.sourceHandler_ != 'undefined' && typeof tech.sourceHandler_.hls != 'undefined' && tech.sourceHandler_.hls != null) {\n const hls = tech.sourceHandler_.hls;\n const audioTrackId = hls.audioTrack;\n const len = hls.audioTracks.length;\n for (let i = 0; i < len; i++) {\n if (audioTrackId === i) {\n debugLog(`audio track [${i}] ${hls.audioTracks[i].name} - enabled`, hls.audioTracks[i]);\n } else {\n debugLog(`audio track [${i}] ${hls.audioTracks[i].name} - disabled`, hls.audioTracks[i]);\n }\n }\n }\n };\n\n // Helper to synchronise Video.js AudioTrackList with hls.js active track\n const updateVjsAudioTracksEnabled = activeIndex => {\n const list = player.audioTracks();\n if (!list) return;\n for (let i = 0; i < list.length; i++) {\n list[i].enabled = i === activeIndex;\n }\n // Sync complete – log for debug\n logAudioTrackInfo();\n };\n\n // Flush buffered audio by performing a tiny seek outside current range\n const flushBufferedAudio = () => {\n try {\n const cur = player.currentTime();\n const delta = 0.5; // 500 ms gap to escape current buffer\n const target = Math.min(cur + delta, player.duration() - 0.1);\n player.currentTime(target);\n player.currentTime(cur);\n } catch (e) {\n debugLog('Error while flushing buffered audio', e);\n }\n };\n\n // Force hls.js to switch track and immediately start loading fragments for it\n const selectAudioTrack = index => {\n var tech = player.tech({\n IWillNotUseThisInPlugins: true\n });\n if (typeof tech.sourceHandler_ != 'undefined' && typeof tech.sourceHandler_.hls != 'undefined' && tech.sourceHandler_.hls != null) {\n const hls = tech.sourceHandler_.hls;\n if (hls.audioTrack === index) {\n return;\n }\n hls.audioTrack = index;\n // Quickly restart loading to fill the buffer of the new audio group\n if (hls.media) {\n try {\n hls.stopLoad();\n hls.startLoad(0);\n } catch (e) {\n debugLog('Error while reloading after audioTrack switch', e);\n }\n }\n logAudioTrackInfo();\n // will flush once switch is confirmed (AUDIO_TRACK_SWITCHED)\n hls.once(hls_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Events.AUDIO_TRACK_SWITCHED, () => {\n flushBufferedAudio();\n });\n }\n };\n\n // Audio track handling\n const addAudioTrackVideojs = (track, hls) => {\n const vjsTrack = new (video_js__WEBPACK_IMPORTED_MODULE_0___default().AudioTrack)({\n id: `${track.type}-id_${track.id}-groupId_${track.groupId}-${track.name}`,\n kind: 'translation',\n label: track.name,\n language: track.lang,\n enabled: hls.audioTrack === hls.audioTracks.indexOf(track),\n default: track.default\n });\n\n // Add the track to the player's audio track list.\n player.audioTracks().addTrack(vjsTrack);\n };\n const initAudioTrackInfo = () => {\n var tech = player.tech({\n IWillNotUseThisInPlugins: true\n });\n if (typeof tech.sourceHandler_ != 'undefined' && typeof tech.sourceHandler_.hls != 'undefined' && tech.sourceHandler_.hls != null) {\n const hls = tech.sourceHandler_.hls;\n const len = hls.audioTracks.length;\n for (let i = 0; i < len; i++) {\n addAudioTrackVideojs(hls.audioTracks[i], hls);\n }\n }\n\n // Listen to the \"change\" event.\n var audioTrackList = player.audioTracks();\n audioTrackList.addEventListener('change', function () {\n var tech = player.tech({\n IWillNotUseThisInPlugins: true\n });\n if (typeof tech.sourceHandler_ != 'undefined' && typeof tech.sourceHandler_.hls != 'undefined' && tech.sourceHandler_.hls != null) {\n for (var i = 0; i < audioTrackList.length; i++) {\n var track = audioTrackList[i];\n if (track.enabled) {\n selectAudioTrack(i);\n return;\n }\n }\n }\n });\n };\n\n // Map hls.js events to QualityLevels\n const initQualityLevels = () => {\n var tech = player.tech({\n IWillNotUseThisInPlugins: true\n });\n if (typeof tech == 'undefined') {\n console.warn('ERROR - tech not found!');\n }\n\n // HLS\n if (typeof tech.sourceHandler_ != 'undefined' && typeof tech.sourceHandler_.hls != 'undefined' && tech.sourceHandler_.hls != null) {\n const hls = tech.sourceHandler_.hls;\n const manifestLoadedHandler = (eventName, data) => {\n debugLog(`HLS event: ${eventName}`, data);\n populateLevels(hls.levels, 'hls');\n initAudioTrackInfo();\n hls.off(hls_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Events.MANIFEST_LOADED, manifestLoadedHandler);\n };\n\n // If manifest is already loaded, populate levels immediately.\n if (hls.levels && hls.levels.length > 0) {\n manifestLoadedHandler('MANUAL_MANIFEST_LOADED', {});\n } else {\n hls.on(hls_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Events.MANIFEST_LOADED, manifestLoadedHandler);\n }\n hls.on(hls_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Events.LEVEL_SWITCHED, (eventName, data) => {\n debugLog(`HLS event: ${eventName}`, data);\n populateQualityLevelsChange(data.level);\n populateQualityChangedEvent(data.level);\n });\n hls.on(hls_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Events.AUDIO_TRACK_SWITCHED, (eventName, data) => {\n debugLog(`HLS event: ${eventName}`, data);\n // Make sure Video.js AudioTracks reflect the newly-selected HLS track\n if (typeof data.id !== 'undefined') {\n updateVjsAudioTracksEnabled(data.id);\n }\n // Ensure buffer flushed when switch originates from hls.js (e.g. default track)\n flushBufferedAudio();\n });\n hls.on(hls_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].Events.ERROR, (eventName, data) => {\n debugLog(`HLS event: ${eventName}`, data);\n if (data.fatal) {\n player.error({\n code: 4,\n // MEDIA_ERR_SRC_NOT_SUPPORTED will trigger Utils.handleCldError\n ...data\n });\n }\n });\n } else {\n // DASH\n var dash = player.dash;\n if (typeof dash != 'undefined' && dash != null && typeof dash.mediaPlayer != 'undefined' && dash.mediaPlayer != null) {\n let renditions = getRenditionsDash();\n populateLevels(renditions, 'dash');\n dash.mediaPlayer.on('qualityChangeRendered', evt => {\n const currentVideoQuality = dash.mediaPlayer.getQualityFor('video');\n const availableQualities = dash.mediaPlayer.getBitrateInfoListFor('video');\n const currentQualityInfo = availableQualities[currentVideoQuality];\n const renditionIndex = findDashQualityIndex(currentQualityInfo.width, currentQualityInfo.height);\n if (renditionIndex >= 0) {\n debugLog(`DASH event: ${evt.type}`, evt, renditions[renditionIndex]);\n populateQualityLevelsChange(renditionIndex);\n populateQualityChangedEvent(renditionIndex);\n } else {\n console.warn('Could not find matching rendition for DASH quality change');\n }\n });\n }\n }\n };\n return {\n init: initQualityLevels\n };\n};\n\n\n//# sourceURL=webpack:///./plugins/adaptive-streaming/quality-levels.js?\n}");
|
|
46
46
|
|
|
47
47
|
/***/ },
|
|
48
48
|
|