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
@@ -1 +1,235 @@
1
- (self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[728],{9148:(e,a,s)=>{s.d(a,{default:()=>l});var t=s(6673),r=s.n(t);const l=(e,a)=>{a.addClass("vjs-visual-search");let s=!1;const t=(e=>{const a=()=>{e.$$(".vjs-visual-search-marker").forEach(e=>e.remove()),e.$$(".vjs-visual-search-results-wrapper").forEach(e=>e.remove()),e.removeClass("vjs-visual-search-results-active")};return{displayResults:s=>{a();const t=e.duration(),l=e.controlBar.progressControl.seekBar,n=r().dom.createEl("div",{className:"vjs-visual-search-results-wrapper",role:"presentation"});s.forEach(a=>{const{start_time:s,end_time:l}=a,c=s/t*100,o=(l-s)/t*100,i=`${Math.floor(s/60)}:${Math.floor(s%60).toString().padStart(2,"0")}`,d=r().dom.createEl("div",{className:"vjs-control vjs-visual-search-marker",style:`left: ${c}%; width: ${o}%`,tabIndex:0,role:"button",title:`Search result at ${i}`,ariaLabel:`Search result at ${i}`});n.appendChild(d),d.addEventListener("click",()=>{e.currentTime(s)}),d.addEventListener("keydown",a=>{"Enter"!==a.key&&" "!==a.key||(a.preventDefault(),e.currentTime(s))})}),l.el().appendChild(n),s.length>0&&e.addClass("vjs-visual-search-results-active")},clearMarkers:a}})(a),l=async e=>{const s=a.$(".vjs-visual-search-button");s.classList.add("vjs-waiting");try{const s=a.cloudinary.source(),r=s.publicId(),l=Object.assign({},s.transformation());l.flags=l.flags||[],l.flags.push(`getinfo:search_b64_${btoa(e)}`);const n=s.config().url(`${r}`,{transformation:l}),c=await fetch(n,{method:"GET",headers:{"Content-Type":"application/json"}});if(!c.ok)throw new Error(`Search request failed with status: ${c.status}`);const o=await c.json();t.displayResults(o.timestamps),o&&!a.hasStarted()&&a.play().then(()=>a.pause())}catch(e){console.error("Error performing visual search:",e)}finally{s.classList.remove("vjs-waiting")}},n=()=>{s=!1,t.clearMarkers(),a.$(".vjs-visual-search-wrapper")?.remove()},c=()=>{n();const e=a.$(".vjs-title-bar");e&&e.classList.remove("vjs-hidden");const c=r().dom.createEl("div",{className:"vjs-visual-search-wrapper"}),o=()=>{s&&(s=!1,c.classList.remove("vjs-visual-search-active"),d.input.value="",d.input.tabIndex=-1,d.closeButton.tabIndex=-1,t.clearMarkers())},i=(()=>{const e=r().dom.createEl("button",{className:"vjs-control vjs-button vjs-visual-search-button",title:"Search video content",ariaLabel:"Search video content"}),a=r().dom.createEl("span",{className:"vjs-icon-search"});e.appendChild(a);const t=r().dom.createEl("span",{className:"vjs-loading-spinner"});return e.appendChild(t),e.addEventListener("click",()=>{if(s){const e=d.input.value.trim();e&&l(e)}else s=!0,c.classList.add("vjs-visual-search-active"),d.input.tabIndex=0,d.closeButton.tabIndex=0,d.input.focus()}),e})(),d=((e,a)=>{const s=r().dom.createEl("form",{className:"vjs-visual-search-form"}),t=r().dom.createEl("input",{className:"vjs-visual-search-input",type:"text",ariaLabel:"Search input",tabIndex:-1}),l=r().dom.createEl("button",{className:"vjs-control vjs-button vjs-visual-search-close",type:"button",title:"Close search",ariaLabel:"Close search",tabIndex:-1}),n=r().dom.createEl("span",{className:"vjs-icon-close"});return l.appendChild(n),s.appendChild(t),s.appendChild(l),s.addEventListener("submit",a=>{a.preventDefault();const s=t.value.trim();s&&e(s)}),l.addEventListener("click",e=>{e.preventDefault(),a&&a()}),{element:s,input:t,closeButton:l}})(l,o);c.appendChild(i),c.appendChild(d.element),e.prepend(c),a.on("keydown",e=>{"Escape"===e.key&&s&&o()})};c(),a.visualSearch={createSearchUI:c,clearUI:n}}}}]);
1
+ import { _ as _vjs } from './_videojs-proxy.js';
2
+ import './_commonjsHelpers.js';
3
+
4
+ const SearchButton = onClick => {
5
+ const button = _vjs.dom.createEl('button', {
6
+ className: 'vjs-control vjs-button vjs-visual-search-button',
7
+ title: 'Search video content',
8
+ ariaLabel: 'Search video content'
9
+ });
10
+ const searchIcon = _vjs.dom.createEl('span', {
11
+ className: 'vjs-icon-search'
12
+ });
13
+ button.appendChild(searchIcon);
14
+ const spinnerIcon = _vjs.dom.createEl('span', {
15
+ className: 'vjs-loading-spinner'
16
+ });
17
+ button.appendChild(spinnerIcon);
18
+ button.addEventListener('click', onClick);
19
+ return button;
20
+ };
21
+
22
+ const SearchInput = (onSearch, onClose) => {
23
+ const form = _vjs.dom.createEl('form', {
24
+ className: 'vjs-visual-search-form'
25
+ });
26
+ const input = _vjs.dom.createEl('input', {
27
+ className: 'vjs-visual-search-input',
28
+ type: 'text',
29
+ ariaLabel: 'Search input',
30
+ tabIndex: -1
31
+ });
32
+ const closeButton = _vjs.dom.createEl('button', {
33
+ className: 'vjs-control vjs-button vjs-visual-search-close',
34
+ type: 'button',
35
+ title: 'Close search',
36
+ ariaLabel: 'Close search',
37
+ tabIndex: -1
38
+ });
39
+
40
+ // Add close icon
41
+ const closeIcon = _vjs.dom.createEl('span', {
42
+ className: 'vjs-icon-close'
43
+ });
44
+ closeButton.appendChild(closeIcon);
45
+ form.appendChild(input);
46
+ form.appendChild(closeButton);
47
+
48
+ // Handle search submission
49
+ form.addEventListener('submit', e => {
50
+ e.preventDefault();
51
+ const query = input.value.trim();
52
+ if (query) {
53
+ onSearch(query);
54
+ }
55
+ });
56
+
57
+ // Handle close button
58
+ closeButton.addEventListener('click', e => {
59
+ e.preventDefault();
60
+ if (onClose) {
61
+ onClose();
62
+ }
63
+ });
64
+ return {
65
+ element: form,
66
+ input,
67
+ closeButton
68
+ };
69
+ };
70
+
71
+ const SearchResults = player => {
72
+ const clearMarkers = () => {
73
+ player.$$('.vjs-visual-search-marker').forEach(el => el.remove());
74
+ player.$$('.vjs-visual-search-results-wrapper').forEach(el => el.remove());
75
+
76
+ // Remove the class that indicates search results are displayed
77
+ player.removeClass('vjs-visual-search-results-active');
78
+ };
79
+ const displayResults = results => {
80
+ // Clear existing markers
81
+ clearMarkers();
82
+ const total = player.duration();
83
+ const seekBar = player.controlBar.progressControl.seekBar;
84
+
85
+ // Create wrapper for search results
86
+ const wrapperEl = _vjs.dom.createEl('div', {
87
+ className: 'vjs-visual-search-results-wrapper',
88
+ role: 'presentation'
89
+ });
90
+
91
+ // Add markers for each result
92
+ results.forEach(result => {
93
+ const {
94
+ start_time,
95
+ end_time
96
+ } = result;
97
+ const position = start_time / total * 100;
98
+ const width = (end_time - start_time) / total * 100;
99
+ const time = `${Math.floor(start_time / 60)}:${Math.floor(start_time % 60).toString().padStart(2, '0')}`;
100
+ const markerEl = _vjs.dom.createEl('div', {
101
+ className: 'vjs-control vjs-visual-search-marker',
102
+ style: `left: ${position}%; width: ${width}%`,
103
+ tabIndex: 0,
104
+ role: 'button',
105
+ title: `Search result at ${time}`,
106
+ ariaLabel: `Search result at ${time}`
107
+ });
108
+ wrapperEl.appendChild(markerEl);
109
+
110
+ // Add click handler to jump to this time
111
+ markerEl.addEventListener('click', () => {
112
+ player.currentTime(start_time);
113
+ });
114
+
115
+ // Add keyboard support
116
+ markerEl.addEventListener('keydown', e => {
117
+ if (e.key === 'Enter' || e.key === ' ') {
118
+ e.preventDefault();
119
+ player.currentTime(start_time);
120
+ }
121
+ });
122
+ });
123
+
124
+ // Add wrapper to seek bar
125
+ seekBar.el().appendChild(wrapperEl);
126
+
127
+ // Add a class to indicate search results are displayed
128
+ if (results.length > 0) {
129
+ player.addClass('vjs-visual-search-results-active');
130
+ }
131
+ };
132
+ return {
133
+ displayResults,
134
+ clearMarkers
135
+ };
136
+ };
137
+
138
+ const visualSearch = (options, player) => {
139
+ player.addClass('vjs-visual-search');
140
+ let isSearchActive = false;
141
+ const searchResults = SearchResults(player);
142
+ const performSearch = async query => {
143
+ const searchButton = player.$('.vjs-visual-search-button');
144
+ searchButton.classList.add('vjs-waiting');
145
+ try {
146
+ const source = player.cloudinary.source();
147
+ const publicId = source.publicId();
148
+ const transformation = Object.assign({}, source.transformation());
149
+ transformation.flags = transformation.flags || [];
150
+ transformation.flags.push(`getinfo:search_b64_${btoa(query)}`);
151
+ const visualSearchSrc = source.config().url(`${publicId}`, {
152
+ transformation
153
+ });
154
+ const response = await fetch(visualSearchSrc, {
155
+ method: 'GET',
156
+ headers: {
157
+ 'Content-Type': 'application/json'
158
+ }
159
+ });
160
+ if (!response.ok) {
161
+ throw new Error(`Search request failed with status: ${response.status}`);
162
+ }
163
+ const results = await response.json();
164
+ searchResults.displayResults(results.timestamps);
165
+ if (results && !player.hasStarted()) {
166
+ // Make sure the progress bar is visible
167
+ player.play().then(() => player.pause());
168
+ }
169
+ } catch (error) {
170
+ console.error('Error performing visual search:', error);
171
+ } finally {
172
+ searchButton.classList.remove('vjs-waiting');
173
+ }
174
+ };
175
+ const clearUI = () => {
176
+ isSearchActive = false;
177
+ searchResults.clearMarkers();
178
+ player.$('.vjs-visual-search-wrapper')?.remove();
179
+ };
180
+ const createSearchUI = () => {
181
+ clearUI();
182
+ const titleBar = player.$('.vjs-title-bar');
183
+ if (titleBar) {
184
+ titleBar.classList.remove('vjs-hidden');
185
+ }
186
+ const searchContainer = _vjs.dom.createEl('div', {
187
+ className: 'vjs-visual-search-wrapper'
188
+ });
189
+
190
+ // Handle the search icon click (expand or submit)
191
+ const handleSearchButtonClick = () => {
192
+ if (!isSearchActive) {
193
+ isSearchActive = true;
194
+ searchContainer.classList.add('vjs-visual-search-active');
195
+ searchInput.input.tabIndex = 0;
196
+ searchInput.closeButton.tabIndex = 0;
197
+ searchInput.input.focus();
198
+ } else {
199
+ const query = searchInput.input.value.trim();
200
+ if (query) {
201
+ performSearch(query);
202
+ }
203
+ }
204
+ };
205
+ const closeSearch = () => {
206
+ if (isSearchActive) {
207
+ isSearchActive = false;
208
+ searchContainer.classList.remove('vjs-visual-search-active');
209
+ searchInput.input.value = '';
210
+ searchInput.input.tabIndex = -1;
211
+ searchInput.closeButton.tabIndex = -1;
212
+ searchResults.clearMarkers();
213
+ }
214
+ };
215
+ const searchButton = SearchButton(handleSearchButtonClick);
216
+ const searchInput = SearchInput(performSearch, closeSearch);
217
+ searchContainer.appendChild(searchButton);
218
+ searchContainer.appendChild(searchInput.element);
219
+ titleBar.prepend(searchContainer);
220
+ player.on('keydown', e => {
221
+ if (e.key === 'Escape' && isSearchActive) {
222
+ closeSearch();
223
+ }
224
+ });
225
+ };
226
+ createSearchUI();
227
+
228
+ // Public methods
229
+ player.visualSearch = {
230
+ createSearchUI,
231
+ clearUI
232
+ };
233
+ };
234
+
235
+ export { visualSearch as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudinary-video-player",
3
- "version": "3.12.1",
3
+ "version": "3.12.2-edge.0",
4
4
  "description": "Cloudinary Video Player",
5
5
  "author": "Cloudinary",
6
6
  "license": "MIT",
@@ -8,7 +8,7 @@
8
8
  "type": "git",
9
9
  "url": "https://github.com/cloudinary/cloudinary-video-player.git"
10
10
  },
