cloudinary-video-player 3.0.0 → 3.0.1-edge.1

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/chapters.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * Cloudinary Video Player v3.0.0
3
- * Built on 2025-06-08T14:24:10.290Z
2
+ * Cloudinary Video Player v3.0.1-edge.1
3
+ * Built on 2025-06-09T17:56:13.518Z
4
4
  * https://github.com/cloudinary/cloudinary-video-player
5
5
  */
6
6
  "use strict";
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * Cloudinary Video Player v3.0.0
3
- * Built on 2025-06-08T14:23:51.163Z
2
+ * Cloudinary Video Player v3.0.1-edge.1
3
+ * Built on 2025-06-09T17:55:54.085Z
4
4
  * https://github.com/cloudinary/cloudinary-video-player
5
5
  */
6
6
  "use strict";(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[625],{9234:(t,e,r)=>{r.d(e,{default:()=>n});var s=r(6673),a=r.n(s),i=r(9388);const o=function(){function t(t,e){return this.player=t,this.options=e,this.player.one("loadedmetadata",this.initializeChapters.bind(this)),this}return t.prototype.src=function(t){this.resetPlugin(),this.options=t,this.player.one("loadedmetadata",this.initializeChapters.bind(this))},t.prototype.detach=function(){this.resetPlugin()},t.prototype.resetPlugin=function(){this.chaptersTrack&&(this.player.$(".vjs-control-bar-chapter-display").remove(),this.player.$(".vjs-chapter-display").remove(),this.player.$$(".vjs-chapter-marker").forEach((t=>t.remove())),this.player.removeRemoteTextTrack(this.chaptersTrack),delete this.chaptersTrack)},t.prototype.getChaptersFileUrlByName=function(){const t=this.player.cloudinary.currentPublicId();if(!t)return null;return`${(0,i.KA)(`${t}-chapters.vtt`,(0,i.lP)(this.player.cloudinary.cloudinaryConfig(),{resource_type:"raw",version:"1"}))}?t=${Date.now()}`},t.prototype.initializeChapters=async function(){const t=!0===this.options?this.getChaptersFileUrlByName():this.options.url;if(t){const e={kind:"chapters",src:t,default:!0},r=this.player.addRemoteTextTrack(e);r.addEventListener("load",(()=>{this.chaptersTrack=r.track,this.setupChaptersDisplays()}))}else if(Object.entries(this.options).length){const t=this.player.addRemoteTextTrack({kind:"chapters",default:!0}),e=this.player.duration();Object.entries(this.options).forEach(((r,s,a)=>{const i=new VTTCue(parseFloat(r[0]),parseFloat(a[s+1]?a[s+1][0]:e),r[1]);t.track.addCue(i)})),this.chaptersTrack=t.track,this.setupChaptersDisplays(),this.player.controlBar.chaptersButton&&this.player.controlBar.chaptersButton.update()}},t.prototype.setupChaptersDisplays=function(){this.setupProgressBarMarkers(),this.setupProgressBarChapter(),this.setupControlBarChapter()},t.prototype.setupControlBarChapter=function(){const t=this.player.$(".vjs-control-bar-chapter-display")||document.createElement("div");t.setAttribute("class","vjs-control-bar-chapter-display");const e=this.player.$(".vjs-control-bar .vjs-spacer");e.innerHTML="",e.classList.add("vjs-control-bar-chapter-wrapper"),e.appendChild(t),this.chaptersTrack.addEventListener("cuechange",(()=>{const e=Array.from(this.chaptersTrack.activeCues);t.innerText=e.length>0?e[0].text:""}))},t.prototype.setupProgressBarMarkers=function(){const t=this.player.duration(),{seekBar:e}=this.player.controlBar.progressControl;Array.from(this.chaptersTrack.cues).forEach((r=>{if(0!==r.startTime){const s=r.startTime/t*100+"%",i=a().dom.createEl("div",void 0,{class:"vjs-chapter-marker",style:`left: ${s}`});e.el().append(i)}}))},t.prototype.setupProgressBarChapter=function(){const t=a().dom.createEl("div",void 0,{class:"vjs-chapter-display",style:`max-width: ${this.player.$(".vjs-vtt-thumbnail-display")?this.player.$(".vjs-vtt-thumbnail-display").style.width:"160px"}`}),e=this.player.getDescendant(["controlBar","progressControl","seekBar","mouseTimeDisplay"]),r=e.getDescendant(["timeTooltip"]);r.el().parentElement.prepend(t);const s=t=>{const e=t*this.player.duration(),r=Array.from(this.chaptersTrack?.cues||[]).find((t=>e>=t.startTime&&e<=t.endTime));return r?r.text:""};r.update=function(e,r,a){Object.getPrototypeOf(this).update.call(this,e,r,a),t.innerText=s(r)},"object"!=typeof this.player.vttThumbnails&&(e.update=function(e,s){const i=s*this.player_.duration(),o=e.width,n=t.clientWidth/2;r.updateTime(e,s,i,(()=>{e.width*s<n?this.el_.style.left=`${n}px`:e.width*s+n>o?this.el_.style.left=e.width-n+"px":this.el_.style.left=e.width*s+"px"})),r.write(a().time.formatTime(i))})},t}(),n=function(t,e){e.addClass("vjs-chapters"),e.chapters=new o(e,t)}}}]);
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * Cloudinary Video Player v3.0.0
3
- * Built on 2025-06-08T14:24:10.290Z
2
+ * Cloudinary Video Player v3.0.1-edge.1
3
+ * Built on 2025-06-09T17:56:13.518Z
4
4
  * https://github.com/cloudinary/cloudinary-video-player
