cloudinary-video-player 2.0.5 → 2.1.0
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 +7 -7
- package/dist/chapters.light.js +7 -7
- package/dist/chapters.light.min.js +1 -1
- package/dist/chapters.min.js +1 -1
- package/dist/cld-video-player.css +5 -5
- package/dist/cld-video-player.js +3852 -1479
- package/dist/cld-video-player.light.css +5 -5
- package/dist/cld-video-player.light.js +2495 -901
- package/dist/cld-video-player.light.min.css +1 -1
- package/dist/cld-video-player.light.min.js +1 -1
- package/dist/cld-video-player.light.min.js.LICENSE.txt +1 -5
- package/dist/cld-video-player.min.css +1 -1
- package/dist/cld-video-player.min.js +1 -1
- package/dist/cld-video-player.min.js.LICENSE.txt +1 -5
- package/dist/debug.js +11 -11
- package/dist/debug.light.js +11 -11
- package/dist/debug.light.min.js +1 -1
- package/dist/debug.min.js +1 -1
- package/dist/ima.js +21 -9
- package/dist/ima.light.js +21 -9
- package/dist/ima.light.min.js +1 -1
- package/dist/ima.min.js +1 -1
- package/dist/interaction-areas.js +28 -28
- package/dist/interaction-areas.light.js +28 -28
- package/dist/interaction-areas.light.min.js +1 -1
- package/dist/interaction-areas.min.js +1 -1
- package/dist/playlist.js +40 -44
- package/dist/playlist.light.js +40 -44
- package/dist/playlist.light.min.js +1 -1
- package/dist/playlist.min.js +1 -1
- package/dist/recommendations-overlay.js +2 -2
- package/dist/recommendations-overlay.light.js +2 -2
- package/dist/recommendations-overlay.light.min.js +1 -1
- package/dist/recommendations-overlay.min.js +1 -1
- package/dist/shoppable.js +60 -50
- package/dist/shoppable.light.js +60 -50
- package/dist/shoppable.light.min.js +1 -1
- package/dist/shoppable.min.js +1 -1
- package/lib/all.js +1 -1
- package/lib/all.js.LICENSE.txt +1 -5
- package/lib/chapters.js +1 -1
- package/lib/cld-video-player.js +1 -1
- package/lib/cld-video-player.js.LICENSE.txt +1 -5
- package/lib/cld-video-player.min.css +2 -2
- package/lib/debug.js +1 -1
- package/lib/ima.js +1 -1
- package/lib/interaction-areas.js +1 -1
- package/lib/player.js +3 -0
- package/lib/player.js.LICENSE.txt +19 -0
- package/lib/playlist.js +1 -1
- package/lib/recommendations-overlay.js +1 -1
- package/lib/shoppable.js +1 -1
- package/lib/videoPlayer.js +1 -1
- package/lib/videoPlayer.js.LICENSE.txt +1 -5
- package/lib/videoPlayerWithProfile.js +1 -1
- package/lib/videoPlayerWithProfile.js.LICENSE.txt +1 -5
- package/package.json +32 -32
package/dist/playlist.js
CHANGED
|
@@ -157,12 +157,12 @@ class PlaylistButton extends ClickableComponent {
|
|
|
157
157
|
// The `createEl` function of a component creates its DOM element.
|
|
158
158
|
createEl() {
|
|
159
159
|
const type = this.options_.type;
|
|
160
|
-
const typeCssClass =
|
|
160
|
+
const typeCssClass = `vjs-icon-${type}-item`;
|
|
161
161
|
return video_js__WEBPACK_IMPORTED_MODULE_0___default().dom.createEl('button', {
|
|
162
162
|
// Prefixing classes of elements within a player with "vjs-"
|
|
163
163
|
// is a convention used in Video.js.
|
|
164
|
-
className:
|
|
165
|
-
ariaLabel:
|
|
164
|
+
className: `vjs-control vjs-playlist-button vjs-button ${typeCssClass}`,
|
|
165
|
+
ariaLabel: `Playlist ${type} item`
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
}
|
|
@@ -272,9 +272,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
272
272
|
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(video_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
273
273
|
/* harmony import */ var _upcoming_video_overlay_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./upcoming-video-overlay.scss */ "./plugins/playlist/ui/components/upcoming-video-overlay.scss");
|
|
274
274
|
/* harmony import */ var utils_consts__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! utils/consts */ "./utils/consts.js");
|
|
275
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
276
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
277
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
278
275
|
|
|
279
276
|
|
|
280
277
|
|
|
@@ -284,33 +281,13 @@ const dom = (video_js__WEBPACK_IMPORTED_MODULE_0___default().dom) || (video_js__
|
|
|
284
281
|
const Component = video_js__WEBPACK_IMPORTED_MODULE_0___default().getComponent('Component');
|
|
285
282
|
const ClickableComponent = video_js__WEBPACK_IMPORTED_MODULE_0___default().getComponent('ClickableComponent');
|
|
286
283
|
class UpcomingVideoOverlay extends ClickableComponent {
|
|
284
|
+
static DISABLE_TRANSITION_CLASS = 'disable-transition';
|
|
285
|
+
static VJS_UPCOMING_VIDEO_SHOW = 'vjs-upcoming-video-show';
|
|
287
286
|
constructor(player) {
|
|
288
287
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
289
288
|
args[_key - 1] = arguments[_key];
|
|
290
289
|
}
|
|
291
290
|
super(player, ...args);
|
|
292
|
-
_defineProperty(this, "_hide", () => {
|
|
293
|
-
this.removeClass(UpcomingVideoOverlay.VJS_UPCOMING_VIDEO_SHOW);
|
|
294
|
-
});
|
|
295
|
-
_defineProperty(this, "_onPlaylistItemChange", (_, event) => {
|
|
296
|
-
this._hide();
|
|
297
|
-
this._disableTransition(() => {
|
|
298
|
-
if (event.next) {
|
|
299
|
-
this.setItem(event.next);
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
});
|
|
303
|
-
_defineProperty(this, "_show", () => {
|
|
304
|
-
const ima = this.player().ima;
|
|
305
|
-
const adsManager = ima === 'object' && ima.getAdsManager();
|
|
306
|
-
if (adsManager) {
|
|
307
|
-
if (!adsManager.getCurrentAd() || adsManager.getCurrentAd().isLinear()) {
|
|
308
|
-
this.addClass(UpcomingVideoOverlay.VJS_UPCOMING_VIDEO_SHOW);
|
|
309
|
-
}
|
|
310
|
-
} else {
|
|
311
|
-
this.addClass(UpcomingVideoOverlay.VJS_UPCOMING_VIDEO_SHOW);
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
291
|
this._setEvents(player);
|
|
315
292
|
}
|
|
316
293
|
_setEvents(player) {
|
|
@@ -318,11 +295,33 @@ class UpcomingVideoOverlay extends ClickableComponent {
|
|
|
318
295
|
player.on(utils_consts__WEBPACK_IMPORTED_MODULE_2__.PLAYER_EVENT.UP_COMING_VIDEO_HIDE, this._hide);
|
|
319
296
|
player.on(utils_consts__WEBPACK_IMPORTED_MODULE_2__.PLAYER_EVENT.PLAYLIST_ITEM_CHANGED, this._onPlaylistItemChange);
|
|
320
297
|
}
|
|
298
|
+
_hide = () => {
|
|
299
|
+
this.removeClass(UpcomingVideoOverlay.VJS_UPCOMING_VIDEO_SHOW);
|
|
300
|
+
};
|
|
321
301
|
_disableTransition(block) {
|
|
322
302
|
this.addClass(UpcomingVideoOverlay.DISABLE_TRANSITION_CLASS);
|
|
323
303
|
block();
|
|
324
304
|
this.removeClass(UpcomingVideoOverlay.DISABLE_TRANSITION_CLASS);
|
|
325
305
|
}
|
|
306
|
+
_onPlaylistItemChange = (_, event) => {
|
|
307
|
+
this._hide();
|
|
308
|
+
this._disableTransition(() => {
|
|
309
|
+
if (event.next) {
|
|
310
|
+
this.setItem(event.next);
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
};
|
|
314
|
+
_show = () => {
|
|
315
|
+
const ima = this.player().ima;
|
|
316
|
+
const adsManager = ima === 'object' && ima.getAdsManager();
|
|
317
|
+
if (adsManager) {
|
|
318
|
+
if (!adsManager.getCurrentAd() || adsManager.getCurrentAd().isLinear()) {
|
|
319
|
+
this.addClass(UpcomingVideoOverlay.VJS_UPCOMING_VIDEO_SHOW);
|
|
320
|
+
}
|
|
321
|
+
} else {
|
|
322
|
+
this.addClass(UpcomingVideoOverlay.VJS_UPCOMING_VIDEO_SHOW);
|
|
323
|
+
}
|
|
324
|
+
};
|
|
326
325
|
setTitle(source) {
|
|
327
326
|
const title = this.getChild('upcomingVideoOverlayContent').getChild('upcomingVideoOverlayBar').getChild('upcomingVideoOverlayTitle');
|
|
328
327
|
title.setContent(source.info().title || source.publicId());
|
|
@@ -339,9 +338,9 @@ class UpcomingVideoOverlay extends ClickableComponent {
|
|
|
339
338
|
};
|
|
340
339
|
const content = this.getChild('upcomingVideoOverlayContent');
|
|
341
340
|
this.setTitle(source);
|
|
342
|
-
content.el().style.backgroundImage =
|
|
341
|
+
content.el().style.backgroundImage = `url("${this._source.poster().url({
|
|
343
342
|
transformation
|
|
344
|
-
})
|
|
343
|
+
})}")`;
|
|
345
344
|
}
|
|
346
345
|
handleClick() {
|
|
347
346
|
super.handleClick(event);
|
|
@@ -353,8 +352,6 @@ class UpcomingVideoOverlay extends ClickableComponent {
|
|
|
353
352
|
});
|
|
354
353
|
}
|
|
355
354
|
}
|
|
356
|
-
_defineProperty(UpcomingVideoOverlay, "DISABLE_TRANSITION_CLASS", 'disable-transition');
|
|
357
|
-
_defineProperty(UpcomingVideoOverlay, "VJS_UPCOMING_VIDEO_SHOW", 'vjs-upcoming-video-show');
|
|
358
355
|
class UpcomingVideoOverlayContent extends Component {
|
|
359
356
|
createEl() {
|
|
360
357
|
// Content wraps image and bar
|
|
@@ -806,7 +803,7 @@ const modifyOptions = (player, opt) => {
|
|
|
806
803
|
options.renderTo = document.querySelector(options.selector);
|
|
807
804
|
options.showAll = true;
|
|
808
805
|
if (!options.renderTo.length === 0) {
|
|
809
|
-
throw new Error(
|
|
806
|
+
throw new Error(`Couldn't find element(s) by selector '${options.selector}' for playlist`);
|
|
810
807
|
}
|
|
811
808
|
}
|
|
812
809
|
if (options.show && !options.selector) {
|
|
@@ -939,9 +936,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
939
936
|
/* harmony import */ var _components_playlist_buttons__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/playlist-buttons */ "./plugins/playlist/ui/components/playlist-buttons.js");
|
|
940
937
|
/* harmony import */ var _playlist_const__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./playlist.const */ "./plugins/playlist/ui/playlist.const.js");
|
|
941
938
|
/* harmony import */ var _playlist_scss__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./playlist.scss */ "./plugins/playlist/ui/playlist.scss");
|
|
942
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
943
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
944
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
945
939
|
|
|
946
940
|
|
|
947
941
|
|
|
@@ -950,17 +944,12 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
950
944
|
|
|
951
945
|
class Playlist {
|
|
952
946
|
constructor(context) {
|
|
953
|
-
|
|
954
|
-
let _sources = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
947
|
+
let sources = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
955
948
|
let {
|
|
956
949
|
repeat = false,
|
|
957
950
|
autoAdvance = false,
|
|
958
951
|
presentUpcoming = false
|
|
959
952
|
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
960
|
-
_defineProperty(this, "playlistByTag", function (tag) {
|
|
961
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
962
|
-
return _this.player().sourcesByTag(tag, options).then(sources => _this.player().playlist(sources, options));
|
|
963
|
-
});
|
|
964
953
|
this._context = context;
|
|
965
954
|
this._sources = [];
|
|
966
955
|
this._defaultRecResolverCache = {};
|
|
@@ -974,7 +963,7 @@ class Playlist {
|
|
|
974
963
|
this.autoAdvance(autoAdvance);
|
|
975
964
|
this.presentUpcoming(presentUpcoming);
|
|
976
965
|
};
|
|
977
|
-
|
|
966
|
+
sources.forEach(source => this.enqueue(source));
|
|
978
967
|
this.resetState();
|
|
979
968
|
}
|
|
980
969
|
list() {
|
|
@@ -1276,6 +1265,13 @@ class Playlist {
|
|
|
1276
1265
|
}
|
|
1277
1266
|
return this.playAtIndex(previousIndex);
|
|
1278
1267
|
}
|
|
1268
|
+
playlistByTag = (() => {
|
|
1269
|
+
var _this = this;
|
|
1270
|
+
return function (tag) {
|
|
1271
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1272
|
+
return _this.player().sourcesByTag(tag, options).then(sources => _this.player().playlist(sources, options));
|
|
1273
|
+
};
|
|
1274
|
+
})();
|
|
1279
1275
|
}
|
|
1280
1276
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Playlist);
|
|
1281
1277
|
|
|
@@ -1346,7 +1342,7 @@ class Thumbnail extends ClickableComponent {
|
|
|
1346
1342
|
src: this.getThumbnail()
|
|
1347
1343
|
});
|
|
1348
1344
|
el.appendChild(img);
|
|
1349
|
-
el.style.backgroundImage =
|
|
1345
|
+
el.style.backgroundImage = `url('${this.getThumbnail()}')`;
|
|
1350
1346
|
return el;
|
|
1351
1347
|
}
|
|
1352
1348
|
}
|
package/dist/playlist.light.js
CHANGED
|
@@ -157,12 +157,12 @@ class PlaylistButton extends ClickableComponent {
|
|
|
157
157
|
// The `createEl` function of a component creates its DOM element.
|
|
158
158
|
createEl() {
|
|
159
159
|
const type = this.options_.type;
|
|
160
|
-
const typeCssClass =
|
|
160
|
+
const typeCssClass = `vjs-icon-${type}-item`;
|
|
161
161
|
return video_js__WEBPACK_IMPORTED_MODULE_0___default().dom.createEl('button', {
|
|
162
162
|
// Prefixing classes of elements within a player with "vjs-"
|
|
163
163
|
// is a convention used in Video.js.
|
|
164
|
-
className:
|
|
165
|
-
ariaLabel:
|
|
164
|
+
className: `vjs-control vjs-playlist-button vjs-button ${typeCssClass}`,
|
|
165
|
+
ariaLabel: `Playlist ${type} item`
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
}
|
|
@@ -272,9 +272,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
272
272
|
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(video_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
273
273
|
/* harmony import */ var _upcoming_video_overlay_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./upcoming-video-overlay.scss */ "./plugins/playlist/ui/components/upcoming-video-overlay.scss");
|
|
274
274
|
/* harmony import */ var utils_consts__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! utils/consts */ "./utils/consts.js");
|
|
275
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
276
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
277
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
278
275
|
|
|
279
276
|
|
|
280
277
|
|
|
@@ -284,33 +281,13 @@ const dom = (video_js__WEBPACK_IMPORTED_MODULE_0___default().dom) || (video_js__
|
|
|
284
281
|
const Component = video_js__WEBPACK_IMPORTED_MODULE_0___default().getComponent('Component');
|
|
285
282
|
const ClickableComponent = video_js__WEBPACK_IMPORTED_MODULE_0___default().getComponent('ClickableComponent');
|
|
286
283
|
class UpcomingVideoOverlay extends ClickableComponent {
|
|
284
|
+
static DISABLE_TRANSITION_CLASS = 'disable-transition';
|
|
285
|
+
static VJS_UPCOMING_VIDEO_SHOW = 'vjs-upcoming-video-show';
|
|
287
286
|
constructor(player) {
|
|
288
287
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
289
288
|
args[_key - 1] = arguments[_key];
|
|
290
289
|
}
|
|
291
290
|
super(player, ...args);
|
|
292
|
-
_defineProperty(this, "_hide", () => {
|
|
293
|
-
this.removeClass(UpcomingVideoOverlay.VJS_UPCOMING_VIDEO_SHOW);
|
|
294
|
-
});
|
|
295
|
-
_defineProperty(this, "_onPlaylistItemChange", (_, event) => {
|
|
296
|
-
this._hide();
|
|
297
|
-
this._disableTransition(() => {
|
|
298
|
-
if (event.next) {
|
|
299
|
-
this.setItem(event.next);
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
});
|
|
303
|
-
_defineProperty(this, "_show", () => {
|
|
304
|
-
const ima = this.player().ima;
|
|
305
|
-
const adsManager = ima === 'object' && ima.getAdsManager();
|
|
306
|
-
if (adsManager) {
|
|
307
|
-
if (!adsManager.getCurrentAd() || adsManager.getCurrentAd().isLinear()) {
|
|
308
|
-
this.addClass(UpcomingVideoOverlay.VJS_UPCOMING_VIDEO_SHOW);
|
|
309
|
-
}
|
|
310
|
-
} else {
|
|
311
|
-
this.addClass(UpcomingVideoOverlay.VJS_UPCOMING_VIDEO_SHOW);
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
291
|
this._setEvents(player);
|
|
315
292
|
}
|
|
316
293
|
_setEvents(player) {
|
|
@@ -318,11 +295,33 @@ class UpcomingVideoOverlay extends ClickableComponent {
|
|
|
318
295
|
player.on(utils_consts__WEBPACK_IMPORTED_MODULE_2__.PLAYER_EVENT.UP_COMING_VIDEO_HIDE, this._hide);
|
|
319
296
|
player.on(utils_consts__WEBPACK_IMPORTED_MODULE_2__.PLAYER_EVENT.PLAYLIST_ITEM_CHANGED, this._onPlaylistItemChange);
|
|
320
297
|
}
|
|
298
|
+
_hide = () => {
|
|
299
|
+
this.removeClass(UpcomingVideoOverlay.VJS_UPCOMING_VIDEO_SHOW);
|
|
300
|
+
};
|
|
321
301
|
_disableTransition(block) {
|
|
322
302
|
this.addClass(UpcomingVideoOverlay.DISABLE_TRANSITION_CLASS);
|
|
323
303
|
block();
|
|
324
304
|
this.removeClass(UpcomingVideoOverlay.DISABLE_TRANSITION_CLASS);
|
|
325
305
|
}
|
|
306
|
+
_onPlaylistItemChange = (_, event) => {
|
|
307
|
+
this._hide();
|
|
308
|
+
this._disableTransition(() => {
|
|
309
|
+
if (event.next) {
|
|
310
|
+
this.setItem(event.next);
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
};
|
|
314
|
+
_show = () => {
|
|
315
|
+
const ima = this.player().ima;
|
|
316
|
+
const adsManager = ima === 'object' && ima.getAdsManager();
|
|
317
|
+
if (adsManager) {
|
|
318
|
+
if (!adsManager.getCurrentAd() || adsManager.getCurrentAd().isLinear()) {
|
|
319
|
+
this.addClass(UpcomingVideoOverlay.VJS_UPCOMING_VIDEO_SHOW);
|
|
320
|
+
}
|
|
321
|
+
} else {
|
|
322
|
+
this.addClass(UpcomingVideoOverlay.VJS_UPCOMING_VIDEO_SHOW);
|
|
323
|
+
}
|
|
324
|
+
};
|
|
326
325
|
setTitle(source) {
|
|
327
326
|
const title = this.getChild('upcomingVideoOverlayContent').getChild('upcomingVideoOverlayBar').getChild('upcomingVideoOverlayTitle');
|
|
328
327
|
title.setContent(source.info().title || source.publicId());
|
|
@@ -339,9 +338,9 @@ class UpcomingVideoOverlay extends ClickableComponent {
|
|
|
339
338
|
};
|
|
340
339
|
const content = this.getChild('upcomingVideoOverlayContent');
|
|
341
340
|
this.setTitle(source);
|
|
342
|
-
content.el().style.backgroundImage =
|
|
341
|
+
content.el().style.backgroundImage = `url("${this._source.poster().url({
|
|
343
342
|
transformation
|
|
344
|
-
})
|
|
343
|
+
})}")`;
|
|
345
344
|
}
|
|
346
345
|
handleClick() {
|
|
347
346
|
super.handleClick(event);
|
|
@@ -353,8 +352,6 @@ class UpcomingVideoOverlay extends ClickableComponent {
|
|
|
353
352
|
});
|
|
354
353
|
}
|
|
355
354
|
}
|
|
356
|
-
_defineProperty(UpcomingVideoOverlay, "DISABLE_TRANSITION_CLASS", 'disable-transition');
|
|
357
|
-
_defineProperty(UpcomingVideoOverlay, "VJS_UPCOMING_VIDEO_SHOW", 'vjs-upcoming-video-show');
|
|
358
355
|
class UpcomingVideoOverlayContent extends Component {
|
|
359
356
|
createEl() {
|
|
360
357
|
// Content wraps image and bar
|
|
@@ -806,7 +803,7 @@ const modifyOptions = (player, opt) => {
|
|
|
806
803
|
options.renderTo = document.querySelector(options.selector);
|
|
807
804
|
options.showAll = true;
|
|
808
805
|
if (!options.renderTo.length === 0) {
|
|
809
|
-
throw new Error(
|
|
806
|
+
throw new Error(`Couldn't find element(s) by selector '${options.selector}' for playlist`);
|
|
810
807
|
}
|
|
811
808
|
}
|
|
812
809
|
if (options.show && !options.selector) {
|
|
@@ -939,9 +936,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
939
936
|
/* harmony import */ var _components_playlist_buttons__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/playlist-buttons */ "./plugins/playlist/ui/components/playlist-buttons.js");
|
|
940
937
|
/* harmony import */ var _playlist_const__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./playlist.const */ "./plugins/playlist/ui/playlist.const.js");
|
|
941
938
|
/* harmony import */ var _playlist_scss__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./playlist.scss */ "./plugins/playlist/ui/playlist.scss");
|
|
942
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
943
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
944
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
945
939
|
|
|
946
940
|
|
|
947
941
|
|
|
@@ -950,17 +944,12 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
950
944
|
|
|
951
945
|
class Playlist {
|
|
952
946
|
constructor(context) {
|
|
953
|
-
|
|
954
|
-
let _sources = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
947
|
+
let sources = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
955
948
|
let {
|
|
956
949
|
repeat = false,
|
|
957
950
|
autoAdvance = false,
|
|
958
951
|
presentUpcoming = false
|
|
959
952
|
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
960
|
-
_defineProperty(this, "playlistByTag", function (tag) {
|
|
961
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
962
|
-
return _this.player().sourcesByTag(tag, options).then(sources => _this.player().playlist(sources, options));
|
|
963
|
-
});
|
|
964
953
|
this._context = context;
|
|
965
954
|
this._sources = [];
|
|
966
955
|
this._defaultRecResolverCache = {};
|
|
@@ -974,7 +963,7 @@ class Playlist {
|
|
|
974
963
|
this.autoAdvance(autoAdvance);
|
|
975
964
|
this.presentUpcoming(presentUpcoming);
|
|
976
965
|
};
|
|
977
|
-
|
|
966
|
+
sources.forEach(source => this.enqueue(source));
|
|
978
967
|
this.resetState();
|
|
979
968
|
}
|
|
980
969
|
list() {
|
|
@@ -1276,6 +1265,13 @@ class Playlist {
|
|
|
1276
1265
|
}
|
|
1277
1266
|
return this.playAtIndex(previousIndex);
|
|
1278
1267
|
}
|
|
1268
|
+
playlistByTag = (() => {
|
|
1269
|
+
var _this = this;
|
|
1270
|
+
return function (tag) {
|
|
1271
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1272
|
+
return _this.player().sourcesByTag(tag, options).then(sources => _this.player().playlist(sources, options));
|
|
1273
|
+
};
|
|
1274
|
+
})();
|
|
1279
1275
|
}
|
|
1280
1276
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Playlist);
|
|
1281
1277
|
|
|
@@ -1346,7 +1342,7 @@ class Thumbnail extends ClickableComponent {
|
|
|
1346
1342
|
src: this.getThumbnail()
|
|
1347
1343
|
});
|
|
1348
1344
|
el.appendChild(img);
|
|
1349
|
-
el.style.backgroundImage =
|
|
1345
|
+
el.style.backgroundImage = `url('${this.getThumbnail()}')`;
|
|
1350
1346
|
return el;
|
|
1351
1347
|
}
|
|
1352
1348
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[33],{5826:(t,e,s)=>{"use strict";s.d(e,{default:()=>X});var i=s(4679),n=s.n(i),r=s(5871),o=s(1104),l=s(8033),a=s(3686),c=s.n(a);const d=[1,4,5,6,7,10,11],u=["created_at","updated_at"],p=t=>{const e={};return n()(t)?(Object.keys(t).reduce(((e,s)=>{const i=c()(s);return-1!==u.indexOf(s)?e[i]=new Date(function(t){let e=0,s=0,i=0;if(s=/^(\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=d[e];++e)s[t]=+s[t]||0;s[2]=(+s[2]||1)-1,s[3]=+s[3]||1,"Z"!==s[8]&&void 0!==s[9]&&(i=60*s[10]+s[11],"+"===s[9]&&(i=0-i)),e=Date.UTC(s[1],s[2],s[3],s[4],s[5]+i,s[6],s[7])}else e=NaN;return e}(t[s])):e[i]=p(t[s]),e}),e),e):Array.isArray(t)?t.map((t=>p(t))):t};var h=s(5381),m=s(4466),g=s.n(m),y=s(6673),_=s.n(y);function v(t,e,s){var i;return(e="symbol"==typeof(i=function(t,e){if("object"!=typeof t||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var i=s.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(e,"string"))?i:i+"")in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}const f=_().dom||_(),C=_().getComponent("Component"),x=_().getComponent("ClickableComponent");class I extends x{constructor(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),i=1;i<e;i++)s[i-1]=arguments[i];super(t,...s),v(this,"_hide",(()=>{this.removeClass(I.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(I.VJS_UPCOMING_VIDEO_SHOW)})),this._setEvents(t)}_setEvents(t){t.on(o.f.UP_COMING_VIDEO_SHOW,this._show),t.on(o.f.UP_COMING_VIDEO_HIDE,this._hide),t.on(o.f.PLAYLIST_ITEM_CHANGED,this._onPlaylistItemChange)}_disableTransition(t){this.addClass(I.DISABLE_TRANSITION_CLASS),t(),this.removeClass(I.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),s={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:s}),'")')}handleClick(){super.handleClick(event),this.player().cloudinary.playlist().playNext()}createEl(){return super.createEl("div",{className:"vjs-upcoming-video"})}}v(I,"DISABLE_TRANSITION_CLASS","disable-transition"),v(I,"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 A extends C{createEl(){return super.createEl("div",{className:"vjs-upcoming-video-bar"})}}I.prototype.options_={children:["upcomingVideoOverlayContent"]},_().registerComponent("upcomingVideoOverlay",I),w.prototype.options_={children:["upcomingVideoOverlayBar"]},_().registerComponent("upcomingVideoOverlayContent",w),A.prototype.options_={children:["upcomingVideoOverlayTitle","playlistNextButton"]},_().registerComponent("upcomingVideoOverlayBar",A),_().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=f.createEl("div",{className:"vjs-upcoming-video-title-display",innerHTML:'<span class="vjs-control-text">Next up</span>Next up: '});return this._contentSpan=f.createEl("span",{className:"vjs-upcoming-video-title-display-label"}),e.appendChild(this._contentSpan),t.appendChild(e),t}});const b=_().getComponent("ClickableComponent");const E=class extends b{constructor(t,e){super(t,e);const s=e.type;if(!s&&"previous"!==s&&"next"!==s)throw new Error("Type must be either 'previous' or 'next'")}createEl(){const t=this.options_.type,e="vjs-icon-".concat(t,"-item");return _().dom.createEl("button",{className:"vjs-control vjs-playlist-button vjs-button ".concat(e),ariaLabel:"Playlist ".concat(t," item")})}};class T extends E{constructor(t){super(t,{type:"next"})}handleClick(t){t.stopPropagation(),super.handleClick(t),this.player().cloudinary.playlist().playNext()}}_().registerComponent("PlaylistNextButton",T);class N extends E{constructor(t){super(t,{type:"previous"})}handleClick(t){super.handleClick(t),this.player().cloudinary.playlist().playPrevious()}}_().registerComponent("PlaylistPreviousButton",N);const P={fluid:!1,show:!0,direction:"vertical",total:4,selector:!1,renderTo:[]};function S(t,e,s){var i;return(e="symbol"==typeof(i=function(t,e){if("object"!=typeof t||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var i=s.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(e,"string"))?i:i+"")in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}const U=class{constructor(t){var e=this;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],{repeat:i=!1,autoAdvance:n=!1,presentUpcoming:r=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};S(this,"playlistByTag",(function(t){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.player().sourcesByTag(t,s).then((t=>e.player().playlist(t,s)))})),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(r)},s.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;if(!1===t)return;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(),s=this._recommendationItemBuilder(e);e.recommendations()||e.recommendations(this._defaultRecommendationsResolver(e)),this._context.source(e,{recommendationOptions:{disableAutoShow:!0,itemBuilder:s}});const i={playlist:this,current:e,next:this.next()};return this.player().trigger("playlistitemchanged",i),this._refreshRecommendations(),this._refreshTextTracks(),e}_defaultRecommendationsResolver(t){const e=this._defaultRecResolverCache[t.objectId];return e||(this._defaultRecResolverCache[t.objectId]=()=>{let e=this.list().indexOf(t);const s=[],i=Math.min(4,this.length()-1);for(;s.length<i&&(e=this.nextIndex(e),-1!==e);){const t=this.list()[e];s.push(t)}return s},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 s=t instanceof h.A?t:this.buildSource(t,e);return this._sources.push(s),s}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)}},L=(t,e)=>(t.parentNode.insertBefore(e,t),e.appendChild(t),e);var O=s(3066);const j=_().dom||_(),k=_().getComponent("Component"),D={wrap:!1};class R extends k{constructor(t,e){const s={...D,...e};super(t,s),this.player_=t;const i=(t,e)=>{this.options_.fluid=e,this.removeCls(),this.setCls()},n=()=>{const t=this.el();this.videoWrap_=j.createEl("div",{className:"cld-plw-col-player"}),this.contentEl_=this.contentEl_=j.createEl("div",{className:"cld-plw-col-list"}),L(this.player().el(),t),t.appendChild(this.videoWrap_),t.appendChild(this.contentEl_),L(this.player().el(),this.videoWrap_)};s.wrap&&n(),t.on(o.f.FLUID,i),this.addChild(o.f.PLAYLIST_PANEL,this.options_),this.setCls(),this.dispose=()=>{this.removeLayout(),super.dispose(),t.off(o.f.FLUID,i)}}getCls(){let t=["cld-video-player","cld-plw-layout"];return t.push((0,O.skinClassPrefix)(this.player())),t.push((0,O.playerClassPrefix)(this.player())),this.options_.fluid&&t.push("cld-plw-layout-fluid"),t}setCls(){this.removeClass((0,O.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}}_().registerComponent("playlistLayout",R);const V=R;const B=class extends V{constructor(t,e){e.wrap=!0,super(t,e)}getCls(){const t=super.getCls();return t.push("cld-plw-horizontal"),t}};const H=class extends V{constructor(t,e){e.wrap=!0,super(t,e)}getCls(){const t=super.getCls();return t.push("cld-plw-vertical"),t}};const F=class extends V{getCls(){let t=super.getCls();return t.push("cld-plw-custom"),t}createEl(){const t=super.createEl();return this.options_.renderTo.appendChild(t),t}};const M=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=((t,e)=>{const s={...P,...e};if(s.show&&"string"==typeof s.selector&&(s.useDefaultLayout=!1,s.useCustomLayout=!0,s.renderTo=document.querySelector(s.selector),s.showAll=!0,0===!s.renderTo.length))throw new Error("Couldn't find element(s) by selector '".concat(s.selector,"' for playlist"));return s.show&&!s.selector&&(s.useDefaultLayout=!0,s.useCustomLayout=!1),s.direction="horizontal"===s.direction.toLowerCase()?"horizontal":"vertical",s.skin=t.options_.skin,s})(t,e),this.options_=e,this.player_=t,this.render();const s=(t,e)=>{this.options_.fluid=e};t.on(o.f.FLUID,s),this.options=e=>e?(this.options_=_().obj.merge(this.options_,e),t.trigger("playlistwidgetoption",this.options_.playlistWidget),this.options_):this.options_,this.dispose=()=>{this.layout_.dispose(),t.off(o.f.FLUID,s)}}render(){this.options_.useDefaultLayout&&("horizontal"===this.options_.direction?this.layout_=new B(this.player_,this.options_):this.layout_=new H(this.player_,this.options_)),this.options_.useCustomLayout&&(this.layout_=new F(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]:P.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]:P.direction;return"horizontal"!==t&&"vertical"!==t||this.update("direction",{direction:t}),this}},W=_().getComponent("ClickableComponent"),G={item:null,transformation:{width:300,aspect_ratio:"16:9",crop:"pad",background:"black"}};const z=class extends W{constructor(t,e){super(t,_().obj.merge(G,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:"#"}),s=super.createEl("img",{className:"cld-thumbnail-img",src:this.getThumbnail()});return e.appendChild(s),e.style.backgroundImage="url('".concat(this.getThumbnail(),"')"),e}},Y=_().dom||_(),$={source:null,next:!1};class q extends z{constructor(t,e){super(t,_().obj.merge($,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=Y.createEl("div",{className:"cld-plw-item-info-wrap"}),s=Y.createEl("div",{className:"cld-plw-item-title"});if(this.isCurrent()){t.classList.add("cld-plw-panel-item-active");const e=Y.createEl("span",{className:"cld-plw-item-title-curr"},{},"Now Playing: ");s.appendChild(e)}const i=Y.createEl("span",{className:"cld-plw-item-title"},{},this.getTitle());s.appendChild(i);const n=Y.createEl("div",{className:"cld-plw-item-duration"},{},this.getDuration());return e.appendChild(s),e.appendChild(n),t&&t.appendChild(e),t.appendChild(e),t}}_().registerComponent("playlistPanelItem",q);const J=q,Z=_().getComponent("Component");class K extends Z{constructor(t){super(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});const e=()=>{this.render()};t.on(o.f.PLAYLIST_ITEM_CHANGED,e),this.render(),this.dispose=()=>{super.dispose(),t.off(o.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 s=[],i=this.options_.total;let n=t.currentIndex(),r=t.list()[n];for(s.push(r);s.length<i;){if(n=t.nextIndex(n),-1===n){if(!e&&s.length>0)break;n=0}r=t.list()[n],s.push(r)}return s}render(){const t=this.getItems();this.removeAll(),t.forEach(((t,e)=>{const s=new J(this.player(),_().obj.merge(this.options_,{item:t,next:1===e,current:0===e}));this.addChild(s)}))}}_().registerComponent("playlistPanel",K);const Q={format:"json",resource_type:"video",type:"list"},X=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=(0,r.sliceProperties)(e,"chainTarget").chainTarget;let i=null,a=null,c=null;const d=()=>{t.on(o.f.PLAYLIST_CREATED,(()=>{c&&c.dispose(),n()(e.playlistWidget)&&(t.fluid_&&(e.playlistWidget.fluid=!0),t.cloudinary.fontFace&&(e.playlistWidget.fontFace=t.cloudinary.fontFace),c=new M(t,e.playlistWidget))}))},u=(e,s)=>{e instanceof U?(i=e,i.resetState(),i.currentIndex(i.currentIndex())):(i=new U(t.cloudinary,e,s),i.currentIndex(0)),d(),a=(()=>{const e=()=>{i&&!i.currentSource().contains(t.currentSource())&&t.disposePlaylist()};return t.on("cldsourcechanged",e),e})(),t.addClass("vjs-playlist")};return t.cloudinary.sourcesByTag=async function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=(0,l.KA)(e,Object.assign({},t.cloudinary.cloudinaryConfig(),Q)),n=await fetch(i),r=await n.json(),o=p(r.resources);s.sorter&&o.sort(s.sorter);return o.map((e=>{let i=s.sourceParams||{};"function"==typeof i&&(i=i(e));const n=e.context&&e.context.custom||{},r=Object.assign({info:n},i,{publicId:e.publicId});return t.cloudinary.buildSource(r)}))},function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return void 0===e?i:(i&&(t.removeClass("vjs-playlist"),i=void 0,t.playlist().dispose(),t.off("cldsourcechanged",a)),u(e,n),t.trigger("playlistcreated"),s)}}},8812:(t,e,s)=>{var i=s(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 s=t.length;s--&&e.test(t.charAt(s)););return s}},4466:(t,e,s)=>{var i=s(9445);t.exports=function(t){return"number"==typeof t&&t==i(t)}},4764:(t,e,s)=>{var i=s(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,s)=>{var i=s(4764);t.exports=function(t){var e=i(t),s=e%1;return e==e?s?e-s:e:0}},5378:(t,e,s)=>{var i=s(8812),n=s(8953),r=s(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(r(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 s=l.test(t);return s||a.test(t)?c(t.slice(2),s?2:8):o.test(t)?NaN:+t}}}]);
|
|
1
|
+
(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[33],{5826:(t,e,s)=>{"use strict";s.d(e,{default:()=>K});var i=s(4679),n=s.n(i),r=s(5871),o=s(1104),l=s(8033),a=s(3686),c=s.n(a);const d=[1,4,5,6,7,10,11],p=["created_at","updated_at"],h=t=>{const e={};return n()(t)?(Object.keys(t).reduce(((e,s)=>{const i=c()(s);return-1!==p.indexOf(s)?e[i]=new Date(function(t){let e=0,s=0,i=0;if(s=/^(\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=d[e];++e)s[t]=+s[t]||0;s[2]=(+s[2]||1)-1,s[3]=+s[3]||1,"Z"!==s[8]&&void 0!==s[9]&&(i=60*s[10]+s[11],"+"===s[9]&&(i=0-i)),e=Date.UTC(s[1],s[2],s[3],s[4],s[5]+i,s[6],s[7])}else e=NaN;return e}(t[s])):e[i]=h(t[s]),e}),e),e):Array.isArray(t)?t.map((t=>h(t))):t};var u=s(5381),m=s(4466),g=s.n(m),y=s(6673),_=s.n(y);const v=_().dom||_(),f=_().getComponent("Component"),C=_().getComponent("ClickableComponent");class x extends C{static DISABLE_TRANSITION_CLASS="disable-transition";static VJS_UPCOMING_VIDEO_SHOW="vjs-upcoming-video-show";constructor(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),i=1;i<e;i++)s[i-1]=arguments[i];super(t,...s),this._setEvents(t)}_setEvents(t){t.on(o.f.UP_COMING_VIDEO_SHOW,this._show),t.on(o.f.UP_COMING_VIDEO_HIDE,this._hide),t.on(o.f.PLAYLIST_ITEM_CHANGED,this._onPlaylistItemChange)}_hide=()=>{this.removeClass(x.VJS_UPCOMING_VIDEO_SHOW)};_disableTransition(t){this.addClass(x.DISABLE_TRANSITION_CLASS),t(),this.removeClass(x.DISABLE_TRANSITION_CLASS)}_onPlaylistItemChange=(t,e)=>{this._hide(),this._disableTransition((()=>{e.next&&this.setItem(e.next)}))};_show=()=>{const t=this.player().ima,e="object"===t&&t.getAdsManager();e&&e.getCurrentAd()&&!e.getCurrentAd().isLinear()||this.addClass(x.VJS_UPCOMING_VIDEO_SHOW)};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),s={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("${this._source.poster().url({transformation:s})}")`}handleClick(){super.handleClick(event),this.player().cloudinary.playlist().playNext()}createEl(){return super.createEl("div",{className:"vjs-upcoming-video"})}}class I extends f{createEl(){return super.createEl("div",{className:"upcoming-video-overlay aspect-ratio-content"})}}class w extends f{createEl(){return super.createEl("div",{className:"vjs-upcoming-video-bar"})}}x.prototype.options_={children:["upcomingVideoOverlayContent"]},_().registerComponent("upcomingVideoOverlay",x),I.prototype.options_={children:["upcomingVideoOverlayBar"]},_().registerComponent("upcomingVideoOverlayContent",I),w.prototype.options_={children:["upcomingVideoOverlayTitle","playlistNextButton"]},_().registerComponent("upcomingVideoOverlayBar",w),_().registerComponent("upcomingVideoOverlayTitle",class extends f{setContent(t){this._contentSpan.innerText=t}createEl(){const t=super.createEl("div",{className:"vjs-control vjs-upcoming-video-title"}),e=v.createEl("div",{className:"vjs-upcoming-video-title-display",innerHTML:'<span class="vjs-control-text">Next up</span>Next up: '});return this._contentSpan=v.createEl("span",{className:"vjs-upcoming-video-title-display-label"}),e.appendChild(this._contentSpan),t.appendChild(e),t}});const A=_().getComponent("ClickableComponent");const E=class extends A{constructor(t,e){super(t,e);const s=e.type;if(!s&&"previous"!==s&&"next"!==s)throw new Error("Type must be either 'previous' or 'next'")}createEl(){const t=this.options_.type,e=`vjs-icon-${t}-item`;return _().dom.createEl("button",{className:`vjs-control vjs-playlist-button vjs-button ${e}`,ariaLabel:`Playlist ${t} item`})}};class T extends E{constructor(t){super(t,{type:"next"})}handleClick(t){t.stopPropagation(),super.handleClick(t),this.player().cloudinary.playlist().playNext()}}_().registerComponent("PlaylistNextButton",T);class b extends E{constructor(t){super(t,{type:"previous"})}handleClick(t){super.handleClick(t),this.player().cloudinary.playlist().playPrevious()}}_().registerComponent("PlaylistPreviousButton",b);const N={fluid:!1,show:!0,direction:"vertical",total:4,selector:!1,renderTo:[]};const S=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],{repeat:s=!1,autoAdvance:i=!1,presentUpcoming:n=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};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(s),this.autoAdvance(i),this.presentUpcoming(n)},e.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;if(!1===t)return;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(),s=this._recommendationItemBuilder(e);e.recommendations()||e.recommendations(this._defaultRecommendationsResolver(e)),this._context.source(e,{recommendationOptions:{disableAutoShow:!0,itemBuilder:s}});const i={playlist:this,current:e,next:this.next()};return this.player().trigger("playlistitemchanged",i),this._refreshRecommendations(),this._refreshTextTracks(),e}_defaultRecommendationsResolver(t){const e=this._defaultRecResolverCache[t.objectId];return e||(this._defaultRecResolverCache[t.objectId]=()=>{let e=this.list().indexOf(t);const s=[],i=Math.min(4,this.length()-1);for(;s.length<i&&(e=this.nextIndex(e),-1!==e);){const t=this.list()[e];s.push(t)}return s},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 s=t instanceof u.A?t:this.buildSource(t,e);return this._sources.push(s),s}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)}playlistByTag=(()=>{var t=this;return function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.player().sourcesByTag(e,s).then((e=>t.player().playlist(e,s)))}})()},P=(t,e)=>(t.parentNode.insertBefore(e,t),e.appendChild(t),e);var U=s(3066);const L=_().dom||_(),O=_().getComponent("Component"),k={wrap:!1};class j extends O{constructor(t,e){const s={...k,...e};super(t,s),this.player_=t;const i=(t,e)=>{this.options_.fluid=e,this.removeCls(),this.setCls()},n=()=>{const t=this.el();this.videoWrap_=L.createEl("div",{className:"cld-plw-col-player"}),this.contentEl_=this.contentEl_=L.createEl("div",{className:"cld-plw-col-list"}),P(this.player().el(),t),t.appendChild(this.videoWrap_),t.appendChild(this.contentEl_),P(this.player().el(),this.videoWrap_)};s.wrap&&n(),t.on(o.f.FLUID,i),this.addChild(o.f.PLAYLIST_PANEL,this.options_),this.setCls(),this.dispose=()=>{this.removeLayout(),super.dispose(),t.off(o.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}}_().registerComponent("playlistLayout",j);const D=j;const R=class extends D{constructor(t,e){e.wrap=!0,super(t,e)}getCls(){const t=super.getCls();return t.push("cld-plw-horizontal"),t}};const V=class extends D{constructor(t,e){e.wrap=!0,super(t,e)}getCls(){const t=super.getCls();return t.push("cld-plw-vertical"),t}};const B=class extends D{getCls(){let t=super.getCls();return t.push("cld-plw-custom"),t}createEl(){const t=super.createEl();return this.options_.renderTo.appendChild(t),t}};const H=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=((t,e)=>{const s={...N,...e};if(s.show&&"string"==typeof s.selector&&(s.useDefaultLayout=!1,s.useCustomLayout=!0,s.renderTo=document.querySelector(s.selector),s.showAll=!0,0===!s.renderTo.length))throw new Error(`Couldn't find element(s) by selector '${s.selector}' for playlist`);return s.show&&!s.selector&&(s.useDefaultLayout=!0,s.useCustomLayout=!1),s.direction="horizontal"===s.direction.toLowerCase()?"horizontal":"vertical",s.skin=t.options_.skin,s})(t,e),this.options_=e,this.player_=t,this.render();const s=(t,e)=>{this.options_.fluid=e};t.on(o.f.FLUID,s),this.options=e=>e?(this.options_=_().obj.merge(this.options_,e),t.trigger("playlistwidgetoption",this.options_.playlistWidget),this.options_):this.options_,this.dispose=()=>{this.layout_.dispose(),t.off(o.f.FLUID,s)}}render(){this.options_.useDefaultLayout&&("horizontal"===this.options_.direction?this.layout_=new R(this.player_,this.options_):this.layout_=new V(this.player_,this.options_)),this.options_.useCustomLayout&&(this.layout_=new B(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]:N.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]:N.direction;return"horizontal"!==t&&"vertical"!==t||this.update("direction",{direction:t}),this}},F=_().getComponent("ClickableComponent"),M={item:null,transformation:{width:300,aspect_ratio:"16:9",crop:"pad",background:"black"}};const W=class extends F{constructor(t,e){super(t,_().obj.merge(M,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:"#"}),s=super.createEl("img",{className:"cld-thumbnail-img",src:this.getThumbnail()});return e.appendChild(s),e.style.backgroundImage=`url('${this.getThumbnail()}')`,e}},$=_().dom||_(),G={source:null,next:!1};class z extends W{constructor(t,e){super(t,_().obj.merge(G,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=$.createEl("div",{className:"cld-plw-item-info-wrap"}),s=$.createEl("div",{className:"cld-plw-item-title"});if(this.isCurrent()){t.classList.add("cld-plw-panel-item-active");const e=$.createEl("span",{className:"cld-plw-item-title-curr"},{},"Now Playing: ");s.appendChild(e)}const i=$.createEl("span",{className:"cld-plw-item-title"},{},this.getTitle());s.appendChild(i);const n=$.createEl("div",{className:"cld-plw-item-duration"},{},this.getDuration());return e.appendChild(s),e.appendChild(n),t&&t.appendChild(e),t.appendChild(e),t}}_().registerComponent("playlistPanelItem",z);const Y=z,q=_().getComponent("Component");class J extends q{constructor(t){super(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});const e=()=>{this.render()};t.on(o.f.PLAYLIST_ITEM_CHANGED,e),this.render(),this.dispose=()=>{super.dispose(),t.off(o.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 s=[],i=this.options_.total;let n=t.currentIndex(),r=t.list()[n];for(s.push(r);s.length<i;){if(n=t.nextIndex(n),-1===n){if(!e&&s.length>0)break;n=0}r=t.list()[n],s.push(r)}return s}render(){const t=this.getItems();this.removeAll(),t.forEach(((t,e)=>{const s=new Y(this.player(),_().obj.merge(this.options_,{item:t,next:1===e,current:0===e}));this.addChild(s)}))}}_().registerComponent("playlistPanel",J);const Z={format:"json",resource_type:"video",type:"list"},K=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=(0,r.sliceProperties)(e,"chainTarget").chainTarget;let i=null,a=null,c=null;const d=()=>{t.on(o.f.PLAYLIST_CREATED,(()=>{c&&c.dispose(),n()(e.playlistWidget)&&(t.fluid_&&(e.playlistWidget.fluid=!0),t.cloudinary.fontFace&&(e.playlistWidget.fontFace=t.cloudinary.fontFace),c=new H(t,e.playlistWidget))}))},p=(e,s)=>{e instanceof S?(i=e,i.resetState(),i.currentIndex(i.currentIndex())):(i=new S(t.cloudinary,e,s),i.currentIndex(0)),d(),a=(()=>{const e=()=>{i&&!i.currentSource().contains(t.currentSource())&&t.disposePlaylist()};return t.on("cldsourcechanged",e),e})(),t.addClass("vjs-playlist")};return t.cloudinary.sourcesByTag=async function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=(0,l.KA)(e,Object.assign({},t.cloudinary.cloudinaryConfig(),Z)),n=await fetch(i),r=await n.json(),o=h(r.resources);s.sorter&&o.sort(s.sorter);return o.map((e=>{let i=s.sourceParams||{};"function"==typeof i&&(i=i(e));const n=e.context&&e.context.custom||{},r=Object.assign({info:n},i,{publicId:e.publicId});return t.cloudinary.buildSource(r)}))},function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return void 0===e?i:(i&&(t.removeClass("vjs-playlist"),i=void 0,t.playlist().dispose(),t.off("cldsourcechanged",a)),p(e,n),t.trigger("playlistcreated"),s)}}},8812:(t,e,s)=>{var i=s(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 s=t.length;s--&&e.test(t.charAt(s)););return s}},4466:(t,e,s)=>{var i=s(9445);t.exports=function(t){return"number"==typeof t&&t==i(t)}},4764:(t,e,s)=>{var i=s(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,s)=>{var i=s(4764);t.exports=function(t){var e=i(t),s=e%1;return e==e?s?e-s:e:0}},5378:(t,e,s)=>{var i=s(8812),n=s(8953),r=s(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(r(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 s=l.test(t);return s||a.test(t)?c(t.slice(2),s?2:8):o.test(t)?NaN:+t}}}]);
|
|
2
2
|
//# sourceMappingURL=playlist.light.min.js.map
|
package/dist/playlist.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[33],{5826:(t,e,s)=>{"use strict";s.d(e,{default:()=>X});var i=s(4679),n=s.n(i),r=s(5871),o=s(1104),l=s(8033),a=s(3686),c=s.n(a);const d=[1,4,5,6,7,10,11],u=["created_at","updated_at"],p=t=>{const e={};return n()(t)?(Object.keys(t).reduce(((e,s)=>{const i=c()(s);return-1!==u.indexOf(s)?e[i]=new Date(function(t){let e=0,s=0,i=0;if(s=/^(\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=d[e];++e)s[t]=+s[t]||0;s[2]=(+s[2]||1)-1,s[3]=+s[3]||1,"Z"!==s[8]&&void 0!==s[9]&&(i=60*s[10]+s[11],"+"===s[9]&&(i=0-i)),e=Date.UTC(s[1],s[2],s[3],s[4],s[5]+i,s[6],s[7])}else e=NaN;return e}(t[s])):e[i]=p(t[s]),e}),e),e):Array.isArray(t)?t.map((t=>p(t))):t};var h=s(5381),m=s(4466),g=s.n(m),y=s(7938),_=s.n(y);function v(t,e,s){var i;return(e="symbol"==typeof(i=function(t,e){if("object"!=typeof t||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var i=s.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(e,"string"))?i:i+"")in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}const f=_().dom||_(),C=_().getComponent("Component"),x=_().getComponent("ClickableComponent");class I extends x{constructor(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),i=1;i<e;i++)s[i-1]=arguments[i];super(t,...s),v(this,"_hide",(()=>{this.removeClass(I.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(I.VJS_UPCOMING_VIDEO_SHOW)})),this._setEvents(t)}_setEvents(t){t.on(o.f.UP_COMING_VIDEO_SHOW,this._show),t.on(o.f.UP_COMING_VIDEO_HIDE,this._hide),t.on(o.f.PLAYLIST_ITEM_CHANGED,this._onPlaylistItemChange)}_disableTransition(t){this.addClass(I.DISABLE_TRANSITION_CLASS),t(),this.removeClass(I.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),s={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:s}),'")')}handleClick(){super.handleClick(event),this.player().cloudinary.playlist().playNext()}createEl(){return super.createEl("div",{className:"vjs-upcoming-video"})}}v(I,"DISABLE_TRANSITION_CLASS","disable-transition"),v(I,"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 A extends C{createEl(){return super.createEl("div",{className:"vjs-upcoming-video-bar"})}}I.prototype.options_={children:["upcomingVideoOverlayContent"]},_().registerComponent("upcomingVideoOverlay",I),w.prototype.options_={children:["upcomingVideoOverlayBar"]},_().registerComponent("upcomingVideoOverlayContent",w),A.prototype.options_={children:["upcomingVideoOverlayTitle","playlistNextButton"]},_().registerComponent("upcomingVideoOverlayBar",A),_().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=f.createEl("div",{className:"vjs-upcoming-video-title-display",innerHTML:'<span class="vjs-control-text">Next up</span>Next up: '});return this._contentSpan=f.createEl("span",{className:"vjs-upcoming-video-title-display-label"}),e.appendChild(this._contentSpan),t.appendChild(e),t}});const b=_().getComponent("ClickableComponent");const E=class extends b{constructor(t,e){super(t,e);const s=e.type;if(!s&&"previous"!==s&&"next"!==s)throw new Error("Type must be either 'previous' or 'next'")}createEl(){const t=this.options_.type,e="vjs-icon-".concat(t,"-item");return _().dom.createEl("button",{className:"vjs-control vjs-playlist-button vjs-button ".concat(e),ariaLabel:"Playlist ".concat(t," item")})}};class T extends E{constructor(t){super(t,{type:"next"})}handleClick(t){t.stopPropagation(),super.handleClick(t),this.player().cloudinary.playlist().playNext()}}_().registerComponent("PlaylistNextButton",T);class N extends E{constructor(t){super(t,{type:"previous"})}handleClick(t){super.handleClick(t),this.player().cloudinary.playlist().playPrevious()}}_().registerComponent("PlaylistPreviousButton",N);const P={fluid:!1,show:!0,direction:"vertical",total:4,selector:!1,renderTo:[]};function S(t,e,s){var i;return(e="symbol"==typeof(i=function(t,e){if("object"!=typeof t||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var i=s.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(e,"string"))?i:i+"")in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}const U=class{constructor(t){var e=this;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],{repeat:i=!1,autoAdvance:n=!1,presentUpcoming:r=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};S(this,"playlistByTag",(function(t){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.player().sourcesByTag(t,s).then((t=>e.player().playlist(t,s)))})),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(r)},s.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;if(!1===t)return;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(),s=this._recommendationItemBuilder(e);e.recommendations()||e.recommendations(this._defaultRecommendationsResolver(e)),this._context.source(e,{recommendationOptions:{disableAutoShow:!0,itemBuilder:s}});const i={playlist:this,current:e,next:this.next()};return this.player().trigger("playlistitemchanged",i),this._refreshRecommendations(),this._refreshTextTracks(),e}_defaultRecommendationsResolver(t){const e=this._defaultRecResolverCache[t.objectId];return e||(this._defaultRecResolverCache[t.objectId]=()=>{let e=this.list().indexOf(t);const s=[],i=Math.min(4,this.length()-1);for(;s.length<i&&(e=this.nextIndex(e),-1!==e);){const t=this.list()[e];s.push(t)}return s},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 s=t instanceof h.A?t:this.buildSource(t,e);return this._sources.push(s),s}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)}},L=(t,e)=>(t.parentNode.insertBefore(e,t),e.appendChild(t),e);var O=s(3066);const j=_().dom||_(),k=_().getComponent("Component"),D={wrap:!1};class R extends k{constructor(t,e){const s={...D,...e};super(t,s),this.player_=t;const i=(t,e)=>{this.options_.fluid=e,this.removeCls(),this.setCls()},n=()=>{const t=this.el();this.videoWrap_=j.createEl("div",{className:"cld-plw-col-player"}),this.contentEl_=this.contentEl_=j.createEl("div",{className:"cld-plw-col-list"}),L(this.player().el(),t),t.appendChild(this.videoWrap_),t.appendChild(this.contentEl_),L(this.player().el(),this.videoWrap_)};s.wrap&&n(),t.on(o.f.FLUID,i),this.addChild(o.f.PLAYLIST_PANEL,this.options_),this.setCls(),this.dispose=()=>{this.removeLayout(),super.dispose(),t.off(o.f.FLUID,i)}}getCls(){let t=["cld-video-player","cld-plw-layout"];return t.push((0,O.skinClassPrefix)(this.player())),t.push((0,O.playerClassPrefix)(this.player())),this.options_.fluid&&t.push("cld-plw-layout-fluid"),t}setCls(){this.removeClass((0,O.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}}_().registerComponent("playlistLayout",R);const V=R;const B=class extends V{constructor(t,e){e.wrap=!0,super(t,e)}getCls(){const t=super.getCls();return t.push("cld-plw-horizontal"),t}};const H=class extends V{constructor(t,e){e.wrap=!0,super(t,e)}getCls(){const t=super.getCls();return t.push("cld-plw-vertical"),t}};const F=class extends V{getCls(){let t=super.getCls();return t.push("cld-plw-custom"),t}createEl(){const t=super.createEl();return this.options_.renderTo.appendChild(t),t}};const M=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=((t,e)=>{const s={...P,...e};if(s.show&&"string"==typeof s.selector&&(s.useDefaultLayout=!1,s.useCustomLayout=!0,s.renderTo=document.querySelector(s.selector),s.showAll=!0,0===!s.renderTo.length))throw new Error("Couldn't find element(s) by selector '".concat(s.selector,"' for playlist"));return s.show&&!s.selector&&(s.useDefaultLayout=!0,s.useCustomLayout=!1),s.direction="horizontal"===s.direction.toLowerCase()?"horizontal":"vertical",s.skin=t.options_.skin,s})(t,e),this.options_=e,this.player_=t,this.render();const s=(t,e)=>{this.options_.fluid=e};t.on(o.f.FLUID,s),this.options=e=>e?(this.options_=_().obj.merge(this.options_,e),t.trigger("playlistwidgetoption",this.options_.playlistWidget),this.options_):this.options_,this.dispose=()=>{this.layout_.dispose(),t.off(o.f.FLUID,s)}}render(){this.options_.useDefaultLayout&&("horizontal"===this.options_.direction?this.layout_=new B(this.player_,this.options_):this.layout_=new H(this.player_,this.options_)),this.options_.useCustomLayout&&(this.layout_=new F(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]:P.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]:P.direction;return"horizontal"!==t&&"vertical"!==t||this.update("direction",{direction:t}),this}},W=_().getComponent("ClickableComponent"),G={item:null,transformation:{width:300,aspect_ratio:"16:9",crop:"pad",background:"black"}};const z=class extends W{constructor(t,e){super(t,_().obj.merge(G,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:"#"}),s=super.createEl("img",{className:"cld-thumbnail-img",src:this.getThumbnail()});return e.appendChild(s),e.style.backgroundImage="url('".concat(this.getThumbnail(),"')"),e}},Y=_().dom||_(),$={source:null,next:!1};class q extends z{constructor(t,e){super(t,_().obj.merge($,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=Y.createEl("div",{className:"cld-plw-item-info-wrap"}),s=Y.createEl("div",{className:"cld-plw-item-title"});if(this.isCurrent()){t.classList.add("cld-plw-panel-item-active");const e=Y.createEl("span",{className:"cld-plw-item-title-curr"},{},"Now Playing: ");s.appendChild(e)}const i=Y.createEl("span",{className:"cld-plw-item-title"},{},this.getTitle());s.appendChild(i);const n=Y.createEl("div",{className:"cld-plw-item-duration"},{},this.getDuration());return e.appendChild(s),e.appendChild(n),t&&t.appendChild(e),t.appendChild(e),t}}_().registerComponent("playlistPanelItem",q);const J=q,Z=_().getComponent("Component");class K extends Z{constructor(t){super(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});const e=()=>{this.render()};t.on(o.f.PLAYLIST_ITEM_CHANGED,e),this.render(),this.dispose=()=>{super.dispose(),t.off(o.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 s=[],i=this.options_.total;let n=t.currentIndex(),r=t.list()[n];for(s.push(r);s.length<i;){if(n=t.nextIndex(n),-1===n){if(!e&&s.length>0)break;n=0}r=t.list()[n],s.push(r)}return s}render(){const t=this.getItems();this.removeAll(),t.forEach(((t,e)=>{const s=new J(this.player(),_().obj.merge(this.options_,{item:t,next:1===e,current:0===e}));this.addChild(s)}))}}_().registerComponent("playlistPanel",K);const Q={format:"json",resource_type:"video",type:"list"},X=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=(0,r.sliceProperties)(e,"chainTarget").chainTarget;let i=null,a=null,c=null;const d=()=>{t.on(o.f.PLAYLIST_CREATED,(()=>{c&&c.dispose(),n()(e.playlistWidget)&&(t.fluid_&&(e.playlistWidget.fluid=!0),t.cloudinary.fontFace&&(e.playlistWidget.fontFace=t.cloudinary.fontFace),c=new M(t,e.playlistWidget))}))},u=(e,s)=>{e instanceof U?(i=e,i.resetState(),i.currentIndex(i.currentIndex())):(i=new U(t.cloudinary,e,s),i.currentIndex(0)),d(),a=(()=>{const e=()=>{i&&!i.currentSource().contains(t.currentSource())&&t.disposePlaylist()};return t.on("cldsourcechanged",e),e})(),t.addClass("vjs-playlist")};return t.cloudinary.sourcesByTag=async function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=(0,l.KA)(e,Object.assign({},t.cloudinary.cloudinaryConfig(),Q)),n=await fetch(i),r=await n.json(),o=p(r.resources);s.sorter&&o.sort(s.sorter);return o.map((e=>{let i=s.sourceParams||{};"function"==typeof i&&(i=i(e));const n=e.context&&e.context.custom||{},r=Object.assign({info:n},i,{publicId:e.publicId});return t.cloudinary.buildSource(r)}))},function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return void 0===e?i:(i&&(t.removeClass("vjs-playlist"),i=void 0,t.playlist().dispose(),t.off("cldsourcechanged",a)),u(e,n),t.trigger("playlistcreated"),s)}}},8812:(t,e,s)=>{var i=s(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 s=t.length;s--&&e.test(t.charAt(s)););return s}},4466:(t,e,s)=>{var i=s(9445);t.exports=function(t){return"number"==typeof t&&t==i(t)}},4764:(t,e,s)=>{var i=s(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,s)=>{var i=s(4764);t.exports=function(t){var e=i(t),s=e%1;return e==e?s?e-s:e:0}},5378:(t,e,s)=>{var i=s(8812),n=s(8953),r=s(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(r(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 s=l.test(t);return s||a.test(t)?c(t.slice(2),s?2:8):o.test(t)?NaN:+t}}}]);
|
|
1
|
+
(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[33],{5826:(t,e,s)=>{"use strict";s.d(e,{default:()=>K});var i=s(4679),n=s.n(i),r=s(5871),o=s(1104),l=s(8033),a=s(3686),c=s.n(a);const d=[1,4,5,6,7,10,11],p=["created_at","updated_at"],h=t=>{const e={};return n()(t)?(Object.keys(t).reduce(((e,s)=>{const i=c()(s);return-1!==p.indexOf(s)?e[i]=new Date(function(t){let e=0,s=0,i=0;if(s=/^(\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=d[e];++e)s[t]=+s[t]||0;s[2]=(+s[2]||1)-1,s[3]=+s[3]||1,"Z"!==s[8]&&void 0!==s[9]&&(i=60*s[10]+s[11],"+"===s[9]&&(i=0-i)),e=Date.UTC(s[1],s[2],s[3],s[4],s[5]+i,s[6],s[7])}else e=NaN;return e}(t[s])):e[i]=h(t[s]),e}),e),e):Array.isArray(t)?t.map((t=>h(t))):t};var u=s(5381),m=s(4466),g=s.n(m),y=s(7938),_=s.n(y);const v=_().dom||_(),f=_().getComponent("Component"),C=_().getComponent("ClickableComponent");class x extends C{static DISABLE_TRANSITION_CLASS="disable-transition";static VJS_UPCOMING_VIDEO_SHOW="vjs-upcoming-video-show";constructor(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),i=1;i<e;i++)s[i-1]=arguments[i];super(t,...s),this._setEvents(t)}_setEvents(t){t.on(o.f.UP_COMING_VIDEO_SHOW,this._show),t.on(o.f.UP_COMING_VIDEO_HIDE,this._hide),t.on(o.f.PLAYLIST_ITEM_CHANGED,this._onPlaylistItemChange)}_hide=()=>{this.removeClass(x.VJS_UPCOMING_VIDEO_SHOW)};_disableTransition(t){this.addClass(x.DISABLE_TRANSITION_CLASS),t(),this.removeClass(x.DISABLE_TRANSITION_CLASS)}_onPlaylistItemChange=(t,e)=>{this._hide(),this._disableTransition((()=>{e.next&&this.setItem(e.next)}))};_show=()=>{const t=this.player().ima,e="object"===t&&t.getAdsManager();e&&e.getCurrentAd()&&!e.getCurrentAd().isLinear()||this.addClass(x.VJS_UPCOMING_VIDEO_SHOW)};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),s={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("${this._source.poster().url({transformation:s})}")`}handleClick(){super.handleClick(event),this.player().cloudinary.playlist().playNext()}createEl(){return super.createEl("div",{className:"vjs-upcoming-video"})}}class I extends f{createEl(){return super.createEl("div",{className:"upcoming-video-overlay aspect-ratio-content"})}}class w extends f{createEl(){return super.createEl("div",{className:"vjs-upcoming-video-bar"})}}x.prototype.options_={children:["upcomingVideoOverlayContent"]},_().registerComponent("upcomingVideoOverlay",x),I.prototype.options_={children:["upcomingVideoOverlayBar"]},_().registerComponent("upcomingVideoOverlayContent",I),w.prototype.options_={children:["upcomingVideoOverlayTitle","playlistNextButton"]},_().registerComponent("upcomingVideoOverlayBar",w),_().registerComponent("upcomingVideoOverlayTitle",class extends f{setContent(t){this._contentSpan.innerText=t}createEl(){const t=super.createEl("div",{className:"vjs-control vjs-upcoming-video-title"}),e=v.createEl("div",{className:"vjs-upcoming-video-title-display",innerHTML:'<span class="vjs-control-text">Next up</span>Next up: '});return this._contentSpan=v.createEl("span",{className:"vjs-upcoming-video-title-display-label"}),e.appendChild(this._contentSpan),t.appendChild(e),t}});const A=_().getComponent("ClickableComponent");const E=class extends A{constructor(t,e){super(t,e);const s=e.type;if(!s&&"previous"!==s&&"next"!==s)throw new Error("Type must be either 'previous' or 'next'")}createEl(){const t=this.options_.type,e=`vjs-icon-${t}-item`;return _().dom.createEl("button",{className:`vjs-control vjs-playlist-button vjs-button ${e}`,ariaLabel:`Playlist ${t} item`})}};class T extends E{constructor(t){super(t,{type:"next"})}handleClick(t){t.stopPropagation(),super.handleClick(t),this.player().cloudinary.playlist().playNext()}}_().registerComponent("PlaylistNextButton",T);class b extends E{constructor(t){super(t,{type:"previous"})}handleClick(t){super.handleClick(t),this.player().cloudinary.playlist().playPrevious()}}_().registerComponent("PlaylistPreviousButton",b);const N={fluid:!1,show:!0,direction:"vertical",total:4,selector:!1,renderTo:[]};const S=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],{repeat:s=!1,autoAdvance:i=!1,presentUpcoming:n=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};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(s),this.autoAdvance(i),this.presentUpcoming(n)},e.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;if(!1===t)return;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(),s=this._recommendationItemBuilder(e);e.recommendations()||e.recommendations(this._defaultRecommendationsResolver(e)),this._context.source(e,{recommendationOptions:{disableAutoShow:!0,itemBuilder:s}});const i={playlist:this,current:e,next:this.next()};return this.player().trigger("playlistitemchanged",i),this._refreshRecommendations(),this._refreshTextTracks(),e}_defaultRecommendationsResolver(t){const e=this._defaultRecResolverCache[t.objectId];return e||(this._defaultRecResolverCache[t.objectId]=()=>{let e=this.list().indexOf(t);const s=[],i=Math.min(4,this.length()-1);for(;s.length<i&&(e=this.nextIndex(e),-1!==e);){const t=this.list()[e];s.push(t)}return s},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 s=t instanceof u.A?t:this.buildSource(t,e);return this._sources.push(s),s}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)}playlistByTag=(()=>{var t=this;return function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.player().sourcesByTag(e,s).then((e=>t.player().playlist(e,s)))}})()},P=(t,e)=>(t.parentNode.insertBefore(e,t),e.appendChild(t),e);var U=s(3066);const L=_().dom||_(),O=_().getComponent("Component"),k={wrap:!1};class j extends O{constructor(t,e){const s={...k,...e};super(t,s),this.player_=t;const i=(t,e)=>{this.options_.fluid=e,this.removeCls(),this.setCls()},n=()=>{const t=this.el();this.videoWrap_=L.createEl("div",{className:"cld-plw-col-player"}),this.contentEl_=this.contentEl_=L.createEl("div",{className:"cld-plw-col-list"}),P(this.player().el(),t),t.appendChild(this.videoWrap_),t.appendChild(this.contentEl_),P(this.player().el(),this.videoWrap_)};s.wrap&&n(),t.on(o.f.FLUID,i),this.addChild(o.f.PLAYLIST_PANEL,this.options_),this.setCls(),this.dispose=()=>{this.removeLayout(),super.dispose(),t.off(o.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}}_().registerComponent("playlistLayout",j);const D=j;const R=class extends D{constructor(t,e){e.wrap=!0,super(t,e)}getCls(){const t=super.getCls();return t.push("cld-plw-horizontal"),t}};const V=class extends D{constructor(t,e){e.wrap=!0,super(t,e)}getCls(){const t=super.getCls();return t.push("cld-plw-vertical"),t}};const B=class extends D{getCls(){let t=super.getCls();return t.push("cld-plw-custom"),t}createEl(){const t=super.createEl();return this.options_.renderTo.appendChild(t),t}};const H=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=((t,e)=>{const s={...N,...e};if(s.show&&"string"==typeof s.selector&&(s.useDefaultLayout=!1,s.useCustomLayout=!0,s.renderTo=document.querySelector(s.selector),s.showAll=!0,0===!s.renderTo.length))throw new Error(`Couldn't find element(s) by selector '${s.selector}' for playlist`);return s.show&&!s.selector&&(s.useDefaultLayout=!0,s.useCustomLayout=!1),s.direction="horizontal"===s.direction.toLowerCase()?"horizontal":"vertical",s.skin=t.options_.skin,s})(t,e),this.options_=e,this.player_=t,this.render();const s=(t,e)=>{this.options_.fluid=e};t.on(o.f.FLUID,s),this.options=e=>e?(this.options_=_().obj.merge(this.options_,e),t.trigger("playlistwidgetoption",this.options_.playlistWidget),this.options_):this.options_,this.dispose=()=>{this.layout_.dispose(),t.off(o.f.FLUID,s)}}render(){this.options_.useDefaultLayout&&("horizontal"===this.options_.direction?this.layout_=new R(this.player_,this.options_):this.layout_=new V(this.player_,this.options_)),this.options_.useCustomLayout&&(this.layout_=new B(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]:N.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]:N.direction;return"horizontal"!==t&&"vertical"!==t||this.update("direction",{direction:t}),this}},F=_().getComponent("ClickableComponent"),M={item:null,transformation:{width:300,aspect_ratio:"16:9",crop:"pad",background:"black"}};const W=class extends F{constructor(t,e){super(t,_().obj.merge(M,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:"#"}),s=super.createEl("img",{className:"cld-thumbnail-img",src:this.getThumbnail()});return e.appendChild(s),e.style.backgroundImage=`url('${this.getThumbnail()}')`,e}},$=_().dom||_(),G={source:null,next:!1};class z extends W{constructor(t,e){super(t,_().obj.merge(G,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=$.createEl("div",{className:"cld-plw-item-info-wrap"}),s=$.createEl("div",{className:"cld-plw-item-title"});if(this.isCurrent()){t.classList.add("cld-plw-panel-item-active");const e=$.createEl("span",{className:"cld-plw-item-title-curr"},{},"Now Playing: ");s.appendChild(e)}const i=$.createEl("span",{className:"cld-plw-item-title"},{},this.getTitle());s.appendChild(i);const n=$.createEl("div",{className:"cld-plw-item-duration"},{},this.getDuration());return e.appendChild(s),e.appendChild(n),t&&t.appendChild(e),t.appendChild(e),t}}_().registerComponent("playlistPanelItem",z);const Y=z,q=_().getComponent("Component");class J extends q{constructor(t){super(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});const e=()=>{this.render()};t.on(o.f.PLAYLIST_ITEM_CHANGED,e),this.render(),this.dispose=()=>{super.dispose(),t.off(o.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 s=[],i=this.options_.total;let n=t.currentIndex(),r=t.list()[n];for(s.push(r);s.length<i;){if(n=t.nextIndex(n),-1===n){if(!e&&s.length>0)break;n=0}r=t.list()[n],s.push(r)}return s}render(){const t=this.getItems();this.removeAll(),t.forEach(((t,e)=>{const s=new Y(this.player(),_().obj.merge(this.options_,{item:t,next:1===e,current:0===e}));this.addChild(s)}))}}_().registerComponent("playlistPanel",J);const Z={format:"json",resource_type:"video",type:"list"},K=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=(0,r.sliceProperties)(e,"chainTarget").chainTarget;let i=null,a=null,c=null;const d=()=>{t.on(o.f.PLAYLIST_CREATED,(()=>{c&&c.dispose(),n()(e.playlistWidget)&&(t.fluid_&&(e.playlistWidget.fluid=!0),t.cloudinary.fontFace&&(e.playlistWidget.fontFace=t.cloudinary.fontFace),c=new H(t,e.playlistWidget))}))},p=(e,s)=>{e instanceof S?(i=e,i.resetState(),i.currentIndex(i.currentIndex())):(i=new S(t.cloudinary,e,s),i.currentIndex(0)),d(),a=(()=>{const e=()=>{i&&!i.currentSource().contains(t.currentSource())&&t.disposePlaylist()};return t.on("cldsourcechanged",e),e})(),t.addClass("vjs-playlist")};return t.cloudinary.sourcesByTag=async function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=(0,l.KA)(e,Object.assign({},t.cloudinary.cloudinaryConfig(),Z)),n=await fetch(i),r=await n.json(),o=h(r.resources);s.sorter&&o.sort(s.sorter);return o.map((e=>{let i=s.sourceParams||{};"function"==typeof i&&(i=i(e));const n=e.context&&e.context.custom||{},r=Object.assign({info:n},i,{publicId:e.publicId});return t.cloudinary.buildSource(r)}))},function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return void 0===e?i:(i&&(t.removeClass("vjs-playlist"),i=void 0,t.playlist().dispose(),t.off("cldsourcechanged",a)),p(e,n),t.trigger("playlistcreated"),s)}}},8812:(t,e,s)=>{var i=s(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 s=t.length;s--&&e.test(t.charAt(s)););return s}},4466:(t,e,s)=>{var i=s(9445);t.exports=function(t){return"number"==typeof t&&t==i(t)}},4764:(t,e,s)=>{var i=s(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,s)=>{var i=s(4764);t.exports=function(t){var e=i(t),s=e%1;return e==e?s?e-s:e:0}},5378:(t,e,s)=>{var i=s(8812),n=s(8953),r=s(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(r(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 s=l.test(t);return s||a.test(t)?c(t.slice(2),s?2:8):o.test(t)?NaN:+t}}}]);
|
|
2
2
|
//# sourceMappingURL=playlist.min.js.map
|
|
@@ -182,7 +182,7 @@ class RecommendationsOverlayPrimaryItem extends _recommendations_overlay_item__W
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
setPoster(url) {
|
|
185
|
-
this.poster.style.backgroundImage =
|
|
185
|
+
this.poster.style.backgroundImage = `url('${url}')`;
|
|
186
186
|
}
|
|
187
187
|
setTitle(text) {
|
|
188
188
|
components_component_utils__WEBPACK_IMPORTED_MODULE_2___default().setText(this.title, text);
|
|
@@ -269,7 +269,7 @@ class RecommendationsOverlaySecondaryItem extends _recommendations_overlay_item_
|
|
|
269
269
|
this.setDuration('');
|
|
270
270
|
}
|
|
271
271
|
setPoster(url) {
|
|
272
|
-
this.el().style.backgroundImage =
|
|
272
|
+
this.el().style.backgroundImage = `url('${url}')`;
|
|
273
273
|
}
|
|
274
274
|
setDuration(text) {
|
|
275
275
|
this.duration.innerText = text;
|
|
@@ -182,7 +182,7 @@ class RecommendationsOverlayPrimaryItem extends _recommendations_overlay_item__W
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
setPoster(url) {
|
|
185
|
-
this.poster.style.backgroundImage =
|
|
185
|
+
this.poster.style.backgroundImage = `url('${url}')`;
|
|
186
186
|
}
|
|
187
187
|
setTitle(text) {
|
|
188
188
|
components_component_utils__WEBPACK_IMPORTED_MODULE_2___default().setText(this.title, text);
|
|
@@ -269,7 +269,7 @@ class RecommendationsOverlaySecondaryItem extends _recommendations_overlay_item_
|
|
|
269
269
|
this.setDuration('');
|
|
270
270
|
}
|
|
271
271
|
setPoster(url) {
|
|
272
|
-
this.el().style.backgroundImage =
|
|
272
|
+
this.el().style.backgroundImage = `url('${url}')`;
|
|
273
273
|
}
|
|
274
274
|
setDuration(text) {
|
|
275
275
|
this.duration.innerText = text;
|