cloudinary-video-player 3.14.1 → 3.14.2-edge.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +3 -13
  2. package/dist/149.min.js +6 -0
  3. package/dist/309.min.js +3 -3
  4. package/dist/689.min.js +2 -2
  5. package/dist/801.min.js +6 -0
  6. package/dist/adaptive-streaming.js +2 -2
  7. package/dist/adaptive-streaming.min.js +2 -2
  8. package/dist/chapters.js +2 -2
  9. package/dist/chapters.min.js +2 -2
  10. package/dist/cld-player-core.js +3119 -11
  11. package/dist/cld-player-core.min.js +3 -3
  12. package/dist/cld-poster-url.js +2 -2
  13. package/dist/cld-poster-url.min.js +2 -2
  14. package/dist/cld-video-player.css +5 -5
  15. package/dist/cld-video-player.js +43 -42
  16. package/dist/cld-video-player.light.js +43 -42
  17. package/dist/cld-video-player.light.min.js +3 -5
  18. package/dist/cld-video-player.min.css +2 -2
  19. package/dist/cld-video-player.min.js +3 -5
  20. package/dist/colors.js +2 -2
  21. package/dist/colors.min.js +2 -2
  22. package/dist/dash.js +2 -2
  23. package/dist/dash.min.js +2 -2
  24. package/dist/debug.js +2 -2
  25. package/dist/debug.min.js +2 -2
  26. package/dist/ima.js +2 -2
  27. package/dist/ima.min.js +2 -2
  28. package/dist/interaction-areas.js +7 -7
  29. package/dist/interaction-areas.min.js +3 -3
  30. package/dist/node_modules_lodash_throttle_js.js +2 -2
  31. package/dist/{video-player_js.js → player-full.js} +1398 -29
  32. package/dist/player-full.min.js +6 -0
  33. package/dist/player.css +3128 -0
  34. package/dist/{cld-video-player-lazy.js → player.js} +69 -101
  35. package/dist/player.min.css +5 -0
  36. package/dist/player.min.js +6 -0
  37. package/dist/playlist.js +2 -2
  38. package/dist/playlist.min.js +2 -2
  39. package/dist/recommendations-overlay.js +2 -2
  40. package/dist/recommendations-overlay.min.js +2 -2
  41. package/dist/share.js +2 -2
  42. package/dist/share.min.js +2 -2
  43. package/dist/shoppable.js +23 -23
  44. package/dist/shoppable.min.js +3 -3
  45. package/dist/utils_fetch-config_js.js +101 -2
  46. package/dist/utils_schedule_js.js +2 -2
  47. package/dist/visual-search.js +2 -2
  48. package/dist/visual-search.min.js +2 -2
  49. package/lib/all.js +3 -4
  50. package/lib/chapters.js +2 -3
  51. package/lib/cld-video-player.min.css +2 -2
  52. package/lib/cloudinary-config-from-options.js +21 -2775
  53. package/lib/colors.js +3 -2
  54. package/lib/debug.js +2 -2
  55. package/lib/fetch-config.js +0 -2
  56. package/lib/index.full.js +57 -0
  57. package/lib/index.js +128 -11
  58. package/lib/index2.js +10331 -0
  59. package/lib/{interaction-areas.service.js → interaction-areas.js} +4 -3
  60. package/lib/player-api.js +7 -2
  61. package/lib/player.min.css +5 -0
  62. package/lib/playlist-panel.js +1 -1
  63. package/lib/playlist.js +4 -3
  64. package/lib/recommendations-overlay.js +2 -3
  65. package/lib/share.js +2 -3
  66. package/lib/shoppable-post-widget.js +1 -1
  67. package/lib/{shoppable-widget.js → shoppable.js} +1 -2
  68. package/lib/throttle.js +1 -1
  69. package/lib/toNumber.js +2 -2
  70. package/lib/validators-functions.js +2 -47
  71. package/lib/video-player.const.js +47 -5
  72. package/lib/video-player.js +401 -7997
  73. package/package.json +22 -23
  74. package/dist/350.min.js +0 -6
  75. package/dist/933.min.js +0 -8
  76. package/dist/cld-video-player-lazy.min.js +0 -6
  77. package/dist/plugins_cloudinary_url-helpers_js-utils_cloudinary-config-from-options_js-utils_querystring_j-adfe37.js +0 -996
  78. package/lib/lazy.js +0 -19
  79. package/lib/player.js +0 -9
  80. package/lib/videoPlayer.js +0 -9