11
- "module": "./lib/cld-video-player.js",
11
+ "module": "./lib/index.js",
12
12
  "main": "./dist/cld-video-player.min.js",
13
13
  "style": "./dist/cld-video-player.min.css",
14
14
  "types": "./types/cld-video-player.d.ts",
@@ -22,9 +22,28 @@
22
22
  "exports": {
23
23
  ".": {
24
24
  "types": "./types/cld-video-player.d.ts",
25
- "import": "./lib/cld-video-player.js",
25
+ "import": "./lib/index.js",
26
26
  "require": "./dist/cld-video-player.min.js"
27
27
  },
28
+ "./videoPlayer": {
29
+ "import": "./lib/videoPlayer.js",
30
+ "require": "./dist/cld-video-player.min.js"
31
+ },
32
+ "./player": {
33
+ "import": "./lib/player.js",
34
+ "require": "./dist/cld-video-player.min.js"
35
+ },
36
+ "./all": {
37
+ "import": "./lib/all.js",
38
+ "require": "./dist/cld-video-player.min.js"
39
+ },
40
+ "./lazy": {
41
+ "import": "./lib/lazy.js",
42
+ "require": "./dist/cld-video-player-lazy.min.js"
43
+ },
44
+ "./cld-video-player.min.css": "./lib/cld-video-player.min.css",
45
+ "./shoppable": "./lib/shoppable-widget.js",
46
+ "./interaction-areas": "./lib/interaction-areas.service.js",
28
47
  "./*": "./lib/*",
29
48
  "./light/*": "./lib/*"
30
49
  },
