cloudinary-video-player 3.5.3-edge.1 → 3.5.3-edge.13
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/adaptive-streaming.js +2 -2
- package/dist/adaptive-streaming.min.js +2 -2
- package/dist/chapters.js +2 -2
- package/dist/chapters.min.js +3 -3
- package/dist/cld-video-player.css +23 -22
- package/dist/cld-video-player.js +25 -36
- package/dist/cld-video-player.light.js +25 -36
- package/dist/cld-video-player.light.min.js +4 -4
- package/dist/cld-video-player.min.css +3 -3
- package/dist/cld-video-player.min.js +4 -4
- package/dist/colors.js +2 -2
- package/dist/colors.min.js +3 -3
- 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 +3 -3
- package/dist/node_modules_lodash_throttle_js.js +2 -2
- package/dist/playlist.js +2 -2
- package/dist/playlist.min.js +3 -3
- package/dist/recommendations-overlay.js +2 -2
- package/dist/recommendations-overlay.min.js +2 -2
- package/dist/schema.json +4 -0
- package/dist/share.js +2 -2
- package/dist/share.min.js +3 -3
- package/dist/shoppable.js +2 -2
- package/dist/shoppable.min.js +2 -2
- package/dist/visual-search.js +2 -2
- package/dist/visual-search.min.js +2 -2
- package/lib/all.js +1 -1
- package/lib/chapters.js +1 -1
- package/lib/cld-video-player.js +1 -1
- package/lib/cld-video-player.min.css +2 -3
- package/lib/colors.js +1 -1
- package/lib/interaction-areas.js +1 -1
- package/lib/player.js +1 -1
- package/lib/playlist.js +1 -1
- package/lib/schema.json +4 -0
- package/lib/share.js +1 -1
- package/lib/videoPlayer.js +1 -1
- package/package.json +5 -1
package/lib/playlist.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[33],{5826:(t,e,r)=>{r.d(e,{default:()=>nt});var i=r(5871),n=r(1104),s=r(8033),o=r(3686),l=r.n(o),a=r(4679),c=r.n(a);const u=[1,4,5,6,7,10,11],p=["created_at","updated_at"],d=t=>{const e={};return c()(t)?(Object.keys(t).reduce((e,r)=>{const i=l()(r);return-1!==p.indexOf(r)?e[i]=new Date(function(t){let e=0,r=0,i=0;if(r=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(t)){for(let t,e=0;t=u[e];++e)r[t]=+r[t]||0;r[2]=(+r[2]||1)-1,r[3]=+r[3]||1,"Z"!==r[8]&&void 0!==r[9]&&(i=60*r[10]+r[11],"+"===r[9]&&(i=0-i)),e=Date.UTC(r[1],r[2],r[3],r[4],r[5]+i,r[6],r[7])}else e=NaN;return e}(t[r])):e[i]=d(t[r]),e},e),e):Array.isArray(t)?t.map(t=>d(t)):t};var h=r(5381),m=r(4466),g=r.n(m),y=r(6673),f=r.n(y);function v(t,e,r){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const _=f().dom||f(),C=f().getComponent("Component"),b=f().getComponent("ClickableComponent");class x extends b{constructor(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];super(t,...r),v(this,"_hide",()=>{this.removeClass(x.VJS_UPCOMING_VIDEO_SHOW)}),v(this,"_onPlaylistItemChange",(t,e)=>{this._hide(),this._disableTransition(()=>{e.next&&this.setItem(e.next)})}),v(this,"_show",()=>{const t=this.player().ima,e="object"===t&&t.getAdsManager();e&&e.getCurrentAd()&&!e.getCurrentAd().isLinear()||this.addClass(x.VJS_UPCOMING_VIDEO_SHOW)}),this._setEvents(t)}_setEvents(t){t.on(n.f.UP_COMING_VIDEO_SHOW,this._show),t.on(n.f.UP_COMING_VIDEO_HIDE,this._hide),t.on(n.f.PLAYLIST_ITEM_CHANGED,this._onPlaylistItemChange)}_disableTransition(t){this.addClass(x.DISABLE_TRANSITION_CLASS),t(),this.removeClass(x.DISABLE_TRANSITION_CLASS)}setTitle(t){this.getChild("upcomingVideoOverlayContent").getChild("upcomingVideoOverlayBar").getChild("upcomingVideoOverlayTitle").setContent(t.info().title||t.publicId())}setItem(t){this._source=t;const e=parseInt(window.getComputedStyle(this.el(),null).getPropertyValue("max-width"),10),r={crop:"pad",background:"auto:predominant",width:e,height:Math.round(e*(9/16))},i=this.getChild("upcomingVideoOverlayContent");this.setTitle(t),i.el().style.backgroundImage='url("'.concat(this._source.poster().url({transformation:r}),'")')}handleClick(){super.handleClick(event),this.player().cloudinary.playlist().playNext()}createEl(){return super.createEl("div",{className:"vjs-upcoming-video"})}}v(x,"DISABLE_TRANSITION_CLASS","disable-transition"),v(x,"VJS_UPCOMING_VIDEO_SHOW","vjs-upcoming-video-show");class w extends C{createEl(){return super.createEl("div",{className:"upcoming-video-overlay aspect-ratio-content"})}}class I extends C{createEl(){return super.createEl("div",{className:"vjs-upcoming-video-bar"})}}x.prototype.options_={children:["upcomingVideoOverlayContent"]},f().registerComponent("upcomingVideoOverlay",x),w.prototype.options_={children:["upcomingVideoOverlayBar"]},f().registerComponent("upcomingVideoOverlayContent",w),I.prototype.options_={children:["upcomingVideoOverlayTitle","playlistNextButton"]},f().registerComponent("upcomingVideoOverlayBar",I),f().registerComponent("upcomingVideoOverlayTitle",class extends C{setContent(t){this._contentSpan.innerText=t}createEl(){const t=super.createEl("div",{className:"vjs-control vjs-upcoming-video-title"}),e=_.createEl("div",{className:"vjs-upcoming-video-title-display",innerHTML:'<span class="vjs-control-text">Next up</span>Next up: '});return this._contentSpan=_.createEl("span",{className:"vjs-upcoming-video-title-display-label"}),e.appendChild(this._contentSpan),t.appendChild(e),t}});const O=f().getComponent("ClickableComponent"),P=class extends O{constructor(t,e){super(t,e);const r=e.type;if(!r&&"previous"!==r&&"next"!==r)throw new Error("Type must be either 'previous' or 'next'")}createEl(){const t=this.options_.type,e="vjs-icon-".concat(t,"-item");return f().dom.createEl("button",{className:"vjs-control vjs-playlist-button vjs-button ".concat(e),ariaLabel:"Playlist ".concat(t," item")})}};f().registerComponent("PlaylistNextButton",class extends P{constructor(t){super(t,{type:"next"})}handleClick(t){t.stopPropagation(),super.handleClick(t),this.player().cloudinary.playlist().playNext()}});f().registerComponent("PlaylistPreviousButton",class extends P{constructor(t){super(t,{type:"previous"})}handleClick(t){super.handleClick(t),this.player().cloudinary.playlist().playPrevious()}});const E={fluid:!1,show:!0,direction:"vertical",total:4,selector:!1,renderTo:[]};function A(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,i)}return r}function j(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?A(Object(r),!0).forEach(function(e){T(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function T(t,e,r){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const S=class{constructor(t){var e=this;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],{repeat:i=!1,autoAdvance:n=!1,presentUpcoming:s=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};T(this,"playlistByTag",function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.player().sourcesByTag(t,r).then(t=>e.player().playlist(t,r))}),this._context=t,this._sources=[],this._defaultRecResolverCache={},this._currentIndex=null,this._recommendationsHandler=null,this._autoAdvance=null,this._presentUpcoming=null,this.addUiComponents(),this.resetState=()=>{this.repeat(i),this.autoAdvance(n),this.presentUpcoming(s)},r.forEach(t=>this.enqueue(t)),this.resetState()}list(){return this._sources}player(){return this._context.player}addUiComponents(){const t=this.player().getChild("ControlBar"),e=t.children();t.addChild("playlistPreviousButton",{},e.findIndex(t=>"PlayToggle"===t.name_)),t.addChild("playlistNextButton",{},e.findIndex(t=>"PlayToggle"===t.name_)+1),this.player().addChild("upcomingVideoOverlay")}presentUpcoming(t){if(this._presentUpcoming=this._presentUpcoming||{},void 0===t)return this._presentUpcoming.delay;if(!0===t)t=10;else if(!1===t)t=!1;else if(!g()(t)||t<0)throw new Error("presentUpcoming 'delay' must be either a boolean or a positive integer.");return this._presentUpcoming.delay=t,this._setupPresentUpcoming(),this._presentUpcoming.delay}autoAdvance(t){if(this._autoAdvance=this._autoAdvance||{},void 0===t)return this._autoAdvance.delay;if(!0===t)t=0;else if(!1===t)t=!1;else if(!g()(t)||t<0)throw new Error("Auto advance 'delay' must be either a boolean or a positive integer.");return this._autoAdvance.delay=t,this._setupAutoAdvance(),this._autoAdvance.delay}_setupAutoAdvance(){this._resetAutoAdvance();const t=this._autoAdvance.delay;!1!==t&&(this._autoAdvance={delay:t,trigger:()=>{this.player().ended()&&(this._autoAdvance.timeout=setTimeout(()=>{this.playNext()},1e3*t))}},this._context.on("ended",this._autoAdvance.trigger))}dispose(){this._resetAutoAdvance(),this._resetPresentUpcoming(),this._resetRecommendations()}_resetPresentUpcoming(){this.player().trigger("upcomingvideohide"),this._presentUpcoming||(this._presentUpcoming={}),this._presentUpcoming.trigger&&this._context.off("timeupdate",this._presentUpcoming.trigger),this._presentUpcoming.trigger=null,this._presentUpcoming.showTriggered=!1}_setupPresentUpcoming(){this._resetPresentUpcoming(),!1!==this._presentUpcoming.delay&&(this._presentUpcoming.trigger=()=>{const t=this.player().currentTime(),e=this.player().duration()-t;e<1.5?this._presentUpcoming.showTriggered&&(this.player().trigger("upcomingvideohide"),this._presentUpcoming.showTriggered=!1):e<=this._presentUpcoming.delay&&!this._presentUpcoming.showTriggered&&!this.player().loop()?(this.player().trigger("upcomingvideoshow"),this._presentUpcoming.showTriggered=!0):this._presentUpcoming.showTriggered&&(e>this._presentUpcoming.delay||this.player().loop())&&(this.player().trigger("upcomingvideohide"),this._presentUpcoming.showTriggered=!1)},this._context.on("timeupdate",this._presentUpcoming.trigger))}_resetAutoAdvance(){this._autoAdvance||(this._autoAdvance={}),this._autoAdvance.timeout&&clearTimeout(this._autoAdvance.timeout),this._autoAdvance.trigger&&this._context.off("ended",this._autoAdvance.trigger),this._autoAdvance.timeout=null,this._autoAdvance.trigger=null}_resetRecommendations(){this._recommendationsHandler&&this._context.off("ended",this._recommendationsHandler)}_refreshRecommendations(){this._resetRecommendations(),this._recommendationsHandler=()=>{!1===this.autoAdvance()&&this._context.autoShowRecommendations()&&this.player().trigger("recommendationsshow")},this._context.on("ended",this._recommendationsHandler)}_refreshTextTracks(){this.player().trigger("refreshTextTracks",this.currentSource().textTracks())}_recommendationItemBuilder(t){const e=this._defaultRecResolverCache[t.objectId];if(!t.recommendations()||e&&t.recommendations()===e)return t=>({source:t,action:()=>this.playItem(t)})}currentIndex(t){if(void 0===t)return this._currentIndex;if(t>=this.length()||t<0)throw new Error("Invalid playlist index.");this._currentIndex=t;const e=this.currentSource(),r=this._recommendationItemBuilder(e);e.recommendations()||e.recommendations(this._defaultRecommendationsResolver(e));const i=e.getInitOptions?e.getInitOptions():{};this._context.source(e,j(j({},i),{},{recommendationOptions:{disableAutoShow:!0,itemBuilder:r}}));const n={playlist:this,current:e,next:this.next()};return this.player().trigger("playlistitemchanged",n),this._refreshRecommendations(),this._refreshTextTracks(),e}_defaultRecommendationsResolver(t){return this._defaultRecResolverCache[t.objectId]||(this._defaultRecResolverCache[t.objectId]=()=>{let e=this.list().indexOf(t);const r=[],i=Math.min(4,this.length()-1);for(;r.length<i&&(e=this.nextIndex(e),-1!==e);){const t=this.list()[e];r.push(t)}return r},this._defaultRecResolverCache[t.objectId])}buildSource(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._context.buildSource(t,e)}enqueue(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=t instanceof h.A?t:this.buildSource(t,e);return this._sources.push(r),r}playItem(t){let e=this.list().indexOf(t);if(-1===e)throw new Error("Invalid playlist item.");this.playAtIndex(e)}playAtIndex(t){return this.currentIndex(t),this.player().play(),this.currentSource()}currentSource(){return this.list()[this.currentIndex()]}removeAt(t){if(t>=this.length()||t<0)throw new Error("Invalid playlist index.");return this._sources.splice(t,1),this}repeat(t){return void 0===t||(this._repeat=!!t),this._repeat}first(){return this.list()[0]}last(){return this.list()[this.length()-1]}next(){const t=this.nextIndex();return-1===t?null:this.list()[t]}nextIndex(t){if((t=void 0!==t?t:this.currentIndex())>=this.length()||t<0)throw new Error("Invalid playlist index.");let e=t+1;if(t===this.length()-1){if(!this.repeat())return-1;e=0}return e}previousIndex(){return this.isFirst()?-1:this.currentIndex()-1}playFirst(){return this.playAtIndex(0)}playLast(){const t=this.list().length-1;return this.playAtIndex(t)}isLast(){return this.currentIndex()>=this.length()-1}isFirst(){return 0===this.currentIndex()}length(){return this.list().length}playNext(){let t=this.nextIndex();return-1===t?null:this.playAtIndex(t)}playPrevious(){let t=this.previousIndex();return-1===t?null:this.playAtIndex(t)}},N=(t,e)=>(t.parentNode.insertBefore(e,t),e.appendChild(t),e);var U=r(3066);function L(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,i)}return r}function D(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?L(Object(r),!0).forEach(function(e){k(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function k(t,e,r){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const R=f().dom||f(),V=f().getComponent("Component"),B={wrap:!1};class H extends V{constructor(t,e){const r=D(D({},B),e);super(t,r),this.player_=t;const i=(t,e)=>{this.options_.fluid=e,this.removeCls(),this.setCls()};r.wrap&&(()=>{const t=this.el();this.videoWrap_=R.createEl("div",{className:"cld-plw-col-player"}),this.contentEl_=this.contentEl_=R.createEl("div",{className:"cld-plw-col-list"}),N(this.player().el(),t),t.appendChild(this.videoWrap_),t.appendChild(this.contentEl_),N(this.player().el(),this.videoWrap_)})(),t.on(n.f.FLUID,i),this.addChild(n.f.PLAYLIST_PANEL,this.options_),this.setCls(),this.dispose=()=>{this.removeLayout(),super.dispose(),t.off(n.f.FLUID,i)}}getCls(){let t=["cld-video-player","cld-plw-layout"];return t.push((0,U.skinClassPrefix)(this.player())),t.push((0,U.playerClassPrefix)(this.player())),this.options_.fluid&&t.push("cld-plw-layout-fluid"),t}setCls(){this.removeClass((0,U.skinClassPrefix)(this.player())),this.getCls().forEach(t=>{this.addClass(t)})}removeCls(){this.getCls().forEach(t=>{this.removeClass(t)})}update(t,e){this.options(e),this.removeChild("PlaylistPanel"),this.addChild("PlaylistPanel",this.options_),this.trigger("playlistlayoutupdate")}removeLayout(){const t=this.el().parentElement;t&&t.appendChild(this.player().el())}createEl(){const t=super.createEl("div");return t.style.fontFamily=this.player().el().style.fontFamily,t}}f().registerComponent("playlistLayout",H);const F=H,M=class extends F{constructor(t,e){e.wrap=!0,super(t,e)}getCls(){const t=super.getCls();return t.push("cld-plw-horizontal"),t}},W=class extends F{constructor(t,e){e.wrap=!0,super(t,e)}getCls(){const t=super.getCls();return t.push("cld-plw-vertical"),t}},G=class extends F{getCls(){let t=super.getCls();return t.push("cld-plw-custom"),t}createEl(){const t=super.createEl();return this.options_.renderTo.appendChild(t),t}};function z(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,i)}return r}function Y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?z(Object(r),!0).forEach(function(e){$(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):z(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function $(t,e,r){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const q=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=((t,e)=>{const r=Y(Y({},E),e);if(r.show&&"string"==typeof r.selector&&(r.useDefaultLayout=!1,r.useCustomLayout=!0,r.renderTo=document.querySelector(r.selector),r.showAll=!0,0===!r.renderTo.length))throw new Error("Couldn't find element(s) by selector '".concat(r.selector,"' for playlist"));return r.show&&!r.selector&&(r.useDefaultLayout=!0,r.useCustomLayout=!1),r.direction="horizontal"===r.direction.toLowerCase()?"horizontal":"vertical",r.skin=t.options_.skin,r})(t,e),this.options_=e,this.player_=t,this.render();const r=(t,e)=>{this.options_.fluid=e};t.on(n.f.FLUID,r),this.options=e=>e?(this.options_=f().obj.merge(this.options_,e),t.trigger("playlistwidgetoption",this.options_.playlistWidget),this.options_):this.options_,this.dispose=()=>{this.layout_.dispose(),t.off(n.f.FLUID,r)}}render(){this.options_.useDefaultLayout&&("horizontal"===this.options_.direction?this.layout_=new M(this.player_,this.options_):this.layout_=new W(this.player_,this.options_)),this.options_.useCustomLayout&&(this.layout_=new G(this.player_,this.options_))}getLayout(){return this.layout_}update(t,e){this.options(e),"direction"===t?(this.layout_.removeLayout(),this.layout_.dispose(),this.render()):this.layout_.update(t,this.options_)}setSkin(){this.layout_.setCls()}total(){const t=parseInt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:E.total,10);return t!==this.options_.total&&"number"==typeof t&&t>0&&this.update("total",{total:t}),this}direction(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:E.direction;return"horizontal"!==t&&"vertical"!==t||this.update("direction",{direction:t}),this}},J=f().getComponent("ClickableComponent"),Z={item:null,transformation:{width:300,aspect_ratio:"16:9",crop:"pad",background:"black"}},K=class extends J{constructor(t,e){super(t,f().obj.merge(Z,e))}getItem(){return this.options_.item}getTitle(){return this.getItem().info().title}getDuration(){return" "}getThumbnail(){return this.getItem().poster().url({transformation:this.options_.transformation})}handleClick(t){t.preventDefault()}createControlTextEl(){}createEl(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"a";const e=super.createEl(t,{className:"cld-thumbnail",href:"#"}),r=super.createEl("img",{className:"cld-thumbnail-img",src:this.getThumbnail()});return e.appendChild(r),e.style.backgroundImage="url('".concat(this.getThumbnail(),"')"),e}},Q=f().dom||f(),X={source:null,next:!1};class tt extends K{constructor(t,e){super(t,f().obj.merge(X,e))}handleClick(t){super.handleClick(t),this.play()}play(){const t=this.getItem(),e=this.player().cloudinary.playlist().list().indexOf(t);if(-1===e)throw new Error("Invalid playlist item...");this.player().cloudinary.playlist().playAtIndex(e)}isCurrent(){return this.options_.current}getTitle(){return super.getTitle()}getDuration(){return super.getDuration()}createEl(){const t=super.createEl();t.classList.add("cld-plw-panel-item");const e=Q.createEl("div",{className:"cld-plw-item-info-wrap"}),r=Q.createEl("div",{className:"cld-plw-item-title"});if(this.isCurrent()){t.classList.add("cld-plw-panel-item-active");const e=Q.createEl("span",{className:"cld-plw-item-title-curr"},{},"Now Playing: ");r.appendChild(e)}const i=Q.createEl("span",{className:"cld-plw-item-title"},{},this.getTitle());r.appendChild(i);const n=Q.createEl("div",{className:"cld-plw-item-duration"},{},this.getDuration());return e.appendChild(r),e.appendChild(n),t&&t.appendChild(e),t.appendChild(e),t}}f().registerComponent("playlistPanelItem",tt);const et=tt,rt=f().getComponent("Component");f().registerComponent("playlistPanel",class extends rt{constructor(t){super(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});const e=()=>{this.render()};t.on(n.f.PLAYLIST_ITEM_CHANGED,e),this.render(),this.dispose=()=>{super.dispose(),t.off(n.f.PLAYLIST_ITEM_CHANGED,e)}}createEl(){const t=super.createEl();return t.classList.add("cld-plw-panel"),t}removeAll(){const t=this.children();for(let e=t.length-1;e>=0;--e)this.removeChild(t[e])}getItems(){const t=this.player().cloudinary.playlist(),e=t._repeat;if(this.options_.showAll)return t.list();const r=[],i=this.options_.total;let n=t.currentIndex(),s=t.list()[n];for(r.push(s);r.length<i;){if(n=t.nextIndex(n),-1===n){if(!e&&r.length>0)break;n=0}s=t.list()[n],r.push(s)}return r}render(){const t=this.getItems();this.removeAll(),t.forEach((t,e)=>{const r=new et(this.player(),f().obj.merge(this.options_,{item:t,next:1===e,current:0===e}));this.addChild(r)})}});const it={format:"json",resource_type:"video",type:"list"},nt=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=(0,i.sliceProperties)(e,"chainTarget").chainTarget;let o=null,l=null,a=null;const c=()=>{t.on(n.f.PLAYLIST_CREATED,()=>{var r;a&&a.dispose(),0!=(null===(r=e.playlistWidget)||void 0===r?void 0:r.show)&&(t.fluid_&&(e.playlistWidget.fluid=!0),t.cloudinary.fontFace&&(e.playlistWidget.fontFace=t.cloudinary.fontFace),a=new q(t,e.playlistWidget))})};return t.cloudinary.sourcesByTag=async function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=(0,s.KA)(e,Object.assign({},t.cloudinary.cloudinaryConfig(),it)),n=await fetch(i),o=await n.json(),l=d(o.resources);return r.sorter&&l.sort(r.sorter),l.map(e=>{let i=r.sourceParams||{};"function"==typeof i&&(i=i(e));const n=e.context&&e.context.custom||{},s=Object.assign({info:n},i,{publicId:e.publicId});return t.cloudinary.buildSource(s)})},function(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return void 0===e?o:(o&&(t.removeClass("vjs-playlist"),o=void 0,t.playlist().dispose(),t.off("cldsourcechanged",l)),((e,r)=>{e instanceof S?(o=e,o.resetState(),o.currentIndex(o.currentIndex())):(o=new S(t.cloudinary,e,r),o.currentIndex(0)),c(),l=(()=>{const e=()=>{o&&!o.currentSource().contains(t.currentSource())&&t.disposePlaylist()};return t.on("cldsourcechanged",e),e})(),t.addClass("vjs-playlist")})(e,i),t.trigger("playlistcreated"),r)}}},8812:(t,e,r)=>{var i=r(2140),n=/^\s+/;t.exports=function(t){return t?t.slice(0,i(t)+1).replace(n,""):t}},2140:t=>{var e=/\s/;t.exports=function(t){for(var r=t.length;r--&&e.test(t.charAt(r)););return r}},4466:(t,e,r)=>{var i=r(9445);t.exports=function(t){return"number"==typeof t&&t==i(t)}},4764:(t,e,r)=>{var i=r(5378),n=1/0;t.exports=function(t){return t?(t=i(t))===n||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}},9445:(t,e,r)=>{var i=r(4764);t.exports=function(t){var e=i(t),r=e%1;return e==e?r?e-r:e:0}},5378:(t,e,r)=>{var i=r(8812),n=r(8953),s=r(5414),o=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,a=/^0o[0-7]+$/i,c=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(s(t))return NaN;if(n(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=n(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=i(t);var r=l.test(t);return r||a.test(t)?c(t.slice(2),r?2:8):o.test(t)?NaN:+t}}}]);
|
|
1
|
+
(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[33],{5826:(t,e,r)=>{r.d(e,{default:()=>nt});var i=r(5871),n=r(1104),s=r(1865),o=r(3686),l=r.n(o),a=r(4679),c=r.n(a);const u=[1,4,5,6,7,10,11],p=["created_at","updated_at"],d=t=>{const e={};return c()(t)?(Object.keys(t).reduce((e,r)=>{const i=l()(r);return-1!==p.indexOf(r)?e[i]=new Date(function(t){let e=0,r=0,i=0;if(r=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(t)){for(let t,e=0;t=u[e];++e)r[t]=+r[t]||0;r[2]=(+r[2]||1)-1,r[3]=+r[3]||1,"Z"!==r[8]&&void 0!==r[9]&&(i=60*r[10]+r[11],"+"===r[9]&&(i=0-i)),e=Date.UTC(r[1],r[2],r[3],r[4],r[5]+i,r[6],r[7])}else e=NaN;return e}(t[r])):e[i]=d(t[r]),e},e),e):Array.isArray(t)?t.map(t=>d(t)):t};var h=r(5381),m=r(4466),g=r.n(m),y=r(6673),f=r.n(y);function v(t,e,r){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const _=f().dom||f(),C=f().getComponent("Component"),b=f().getComponent("ClickableComponent");class x extends b{constructor(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];super(t,...r),v(this,"_hide",()=>{this.removeClass(x.VJS_UPCOMING_VIDEO_SHOW)}),v(this,"_onPlaylistItemChange",(t,e)=>{this._hide(),this._disableTransition(()=>{e.next&&this.setItem(e.next)})}),v(this,"_show",()=>{const t=this.player().ima,e="object"===t&&t.getAdsManager();e&&e.getCurrentAd()&&!e.getCurrentAd().isLinear()||this.addClass(x.VJS_UPCOMING_VIDEO_SHOW)}),this._setEvents(t)}_setEvents(t){t.on(n.f.UP_COMING_VIDEO_SHOW,this._show),t.on(n.f.UP_COMING_VIDEO_HIDE,this._hide),t.on(n.f.PLAYLIST_ITEM_CHANGED,this._onPlaylistItemChange)}_disableTransition(t){this.addClass(x.DISABLE_TRANSITION_CLASS),t(),this.removeClass(x.DISABLE_TRANSITION_CLASS)}setTitle(t){this.getChild("upcomingVideoOverlayContent").getChild("upcomingVideoOverlayBar").getChild("upcomingVideoOverlayTitle").setContent(t.info().title||t.publicId())}setItem(t){this._source=t;const e=parseInt(window.getComputedStyle(this.el(),null).getPropertyValue("max-width"),10),r={crop:"pad",background:"auto:predominant",width:e,height:Math.round(e*(9/16))},i=this.getChild("upcomingVideoOverlayContent");this.setTitle(t),i.el().style.backgroundImage='url("'.concat(this._source.poster().url({transformation:r}),'")')}handleClick(){super.handleClick(event),this.player().cloudinary.playlist().playNext()}createEl(){return super.createEl("div",{className:"vjs-upcoming-video"})}}v(x,"DISABLE_TRANSITION_CLASS","disable-transition"),v(x,"VJS_UPCOMING_VIDEO_SHOW","vjs-upcoming-video-show");class w extends C{createEl(){return super.createEl("div",{className:"upcoming-video-overlay aspect-ratio-content"})}}class I extends C{createEl(){return super.createEl("div",{className:"vjs-upcoming-video-bar"})}}x.prototype.options_={children:["upcomingVideoOverlayContent"]},f().registerComponent("upcomingVideoOverlay",x),w.prototype.options_={children:["upcomingVideoOverlayBar"]},f().registerComponent("upcomingVideoOverlayContent",w),I.prototype.options_={children:["upcomingVideoOverlayTitle","playlistNextButton"]},f().registerComponent("upcomingVideoOverlayBar",I),f().registerComponent("upcomingVideoOverlayTitle",class extends C{setContent(t){this._contentSpan.innerText=t}createEl(){const t=super.createEl("div",{className:"vjs-control vjs-upcoming-video-title"}),e=_.createEl("div",{className:"vjs-upcoming-video-title-display",innerHTML:'<span class="vjs-control-text">Next up</span>Next up: '});return this._contentSpan=_.createEl("span",{className:"vjs-upcoming-video-title-display-label"}),e.appendChild(this._contentSpan),t.appendChild(e),t}});const O=f().getComponent("ClickableComponent"),P=class extends O{constructor(t,e){super(t,e);const r=e.type;if(!r&&"previous"!==r&&"next"!==r)throw new Error("Type must be either 'previous' or 'next'")}createEl(){const t=this.options_.type,e="vjs-icon-".concat(t,"-item");return f().dom.createEl("button",{className:"vjs-control vjs-playlist-button vjs-button ".concat(e),ariaLabel:"Playlist ".concat(t," item")})}};f().registerComponent("PlaylistNextButton",class extends P{constructor(t){super(t,{type:"next"})}handleClick(t){t.stopPropagation(),super.handleClick(t),this.player().cloudinary.playlist().playNext()}});f().registerComponent("PlaylistPreviousButton",class extends P{constructor(t){super(t,{type:"previous"})}handleClick(t){super.handleClick(t),this.player().cloudinary.playlist().playPrevious()}});const E={fluid:!1,show:!0,direction:"vertical",total:4,selector:!1,renderTo:[]};function A(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,i)}return r}function j(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?A(Object(r),!0).forEach(function(e){T(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function T(t,e,r){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const S=class{constructor(t){var e=this;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],{repeat:i=!1,autoAdvance:n=!1,presentUpcoming:s=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};T(this,"playlistByTag",function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.player().sourcesByTag(t,r).then(t=>e.player().playlist(t,r))}),this._context=t,this._sources=[],this._defaultRecResolverCache={},this._currentIndex=null,this._recommendationsHandler=null,this._autoAdvance=null,this._presentUpcoming=null,this.addUiComponents(),this.resetState=()=>{this.repeat(i),this.autoAdvance(n),this.presentUpcoming(s)},r.forEach(t=>this.enqueue(t)),this.resetState()}list(){return this._sources}player(){return this._context.player}addUiComponents(){const t=this.player().getChild("ControlBar"),e=t.children();t.addChild("playlistPreviousButton",{},e.findIndex(t=>"PlayToggle"===t.name_)),t.addChild("playlistNextButton",{},e.findIndex(t=>"PlayToggle"===t.name_)+1),this.player().addChild("upcomingVideoOverlay")}presentUpcoming(t){if(this._presentUpcoming=this._presentUpcoming||{},void 0===t)return this._presentUpcoming.delay;if(!0===t)t=10;else if(!1===t)t=!1;else if(!g()(t)||t<0)throw new Error("presentUpcoming 'delay' must be either a boolean or a positive integer.");return this._presentUpcoming.delay=t,this._setupPresentUpcoming(),this._presentUpcoming.delay}autoAdvance(t){if(this._autoAdvance=this._autoAdvance||{},void 0===t)return this._autoAdvance.delay;if(!0===t)t=0;else if(!1===t)t=!1;else if(!g()(t)||t<0)throw new Error("Auto advance 'delay' must be either a boolean or a positive integer.");return this._autoAdvance.delay=t,this._setupAutoAdvance(),this._autoAdvance.delay}_setupAutoAdvance(){this._resetAutoAdvance();const t=this._autoAdvance.delay;!1!==t&&(this._autoAdvance={delay:t,trigger:()=>{this.player().ended()&&(this._autoAdvance.timeout=setTimeout(()=>{this.playNext()},1e3*t))}},this._context.on("ended",this._autoAdvance.trigger))}dispose(){this._resetAutoAdvance(),this._resetPresentUpcoming(),this._resetRecommendations()}_resetPresentUpcoming(){this.player().trigger("upcomingvideohide"),this._presentUpcoming||(this._presentUpcoming={}),this._presentUpcoming.trigger&&this._context.off("timeupdate",this._presentUpcoming.trigger),this._presentUpcoming.trigger=null,this._presentUpcoming.showTriggered=!1}_setupPresentUpcoming(){this._resetPresentUpcoming(),!1!==this._presentUpcoming.delay&&(this._presentUpcoming.trigger=()=>{const t=this.player().currentTime(),e=this.player().duration()-t;e<1.5?this._presentUpcoming.showTriggered&&(this.player().trigger("upcomingvideohide"),this._presentUpcoming.showTriggered=!1):e<=this._presentUpcoming.delay&&!this._presentUpcoming.showTriggered&&!this.player().loop()?(this.player().trigger("upcomingvideoshow"),this._presentUpcoming.showTriggered=!0):this._presentUpcoming.showTriggered&&(e>this._presentUpcoming.delay||this.player().loop())&&(this.player().trigger("upcomingvideohide"),this._presentUpcoming.showTriggered=!1)},this._context.on("timeupdate",this._presentUpcoming.trigger))}_resetAutoAdvance(){this._autoAdvance||(this._autoAdvance={}),this._autoAdvance.timeout&&clearTimeout(this._autoAdvance.timeout),this._autoAdvance.trigger&&this._context.off("ended",this._autoAdvance.trigger),this._autoAdvance.timeout=null,this._autoAdvance.trigger=null}_resetRecommendations(){this._recommendationsHandler&&this._context.off("ended",this._recommendationsHandler)}_refreshRecommendations(){this._resetRecommendations(),this._recommendationsHandler=()=>{!1===this.autoAdvance()&&this._context.autoShowRecommendations()&&this.player().trigger("recommendationsshow")},this._context.on("ended",this._recommendationsHandler)}_refreshTextTracks(){this.player().trigger("refreshTextTracks",this.currentSource().textTracks())}_recommendationItemBuilder(t){const e=this._defaultRecResolverCache[t.objectId];if(!t.recommendations()||e&&t.recommendations()===e)return t=>({source:t,action:()=>this.playItem(t)})}currentIndex(t){if(void 0===t)return this._currentIndex;if(t>=this.length()||t<0)throw new Error("Invalid playlist index.");this._currentIndex=t;const e=this.currentSource(),r=this._recommendationItemBuilder(e);e.recommendations()||e.recommendations(this._defaultRecommendationsResolver(e));const i=e.getInitOptions?e.getInitOptions():{};this._context.source(e,j(j({},i),{},{recommendationOptions:{disableAutoShow:!0,itemBuilder:r}}));const n={playlist:this,current:e,next:this.next()};return this.player().trigger("playlistitemchanged",n),this._refreshRecommendations(),this._refreshTextTracks(),e}_defaultRecommendationsResolver(t){return this._defaultRecResolverCache[t.objectId]||(this._defaultRecResolverCache[t.objectId]=()=>{let e=this.list().indexOf(t);const r=[],i=Math.min(4,this.length()-1);for(;r.length<i&&(e=this.nextIndex(e),-1!==e);){const t=this.list()[e];r.push(t)}return r},this._defaultRecResolverCache[t.objectId])}buildSource(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._context.buildSource(t,e)}enqueue(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=t instanceof h.A?t:this.buildSource(t,e);return this._sources.push(r),r}playItem(t){let e=this.list().indexOf(t);if(-1===e)throw new Error("Invalid playlist item.");this.playAtIndex(e)}playAtIndex(t){return this.currentIndex(t),this.player().play(),this.currentSource()}currentSource(){return this.list()[this.currentIndex()]}removeAt(t){if(t>=this.length()||t<0)throw new Error("Invalid playlist index.");return this._sources.splice(t,1),this}repeat(t){return void 0===t||(this._repeat=!!t),this._repeat}first(){return this.list()[0]}last(){return this.list()[this.length()-1]}next(){const t=this.nextIndex();return-1===t?null:this.list()[t]}nextIndex(t){if((t=void 0!==t?t:this.currentIndex())>=this.length()||t<0)throw new Error("Invalid playlist index.");let e=t+1;if(t===this.length()-1){if(!this.repeat())return-1;e=0}return e}previousIndex(){return this.isFirst()?-1:this.currentIndex()-1}playFirst(){return this.playAtIndex(0)}playLast(){const t=this.list().length-1;return this.playAtIndex(t)}isLast(){return this.currentIndex()>=this.length()-1}isFirst(){return 0===this.currentIndex()}length(){return this.list().length}playNext(){let t=this.nextIndex();return-1===t?null:this.playAtIndex(t)}playPrevious(){let t=this.previousIndex();return-1===t?null:this.playAtIndex(t)}},N=(t,e)=>(t.parentNode.insertBefore(e,t),e.appendChild(t),e);var U=r(3066);function L(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,i)}return r}function D(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?L(Object(r),!0).forEach(function(e){k(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function k(t,e,r){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const R=f().dom||f(),V=f().getComponent("Component"),B={wrap:!1};class H extends V{constructor(t,e){const r=D(D({},B),e);super(t,r),this.player_=t;const i=(t,e)=>{this.options_.fluid=e,this.removeCls(),this.setCls()};r.wrap&&(()=>{const t=this.el();this.videoWrap_=R.createEl("div",{className:"cld-plw-col-player"}),this.contentEl_=this.contentEl_=R.createEl("div",{className:"cld-plw-col-list"}),N(this.player().el(),t),t.appendChild(this.videoWrap_),t.appendChild(this.contentEl_),N(this.player().el(),this.videoWrap_)})(),t.on(n.f.FLUID,i),this.addChild(n.f.PLAYLIST_PANEL,this.options_),this.setCls(),this.dispose=()=>{this.removeLayout(),super.dispose(),t.off(n.f.FLUID,i)}}getCls(){let t=["cld-video-player","cld-plw-layout"];return t.push((0,U.skinClassPrefix)(this.player())),t.push((0,U.playerClassPrefix)(this.player())),this.options_.fluid&&t.push("cld-plw-layout-fluid"),t}setCls(){this.removeClass((0,U.skinClassPrefix)(this.player())),this.getCls().forEach(t=>{this.addClass(t)})}removeCls(){this.getCls().forEach(t=>{this.removeClass(t)})}update(t,e){this.options(e),this.removeChild("PlaylistPanel"),this.addChild("PlaylistPanel",this.options_),this.trigger("playlistlayoutupdate")}removeLayout(){const t=this.el().parentElement;t&&t.appendChild(this.player().el())}createEl(){const t=super.createEl("div");return t.style.fontFamily=this.player().el().style.fontFamily,t}}f().registerComponent("playlistLayout",H);const F=H,M=class extends F{constructor(t,e){e.wrap=!0,super(t,e)}getCls(){const t=super.getCls();return t.push("cld-plw-horizontal"),t}},W=class extends F{constructor(t,e){e.wrap=!0,super(t,e)}getCls(){const t=super.getCls();return t.push("cld-plw-vertical"),t}},G=class extends F{getCls(){let t=super.getCls();return t.push("cld-plw-custom"),t}createEl(){const t=super.createEl();return this.options_.renderTo.appendChild(t),t}};function z(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,i)}return r}function Y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?z(Object(r),!0).forEach(function(e){$(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):z(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function $(t,e,r){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const q=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=((t,e)=>{const r=Y(Y({},E),e);if(r.show&&"string"==typeof r.selector&&(r.useDefaultLayout=!1,r.useCustomLayout=!0,r.renderTo=document.querySelector(r.selector),r.showAll=!0,0===!r.renderTo.length))throw new Error("Couldn't find element(s) by selector '".concat(r.selector,"' for playlist"));return r.show&&!r.selector&&(r.useDefaultLayout=!0,r.useCustomLayout=!1),r.direction="horizontal"===r.direction.toLowerCase()?"horizontal":"vertical",r.skin=t.options_.skin,r})(t,e),this.options_=e,this.player_=t,this.render();const r=(t,e)=>{this.options_.fluid=e};t.on(n.f.FLUID,r),this.options=e=>e?(this.options_=f().obj.merge(this.options_,e),t.trigger("playlistwidgetoption",this.options_.playlistWidget),this.options_):this.options_,this.dispose=()=>{this.layout_.dispose(),t.off(n.f.FLUID,r)}}render(){this.options_.useDefaultLayout&&("horizontal"===this.options_.direction?this.layout_=new M(this.player_,this.options_):this.layout_=new W(this.player_,this.options_)),this.options_.useCustomLayout&&(this.layout_=new G(this.player_,this.options_))}getLayout(){return this.layout_}update(t,e){this.options(e),"direction"===t?(this.layout_.removeLayout(),this.layout_.dispose(),this.render()):this.layout_.update(t,this.options_)}setSkin(){this.layout_.setCls()}total(){const t=parseInt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:E.total,10);return t!==this.options_.total&&"number"==typeof t&&t>0&&this.update("total",{total:t}),this}direction(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:E.direction;return"horizontal"!==t&&"vertical"!==t||this.update("direction",{direction:t}),this}},J=f().getComponent("ClickableComponent"),Z={item:null,transformation:{width:300,aspect_ratio:"16:9",crop:"pad",background:"black"}},K=class extends J{constructor(t,e){super(t,f().obj.merge(Z,e))}getItem(){return this.options_.item}getTitle(){return this.getItem().info().title}getDuration(){return" "}getThumbnail(){return this.getItem().poster().url({transformation:this.options_.transformation})}handleClick(t){t.preventDefault()}createControlTextEl(){}createEl(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"a";const e=super.createEl(t,{className:"cld-thumbnail",href:"#"}),r=super.createEl("img",{className:"cld-thumbnail-img",src:this.getThumbnail()});return e.appendChild(r),e.style.backgroundImage="url('".concat(this.getThumbnail(),"')"),e}},Q=f().dom||f(),X={source:null,next:!1};class tt extends K{constructor(t,e){super(t,f().obj.merge(X,e))}handleClick(t){super.handleClick(t),this.play()}play(){const t=this.getItem(),e=this.player().cloudinary.playlist().list().indexOf(t);if(-1===e)throw new Error("Invalid playlist item...");this.player().cloudinary.playlist().playAtIndex(e)}isCurrent(){return this.options_.current}getTitle(){return super.getTitle()}getDuration(){return super.getDuration()}createEl(){const t=super.createEl();t.classList.add("cld-plw-panel-item");const e=Q.createEl("div",{className:"cld-plw-item-info-wrap"}),r=Q.createEl("div",{className:"cld-plw-item-title"});if(this.isCurrent()){t.classList.add("cld-plw-panel-item-active");const e=Q.createEl("span",{className:"cld-plw-item-title-curr"},{},"Now Playing: ");r.appendChild(e)}const i=Q.createEl("span",{className:"cld-plw-item-title"},{},this.getTitle());r.appendChild(i);const n=Q.createEl("div",{className:"cld-plw-item-duration"},{},this.getDuration());return e.appendChild(r),e.appendChild(n),t&&t.appendChild(e),t.appendChild(e),t}}f().registerComponent("playlistPanelItem",tt);const et=tt,rt=f().getComponent("Component");f().registerComponent("playlistPanel",class extends rt{constructor(t){super(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});const e=()=>{this.render()};t.on(n.f.PLAYLIST_ITEM_CHANGED,e),this.render(),this.dispose=()=>{super.dispose(),t.off(n.f.PLAYLIST_ITEM_CHANGED,e)}}createEl(){const t=super.createEl();return t.classList.add("cld-plw-panel"),t}removeAll(){const t=this.children();for(let e=t.length-1;e>=0;--e)this.removeChild(t[e])}getItems(){const t=this.player().cloudinary.playlist(),e=t._repeat;if(this.options_.showAll)return t.list();const r=[],i=this.options_.total;let n=t.currentIndex(),s=t.list()[n];for(r.push(s);r.length<i;){if(n=t.nextIndex(n),-1===n){if(!e&&r.length>0)break;n=0}s=t.list()[n],r.push(s)}return r}render(){const t=this.getItems();this.removeAll(),t.forEach((t,e)=>{const r=new et(this.player(),f().obj.merge(this.options_,{item:t,next:1===e,current:0===e}));this.addChild(r)})}});const it={format:"json",resource_type:"video",type:"list"},nt=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=(0,i.sliceProperties)(e,"chainTarget").chainTarget;let o=null,l=null,a=null;const c=()=>{t.on(n.f.PLAYLIST_CREATED,()=>{var r;a&&a.dispose(),0!=(null===(r=e.playlistWidget)||void 0===r?void 0:r.show)&&(t.fluid_&&(e.playlistWidget.fluid=!0),t.cloudinary.fontFace&&(e.playlistWidget.fontFace=t.cloudinary.fontFace),a=new q(t,e.playlistWidget))})};return t.cloudinary.sourcesByTag=async function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=(0,s.KA)(e,Object.assign({},t.cloudinary.cloudinaryConfig(),it)),n=await fetch(i),o=await n.json(),l=d(o.resources);return r.sorter&&l.sort(r.sorter),l.map(e=>{let i=r.sourceParams||{};"function"==typeof i&&(i=i(e));const n=e.context&&e.context.custom||{},s=Object.assign({info:n},i,{publicId:e.publicId});return t.cloudinary.buildSource(s)})},function(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return void 0===e?o:(o&&(t.removeClass("vjs-playlist"),o=void 0,t.playlist().dispose(),t.off("cldsourcechanged",l)),((e,r)=>{e instanceof S?(o=e,o.resetState(),o.currentIndex(o.currentIndex())):(o=new S(t.cloudinary,e,r),o.currentIndex(0)),c(),l=(()=>{const e=()=>{o&&!o.currentSource().contains(t.currentSource())&&t.disposePlaylist()};return t.on("cldsourcechanged",e),e})(),t.addClass("vjs-playlist")})(e,i),t.trigger("playlistcreated"),r)}}},8812:(t,e,r)=>{var i=r(2140),n=/^\s+/;t.exports=function(t){return t?t.slice(0,i(t)+1).replace(n,""):t}},2140:t=>{var e=/\s/;t.exports=function(t){for(var r=t.length;r--&&e.test(t.charAt(r)););return r}},4466:(t,e,r)=>{var i=r(1826);t.exports=function(t){return"number"==typeof t&&t==i(t)}},4764:(t,e,r)=>{var i=r(5378),n=1/0;t.exports=function(t){return t?(t=i(t))===n||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}},1826:(t,e,r)=>{var i=r(4764);t.exports=function(t){var e=i(t),r=e%1;return e==e?r?e-r:e:0}},5378:(t,e,r)=>{var i=r(8812),n=r(8953),s=r(5414),o=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,a=/^0o[0-7]+$/i,c=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(s(t))return NaN;if(n(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=n(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=i(t);var r=l.test(t);return r||a.test(t)?c(t.slice(2),r?2:8):o.test(t)?NaN:+t}}}]);
|
package/lib/schema.json
CHANGED
package/lib/share.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[976],{2130:(e,t,o)=>{o.d(t,{default:()=>p});var n=o(6673),r=o.n(n);const i=r().getComponent("ClickableComponent");r().registerComponent("ShareDownloadButton",class extends i{constructor(e){super(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})}handleClick(e){super.handleClick(e),this.player().share&&"function"==typeof this.player().share.download&&this.player().share.download()}createEl(){const e=r().dom.createEl("button",{className:"vjs-control vjs-share-download-button vjs-button",ariaLabel:"Download video",title:"Download video"}),t=r().dom.createEl("span",{className:"vjs-icon-file-download vjs-icon-placeholder"});e.appendChild(t);const o=r().dom.createEl("span",{className:"vjs-loading-spinner"});return e.appendChild(o),e}setPreparing(e){const t=this.el();e?(t.classList.add("vjs-waiting"),t.setAttribute("title","Download is being prepared")):(t.classList.remove("vjs-waiting"),t.setAttribute("title","Download video"))}});var a=o(
|
|
1
|
+
(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[976],{2130:(e,t,o)=>{o.d(t,{default:()=>p});var n=o(6673),r=o.n(n);const i=r().getComponent("ClickableComponent");r().registerComponent("ShareDownloadButton",class extends i{constructor(e){super(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})}handleClick(e){super.handleClick(e),this.player().share&&"function"==typeof this.player().share.download&&this.player().share.download()}createEl(){const e=r().dom.createEl("button",{className:"vjs-control vjs-share-download-button vjs-button",ariaLabel:"Download video",title:"Download video"}),t=r().dom.createEl("span",{className:"vjs-icon-file-download vjs-icon-placeholder"});e.appendChild(t);const o=r().dom.createEl("span",{className:"vjs-loading-spinner"});return e.appendChild(o),e}setPreparing(e){const t=this.el();e?(t.classList.add("vjs-waiting"),t.setAttribute("title","Download is being prepared")):(t.classList.remove("vjs-waiting"),t.setAttribute("title","Download video"))}});var a=o(1865),l=o(4319),c=o.n(l);function d(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function s(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?d(Object(o),!0).forEach(function(t){u(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):d(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function u(e,t,o){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}const p=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=(arguments.length>1?arguments[1]:void 0)||this;t.addClass("vjs-share");const o=()=>{const e=t.getChild("ControlBar");if(!e||e.getChild("ShareDownloadButton"))return;const o=e.children().findIndex(e=>"FullscreenToggle"===e.name_);e.addChild("ShareDownloadButton",{},-1!==o?o:void 0)};e.download&&o(),t.share={download:()=>{var e;const o=(()=>{var e,o,n;const r=null===(e=t.currentSource)||void 0===e?void 0:e.call(t);if(!r)return null;const i=["format","video_codec","streaming_profile"],l=e=>{if(Array.isArray(e))return e.map(l);if(e&&"object"==typeof e){const t=c()(e,i);return Object.keys(t).forEach(e=>{t[e]=l(t[e])}),t}return e},d=l(t.cloudinary.transformation()||{}),u=null===(o=t.cloudinary.currentPublicId())||void 0===o||null===(o=o.split("/"))||void 0===o?void 0:o.pop(),p=s(s(s({},t.cloudinary.cloudinaryConfig()),d),{},{resource_type:"video",format:"mp4",video_codec:"h264",flags:"streaming_attachment:".concat(u)});return r.isAdaptive&&Object.assign(p,{crop:"limit",width:1920,height:1920}),"AudioSource"===(null===(n=t.cloudinary.source())||void 0===n?void 0:n.getType())&&Object.assign(p,{format:"mp3",video_codec:void 0}),(0,a.KA)(t.cloudinary.currentPublicId(),p)})();if(!o)return void console.warn("Share plugin: Unable to resolve download URL.");const n=[423],r=null===(e=t.controlBar)||void 0===e?void 0:e.getChild("ShareDownloadButton"),i=e=>{var t;null==r||null===(t=r.setPreparing)||void 0===t||t.call(r,e)},l=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const t=await fetch(o,{method:"HEAD"});if(n.includes(t.status)&&e<60)return await new Promise(e=>setTimeout(e,1e4)),l(e+1);i(!1),(()=>{const e=document.createElement("a");e.href=o,e.download="",document.body.appendChild(e),e.click(),document.body.removeChild(e)})()};i(!0),l()},addDownloadButton:o,removeDownloadButton:()=>{if(!t.controlBar)return;const e=t.controlBar.getChild("ShareDownloadButton");e&&t.controlBar.removeChild(e)}}}}}]);
|