package/lib/colors.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import { i as isLight } from './video-player.js';
2
2
  import './_videojs-proxy.js';
3
3
  import './_commonjsHelpers.js';
4
- import './cloudinary-config-from-options.js';
4
+ import './index2.js';
5
5
  import './video-player.const.js';
6
- import './validators-functions.js';
6
+ import './cloudinary-config-from-options.js';
7
7
  import './cloudinary-url-prefix.js';
8
+ import './validators-functions.js';
8
9
 
9
10
  const defaults = {
10
11
  colorsDark: {
package/lib/debug.js CHANGED
@@ -1,8 +1,8 @@
1
- import { c as require_baseGetTag, e as requireIsObjectLike, k as ADS_IN_PLAYLIST, F as FLOATING_TO, A as AUTO_PLAY_MODE, h as CROP_MODE } from './video-player.const.js';
1
+ import { f as require_baseGetTag, g as requireIsObjectLike, i as isObject, d as isString, l as ADS_IN_PLAYLIST, F as FLOATING_TO, A as AUTO_PLAY_MODE, C as CROP_MODE } from './video-player.const.js';
2
2
  import { e as INTERACTION_AREAS_TEMPLATE, d as INTERACTION_AREAS_THEME } from './interaction-areas.const.js';
3
3
  import { A as ADAPTIVE_STREAMING_STRATEGY } from './abr-strategies.js';
4
4
  import { g as getDefaultExportFromCjs } from './_commonjsHelpers.js';
5
- import { i as isObject, b as isFunction, a as isString, g as getValidatorItem, e as isValueValid } from './validators-functions.js';
5
+ import { i as isFunction, g as getValidatorItem, c as isValueValid } from './validators-functions.js';
6
6
 
7
7
  var isBoolean_1;
8
8
  var hasRequiredIsBoolean;
@@ -1,7 +1,5 @@
1
1
  import { g as getCloudinaryConfigFromOptions, i as isRawUrl, a as appendQueryParams, u as utf8ToBase64 } from './cloudinary-config-from-options.js';
2
2
  import { g as getCloudinaryUrlPrefix } from './cloudinary-url-prefix.js';
3
- import './_commonjsHelpers.js';
4
- import './video-player.const.js';
5
3
 
6
4
  var dist = {};
7
5
 
@@ -0,0 +1,57 @@
1
+ import { c as createVideoPlayer, a as createPlayerWithConfig } from './video-player.js';
2
+ import { s as setupCloudinaryGlobal, c as createMultipleSync, a as createMultiplePlayers, b as createAsyncPlayer } from './player-api.js';
3
+ import './_videojs-proxy.js';
4
+ import './_commonjsHelpers.js';
5
+ import './index2.js';
6
+ import './video-player.const.js';
7
+ import './cloudinary-config-from-options.js';
8
+ import './cloudinary-url-prefix.js';
9
+ import './validators-functions.js';
10
+
11
+ /**
12
+ * UMD entry: full player bundle for backwards-compatible sync videoPlayer().
13
+ * player() is async with profile and schedule support.
14
+ */
15
+ const videoPlayer = function (id) {
16
+ let playerOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
17
+ let ready = arguments.length > 2 ? arguments[2] : undefined;
18
+ return createVideoPlayer(id, playerOptions, ready);
19
+ };
20
+ const videoPlayers = (selector, playerOptions, ready) => createMultipleSync(selector, playerOptions, ready, videoPlayer);
21
+ const player = function (id) {
22
+ let playerOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23
+ let ready = arguments.length > 2 ? arguments[2] : undefined;
24
+ return createAsyncPlayer(id, playerOptions, ready, createPlayerWithConfig);
25
+ };
26
+ const players = (selector, playerOptions, ready) => createMultiplePlayers(selector, playerOptions, ready, player);
27
+ const cloudinaryVideoPlayerLegacyConfig = function () {
28
+ let instanceConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
29
+ console.warn('Cloudinary.new() is deprecated and will be removed. Please use cloudinary.videoPlayer() instead.');
30
+ const mergeOpts = function () {
31
+ let callOpts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
32
+ return Object.assign({}, instanceConfig, callOpts);
33
+ };
34
+ return {
35
+ videoPlayer: function (id) {
36
+ let playerOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
37
+ let ready = arguments.length > 2 ? arguments[2] : undefined;
38
+ return createVideoPlayer(id, mergeOpts(playerOptions), ready);
39
+ },
40
+ videoPlayers: function (selector) {
41
+ let playerOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
42
+ let ready = arguments.length > 2 ? arguments[2] : undefined;
43
+ return createMultipleSync(selector, mergeOpts(playerOptions), ready, videoPlayer);
44
+ }
45
+ };
46
+ };
47
+ var index_full = setupCloudinaryGlobal({
48
+ videoPlayer,
49
+ videoPlayers,
50
+ player,
51
+ players,
52
+ Cloudinary: {
53
+ new: cloudinaryVideoPlayerLegacyConfig
54
+ }
55
+ });
56
+
57
+ export { index_full as default, player, players, videoPlayer, videoPlayers };
package/lib/index.js CHANGED
@@ -1,29 +1,146 @@
1
- export { _ as videojs } from './_videojs-proxy.js';
2
- import { n as createPlayerWithConfig, q as createVideoPlayer } from './video-player.js';
3
- import { s as setupCloudinaryGlobal, a as createAsyncPlayer, c as createMultiplePlayers, b as createMultipleSync } from './player-api.js';
4
- import './_commonjsHelpers.js';
5
- import './cloudinary-config-from-options.js';
6
- import './video-player.const.js';
7
- import './validators-functions.js';
8
- import './cloudinary-url-prefix.js';
1
+ import { s as setupCloudinaryGlobal, b as createAsyncPlayer, a as createMultiplePlayers, c as createMultipleSync } from './player-api.js';
9
2
 
3
+ /**
4
+ * Deferred Player Proxy
5
+ *
6
+ * Returns a synchronous object from videoPlayer() that buffers all method calls
7
+ * while the real VideoPlayer loads asynchronously, then replays them in order.
8
+ *
9
+ * This allows the default entry point to be lightweight (lazy) while preserving
10
+ * the synchronous API contract:
11
+ *
12
+ * const player = cloudinary.videoPlayer('el', { ... });
13
+ * player.source('elephants'); // buffered, replayed after load
14
+ * player.on('error', handler); // buffered, replayed after load
15
+ */
16
+
17
+ /**
18
+ * Creates a deferred player proxy that buffers calls until the real player loads.
19
+ *
20
+ * @param {Promise<Object>} playerPromise - Promise that resolves to a VideoPlayer instance.
21
+ * @returns {Object} A proxy that looks like a VideoPlayer synchronously.
22
+ */
23
+ const createDeferredPlayer = playerPromise => {
24
+ let realPlayer = null;
25
+ let failed = false;
26
+ const queue = [];
27
+ const resolvedPromise = playerPromise.then(p => {
28
+ realPlayer = p;
29
+ queue.forEach(_ref => {
30
+ let {
31
+ method,
32
+ args,
33
+ resolve,
34
+ reject
35
+ } = _ref;
36
+ try {
37
+ resolve(realPlayer[method](...args));
38
+ } catch (e) {
39
+ reject(e);
40
+ }
41
+ });
42
+ queue.length = 0;
43
+ return p;
44
+ }).catch(err => {
45
+ failed = true;
46
+ queue.forEach(_ref2 => {
47
+ let {
48
+ reject
49
+ } = _ref2;
50
+ return reject(err);
51
+ });
52
+ queue.length = 0;
53
+ throw err;
54
+ });
55
+ const proxy = new Proxy({}, {
56
+ get(_target, prop) {
57
+ if (prop === 'then' || prop === 'catch' || prop === 'finally') {
58
+ return resolvedPromise[prop].bind(resolvedPromise);
59
+ }
60
+ if (prop === Symbol.toPrimitive || prop === Symbol.toStringTag) {
61
+ return undefined;
62
+ }
63
+ if (realPlayer) {
64
+ const val = realPlayer[prop];
65
+ return typeof val === 'function' ? val.bind(realPlayer) : val;
66
+ }
67
+ if (failed) {
68
+ return undefined;
69
+ }
70
+ return function () {
71
+ const deferred = {};
72
+ const promise = new Promise((resolve, reject) => {
73
+ deferred.resolve = resolve;
74
+ deferred.reject = reject;
75
+ });
76
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
77
+ args[_key] = arguments[_key];
78
+ }
79
+ queue.push({
80
+ method: prop,
81
+ args,
82
+ ...deferred
83
+ });
84
+ promise.catch(e => console.error('[Cloudinary] Deferred player call failed:', e));
85
+ return proxy;
86
+ };
87
+ },
88
+ has(_target, prop) {
89
+ if (realPlayer) {
90
+ return prop in realPlayer;
91
+ }
92
+ return true;
93
+ }
94
+ });
95
+ return proxy;
96
+ };
97
+
98
+ const importCore = () => import(/* webpackChunkName: "cld-player-core" */'./video-player.js').then(function (n) { return n.v; });
10
99
  const videoPlayer = function (id) {
11
100
  let playerOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12
101
  let ready = arguments.length > 2 ? arguments[2] : undefined;
13
- return createVideoPlayer(id, playerOptions, ready);
102
+ return createDeferredPlayer(importCore().then(m => m.createVideoPlayer(id, playerOptions, ready)));
14
103
  };
15
104
  const videoPlayers = (selector, playerOptions, ready) => createMultipleSync(selector, playerOptions, ready, videoPlayer);
16
105
  const player = function (id) {
17
106
  let playerOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
18
107
  let ready = arguments.length > 2 ? arguments[2] : undefined;
19
- return createAsyncPlayer(id, playerOptions, ready, createPlayerWithConfig);
108
+ return createAsyncPlayer(id, playerOptions, ready, async (videoElement, opts, r) => {
109
+ const {
110
+ createPlayerWithConfig
111
+ } = await importCore();
112
+ return createPlayerWithConfig(videoElement, opts, r);
113
+ });
20
114
  };
21
115
  const players = (selector, playerOptions, ready) => createMultiplePlayers(selector, playerOptions, ready, player);
116
+ const cloudinaryVideoPlayerLegacyConfig = function () {
117
+ let instanceConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
118
+ console.warn('Cloudinary.new() is deprecated and will be removed. Please use cloudinary.videoPlayer() instead.');
119
+ const mergeOpts = function () {
120
+ let callOpts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
121
+ return Object.assign({}, instanceConfig, callOpts);
122
+ };
123
+ return {
124
+ videoPlayer: function (id) {
125
+ let playerOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
126
+ let ready = arguments.length > 2 ? arguments[2] : undefined;
127
+ return createDeferredPlayer(importCore().then(m => m.createVideoPlayer(id, mergeOpts(playerOptions), ready)));
128
+ },
129
+ videoPlayers: function (selector) {
130
+ let playerOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
131
+ let ready = arguments.length > 2 ? arguments[2] : undefined;
132
+ return createMultipleSync(selector, mergeOpts(playerOptions), ready, videoPlayer);
133
+ }
134
+ };
135
+ };
22
136
  var cloudinary = setupCloudinaryGlobal({
23
137
  videoPlayer,
24
138
  videoPlayers,
25
139
  player,
26
- players
140
+ players,
141
+ Cloudinary: {
142
+ new: cloudinaryVideoPlayerLegacyConfig
143
+ }
27
144
  });
28
145
 
29
146
  export { cloudinary as default, player, players, videoPlayer, videoPlayers };