cloudinary-video-player 3.12.1 → 3.12.2-edge.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.
Files changed (86) hide show
  1. package/dist/134.min.js +8 -0
  2. package/dist/309.min.js +6 -0
  3. package/dist/adaptive-streaming.js +9 -9
  4. package/dist/adaptive-streaming.min.js +2 -2
  5. package/dist/chapters.js +4 -4
  6. package/dist/chapters.min.js +3 -3
  7. package/dist/cld-player-core.js +37 -0
  8. package/dist/cld-player-core.min.js +6 -0
  9. package/dist/cld-video-player-lazy.js +494 -0
  10. package/dist/cld-video-player-lazy.min.js +6 -0
  11. package/dist/cld-video-player.css +2 -2
  12. package/dist/cld-video-player.js +366 -332
  13. package/dist/cld-video-player.light.js +366 -332
  14. package/dist/cld-video-player.light.min.js +4 -4
  15. package/dist/cld-video-player.min.css +2 -2
  16. package/dist/cld-video-player.min.js +4 -4
  17. package/dist/colors.js +4 -4
  18. package/dist/colors.min.js +2 -2
  19. package/dist/dash.js +6 -6
  20. package/dist/dash.min.js +2 -2
  21. package/dist/debug.js +8 -8
  22. package/dist/debug.min.js +3 -3
  23. package/dist/ima.js +9 -9
  24. package/dist/ima.min.js +2 -2
  25. package/dist/interaction-areas.js +11 -11
  26. package/dist/interaction-areas.min.js +2 -2
  27. package/dist/node_modules_lodash_throttle_js.js +8 -8
  28. package/dist/playlist.js +31 -31
  29. package/dist/playlist.min.js +3 -3
  30. package/dist/recommendations-overlay.js +10 -10
  31. package/dist/recommendations-overlay.min.js +2 -2
  32. package/dist/schema.json +19 -0
  33. package/dist/share.js +5 -5
  34. package/dist/share.min.js +3 -3
  35. package/dist/shoppable.js +12 -12
  36. package/dist/shoppable.min.js +2 -2
  37. package/dist/utils_fetch-config_js.js +81 -0
  38. package/dist/video-player_js.js +3111 -0
  39. package/dist/visual-search.js +7 -7
  40. package/dist/visual-search.min.js +2 -2
  41. package/lib/_commonjsHelpers.js +7 -0
  42. package/lib/_videojs-proxy.js +30294 -0
  43. package/lib/abr-strategies.js +31 -0
  44. package/lib/adaptive-streaming.js +468 -2
  45. package/lib/all.js +25 -2
  46. package/lib/chapters.js +205 -1
  47. package/lib/cld-video-player.min.css +5 -22
  48. package/lib/colors.js +59 -1
  49. package/lib/{schema.json → config/configSchema.json} +19 -0
  50. package/lib/dash.js +69943 -2
  51. package/lib/debug.js +322 -1
  52. package/lib/document.js +770 -0
  53. package/lib/download-button.js +48 -0
  54. package/lib/fetch-config.js +93 -0
  55. package/lib/ima.js +6851 -1
  56. package/lib/index.js +27 -0
  57. package/lib/interaction-areas.const.js +24 -0
  58. package/lib/interaction-areas.service.js +469 -0
  59. package/lib/lazy.js +20 -0
  60. package/lib/noop.js +33 -0
  61. package/lib/player-api.js +469 -0
  62. package/lib/player.js +7 -2
  63. package/lib/playlist-panel.js +602 -0
  64. package/lib/playlist.js +637 -1
  65. package/lib/querystring.js +81 -0
  66. package/lib/recommendations-overlay.js +320 -1
  67. package/lib/share.js +129 -1
  68. package/lib/shoppable-post-widget.js +572 -0
  69. package/lib/shoppable-widget.js +77 -0
  70. package/lib/throttle.js +318 -0
  71. package/lib/toNumber.js +134 -0
  72. package/lib/validators-functions.js +485 -0
  73. package/lib/video-player.js +16241 -0
  74. package/lib/videoPlayer.js +7 -2
  75. package/lib/videojs-contrib-hlsjs.js +37638 -0
  76. package/lib/visual-search.js +235 -1
  77. package/package.json +31 -15
  78. package/lib/adaptive-streaming.js.LICENSE.txt +0 -3
  79. package/lib/all.js.LICENSE.txt +0 -25
  80. package/lib/cld-video-player.js +0 -2
  81. package/lib/cld-video-player.js.LICENSE.txt +0 -21
  82. package/lib/dash.js.LICENSE.txt +0 -1842
  83. package/lib/interaction-areas.js +0 -1
  84. package/lib/player.js.LICENSE.txt +0 -21
  85. package/lib/shoppable.js +0 -1
  86. package/lib/videoPlayer.js.LICENSE.txt +0 -21