@@ -34,7 +53,7 @@
34
53
  "start": "webpack serve --config webpack/dev.config.js",
35
54
  "build": "WEBPACK_BUILD_MIN=1 webpack --config webpack/build.config.js --progress --color",
36
55
  "build-dev": "webpack --config webpack/build.config.js --progress --color --mode=development",
37
- "build-es": "WEBPACK_BUILD_MIN=1 webpack --config webpack/es6.config.js --progress --color",
56
+ "build-es": "rollup -c rollup.esm.config.js",
38
57
  "build-light": "node webpack/copy-light-bundle.js",
39
58
  "build-all": "npm run clean && npm run build && npm run build-dev && npm run build-es && npm run build-light",
40
59
  "analyze": "webpack --config webpack/analyzer.config.js",
@@ -62,19 +81,11 @@
62
81
  "files": [
63
82
  {
64
83
  "path": "./dist/cld-video-player.min.js",
65
- "maxSize": "137kb"
66
- },
67
- {
68
- "path": "./lib/cld-video-player.js",
69
- "maxSize": "137kb"
70
- },
71
- {
72
- "path": "./lib/videoPlayer.js",
73
- "maxSize": "137kb"
84
+ "maxSize": "140kb"
74
85
  },
75
86
  {
76
- "path": "./lib/all.js",
77
- "maxSize": "330kb"
87
+ "path": "./dist/cld-video-player-lazy.min.js",
88
+ "maxSize": "10kb"
78
89
  }
79
90
  ]
