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.
- package/dist/134.min.js +8 -0
- package/dist/309.min.js +6 -0
- package/dist/adaptive-streaming.js +9 -9
- package/dist/adaptive-streaming.min.js +2 -2
- package/dist/chapters.js +4 -4
- package/dist/chapters.min.js +3 -3
- package/dist/cld-player-core.js +37 -0
- package/dist/cld-player-core.min.js +6 -0
- package/dist/cld-video-player-lazy.js +494 -0
- package/dist/cld-video-player-lazy.min.js +6 -0
- package/dist/cld-video-player.css +2 -2
- package/dist/cld-video-player.js +366 -332
- package/dist/cld-video-player.light.js +366 -332
- package/dist/cld-video-player.light.min.js +4 -4
- package/dist/cld-video-player.min.css +2 -2
- package/dist/cld-video-player.min.js +4 -4
- package/dist/colors.js +4 -4
- package/dist/colors.min.js +2 -2
- package/dist/dash.js +6 -6
- package/dist/dash.min.js +2 -2
- package/dist/debug.js +8 -8
- package/dist/debug.min.js +3 -3
- package/dist/ima.js +9 -9
- package/dist/ima.min.js +2 -2
- package/dist/interaction-areas.js +11 -11
- package/dist/interaction-areas.min.js +2 -2
- package/dist/node_modules_lodash_throttle_js.js +8 -8
- package/dist/playlist.js +31 -31
- package/dist/playlist.min.js +3 -3
- package/dist/recommendations-overlay.js +10 -10
- package/dist/recommendations-overlay.min.js +2 -2
- package/dist/schema.json +19 -0
- package/dist/share.js +5 -5
- package/dist/share.min.js +3 -3
- package/dist/shoppable.js +12 -12
- package/dist/shoppable.min.js +2 -2
- package/dist/utils_fetch-config_js.js +81 -0
- package/dist/video-player_js.js +3111 -0
- package/dist/visual-search.js +7 -7
- package/dist/visual-search.min.js +2 -2
- package/lib/_commonjsHelpers.js +7 -0
- package/lib/_videojs-proxy.js +30294 -0
- package/lib/abr-strategies.js +31 -0
- package/lib/adaptive-streaming.js +468 -2
- package/lib/all.js +25 -2
- package/lib/chapters.js +205 -1
- package/lib/cld-video-player.min.css +5 -22
- package/lib/colors.js +59 -1
- package/lib/{schema.json → config/configSchema.json} +19 -0
- package/lib/dash.js +69943 -2
- package/lib/debug.js +322 -1
- package/lib/document.js +770 -0
- package/lib/download-button.js +48 -0
- package/lib/fetch-config.js +93 -0
- package/lib/ima.js +6851 -1
- package/lib/index.js +27 -0
- package/lib/interaction-areas.const.js +24 -0
- package/lib/interaction-areas.service.js +469 -0
- package/lib/lazy.js +20 -0
- package/lib/noop.js +33 -0
- package/lib/player-api.js +469 -0
- package/lib/player.js +7 -2
- package/lib/playlist-panel.js +602 -0
- package/lib/playlist.js +637 -1
- package/lib/querystring.js +81 -0
- package/lib/recommendations-overlay.js +320 -1
- package/lib/share.js +129 -1
- package/lib/shoppable-post-widget.js +572 -0
- package/lib/shoppable-widget.js +77 -0
- package/lib/throttle.js +318 -0
- package/lib/toNumber.js +134 -0
- package/lib/validators-functions.js +485 -0
- package/lib/video-player.js +16241 -0
- package/lib/videoPlayer.js +7 -2
- package/lib/videojs-contrib-hlsjs.js +37638 -0
- package/lib/visual-search.js +235 -1
- package/package.json +31 -15
- package/lib/adaptive-streaming.js.LICENSE.txt +0 -3
- package/lib/all.js.LICENSE.txt +0 -25
- package/lib/cld-video-player.js +0 -2
- package/lib/cld-video-player.js.LICENSE.txt +0 -21
- package/lib/dash.js.LICENSE.txt +0 -1842
- package/lib/interaction-areas.js +0 -1
- package/lib/player.js.LICENSE.txt +0 -21
- package/lib/shoppable.js +0 -1
- package/lib/videoPlayer.js.LICENSE.txt +0 -21
package/lib/visual-search.js
CHANGED
|
@@ -1 +1,235 @@
|
|
|
1
|
-
|
|
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.
|
|
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/
|
|
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/
|
|
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": "
|
|
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": "
|
|
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": "./
|
|
77
|
-
"maxSize": "
|
|
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",
|
package/lib/all.js.LICENSE.txt
DELETED
|
@@ -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
|
-
*/
|