@@ -0,0 +1,48 @@
1
+ import { _ as _vjs } from './_videojs-proxy.js';
2
+
3
+ const ClickableComponent = _vjs.getComponent('ClickableComponent');
4
+ class ShareDownloadButton extends ClickableComponent {
5
+ constructor(player) {
6
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
7
+ super(player, options);
8
+ }
9
+ handleClick(event) {
10
+ super.handleClick(event);
11
+ // Delegate the actual download to the plugin API if present
12
+ if (this.player().share && typeof this.player().share.download === 'function') {
13
+ this.player().share.download();
14
+ }
15
+ }
16
+ createEl() {
17
+ const button = _vjs.dom.createEl('button', {
18
+ className: 'vjs-control vjs-share-download-button vjs-button',
19
+ ariaLabel: 'Download video',
20
+ title: 'Download video'
21
+ });
22
+ const iconSpan = _vjs.dom.createEl('span', {
23
+ className: 'vjs-icon-file-download vjs-icon-placeholder'
24
+ });
25
+ button.appendChild(iconSpan);
26
+ const spinnerSpan = _vjs.dom.createEl('span', {
27
+ className: 'vjs-loading-spinner'
28
+ });
29
+ button.appendChild(spinnerSpan);
30
+ return button;
31
+ }
32
+
33
+ /**
34
+ * Toggles the "preparing download" visual state (spinner + title).
35
+ * @param {boolean} isPreparing
36
+ */
37
+ setPreparing(isPreparing) {
38
+ const el = this.el();
39
+ if (isPreparing) {
40
+ el.classList.add('vjs-waiting');
41
+ el.setAttribute('title', 'Download is being prepared');
42
+ } else {
43
+ el.classList.remove('vjs-waiting');
44
+ el.setAttribute('title', 'Download video');
45
+ }
46
+ }
47
+ }
48
+ _vjs.registerComponent('ShareDownloadButton', ShareDownloadButton);
@@ -0,0 +1,93 @@
1
+ import { i as isRawUrl, a as appendQueryParams, u as utf8ToBase64 } from './querystring.js';
2
+ import { g as getCloudinaryUrlPrefix } from './player-api.js';
3
+ import './_commonjsHelpers.js';
4
+
5
+ var dist = {};
6
+
7
+ var hasRequiredDist;
8
+
9
+ function requireDist () {
10
+ if (hasRequiredDist) return dist;
11
+ hasRequiredDist = 1;
12
+ (function (exports$1) {
13
+ var e={607:function(e,o,t){var l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:true}),o.defaultProfiles=o.cldLiveStreamingProfile=o.cldAdaptiveStreamProfile=o.cldLoopingProfile=o.cldDefaultProfile=void 0;const r=l(t(704)),i=l(t(83)),a=l(t(832)),s=l(t(877));o.cldDefaultProfile={name:"cld-default",isDefault:true,config:r.default},o.cldLoopingProfile={name:"cld-looping",isDefault:true,config:i.default},o.cldAdaptiveStreamProfile={name:"cld-adaptive-stream",isDefault:true,config:a.default},o.cldLiveStreamingProfile={name:"cld-live-streaming",isDefault:true,config:s.default},o.defaultProfiles=[o.cldDefaultProfile,o.cldLoopingProfile,o.cldAdaptiveStreamProfile,o.cldLiveStreamingProfile];},832:e=>{e.exports=JSON.parse('{"playerOptions":{"fluid":true,"controls":true,"controlBar":{"fullscreenToggle":false},"showJumpControls":true,"hideContextMenu":false,"floatingWhenNotVisible":"none"},"sourceOptions":{"chapters":true,"sourceTypes":["hls"]}}');},704:e=>{e.exports=JSON.parse('{"playerOptions":{},"sourceOptions":{}}');},877:e=>{e.exports=JSON.parse('{"playerOptions":{},"sourceOptions":{"type":"live","sourceTypes":["hls"]}}');},83:e=>{e.exports=JSON.parse('{"playerOptions":{"fluid":true,"controls":false,"muted":true,"floatingWhenNotVisible":"none","hideContextMenu":false,"autoplay":true,"loop":true},"sourceOptions":{}}');}},o={},t=function t(l){var r=o[l];if(void 0!==r)return r.exports;var i=o[l]={exports:{}};return e[l].call(i.exports,i,i.exports,t),i.exports}(607),l=exports$1;for(var r in t)l[r]=t[r];t.__esModule&&Object.defineProperty(l,"__esModule",{value:true});
14
+
15
+ } (dist));
16
+ return dist;
17
+ }
18
+
19
+ var distExports = requireDist();
20
+
21
+ const isDefaultProfile = profileName => !!distExports.defaultProfiles.find(_ref => {
22
+ let {
23
+ name
24
+ } = _ref;
25
+ return profileName === name;
26
+ });
27
+ const getDefaultProfileConfig = profileName => {
28
+ const profile = distExports.defaultProfiles.find(_ref2 => {
29
+ let {
30
+ name
31
+ } = _ref2;
32
+ return profileName === name;
33
+ });
34
+ if (!profile) {
35
+ throw new Error(`Default profile with name ${profileName} does not exist`);
36
+ }
37
+ return profile.config;
38
+ };
39
+ const fetchConfig = async options => {
40
+ const {
41
+ profile,
42
+ publicId,
43
+ cloudinaryConfig,
44
+ type = 'upload',
45
+ videoConfig,
46
+ allowUsageReport = true
47
+ } = options;
48
+ if (profile && isDefaultProfile(profile)) {
49
+ return getDefaultProfileConfig(profile);
50
+ }
51
+ const urlPrefix = getCloudinaryUrlPrefix(cloudinaryConfig) + '/_applet_/video_service';
52
+ const queryParams = allowUsageReport ? {
53
+ _s: `vp-${"3.12.2-edge.0"}`
54
+ } : null;
55
+ let configUrl;
56
+ if (profile) {
57
+ configUrl = isRawUrl(profile) ? profile : appendQueryParams(`${urlPrefix}/video_player_profiles/${profile.replaceAll(' ', '+')}.json`, queryParams);
58
+ } else if (publicId && videoConfig !== false) {
59
+ configUrl = appendQueryParams(`${urlPrefix}/video_player_config/video/${type}/${utf8ToBase64(publicId)}.json`, queryParams);
60
+ } else {
61
+ return {};
62
+ }
63
+ return fetch(configUrl, {
64
+ method: 'GET'
65
+ }).then(res => {
66
+ if (!res.ok) {
67
+ // fail silently
68
+ return {};
69
+ }
70
+ return res.json();
71
+ });
72
+ };
73
+ const fetchAndMergeConfig = async options => {
74
+ const profileOptions = await fetchConfig(options);
75
+ const fetchedConfig = profileOptions.playerOptions ? Object.keys(profileOptions.playerOptions) : [];
76
+ const profileAnalytics = {
77
+ _internalAnalyticsMetadata: {
78
+ newPlayerMethod: true,
79
+ ...(options.profile ? {
80
+ profile: isDefaultProfile(options.profile) ? options.profile : true
81
+ } : {}),
82
+ ...(!options.profile && options.videoConfig !== false && options.publicId ? {
83
+ videoConfig: true
84
+ } : {}),
85
+ ...(fetchedConfig.length > 0 ? {
86
+ fetchedConfig: fetchedConfig.join(',')
87
+ } : {})
88
+ }
89
+ };
90
+ return Object.assign({}, profileOptions.playerOptions || {}, profileOptions.sourceOptions || {}, options, profileAnalytics);
91
+ };
92
+
93
+ export { fetchAndMergeConfig };