80
91
  },
@@ -96,6 +107,10 @@
96
107
  "webfontloader": "^1.6.28"
97
108
  },
98
109
  "devDependencies": {
110
+ "@rollup/plugin-babel": "^6.0.4",
111
+ "@rollup/plugin-commonjs": "^28.0.1",
112
+ "@rollup/plugin-node-resolve": "^16.0.0",
113
+ "@rollup/plugin-replace": "^6.0.0",
99
114
  "@actions/core": "^1.11.1",
100
115
  "@actions/github": "^6.0.1",
101
116
  "@babel/core": "^7.28.5",
@@ -116,6 +131,7 @@
116
131
  "conventional-changelog-angular": "^8.1.0",
117
132
  "conventional-changelog-cli": "^5.0.0",
118
133
  "conventional-recommended-bump": "^11.2.0",
134
+ "rollup": "^4.28.1",
119
135
  "copy-webpack-plugin": "^12.0.2",
120
136
  "css-loader": "^7.1.2",
121
137
  "css-minimizer-webpack-plugin": "^7.0.2",
@@ -1,3 +0,0 @@
1
- /*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */
2
-
3
- /*! @name videojs-contrib-quality-menu @version 1.0.4 @license Apache-2.0 */
@@ -1,25 +0,0 @@
1
- /*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */
2
-
3
- /*! @name videojs-contrib-quality-menu @version 1.0.4 @license Apache-2.0 */
4
-
5
- /*! @name videojs-per-source-behaviors @version 3.0.1 @license Apache-2.0 */
6
-
7
- /**
8
- * @license
9
- * slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
10
- * Copyright (c) 2014 David Björklund
11
- * Available under the MIT license
12
- * <https://github.com/kesla/parse-headers/blob/master/LICENCE>
13
- */
14
-
15
- /**
16
- * @license
17
- * Video.js 8.23.4 <http://videojs.com/>
18
- * Copyright Brightcove, Inc. <https://www.brightcove.com/>
19
- * Available under Apache License Version 2.0
20
- * <https://github.com/videojs/video.js/blob/main/LICENSE>
21
- *
22
- * Includes vtt.js <https://github.com/mozilla/vtt.js>
23
- * Available under Apache License Version 2.0
24
- * <https://github.com/mozilla/vtt.js/blob/main/LICENSE>
25
- */