5
5
  */
6
6
  /*!*************************************************************************************************!*\
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * Cloudinary Video Player v3.0.0
3
- * Built on 2025-06-08T14:24:10.290Z
2
+ * Cloudinary Video Player v3.0.1-edge.1
3
+ * Built on 2025-06-09T17:56:13.518Z
4
4
  * https://github.com/cloudinary/cloudinary-video-player
5
5
  */
6
6
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -827,10 +827,9 @@ __webpack_require__.r(__webpack_exports__);
827
827
  async function lazyAdaptiveStreamingPlugin(options) {
828
828
  const player = this;
829
829
  try {
830
- if (options.isDash) {
830
+ if (options.isDash && !window.dashjs) {
831
831
  await __webpack_require__.e(/*! import() | dash */ "dash").then(__webpack_require__.bind(__webpack_require__, /*! videojs-contrib-dash */ "../node_modules/videojs-contrib-dash/dist/videojs-dash.es.js"));
832
832
  }
833
- await __webpack_require__.e(/*! import() | adaptive-streaming */ "adaptive-streaming").then(__webpack_require__.bind(__webpack_require__, /*! ./adaptive-streaming */ "./plugins/adaptive-streaming/adaptive-streaming.js"));
834
833
  const {
835
834
  default: abrPlugin
836
835
  } = await __webpack_require__.e(/*! import() | adaptive-streaming */ "adaptive-streaming").then(__webpack_require__.bind(__webpack_require__, /*! ./adaptive-streaming */ "./plugins/adaptive-streaming/adaptive-streaming.js"));
@@ -1446,7 +1445,7 @@ class CloudinaryAnalytics {
1446
1445
  } = _ref;
1447
1446
  const metadata = this.getMetadata();
1448
1447
  if (metadata.cloudName && metadata.publicId) {
1449
- const isLiveStream = source.resourceConfig().type === 'live';
1448
+ const isLiveStream = source?.resourceConfig().type === 'live';
1450
1449
  this.currentVideoMetadata = metadata;
1451
1450
  this.cloudinaryAnalytics.startManualTracking({
1452
1451
  ...metadata,
@@ -1456,7 +1455,7 @@ class CloudinaryAnalytics {
1456
1455
  }, {
1457
1456
  ...(lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_0___default()(this.analyticsOptions) ? this.analyticsOptions : {}),
1458
1457
  videoPlayerType: 'cloudinary video player',
1459
- videoPlayerVersion: "3.0.0"
1458
+ videoPlayerVersion: "3.0.1-edge.1"
1460
1459
  });
1461
1460
  } else if (this.currentVideoMetadata.cloudName !== metadata.cloudName || this.currentVideoMetadata.publicId !== metadata.publicId) {
1462
1461
  this.cloudinaryAnalytics.stopManualTracking();
@@ -1851,7 +1850,7 @@ class CloudinaryContext {
1851
1850
  options.sourceTypes = options.sourceTypes || _this.sourceTypes();
1852
1851
  options.poster = options.poster || posterOptionsForCurrent();
1853
1852
  options.queryParams = Object.assign(options.queryParams || {}, options.allowUsageReport ? {
1854
- _s: `vp-${"3.0.0"}`
1853
+ _s: `vp-${"3.0.1-edge.1"}`
1855
1854
  } : {});
1856
1855
  if (options.sourceTypes.indexOf('audio') > -1) {
1857
1856
  builtSrc = new _models_audio_source_audio_source__WEBPACK_IMPORTED_MODULE_7__["default"](publicId, options);
@@ -1978,6 +1977,9 @@ class CloudinaryContext {
1978
1977
  };
1979
1978
  const refresh = () => {
1980
1979
  const src = this.source();
1980
+ if (!src) {
1981
+ return;
1982
+ }
1981
1983
  const posterOptions = Object.assign({}, this.player.cloudinary.posterOptions(), src.getInitOptions().poster);
1982
1984
  if (posterOptions.posterColor) {
1983
1985
  this.disablePoster(posterOptions.posterColor);
@@ -2828,7 +2830,7 @@ const contextMenuContent = player => {
2828
2830
  const isFullscreen = player.isFullscreen();
2829
2831
  const aboutMenuItem = {
2830
2832
  class: 'player-version',
2831
- label: 'Cloudinary Player v' + "3.0.0"
2833
+ label: 'Cloudinary Player v' + "3.0.1-edge.1"
2832
2834
  };
2833
2835
  if (!player.controls()) {
2834
2836
  return [aboutMenuItem];
@@ -5267,7 +5269,7 @@ class VideoPlayer extends _utils__WEBPACK_IMPORTED_MODULE_9__["default"].mixin(_
5267
5269
  const analyticsData = (0,_utils_get_analytics_player_options__WEBPACK_IMPORTED_MODULE_18__.getAnalyticsFromPlayerOptions)(options);
5268
5270
  const analyticsParams = new URLSearchParams(analyticsData).toString();
5269
5271
  const baseParams = new URLSearchParams({
5270
- vpVersion: "3.0.0",
5272
+ vpVersion: "3.0.1-edge.1",
5271
5273
  vpInstanceId: this.getVPInstanceId(),
5272
5274
  cloudName: options.cloudinary.cloudinaryConfig.cloud_name,
5273
5275
  ...internalAnalyticsMetadata
@@ -5457,7 +5459,7 @@ class VideoPlayer extends _utils__WEBPACK_IMPORTED_MODULE_9__["default"].mixin(_
5457
5459
  let {
5458
5460
  source
5459
5461
  } = _ref3;
5460
- if ((!lodash_isEmpty__WEBPACK_IMPORTED_MODULE_1___default()(source._chapters) || source._chapters === true) && this.videojs.chapters) {
5462
+ if ((!lodash_isEmpty__WEBPACK_IMPORTED_MODULE_1___default()(source?._chapters) || source?._chapters === true) && this.videojs.chapters) {
5461
5463
  lodash_isFunction__WEBPACK_IMPORTED_MODULE_4___default()(this.videojs.chapters) ? this.videojs.chapters(source._chapters) : this.videojs.chapters.src(source._chapters);
5462
5464
  } else if (this.videojs.chapters?.resetPlugin) {
5463
5465
  this.videojs.chapters.resetPlugin();
@@ -5477,9 +5479,9 @@ class VideoPlayer extends _utils__WEBPACK_IMPORTED_MODULE_9__["default"].mixin(_
5477
5479
  let {
5478
5480
  source
5479
5481
  } = _ref4;
5480
- if (source._visualSearch && this.videojs.visualSearch) {
5482
+ if (source?._visualSearch && this.videojs.visualSearch) {
5481
5483
  lodash_isFunction__WEBPACK_IMPORTED_MODULE_4___default()(this.videojs.visualSearch) ? this.videojs.visualSearch(source._visualSearch) : this.videojs.visualSearch.createSearchUI(source._visualSearch);
5482
- } else if (!source._visualSearch && this.videojs.visualSearch?.clearUI) {
5484
+ } else if (!source?._visualSearch && this.videojs.visualSearch?.clearUI) {
5483
5485
  this.videojs.visualSearch.clearUI();
5484
5486
  }
5485
5487
  });
@@ -5496,7 +5498,9 @@ class VideoPlayer extends _utils__WEBPACK_IMPORTED_MODULE_9__["default"].mixin(_
5496
5498
  let {
5497
5499
  source
5498
5500
  } = _ref5;
5499
- this.setTextTracks(source._textTracks);
5501
+ if (source?._textTracks) {
5502
+ this.setTextTracks(source._textTracks);
5503
+ }
5500
5504
  });
5501
5505
  }
5502
5506
  _initPerSrcBehaviors() {
@@ -5628,7 +5632,7 @@ class VideoPlayer extends _utils__WEBPACK_IMPORTED_MODULE_9__["default"].mixin(_
5628
5632
  sourceOptions
5629
5633
  })
5630
5634
  });
5631
- this.isLiveStream = source.resourceConfig().type === 'live';
5635
+ this.isLiveStream = source?.resourceConfig()?.type === 'live';
5632
5636
  }
5633
5637
  _setExtendedEvents() {
5634
5638
  const events = [];
@@ -1,7 +1,7 @@
1
1
  console.warn('[Cloudinary] The "light" video-player is deprecated and will be removed in a future release. The main player is now light by default. Please use that instead.');
2
2
  /*!
3
- * Cloudinary Video Player v3.0.0
4
- * Built on 2025-06-08T14:24:10.290Z
3
+ * Cloudinary Video Player v3.0.1-edge.1
4
+ * Built on 2025-06-09T17:56:13.518Z
5
5
  * https://github.com/cloudinary/cloudinary-video-player
6
6
  */
7
7
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -828,10 +828,9 @@ __webpack_require__.r(__webpack_exports__);
828
828
  async function lazyAdaptiveStreamingPlugin(options) {
829
829
  const player = this;
830
830
  try {
831
- if (options.isDash) {
831
+ if (options.isDash && !window.dashjs) {
832
832
  await __webpack_require__.e(/*! import() | dash */ "dash").then(__webpack_require__.bind(__webpack_require__, /*! videojs-contrib-dash */ "../node_modules/videojs-contrib-dash/dist/videojs-dash.es.js"));
833
833
  }
834
- await __webpack_require__.e(/*! import() | adaptive-streaming */ "adaptive-streaming").then(__webpack_require__.bind(__webpack_require__, /*! ./adaptive-streaming */ "./plugins/adaptive-streaming/adaptive-streaming.js"));
835
834
  const {
836
835
  default: abrPlugin
837
836
  } = await __webpack_require__.e(/*! import() | adaptive-streaming */ "adaptive-streaming").then(__webpack_require__.bind(__webpack_require__, /*! ./adaptive-streaming */ "./plugins/adaptive-streaming/adaptive-streaming.js"));
@@ -1447,7 +1446,7 @@ class CloudinaryAnalytics {
1447
1446
  } = _ref;
1448
1447
  const metadata = this.getMetadata();
1449
1448
  if (metadata.cloudName && metadata.publicId) {
1450
- const isLiveStream = source.resourceConfig().type === 'live';
1449
+ const isLiveStream = source?.resourceConfig().type === 'live';
1451
1450
  this.currentVideoMetadata = metadata;
1452
1451
  this.cloudinaryAnalytics.startManualTracking({
1453
1452
  ...metadata,
@@ -1457,7 +1456,7 @@ class CloudinaryAnalytics {
1457
1456
  }, {
1458
1457
  ...(lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_0___default()(this.analyticsOptions) ? this.analyticsOptions : {}),
1459
1458
  videoPlayerType: 'cloudinary video player',
1460
- videoPlayerVersion: "3.0.0"
1459
+ videoPlayerVersion: "3.0.1-edge.1"
1461
1460
  });
1462
1461
  } else if (this.currentVideoMetadata.cloudName !== metadata.cloudName || this.currentVideoMetadata.publicId !== metadata.publicId) {
1463
1462
  this.cloudinaryAnalytics.stopManualTracking();
@@ -1852,7 +1851,7 @@ class CloudinaryContext {
1852
1851
  options.sourceTypes = options.sourceTypes || _this.sourceTypes();
1853
1852
  options.poster = options.poster || posterOptionsForCurrent();
1854
1853
  options.queryParams = Object.assign(options.queryParams || {}, options.allowUsageReport ? {
1855
- _s: `vp-${"3.0.0"}`
1854
+ _s: `vp-${"3.0.1-edge.1"}`
1856
1855
  } : {});
1857
1856
  if (options.sourceTypes.indexOf('audio') > -1) {
1858
1857
  builtSrc = new _models_audio_source_audio_source__WEBPACK_IMPORTED_MODULE_7__["default"](publicId, options);
@@ -1979,6 +1978,9 @@ class CloudinaryContext {
1979
1978
  };
1980
1979
  const refresh = () => {
1981
1980
  const src = this.source();
1981
+ if (!src) {
1982
+ return;
1983
+ }
1982
1984
  const posterOptions = Object.assign({}, this.player.cloudinary.posterOptions(), src.getInitOptions().poster);
1983
1985
  if (posterOptions.posterColor) {
1984
1986
  this.disablePoster(posterOptions.posterColor);
@@ -2829,7 +2831,7 @@ const contextMenuContent = player => {
2829
2831
  const isFullscreen = player.isFullscreen();
2830
2832
  const aboutMenuItem = {
2831
2833
  class: 'player-version',
2832
- label: 'Cloudinary Player v' + "3.0.0"
2834
+ label: 'Cloudinary Player v' + "3.0.1-edge.1"
2833
2835
  };
2834
2836
  if (!player.controls()) {
2835
2837
  return [aboutMenuItem];
@@ -5268,7 +5270,7 @@ class VideoPlayer extends _utils__WEBPACK_IMPORTED_MODULE_9__["default"].mixin(_
5268
5270
  const analyticsData = (0,_utils_get_analytics_player_options__WEBPACK_IMPORTED_MODULE_18__.getAnalyticsFromPlayerOptions)(options);
5269
5271
  const analyticsParams = new URLSearchParams(analyticsData).toString();
5270
5272
  const baseParams = new URLSearchParams({
5271
- vpVersion: "3.0.0",
5273
+ vpVersion: "3.0.1-edge.1",
5272
5274
  vpInstanceId: this.getVPInstanceId(),
5273
5275
  cloudName: options.cloudinary.cloudinaryConfig.cloud_name,
5274
5276
  ...internalAnalyticsMetadata
@@ -5458,7 +5460,7 @@ class VideoPlayer extends _utils__WEBPACK_IMPORTED_MODULE_9__["default"].mixin(_
5458
5460
  let {
5459
5461
  source
5460
5462
  } = _ref3;
5461
- if ((!lodash_isEmpty__WEBPACK_IMPORTED_MODULE_1___default()(source._chapters) || source._chapters === true) && this.videojs.chapters) {
5463
+ if ((!lodash_isEmpty__WEBPACK_IMPORTED_MODULE_1___default()(source?._chapters) || source?._chapters === true) && this.videojs.chapters) {
5462
5464
  lodash_isFunction__WEBPACK_IMPORTED_MODULE_4___default()(this.videojs.chapters) ? this.videojs.chapters(source._chapters) : this.videojs.chapters.src(source._chapters);
5463
5465
  } else if (this.videojs.chapters?.resetPlugin) {
5464
5466
  this.videojs.chapters.resetPlugin();
@@ -5478,9 +5480,9 @@ class VideoPlayer extends _utils__WEBPACK_IMPORTED_MODULE_9__["default"].mixin(_
5478
5480
  let {
5479
5481
  source
5480
5482
  } = _ref4;
5481
- if (source._visualSearch && this.videojs.visualSearch) {
5483
+ if (source?._visualSearch && this.videojs.visualSearch) {
5482
5484
  lodash_isFunction__WEBPACK_IMPORTED_MODULE_4___default()(this.videojs.visualSearch) ? this.videojs.visualSearch(source._visualSearch) : this.videojs.visualSearch.createSearchUI(source._visualSearch);
5483
- } else if (!source._visualSearch && this.videojs.visualSearch?.clearUI) {
5485
+ } else if (!source?._visualSearch && this.videojs.visualSearch?.clearUI) {
5484
5486
  this.videojs.visualSearch.clearUI();
5485
5487
  }
5486
5488
  });
@@ -5497,7 +5499,9 @@ class VideoPlayer extends _utils__WEBPACK_IMPORTED_MODULE_9__["default"].mixin(_
5497
5499
  let {
5498
5500
  source
5499
5501
  } = _ref5;
5500
- this.setTextTracks(source._textTracks);
5502
+ if (source?._textTracks) {
5503
+ this.setTextTracks(source._textTracks);
5504
+ }
5501
5505
  });
5502
5506
  }
5503
5507
  _initPerSrcBehaviors() {
@@ -5629,7 +5633,7 @@ class VideoPlayer extends _utils__WEBPACK_IMPORTED_MODULE_9__["default"].mixin(_
5629
5633
  sourceOptions
5630
5634
  })
5631
5635
  });
5632
- this.isLiveStream = source.resourceConfig().type === 'live';
5636
+ this.isLiveStream = source?.resourceConfig()?.type === 'live';
5633
5637
  }
5634
5638
  _setExtendedEvents() {
5635
5639
  const events = [];