cloudinary-video-player 2.6.1-edge.0 → 2.6.1-edge.2
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/README.md +14 -16
- package/dist/adaptive-streaming.js +36932 -0
- package/dist/adaptive-streaming.min.js +11 -0
- package/dist/chapters.js +6 -1
- package/dist/chapters.min.js +6 -1
- package/dist/cld-video-player.css +205 -11
- package/dist/cld-video-player.js +37521 -79652
- package/dist/cld-video-player.light.js +202 -662
- package/dist/cld-video-player.light.min.js +10 -3
- package/dist/cld-video-player.min.css +5 -1
- package/dist/cld-video-player.min.js +8 -2
- package/dist/colors.js +91 -0
- package/dist/colors.min.js +7 -0
- package/dist/dash.js +67 -2
- package/dist/dash.min.js +1071 -2
- package/dist/debug.js +145 -90
- package/dist/debug.min.js +6 -1
- package/dist/ima.js +71 -3
- package/dist/ima.min.js +6 -1
- package/dist/interaction-areas.js +92 -4
- package/dist/interaction-areas.min.js +6 -1
- package/dist/node_modules_lodash_throttle_js.js +5 -0
- package/dist/playlist.js +14 -9
- package/dist/playlist.min.js +6 -1
- package/dist/recommendations-overlay.js +12 -7
- package/dist/recommendations-overlay.min.js +6 -1
- package/dist/shoppable.js +12 -7
- package/dist/shoppable.min.js +6 -1
- package/dist/srt-text-tracks.js +213 -0
- package/dist/srt-text-tracks.min.js +7 -0
- package/dist/visual-search.js +9 -4
- package/dist/visual-search.min.js +6 -1
- package/lib/adaptive-streaming.js +3 -0
- package/lib/adaptive-streaming.js.LICENSE.txt +3 -0
- package/lib/all.js +1 -1
- package/lib/all.js.LICENSE.txt +18 -12
- package/lib/chapters.js +1 -1
- package/lib/cld-video-player.js +1 -1
- package/lib/cld-video-player.js.LICENSE.txt +16 -14
- package/lib/cld-video-player.min.css +2 -2
- package/lib/colors.js +2 -0
- package/lib/dash.js +1 -1
- package/lib/debug.js +1 -1
- package/lib/ima.js +1 -1
- package/lib/interaction-areas.js +1 -1
- package/lib/player.js +1 -1
- package/lib/player.js.LICENSE.txt +16 -14
- package/lib/playlist.js +1 -1
- package/lib/recommendations-overlay.js +1 -1
- package/lib/shoppable.js +1 -1
- package/lib/srt-text-tracks.js +2 -0
- package/lib/videoPlayer.js +1 -1
- package/lib/videoPlayer.js.LICENSE.txt +16 -14
- package/lib/visual-search.js +1 -1
- package/package.json +10 -23
- package/dist/chapters.light.js +0 -233
- package/dist/chapters.light.min.js +0 -2
- package/dist/cld-video-player.light.css +0 -2428
- package/dist/cld-video-player.light.min.css +0 -2
- package/dist/cld-video-player.light.min.js.LICENSE.txt +0 -21
- package/dist/cld-video-player.min.js.LICENSE.txt +0 -19
- package/dist/dash.light.js +0 -70036
- package/dist/dash.light.min.js +0 -3
- package/dist/dash.light.min.js.LICENSE.txt +0 -1842
- package/dist/dash.min.js.LICENSE.txt +0 -1842
- package/dist/debug.light.js +0 -383
- package/dist/debug.light.min.js +0 -2
- package/dist/ima.light.js +0 -7110
- package/dist/ima.light.min.js +0 -2
- package/dist/interaction-areas.light.js +0 -646
- package/dist/interaction-areas.light.min.js +0 -2
- package/dist/node_modules_lodash_throttle_js.light.js +0 -449
- package/dist/playlist.light.js +0 -1788
- package/dist/playlist.light.min.js +0 -2
- package/dist/recommendations-overlay.light.js +0 -464
- package/dist/recommendations-overlay.light.min.js +0 -2
- package/dist/shoppable.light.js +0 -853
- package/dist/shoppable.light.min.js +0 -2
- package/dist/visual-search.light.js +0 -317
- package/dist/visual-search.light.min.js +0 -2
- package/lib/light/chapters.js +0 -2
- package/lib/light/cld-video-player.light.min.css +0 -21
- package/lib/light/dash.js +0 -3
- package/lib/light/dash.js.LICENSE.txt +0 -1842
- package/lib/light/debug.js +0 -2
- package/lib/light/ima.js +0 -2
- package/lib/light/index.js +0 -3
- package/lib/light/index.js.LICENSE.txt +0 -21
- package/lib/light/interaction-areas.js +0 -2
- package/lib/light/playlist.js +0 -2
- package/lib/light/recommendations-overlay.js +0 -2
- package/lib/light/shoppable.js +0 -2
- package/lib/light/visual-search.js +0 -2
|
@@ -1,646 +0,0 @@
|
|
|
1
|
-
(self["cloudinaryVideoPlayerChunkLoading"] = self["cloudinaryVideoPlayerChunkLoading"] || []).push([["interaction-areas"],{
|
|
2
|
-
|
|
3
|
-
/***/ "./components/themeButton/themedButton.const.js":
|
|
4
|
-
/*!******************************************************!*\
|
|
5
|
-
!*** ./components/themeButton/themedButton.const.js ***!
|
|
6
|
-
\******************************************************/
|
|
7
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8
|
-
|
|
9
|
-
"use strict";
|
|
10
|
-
__webpack_require__.r(__webpack_exports__);
|
|
11
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12
|
-
/* harmony export */ BUTTON_THEME: () => (/* binding */ BUTTON_THEME)
|
|
13
|
-
/* harmony export */ });
|
|
14
|
-
const BUTTON_THEME = {
|
|
15
|
-
TRANSPARENT_WHITE: 'transparent-white'
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/***/ }),
|
|
19
|
-
|
|
20
|
-
/***/ "./components/themeButton/themedButton.js":
|
|
21
|
-
/*!************************************************!*\
|
|
22
|
-
!*** ./components/themeButton/themedButton.js ***!
|
|
23
|
-
\************************************************/
|
|
24
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
25
|
-
|
|
26
|
-
"use strict";
|
|
27
|
-
__webpack_require__.r(__webpack_exports__);
|
|
28
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
29
|
-
/* harmony export */ themedButton: () => (/* binding */ themedButton)
|
|
30
|
-
/* harmony export */ });
|
|
31
|
-
/* harmony import */ var _utils_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/dom */ "./utils/dom.js");
|
|
32
|
-
|
|
33
|
-
const themedButton = _ref => {
|
|
34
|
-
let {
|
|
35
|
-
text,
|
|
36
|
-
onClick,
|
|
37
|
-
theme = '',
|
|
38
|
-
loadingDelay = 0
|
|
39
|
-
} = _ref;
|
|
40
|
-
return (0,_utils_dom__WEBPACK_IMPORTED_MODULE_0__.elementsCreator)({
|
|
41
|
-
tag: 'button',
|
|
42
|
-
attr: {
|
|
43
|
-
class: `vp-theme-button theme-${theme}`
|
|
44
|
-
},
|
|
45
|
-
onClick,
|
|
46
|
-
children: [{
|
|
47
|
-
tag: 'div',
|
|
48
|
-
attr: {
|
|
49
|
-
class: 'vp-loading-bar'
|
|
50
|
-
},
|
|
51
|
-
style: {
|
|
52
|
-
'animation-duration': `${loadingDelay}ms`
|
|
53
|
-
}
|
|
54
|
-
}, {
|
|
55
|
-
tag: 'div',
|
|
56
|
-
attr: {
|
|
57
|
-
class: 'content'
|
|
58
|
-
},
|
|
59
|
-
children: text
|
|
60
|
-
}]
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
/***/ }),
|
|
65
|
-
|
|
66
|
-
/***/ "./plugins/interaction-areas/interaction-areas.const.js":
|
|
67
|
-
/*!**************************************************************!*\
|
|
68
|
-
!*** ./plugins/interaction-areas/interaction-areas.const.js ***!
|
|
69
|
-
\**************************************************************/
|
|
70
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
71
|
-
|
|
72
|
-
"use strict";
|
|
73
|
-
__webpack_require__.r(__webpack_exports__);
|
|
74
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
75
|
-
/* harmony export */ CLOSE_INTERACTION_AREA_LAYOUT_DELAY: () => (/* binding */ CLOSE_INTERACTION_AREA_LAYOUT_DELAY),
|
|
76
|
-
/* harmony export */ DEFAULT_INTERACTION_ARE_TRANSITION: () => (/* binding */ DEFAULT_INTERACTION_ARE_TRANSITION),
|
|
77
|
-
/* harmony export */ INTERACTION_AREAS_CONTAINER_CLASS_NAME: () => (/* binding */ INTERACTION_AREAS_CONTAINER_CLASS_NAME),
|
|
78
|
-
/* harmony export */ INTERACTION_AREAS_PREFIX: () => (/* binding */ INTERACTION_AREAS_PREFIX),
|
|
79
|
-
/* harmony export */ INTERACTION_AREAS_TEMPLATE: () => (/* binding */ INTERACTION_AREAS_TEMPLATE),
|
|
80
|
-
/* harmony export */ INTERACTION_AREAS_THEME: () => (/* binding */ INTERACTION_AREAS_THEME),
|
|
81
|
-
/* harmony export */ INTERACTION_AREA_HAND_ICON: () => (/* binding */ INTERACTION_AREA_HAND_ICON),
|
|
82
|
-
/* harmony export */ INTERACTION_AREA_LAYOUT_LOCAL_STORAGE_NAME: () => (/* binding */ INTERACTION_AREA_LAYOUT_LOCAL_STORAGE_NAME),
|
|
83
|
-
/* harmony export */ TEMPLATE_INTERACTION_AREAS_VTT: () => (/* binding */ TEMPLATE_INTERACTION_AREAS_VTT)
|
|
84
|
-
/* harmony export */ });
|
|
85
|
-
const INTERACTION_AREA_LAYOUT_LOCAL_STORAGE_NAME = 'cld-ia-layout-state';
|
|
86
|
-
const INTERACTION_AREAS_PREFIX = 'vp-ia';
|
|
87
|
-
const INTERACTION_AREAS_CONTAINER_CLASS_NAME = 'interaction-areas-container';
|
|
88
|
-
const INTERACTION_AREAS_TEMPLATE = {
|
|
89
|
-
PORTRAIT: 'portrait',
|
|
90
|
-
LANDSCAPE: 'landscape',
|
|
91
|
-
All: 'all',
|
|
92
|
-
CENTER: 'center'
|
|
93
|
-
};
|
|
94
|
-
const INTERACTION_AREAS_THEME = {
|
|
95
|
-
PULSING: 'pulsing',
|
|
96
|
-
SHADOWED: 'shadowed'
|
|
97
|
-
};
|
|
98
|
-
const TEMPLATE_INTERACTION_AREAS_VTT = {
|
|
99
|
-
[INTERACTION_AREAS_TEMPLATE.PORTRAIT]: 'https://res.cloudinary.com/prod/raw/upload/v1623772481/video-player/vtts/portrait.vtt',
|
|
100
|
-
[INTERACTION_AREAS_TEMPLATE.LANDSCAPE]: 'https://res.cloudinary.com/prod/raw/upload/v1623772303/video-player/vtts/landscape.vtt',
|
|
101
|
-
[INTERACTION_AREAS_TEMPLATE.All]: 'https://res.cloudinary.com/prod/raw/upload/v1623250266/video-player/vtts/all.vtt',
|
|
102
|
-
[INTERACTION_AREAS_TEMPLATE.CENTER]: 'https://res.cloudinary.com/prod/raw/upload/v1623250265/video-player/vtts/center.vtt'
|
|
103
|
-
};
|
|
104
|
-
const INTERACTION_AREA_HAND_ICON = 'https://res.cloudinary.com/prod/image/upload/v1626764643/video-player/interaction-area-hand.svg';
|
|
105
|
-
const CLOSE_INTERACTION_AREA_LAYOUT_DELAY = 4500;
|
|
106
|
-
const DEFAULT_INTERACTION_ARE_TRANSITION = 250;
|
|
107
|
-
|
|
108
|
-
/***/ }),
|
|
109
|
-
|
|
110
|
-
/***/ "./plugins/interaction-areas/interaction-areas.service.js":
|
|
111
|
-
/*!****************************************************************!*\
|
|
112
|
-
!*** ./plugins/interaction-areas/interaction-areas.service.js ***!
|
|
113
|
-
\****************************************************************/
|
|
114
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
115
|
-
|
|
116
|
-
"use strict";
|
|
117
|
-
__webpack_require__.r(__webpack_exports__);
|
|
118
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
119
|
-
/* harmony export */ interactionAreasService: () => (/* binding */ interactionAreasService)
|
|
120
|
-
/* harmony export */ });
|
|
121
|
-
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! video.js */ "../node_modules/video.js/dist/alt/video.core-exposed.js");
|
|
122
|
-
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(video_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
123
|
-
/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/get */ "../node_modules/lodash/get.js");
|
|
124
|
-
/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_get__WEBPACK_IMPORTED_MODULE_1__);
|
|
125
|
-
/* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/throttle */ "../node_modules/lodash/throttle.js");
|
|
126
|
-
/* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_throttle__WEBPACK_IMPORTED_MODULE_2__);
|
|
127
|
-
/* harmony import */ var lodash_noop__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash/noop */ "../node_modules/lodash/noop.js");
|
|
128
|
-
/* harmony import */ var lodash_noop__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_noop__WEBPACK_IMPORTED_MODULE_3__);
|
|
129
|
-
/* harmony import */ var _interaction_areas_const__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./interaction-areas.const */ "./plugins/interaction-areas/interaction-areas.const.js");
|
|
130
|
-
/* harmony import */ var _interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./interaction-areas.utils */ "./plugins/interaction-areas/interaction-areas.utils.js");
|
|
131
|
-
/* harmony import */ var _utils_dom__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../utils/dom */ "./utils/dom.js");
|
|
132
|
-
/* harmony import */ var _video_player_utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../video-player.utils */ "./video-player.utils.js");
|
|
133
|
-
/* harmony import */ var _utils_consts__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utils/consts */ "./utils/consts.js");
|
|
134
|
-
/* harmony import */ var _interaction_areas_scss__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./interaction-areas.scss */ "./plugins/interaction-areas/interaction-areas.scss");
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const interactionAreasService = (player, playerOptions, videojsOptions) => {
|
|
146
|
-
let isZoomed = false;
|
|
147
|
-
let currentSource = null;
|
|
148
|
-
let currentTrack = null;
|
|
149
|
-
let unZoom = (lodash_noop__WEBPACK_IMPORTED_MODULE_3___default());
|
|
150
|
-
const shouldLayoutMessage = () => (0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.shouldShowAreaLayoutMessage)(videojsOptions.interactionDisplay);
|
|
151
|
-
const getIsSyncOffsetTime = () => {
|
|
152
|
-
const interactionAreasConfig = getInteractionAreasConfig();
|
|
153
|
-
return interactionAreasConfig && interactionAreasConfig.syncOffsetTime !== undefined ? interactionAreasConfig.syncOffsetTime : false;
|
|
154
|
-
};
|
|
155
|
-
function isInteractionAreasEnabled() {
|
|
156
|
-
let enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
157
|
-
const interactionAreasConfig = getInteractionAreasConfig();
|
|
158
|
-
return enabled || interactionAreasConfig && interactionAreasConfig.enable;
|
|
159
|
-
}
|
|
160
|
-
function setAreasPositionListener() {
|
|
161
|
-
currentTrack && player.videojs.removeRemoteTextTrack(currentTrack);
|
|
162
|
-
const isEnabled = isInteractionAreasEnabled();
|
|
163
|
-
const interactionAreasConfig = getInteractionAreasConfig();
|
|
164
|
-
if (!isEnabled || isZoomed) {
|
|
165
|
-
return null;
|
|
166
|
-
}
|
|
167
|
-
if (Array.isArray(interactionAreasConfig.template)) {
|
|
168
|
-
addInteractionAreasItems(interactionAreasConfig.template);
|
|
169
|
-
setContainerSize();
|
|
170
|
-
} else {
|
|
171
|
-
const vttUrl = interactionAreasConfig.vttUrl || _interaction_areas_const__WEBPACK_IMPORTED_MODULE_4__.TEMPLATE_INTERACTION_AREAS_VTT[interactionAreasConfig.template];
|
|
172
|
-
if (vttUrl) {
|
|
173
|
-
currentTrack = (0,_video_player_utils__WEBPACK_IMPORTED_MODULE_7__.addMetadataTrack)(player.videojs, vttUrl);
|
|
174
|
-
addCueListener(currentTrack);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
function setGoBackButton() {
|
|
179
|
-
const button = (0,_utils_dom__WEBPACK_IMPORTED_MODULE_6__.createElement)('div', {
|
|
180
|
-
'class': 'go-back-button'
|
|
181
|
-
});
|
|
182
|
-
button.addEventListener('click', () => {
|
|
183
|
-
unZoom();
|
|
184
|
-
}, false);
|
|
185
|
-
const tracksContainer = (0,_utils_dom__WEBPACK_IMPORTED_MODULE_6__.createElement)('div', {
|
|
186
|
-
'class': _interaction_areas_const__WEBPACK_IMPORTED_MODULE_4__.INTERACTION_AREAS_CONTAINER_CLASS_NAME
|
|
187
|
-
}, button);
|
|
188
|
-
(0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.setInteractionAreasContainer)(player.videojs, tracksContainer);
|
|
189
|
-
}
|
|
190
|
-
function getInteractionAreasConfig() {
|
|
191
|
-
const {
|
|
192
|
-
cldSrc
|
|
193
|
-
} = currentSource;
|
|
194
|
-
return cldSrc && cldSrc.getInteractionAreas();
|
|
195
|
-
}
|
|
196
|
-
function removeLayoutMessage() {
|
|
197
|
-
(0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.removeInteractionAreasContainer)(player.videojs);
|
|
198
|
-
setAreasPositionListener();
|
|
199
|
-
player.play();
|
|
200
|
-
}
|
|
201
|
-
function setLayoutMessage() {
|
|
202
|
-
if (!isInteractionAreasEnabled()) {
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
if (shouldLayoutMessage()) {
|
|
206
|
-
let layoutMessageTimout = null;
|
|
207
|
-
const showItAgainCheckbox = lodash_get__WEBPACK_IMPORTED_MODULE_1___default()(videojsOptions, 'interactionDisplay.layout.showAgain', false);
|
|
208
|
-
player.pause();
|
|
209
|
-
(0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.createInteractionAreaLayoutMessage)(player.videojs, () => {
|
|
210
|
-
clearTimeout(layoutMessageTimout);
|
|
211
|
-
removeLayoutMessage();
|
|
212
|
-
}, showItAgainCheckbox);
|
|
213
|
-
if (!showItAgainCheckbox) {
|
|
214
|
-
layoutMessageTimout = setTimeout(removeLayoutMessage, _interaction_areas_const__WEBPACK_IMPORTED_MODULE_4__.CLOSE_INTERACTION_AREA_LAYOUT_DELAY);
|
|
215
|
-
}
|
|
216
|
-
} else {
|
|
217
|
-
removeLayoutMessage();
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
function handleAds() {
|
|
221
|
-
player.on('adsready', () => {
|
|
222
|
-
player.videojs.ima.addEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED, setLayoutMessage);
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
function init() {
|
|
226
|
-
currentSource = currentSource || player.videojs.currentSource();
|
|
227
|
-
if (isInteractionAreasEnabled()) {
|
|
228
|
-
player.videojs.el().classList.add('interaction-areas');
|
|
229
|
-
player.videojs.one(_utils_consts__WEBPACK_IMPORTED_MODULE_8__.PLAYER_EVENT.PLAY, () => {
|
|
230
|
-
if (typeof player.videojs.ima === 'object') {
|
|
231
|
-
handleAds();
|
|
232
|
-
} else {
|
|
233
|
-
setLayoutMessage();
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
const setInteractionAreasContainerSize = lodash_throttle__WEBPACK_IMPORTED_MODULE_2___default()(setContainerSize, 100);
|
|
237
|
-
player.videojs.on(_utils_consts__WEBPACK_IMPORTED_MODULE_8__.PLAYER_EVENT.FULL_SCREEN_CHANGE, () => {
|
|
238
|
-
// waiting for fullscreen will end
|
|
239
|
-
setTimeout(setInteractionAreasContainerSize, 100);
|
|
240
|
-
});
|
|
241
|
-
const resizeDestroy = (0,_utils_dom__WEBPACK_IMPORTED_MODULE_6__.addEventListener)(window, 'resize', setContainerSize, false);
|
|
242
|
-
player.videojs.on(_utils_consts__WEBPACK_IMPORTED_MODULE_8__.PLAYER_EVENT.DISPOSE, resizeDestroy);
|
|
243
|
-
}
|
|
244
|
-
player.videojs.on(_utils_consts__WEBPACK_IMPORTED_MODULE_8__.PLAYER_EVENT.ENDED, () => {
|
|
245
|
-
unZoom();
|
|
246
|
-
});
|
|
247
|
-
player.videojs.on(_utils_consts__WEBPACK_IMPORTED_MODULE_8__.PLAYER_EVENT.ERROR, () => {
|
|
248
|
-
player.pause();
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
function onZoom(src, newOption, item) {
|
|
252
|
-
const originalCurrentTime = player.currentTime();
|
|
253
|
-
const isSyncOffsetTime = getIsSyncOffsetTime();
|
|
254
|
-
const {
|
|
255
|
-
cldSrc
|
|
256
|
-
} = currentSource;
|
|
257
|
-
const currentSrcOptions = cldSrc.getInitOptions();
|
|
258
|
-
const option = newOption || {
|
|
259
|
-
transformation: currentSrcOptions.transformation
|
|
260
|
-
};
|
|
261
|
-
const transformation = !src && (0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.getZoomTransformation)(player.videoElement, item);
|
|
262
|
-
const sourceOptions = transformation ? video_js__WEBPACK_IMPORTED_MODULE_0___default().obj.merge({
|
|
263
|
-
transformation
|
|
264
|
-
}, option) : option;
|
|
265
|
-
const newSource = cldSrc.isRawUrl ? currentSource.src : {
|
|
266
|
-
publicId: cldSrc.publicId()
|
|
267
|
-
};
|
|
268
|
-
player.source(transformation ? {
|
|
269
|
-
publicId: cldSrc.publicId()
|
|
270
|
-
} : src, sourceOptions).play();
|
|
271
|
-
isSyncOffsetTime && player.currentTime(originalCurrentTime);
|
|
272
|
-
isZoomed = true;
|
|
273
|
-
setGoBackButton();
|
|
274
|
-
unZoom = () => {
|
|
275
|
-
if (isZoomed) {
|
|
276
|
-
isZoomed = false;
|
|
277
|
-
const currentZoomedTime = player.currentTime();
|
|
278
|
-
const duration = player.duration();
|
|
279
|
-
player.source(newSource, currentSrcOptions).play();
|
|
280
|
-
isSyncOffsetTime && currentZoomedTime < duration && player.currentTime(currentZoomedTime);
|
|
281
|
-
setAreasPositionListener();
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
function onInteractionAreasClick(_ref) {
|
|
286
|
-
let {
|
|
287
|
-
event,
|
|
288
|
-
item,
|
|
289
|
-
index
|
|
290
|
-
} = _ref;
|
|
291
|
-
const interactionAreasConfig = getInteractionAreasConfig();
|
|
292
|
-
interactionAreasConfig.onClick && interactionAreasConfig.onClick({
|
|
293
|
-
item,
|
|
294
|
-
index,
|
|
295
|
-
event,
|
|
296
|
-
zoom: (source, option) => {
|
|
297
|
-
onZoom(source, option, item);
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
function addInteractionAreasItems(interactionAreasData, previousInteractionAreasData) {
|
|
302
|
-
let durationTime = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
303
|
-
const configs = {
|
|
304
|
-
playerOptions: playerOptions,
|
|
305
|
-
videojsOptions: videojsOptions
|
|
306
|
-
};
|
|
307
|
-
if (previousInteractionAreasData) {
|
|
308
|
-
(0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.updateInteractionAreasItem)(player.videojs, configs, interactionAreasData, previousInteractionAreasData, durationTime, onInteractionAreasClick);
|
|
309
|
-
} else {
|
|
310
|
-
const interactionAreasItems = interactionAreasData.map((item, index) => {
|
|
311
|
-
return (0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.getInteractionAreaItem)(configs, item, index, durationTime, event => {
|
|
312
|
-
onInteractionAreasClick({
|
|
313
|
-
event,
|
|
314
|
-
item,
|
|
315
|
-
index
|
|
316
|
-
});
|
|
317
|
-
});
|
|
318
|
-
});
|
|
319
|
-
(0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.setInteractionAreasContainer)(player.videojs, (0,_utils_dom__WEBPACK_IMPORTED_MODULE_6__.createElement)('div', {
|
|
320
|
-
'class': _interaction_areas_const__WEBPACK_IMPORTED_MODULE_4__.INTERACTION_AREAS_CONTAINER_CLASS_NAME
|
|
321
|
-
}, interactionAreasItems));
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
function setContainerSize() {
|
|
325
|
-
if (isInteractionAreasEnabled()) {
|
|
326
|
-
(0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.setInteractionAreasContainerSize)(player.videojs, player.videoElement);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
function addCueListener(track) {
|
|
330
|
-
if (!track) {
|
|
331
|
-
return;
|
|
332
|
-
}
|
|
333
|
-
let previousTracksData = null;
|
|
334
|
-
track.addEventListener('cuechange', () => {
|
|
335
|
-
const activeCue = track.activeCues && track.activeCues[0];
|
|
336
|
-
if (activeCue) {
|
|
337
|
-
const durationTime = Math.max(Math.floor((activeCue.endTime - activeCue.startTime) * 1000), _interaction_areas_const__WEBPACK_IMPORTED_MODULE_4__.DEFAULT_INTERACTION_ARE_TRANSITION);
|
|
338
|
-
const tracksData = JSON.parse(activeCue.text);
|
|
339
|
-
addInteractionAreasItems(tracksData, previousTracksData, durationTime);
|
|
340
|
-
!previousTracksData && setContainerSize();
|
|
341
|
-
previousTracksData = tracksData;
|
|
342
|
-
} else {
|
|
343
|
-
(0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.removeInteractionAreasContainer)(player.videojs);
|
|
344
|
-
previousTracksData = null;
|
|
345
|
-
}
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
init();
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
/***/ }),
|
|
352
|
-
|
|
353
|
-
/***/ "./plugins/interaction-areas/interaction-areas.utils.js":
|
|
354
|
-
/*!**************************************************************!*\
|
|
355
|
-
!*** ./plugins/interaction-areas/interaction-areas.utils.js ***!
|
|
356
|
-
\**************************************************************/
|
|
357
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
358
|
-
|
|
359
|
-
"use strict";
|
|
360
|
-
__webpack_require__.r(__webpack_exports__);
|
|
361
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
362
|
-
/* harmony export */ createInteractionAreaLayoutMessage: () => (/* binding */ createInteractionAreaLayoutMessage),
|
|
363
|
-
/* harmony export */ getInteractionAreaItem: () => (/* binding */ getInteractionAreaItem),
|
|
364
|
-
/* harmony export */ getZoomTransformation: () => (/* binding */ getZoomTransformation),
|
|
365
|
-
/* harmony export */ percentageToFixedValue: () => (/* binding */ percentageToFixedValue),
|
|
366
|
-
/* harmony export */ removeInteractionAreasContainer: () => (/* binding */ removeInteractionAreasContainer),
|
|
367
|
-
/* harmony export */ setInteractionAreasContainer: () => (/* binding */ setInteractionAreasContainer),
|
|
368
|
-
/* harmony export */ setInteractionAreasContainerSize: () => (/* binding */ setInteractionAreasContainerSize),
|
|
369
|
-
/* harmony export */ shouldShowAreaLayoutMessage: () => (/* binding */ shouldShowAreaLayoutMessage),
|
|
370
|
-
/* harmony export */ updateInteractionAreasItem: () => (/* binding */ updateInteractionAreasItem)
|
|
371
|
-
/* harmony export */ });
|
|
372
|
-
/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/get */ "../node_modules/lodash/get.js");
|
|
373
|
-
/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_get__WEBPACK_IMPORTED_MODULE_0__);
|
|
374
|
-
/* harmony import */ var lodash_noop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/noop */ "../node_modules/lodash/noop.js");
|
|
375
|
-
/* harmony import */ var lodash_noop__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_noop__WEBPACK_IMPORTED_MODULE_1__);
|
|
376
|
-
/* harmony import */ var _utils_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils/dom */ "./utils/dom.js");
|
|
377
|
-
/* harmony import */ var _interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./interaction-areas.const */ "./plugins/interaction-areas/interaction-areas.const.js");
|
|
378
|
-
/* harmony import */ var _colors__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../colors */ "./plugins/colors/index.js");
|
|
379
|
-
/* harmony import */ var _components_themeButton_themedButton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../components/themeButton/themedButton */ "./components/themeButton/themedButton.js");
|
|
380
|
-
/* harmony import */ var _components_themeButton_themedButton_const__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../components/themeButton/themedButton.const */ "./components/themeButton/themedButton.const.js");
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
const getInteractionAreaItemId = (item, index) => item.id || item.type || `id_${index}`;
|
|
389
|
-
const getInteractionAreaItem = (_ref, item, index, durationTime, onClick) => {
|
|
390
|
-
let {
|
|
391
|
-
playerOptions,
|
|
392
|
-
videojsOptions
|
|
393
|
-
} = _ref;
|
|
394
|
-
const defaultColor = (0,_colors__WEBPACK_IMPORTED_MODULE_4__.getDefaultPlayerColor)(videojsOptions);
|
|
395
|
-
const accentColor = playerOptions && playerOptions.colors ? playerOptions.colors.accent : defaultColor.accent;
|
|
396
|
-
|
|
397
|
-
// theme = 'pulsing' / 'shadowed'
|
|
398
|
-
const theme = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(videojsOptions, 'interactionDisplay.theme.template', _interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_THEME.PULSING);
|
|
399
|
-
return (0,_utils_dom__WEBPACK_IMPORTED_MODULE_2__.elementsCreator)({
|
|
400
|
-
tag: 'div',
|
|
401
|
-
attr: {
|
|
402
|
-
class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-item theme-${theme}`,
|
|
403
|
-
'data-id': getInteractionAreaItemId(item, index)
|
|
404
|
-
},
|
|
405
|
-
style: {
|
|
406
|
-
left: `${item.left}%`,
|
|
407
|
-
top: `${item.top}%`,
|
|
408
|
-
width: `${item.width}%`,
|
|
409
|
-
height: `${item.height}%`,
|
|
410
|
-
transitionDuration: `${durationTime}ms`
|
|
411
|
-
},
|
|
412
|
-
event: {
|
|
413
|
-
name: 'click',
|
|
414
|
-
callback: onClick
|
|
415
|
-
},
|
|
416
|
-
children: [{
|
|
417
|
-
tag: 'div',
|
|
418
|
-
attr: {
|
|
419
|
-
class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-area-marker`
|
|
420
|
-
},
|
|
421
|
-
children: [{
|
|
422
|
-
tag: 'div',
|
|
423
|
-
attr: {
|
|
424
|
-
class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-marker-shadow`
|
|
425
|
-
},
|
|
426
|
-
style: {
|
|
427
|
-
[theme === _interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_THEME.SHADOWED ? 'backgroundColor' : 'borderColor']: accentColor
|
|
428
|
-
}
|
|
429
|
-
}, {
|
|
430
|
-
tag: 'div',
|
|
431
|
-
attr: {
|
|
432
|
-
class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-marker-main`
|
|
433
|
-
},
|
|
434
|
-
style: {
|
|
435
|
-
borderColor: accentColor
|
|
436
|
-
}
|
|
437
|
-
}]
|
|
438
|
-
}]
|
|
439
|
-
});
|
|
440
|
-
};
|
|
441
|
-
const percentageToFixedValue = (outOf, value) => outOf / (100 / +value);
|
|
442
|
-
const getZoomTransformation = (videoElement, interactionAreaItem) => {
|
|
443
|
-
const {
|
|
444
|
-
videoHeight,
|
|
445
|
-
videoWidth
|
|
446
|
-
} = videoElement;
|
|
447
|
-
const itemX = percentageToFixedValue(videoWidth, interactionAreaItem.left);
|
|
448
|
-
const itemY = percentageToFixedValue(videoHeight, interactionAreaItem.top);
|
|
449
|
-
const itemWidth = percentageToFixedValue(videoWidth, interactionAreaItem.width);
|
|
450
|
-
const itemHeight = percentageToFixedValue(videoHeight, interactionAreaItem.height);
|
|
451
|
-
const videoAspectRatio = videoWidth / videoHeight;
|
|
452
|
-
const itemAspectRatio = itemWidth / itemHeight;
|
|
453
|
-
const width = Math.round(itemAspectRatio > 1 || videoAspectRatio > 1 ? itemHeight * itemAspectRatio : itemWidth);
|
|
454
|
-
const height = Math.round(width / videoAspectRatio);
|
|
455
|
-
const x = Math.round(itemX - (width - itemWidth) / 2);
|
|
456
|
-
const y = Math.round(itemY - (height - itemHeight) / 2);
|
|
457
|
-
return {
|
|
458
|
-
width,
|
|
459
|
-
height,
|
|
460
|
-
x: Math.min(Math.max(x, 0), videoWidth - width),
|
|
461
|
-
y: Math.min(Math.max(y, 0), videoHeight - height),
|
|
462
|
-
crop: 'crop'
|
|
463
|
-
};
|
|
464
|
-
};
|
|
465
|
-
const setInteractionAreasContainer = (videojs, newInteractionAreasContainer) => {
|
|
466
|
-
const currentInteractionAreasContainer = getInteractionAreasContainer(videojs);
|
|
467
|
-
if (currentInteractionAreasContainer) {
|
|
468
|
-
currentInteractionAreasContainer.replaceWith(newInteractionAreasContainer);
|
|
469
|
-
} else {
|
|
470
|
-
// do not use element.append for ie11 support
|
|
471
|
-
videojs.el().appendChild(newInteractionAreasContainer);
|
|
472
|
-
}
|
|
473
|
-
};
|
|
474
|
-
const getInteractionAreaElementById = (interactionAreasContainer, item, index) => interactionAreasContainer.querySelector(`[data-id=${getInteractionAreaItemId(item, index)}]`);
|
|
475
|
-
const updateInteractionAreasItem = (videojs, configs, interactionAreasData, previousInteractionAreasData, durationTime, onClick) => {
|
|
476
|
-
const interactionAreasContainer = getInteractionAreasContainer(videojs);
|
|
477
|
-
interactionAreasData.forEach((item, index) => {
|
|
478
|
-
const itemElement = getInteractionAreaElementById(interactionAreasContainer, item, index);
|
|
479
|
-
const itemId = getInteractionAreaItemId(item);
|
|
480
|
-
const isExistItem = previousInteractionAreasData.some(i => getInteractionAreaItemId(i) === itemId);
|
|
481
|
-
|
|
482
|
-
// in case the element of the item is in the dom and exist in the previous data , it update the element position
|
|
483
|
-
if (isExistItem && itemElement) {
|
|
484
|
-
(0,_utils_dom__WEBPACK_IMPORTED_MODULE_2__.styleElement)(itemElement, {
|
|
485
|
-
left: `${item.left}%`,
|
|
486
|
-
top: `${item.top}%`,
|
|
487
|
-
width: `${item.width}%`,
|
|
488
|
-
height: `${item.height}%`,
|
|
489
|
-
transitionDuration: `${durationTime}ms`
|
|
490
|
-
});
|
|
491
|
-
// if the element did not exist before , not in the dom and not in the previous data , it add a new element
|
|
492
|
-
} else if (!isExistItem && !itemElement) {
|
|
493
|
-
// do not use element.append for ie11 support
|
|
494
|
-
interactionAreasContainer.appendChild(getInteractionAreaItem(configs, item, index, durationTime, event => {
|
|
495
|
-
onClick({
|
|
496
|
-
event,
|
|
497
|
-
item,
|
|
498
|
-
index
|
|
499
|
-
});
|
|
500
|
-
}));
|
|
501
|
-
}
|
|
502
|
-
});
|
|
503
|
-
|
|
504
|
-
// checking the previous data for element that should be removed if not exist in the new data object.
|
|
505
|
-
previousInteractionAreasData.forEach((item, index) => {
|
|
506
|
-
const itemElement = getInteractionAreaElementById(interactionAreasContainer, item, index);
|
|
507
|
-
const itemId = getInteractionAreaItemId(item);
|
|
508
|
-
const shouldBeRemoved = !interactionAreasData.some(i => getInteractionAreaItemId(i) === itemId);
|
|
509
|
-
if (itemElement && shouldBeRemoved) {
|
|
510
|
-
// do not use element.remove for ie11 support
|
|
511
|
-
itemElement.parentNode.removeChild(itemElement);
|
|
512
|
-
}
|
|
513
|
-
});
|
|
514
|
-
};
|
|
515
|
-
const shouldShowAreaLayoutMessage = interactionAreasConfig => {
|
|
516
|
-
const isLayoutEnabled = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(interactionAreasConfig, 'layout.enable', true);
|
|
517
|
-
return isLayoutEnabled && localStorage.getItem(_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREA_LAYOUT_LOCAL_STORAGE_NAME) !== 'true';
|
|
518
|
-
};
|
|
519
|
-
const onClickInteractionAreaLayoutClick = function (checked) {
|
|
520
|
-
let onClick = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (lodash_noop__WEBPACK_IMPORTED_MODULE_1___default());
|
|
521
|
-
localStorage.setItem(_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREA_LAYOUT_LOCAL_STORAGE_NAME, JSON.parse(checked));
|
|
522
|
-
onClick();
|
|
523
|
-
};
|
|
524
|
-
const createInteractionAreaLayoutMessage = function (videojs, onClick) {
|
|
525
|
-
let showItAgainCheckbox = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
526
|
-
let checked = false;
|
|
527
|
-
const id = `checkbox_${Math.round(Math.random() * 10000)}`;
|
|
528
|
-
const tracksContainer = (0,_utils_dom__WEBPACK_IMPORTED_MODULE_2__.elementsCreator)({
|
|
529
|
-
tag: 'div',
|
|
530
|
-
attr: {
|
|
531
|
-
class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_CONTAINER_CLASS_NAME} ${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-layout-message ${showItAgainCheckbox ? '' : 'clickable'}`
|
|
532
|
-
},
|
|
533
|
-
onClick: !showItAgainCheckbox ? () => onClickInteractionAreaLayoutClick(checked, onClick) : null,
|
|
534
|
-
children: [{
|
|
535
|
-
tag: 'img',
|
|
536
|
-
attr: {
|
|
537
|
-
class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-layout-icon`,
|
|
538
|
-
src: _interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREA_HAND_ICON
|
|
539
|
-
}
|
|
540
|
-
}, {
|
|
541
|
-
tag: 'h3',
|
|
542
|
-
attr: {
|
|
543
|
-
class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-layout-message-title`
|
|
544
|
-
},
|
|
545
|
-
children: 'Tap on dots to zoom for a product.'
|
|
546
|
-
}, (0,_components_themeButton_themedButton__WEBPACK_IMPORTED_MODULE_5__.themedButton)({
|
|
547
|
-
text: 'Got it',
|
|
548
|
-
theme: _components_themeButton_themedButton_const__WEBPACK_IMPORTED_MODULE_6__.BUTTON_THEME.TRANSPARENT_WHITE,
|
|
549
|
-
loadingDelay: showItAgainCheckbox ? 0 : _interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.CLOSE_INTERACTION_AREA_LAYOUT_DELAY,
|
|
550
|
-
onClick: showItAgainCheckbox ? () => onClickInteractionAreaLayoutClick(checked, onClick) : null
|
|
551
|
-
}), showItAgainCheckbox && {
|
|
552
|
-
tag: 'div',
|
|
553
|
-
attr: {
|
|
554
|
-
class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-layout-message-do-not-show`
|
|
555
|
-
},
|
|
556
|
-
children: [{
|
|
557
|
-
tag: 'input',
|
|
558
|
-
attr: {
|
|
559
|
-
type: 'checkbox',
|
|
560
|
-
class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-layout-message-checkbox`,
|
|
561
|
-
id
|
|
562
|
-
},
|
|
563
|
-
event: {
|
|
564
|
-
name: 'input',
|
|
565
|
-
callback: event => {
|
|
566
|
-
checked = event.target.checked;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
}, {
|
|
570
|
-
tag: 'label',
|
|
571
|
-
attr: {
|
|
572
|
-
class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-layout-message-checkbox-title`,
|
|
573
|
-
for: id
|
|
574
|
-
},
|
|
575
|
-
children: 'Don׳t show it again'
|
|
576
|
-
}]
|
|
577
|
-
}].filter(i => i)
|
|
578
|
-
});
|
|
579
|
-
setInteractionAreasContainer(videojs, tracksContainer);
|
|
580
|
-
};
|
|
581
|
-
const getInteractionAreasContainer = videojs => videojs.el().querySelector(`.${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_CONTAINER_CLASS_NAME}`);
|
|
582
|
-
const removeInteractionAreasContainer = videojs => {
|
|
583
|
-
const interactionAreasContainer = getInteractionAreasContainer(videojs);
|
|
584
|
-
|
|
585
|
-
// do not use element.remove for ie11 support
|
|
586
|
-
interactionAreasContainer && interactionAreasContainer.parentNode.removeChild(interactionAreasContainer);
|
|
587
|
-
};
|
|
588
|
-
const setInteractionAreasContainerSize = (videojs, videoElement) => {
|
|
589
|
-
const interactionAreasContainer = getInteractionAreasContainer(videojs);
|
|
590
|
-
if (!interactionAreasContainer) {
|
|
591
|
-
return;
|
|
592
|
-
}
|
|
593
|
-
const {
|
|
594
|
-
videoHeight,
|
|
595
|
-
videoWidth
|
|
596
|
-
} = videoElement;
|
|
597
|
-
const videoAspectRatio = videoWidth / videoHeight;
|
|
598
|
-
const width = videoAspectRatio * videoElement.clientHeight;
|
|
599
|
-
interactionAreasContainer.style.width = `${videoElement.clientWidth < width ? '100%' : width}px`;
|
|
600
|
-
interactionAreasContainer.style.height = videoElement.clientWidth < width ? `${videoElement.clientWidth / videoAspectRatio}px` : '100%';
|
|
601
|
-
};
|
|
602
|
-
|
|
603
|
-
/***/ }),
|
|
604
|
-
|
|
605
|
-
/***/ "../node_modules/lodash/noop.js":
|
|
606
|
-
/*!**************************************!*\
|
|
607
|
-
!*** ../node_modules/lodash/noop.js ***!
|
|
608
|
-
\**************************************/
|
|
609
|
-
/***/ ((module) => {
|
|
610
|
-
|
|
611
|
-
/**
|
|
612
|
-
* This method returns `undefined`.
|
|
613
|
-
*
|
|
614
|
-
* @static
|
|
615
|
-
* @memberOf _
|
|
616
|
-
* @since 2.3.0
|
|
617
|
-
* @category Util
|
|
618
|
-
* @example
|
|
619
|
-
*
|
|
620
|
-
* _.times(2, _.noop);
|
|
621
|
-
* // => [undefined, undefined]
|
|
622
|
-
*/
|
|
623
|
-
function noop() {
|
|
624
|
-
// No operation performed.
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
module.exports = noop;
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
/***/ }),
|
|
631
|
-
|
|
632
|
-
/***/ "./plugins/interaction-areas/interaction-areas.scss":
|
|
633
|
-
/*!**********************************************************!*\
|
|
634
|
-
!*** ./plugins/interaction-areas/interaction-areas.scss ***!
|
|
635
|
-
\**********************************************************/
|
|
636
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
637
|
-
|
|
638
|
-
"use strict";
|
|
639
|
-
__webpack_require__.r(__webpack_exports__);
|
|
640
|
-
// extracted by mini-css-extract-plugin
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
/***/ })
|
|
644
|
-
|
|
645
|
-
}]);
|
|
646
|
-
//# sourceMappingURL=interaction-areas.light.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[404],{9017:(t,e,n)=>{"use strict";n.d(e,{F0:()=>r,Fg:()=>a,IT:()=>s,T$:()=>l,Vv:()=>d,Yx:()=>c,be:()=>o,q3:()=>u,sb:()=>i});const i="cld-ia-layout-state",o="vp-ia",a="interaction-areas-container",r={PORTRAIT:"portrait",LANDSCAPE:"landscape",All:"all",CENTER:"center"},s={PULSING:"pulsing",SHADOWED:"shadowed"},c={[r.PORTRAIT]:"https://res.cloudinary.com/prod/raw/upload/v1623772481/video-player/vtts/portrait.vtt",[r.LANDSCAPE]:"https://res.cloudinary.com/prod/raw/upload/v1623772303/video-player/vtts/landscape.vtt",[r.All]:"https://res.cloudinary.com/prod/raw/upload/v1623250266/video-player/vtts/all.vtt",[r.CENTER]:"https://res.cloudinary.com/prod/raw/upload/v1623250265/video-player/vtts/center.vtt"},l="https://res.cloudinary.com/prod/image/upload/v1626764643/video-player/interaction-area-hand.svg",d=4500,u=250},1066:(t,e,n)=>{"use strict";n.d(e,{interactionAreasService:()=>C});var i=n(6673),o=n.n(i),a=n(2832),r=n.n(a),s=n(2858),c=n.n(s),l=n(5114),d=n.n(l),u=n(9017),v=n(7134),p=n(4500);const h=t=>{let{text:e,onClick:n,theme:i="",loadingDelay:o=0}=t;return(0,v.It)({tag:"button",attr:{class:`vp-theme-button theme-${i}`},onClick:n,children:[{tag:"div",attr:{class:"vp-loading-bar"},style:{"animation-duration":`${o}ms`}},{tag:"div",attr:{class:"content"},children:e}]})},f="transparent-white",m=(t,e)=>t.id||t.type||`id_${e}`,g=(t,e,n,i,o)=>{let{playerOptions:a,videojsOptions:s}=t;const c=(0,p.w)(s),l=a&&a.colors?a.colors.accent:c.accent,d=r()(s,"interactionDisplay.theme.template",u.IT.PULSING);return(0,v.It)({tag:"div",attr:{class:`${u.be}-item theme-${d}`,"data-id":m(e,n)},style:{left:`${e.left}%`,top:`${e.top}%`,width:`${e.width}%`,height:`${e.height}%`,transitionDuration:`${i}ms`},event:{name:"click",callback:o},children:[{tag:"div",attr:{class:`${u.be}-area-marker`},children:[{tag:"div",attr:{class:`${u.be}-marker-shadow`},style:{[d===u.IT.SHADOWED?"backgroundColor":"borderColor"]:l}},{tag:"div",attr:{class:`${u.be}-marker-main`},style:{borderColor:l}}]}]})},y=(t,e)=>t/(100/+e),b=(t,e)=>{const n=x(t);n?n.replaceWith(e):t.el().appendChild(e)},T=(t,e,n)=>t.querySelector(`[data-id=${m(e,n)}]`),$=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d();localStorage.setItem(u.sb,JSON.parse(t)),e()},x=t=>t.el().querySelector(`.${u.Fg}`),E=t=>{const e=x(t);e&&e.parentNode.removeChild(e)};var w=n(8838),k=n(1104);const C=(t,e,n)=>{let i=!1,a=null,s=null,l=d();const p=()=>{return t=n.interactionDisplay,r()(t,"layout.enable",!0)&&"true"!==localStorage.getItem(u.sb);var t},C=()=>{const t=D();return!(!t||void 0===t.syncOffsetTime)&&t.syncOffsetTime};function j(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=D();return t||e&&e.enable}function A(){s&&t.videojs.removeRemoteTextTrack(s);const e=j(),n=D();if(!e||i)return null;if(Array.isArray(n.template))L(n.template),M();else{const e=n.vttUrl||u.Yx[n.template];e&&(s=(0,w.eo)(t.videojs,e),function(e){if(!e)return;let n=null;e.addEventListener("cuechange",(()=>{const i=e.activeCues&&e.activeCues[0];if(i){const t=Math.max(Math.floor(1e3*(i.endTime-i.startTime)),u.q3),e=JSON.parse(i.text);L(e,n,t),!n&&M(),n=e}else E(t.videojs),n=null}))}(s))}}function D(){const{cldSrc:t}=a;return t&&t.getInteractionAreas()}function I(){E(t.videojs),A(),t.play()}function S(){if(j())if(p()){let e=null;const i=r()(n,"interactionDisplay.layout.showAgain",!1);t.pause(),function(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=!1;const o=`checkbox_${Math.round(1e4*Math.random())}`,a=(0,v.It)({tag:"div",attr:{class:`${u.Fg} ${u.be}-layout-message ${n?"":"clickable"}`},onClick:n?null:()=>$(i,e),children:[{tag:"img",attr:{class:`${u.be}-layout-icon`,src:u.T$}},{tag:"h3",attr:{class:`${u.be}-layout-message-title`},children:"Tap on dots to zoom for a product."},h({text:"Got it",theme:f,loadingDelay:n?0:u.Vv,onClick:n?()=>$(i,e):null}),n&&{tag:"div",attr:{class:`${u.be}-layout-message-do-not-show`},children:[{tag:"input",attr:{type:"checkbox",class:`${u.be}-layout-message-checkbox`,id:o},event:{name:"input",callback:t=>{i=t.target.checked}}},{tag:"label",attr:{class:`${u.be}-layout-message-checkbox-title`,for:o},children:"Don׳t show it again"}]}].filter((t=>t))});b(t,a)}(t.videojs,(()=>{clearTimeout(e),I()}),i),i||(e=setTimeout(I,u.Vv))}else I()}function O(e,n,r){const s=t.currentTime(),c=C(),{cldSrc:d}=a,p=d.getInitOptions(),h=n||{transformation:p.transformation},f=!e&&((t,e)=>{const{videoHeight:n,videoWidth:i}=t,o=y(i,e.left),a=y(n,e.top),r=y(i,e.width),s=y(n,e.height),c=i/n,l=r/s,d=Math.round(l>1||c>1?s*l:r),u=Math.round(d/c),v=Math.round(o-(d-r)/2),p=Math.round(a-(u-s)/2);return{width:d,height:u,x:Math.min(Math.max(v,0),i-d),y:Math.min(Math.max(p,0),n-u),crop:"crop"}})(t.videoElement,r),m=f?o().obj.merge({transformation:f},h):h,g=d.isRawUrl?a.src:{publicId:d.publicId()};t.source(f?{publicId:d.publicId()}:e,m).play(),c&&t.currentTime(s),i=!0,function(){const e=(0,v.n)("div",{class:"go-back-button"});e.addEventListener("click",(()=>{l()}),!1);const n=(0,v.n)("div",{class:u.Fg},e);b(t.videojs,n)}(),l=()=>{if(i){i=!1;const e=t.currentTime(),n=t.duration();t.source(g,p).play(),c&&e<n&&t.currentTime(e),A()}}}function N(t){let{event:e,item:n,index:i}=t;const o=D();o.onClick&&o.onClick({item:n,index:i,event:e,zoom:(t,e)=>{O(t,e,n)}})}function L(i,o){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r={playerOptions:e,videojsOptions:n};if(o)((t,e,n,i,o,a)=>{const r=x(t);n.forEach(((t,n)=>{const s=T(r,t,n),c=m(t),l=i.some((t=>m(t)===c));l&&s?(0,v.cu)(s,{left:`${t.left}%`,top:`${t.top}%`,width:`${t.width}%`,height:`${t.height}%`,transitionDuration:`${o}ms`}):l||s||r.appendChild(g(e,t,n,o,(e=>{a({event:e,item:t,index:n})})))})),i.forEach(((t,e)=>{const i=T(r,t,e),o=m(t),a=!n.some((t=>m(t)===o));i&&a&&i.parentNode.removeChild(i)}))})(t.videojs,r,i,o,a,N);else{const e=i.map(((t,e)=>g(r,t,e,a,(n=>{N({event:n,item:t,index:e})}))));b(t.videojs,(0,v.n)("div",{class:u.Fg},e))}}function M(){j()&&((t,e)=>{const n=x(t);if(!n)return;const{videoHeight:i,videoWidth:o}=e,a=o/i,r=a*e.clientHeight;n.style.width=`${e.clientWidth<r?"100%":r}px`,n.style.height=e.clientWidth<r?e.clientWidth/a+"px":"100%"})(t.videojs,t.videoElement)}!function(){if(a=a||t.videojs.currentSource(),j()){t.videojs.el().classList.add("interaction-areas"),t.videojs.one(k.f.PLAY,(()=>{"object"==typeof t.videojs.ima?t.on("adsready",(()=>{t.videojs.ima.addEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,S)})):S()}));const e=c()(M,100);t.videojs.on(k.f.FULL_SCREEN_CHANGE,(()=>{setTimeout(e,100)}));const n=(0,v.q2)(window,"resize",M,!1);t.videojs.on(k.f.DISPOSE,n)}t.videojs.on(k.f.ENDED,(()=>{l()})),t.videojs.on(k.f.ERROR,(()=>{t.pause()}))}()}},8812:(t,e,n)=>{var i=n(2140),o=/^\s+/;t.exports=function(t){return t?t.slice(0,i(t)+1).replace(o,""):t}},2140:t=>{var e=/\s/;t.exports=function(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}},6177:(t,e,n)=>{var i=n(8953),o=n(3664),a=n(5378),r=Math.max,s=Math.min;t.exports=function(t,e,n){var c,l,d,u,v,p,h=0,f=!1,m=!1,g=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function y(e){var n=c,i=l;return c=l=void 0,h=e,u=t.apply(i,n)}function b(t){var n=t-p;return void 0===p||n>=e||n<0||m&&t-h>=d}function T(){var t=o();if(b(t))return $(t);v=setTimeout(T,function(t){var n=e-(t-p);return m?s(n,d-(t-h)):n}(t))}function $(t){return v=void 0,g&&c?y(t):(c=l=void 0,u)}function x(){var t=o(),n=b(t);if(c=arguments,l=this,p=t,n){if(void 0===v)return function(t){return h=t,v=setTimeout(T,e),f?y(t):u}(p);if(m)return clearTimeout(v),v=setTimeout(T,e),y(p)}return void 0===v&&(v=setTimeout(T,e)),u}return e=a(e)||0,i(n)&&(f=!!n.leading,d=(m="maxWait"in n)?r(a(n.maxWait)||0,e):d,g="trailing"in n?!!n.trailing:g),x.cancel=function(){void 0!==v&&clearTimeout(v),h=0,c=p=l=v=void 0},x.flush=function(){return void 0===v?u:$(o())},x}},5114:t=>{t.exports=function(){}},3664:(t,e,n)=>{var i=n(1433);t.exports=function(){return i.Date.now()}},2858:(t,e,n)=>{var i=n(6177),o=n(8953);t.exports=function(t,e,n){var a=!0,r=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return o(n)&&(a="leading"in n?!!n.leading:a,r="trailing"in n?!!n.trailing:r),i(t,e,{leading:a,maxWait:e,trailing:r})}},5378:(t,e,n)=>{var i=n(8812),o=n(8953),a=n(5414),r=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(a(t))return NaN;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=i(t);var n=s.test(t);return n||c.test(t)?l(t.slice(2),n?2:8):r.test(t)?NaN:+t}}}]);
|
|
2
|
-
//# sourceMappingURL=interaction-areas.light.min.js.map
|