cloudinary-video-player 3.1.2-edge.3 → 3.1.2-edge.4
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/adaptive-streaming.js +18 -36920
- package/dist/adaptive-streaming.min.js +3 -4
- package/dist/chapters.js +13 -217
- package/dist/chapters.min.js +3 -4
- package/dist/cld-video-player.css +2 -4
- package/dist/cld-video-player.js +307 -46341
- package/dist/cld-video-player.light.js +307 -46341
- package/dist/cld-video-player.light.min.js +4 -5
- package/dist/cld-video-player.min.css +3 -4
- package/dist/cld-video-player.min.js +4 -5
- package/dist/colors.js +13 -67
- package/dist/colors.min.js +3 -4
- package/dist/dash.js +15 -69999
- package/dist/dash.min.js +3 -4
- package/dist/debug.js +17 -378
- package/dist/debug.min.js +3 -4
- package/dist/ima.js +24 -7049
- package/dist/ima.min.js +3 -4
- package/dist/interaction-areas.js +20 -640
- package/dist/interaction-areas.min.js +3 -4
- package/dist/node_modules_lodash_throttle_js.js +17 -395
- package/dist/playlist.js +40 -1504
- package/dist/playlist.min.js +3 -4
- package/dist/recommendations-overlay.js +19 -391
- package/dist/recommendations-overlay.min.js +3 -4
- package/dist/share.js +14 -195
- package/dist/share.min.js +3 -4
- package/dist/shoppable.js +21 -762
- package/dist/shoppable.min.js +3 -4
- package/dist/srt-text-tracks.js +13 -189
- package/dist/srt-text-tracks.min.js +3 -4
- package/dist/visual-search.js +16 -271
- package/dist/visual-search.min.js +3 -4
- package/lib/adaptive-streaming.js +1 -2
- package/lib/all.js +1 -2
- package/lib/chapters.js +1 -2
- package/lib/cld-video-player.js +1 -2
- package/lib/cld-video-player.min.css +0 -2
- package/lib/colors.js +1 -2
- package/lib/dash.js +1 -2
- package/lib/debug.js +1 -2
- package/lib/ima.js +1 -2
- package/lib/interaction-areas.js +1 -2
- package/lib/player.js +1 -2
- package/lib/playlist.js +1 -2
- package/lib/recommendations-overlay.js +1 -2
- package/lib/share.js +1 -2
- package/lib/shoppable.js +1 -2
- package/lib/srt-text-tracks.js +1 -2
- package/lib/videoPlayer.js +1 -2
- package/lib/visual-search.js +1 -2
- package/package.json +2 -3
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Cloudinary Video Player v3.1.2-edge.
|
|
3
|
-
* Built on 2025-08-
|
|
2
|
+
* Cloudinary Video Player v3.1.2-edge.4
|
|
3
|
+
* Built on 2025-08-11T06:41:19.174Z
|
|
4
4
|
* https://github.com/cloudinary/cloudinary-video-player
|
|
5
5
|
*/
|
|
6
|
+
/*
|
|
7
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
8
|
+
* This devtool is neither made for production nor for readable output files.
|
|
9
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
10
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
11
|
+
* or disable the default devtool with "devtool: false".
|
|
12
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
13
|
+
*/
|
|
6
14
|
(self["cloudinaryVideoPlayerChunkLoading"] = self["cloudinaryVideoPlayerChunkLoading"] || []).push([["interaction-areas"],{
|
|
7
15
|
|
|
8
16
|
/***/ "./components/themeButton/themedButton.const.js":
|
|
@@ -12,13 +20,7 @@
|
|
|
12
20
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
13
21
|
|
|
14
22
|
"use strict";
|
|
15
|
-
__webpack_require__.r(__webpack_exports__);
|
|
16
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
17
|
-
/* harmony export */ BUTTON_THEME: () => (/* binding */ BUTTON_THEME)
|
|
18
|
-
/* harmony export */ });
|
|
19
|
-
const BUTTON_THEME = {
|
|
20
|
-
TRANSPARENT_WHITE: 'transparent-white'
|
|
21
|
-
};
|
|
23
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BUTTON_THEME: () => (/* binding */ BUTTON_THEME)\n/* harmony export */ });\nconst BUTTON_THEME = {\n TRANSPARENT_WHITE: 'transparent-white'\n};\n\n//# sourceURL=webpack://cloudinary-video-player/./components/themeButton/themedButton.const.js?");
|
|
22
24
|
|
|
23
25
|
/***/ }),
|
|
24
26
|
|
|
@@ -29,42 +31,7 @@ const BUTTON_THEME = {
|
|
|
29
31
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
30
32
|
|
|
31
33
|
"use strict";
|
|
32
|
-
__webpack_require__.r(__webpack_exports__);
|
|
33
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
34
|
-
/* harmony export */ themedButton: () => (/* binding */ themedButton)
|
|
35
|
-
/* harmony export */ });
|
|
36
|
-
/* harmony import */ var _utils_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/dom */ "./utils/dom.js");
|
|
37
|
-
|
|
38
|
-
const themedButton = _ref => {
|
|
39
|
-
let {
|
|
40
|
-
text,
|
|
41
|
-
onClick,
|
|
42
|
-
theme = '',
|
|
43
|
-
loadingDelay = 0
|
|
44
|
-
} = _ref;
|
|
45
|
-
return (0,_utils_dom__WEBPACK_IMPORTED_MODULE_0__.elementsCreator)({
|
|
46
|
-
tag: 'button',
|
|
47
|
-
attr: {
|
|
48
|
-
class: `vp-theme-button theme-${theme}`
|
|
49
|
-
},
|
|
50
|
-
onClick,
|
|
51
|
-
children: [{
|
|
52
|
-
tag: 'div',
|
|
53
|
-
attr: {
|
|
54
|
-
class: 'vp-loading-bar'
|
|
55
|
-
},
|
|
56
|
-
style: {
|
|
57
|
-
'animation-duration': `${loadingDelay}ms`
|
|
58
|
-
}
|
|
59
|
-
}, {
|
|
60
|
-
tag: 'div',
|
|
61
|
-
attr: {
|
|
62
|
-
class: 'content'
|
|
63
|
-
},
|
|
64
|
-
children: text
|
|
65
|
-
}]
|
|
66
|
-
});
|
|
67
|
-
};
|
|
34
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ themedButton: () => (/* binding */ themedButton)\n/* harmony export */ });\n/* harmony import */ var _utils_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/dom */ \"./utils/dom.js\");\n\nconst themedButton = _ref => {\n let {\n text,\n onClick,\n theme = '',\n loadingDelay = 0\n } = _ref;\n return (0,_utils_dom__WEBPACK_IMPORTED_MODULE_0__.elementsCreator)({\n tag: 'button',\n attr: {\n class: `vp-theme-button theme-${theme}`\n },\n onClick,\n children: [{\n tag: 'div',\n attr: {\n class: 'vp-loading-bar'\n },\n style: {\n 'animation-duration': `${loadingDelay}ms`\n }\n }, {\n tag: 'div',\n attr: {\n class: 'content'\n },\n children: text\n }]\n });\n};\n\n//# sourceURL=webpack://cloudinary-video-player/./components/themeButton/themedButton.js?");
|
|
68
35
|
|
|
69
36
|
/***/ }),
|
|
70
37
|
|
|
@@ -75,66 +42,7 @@ const themedButton = _ref => {
|
|
|
75
42
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
76
43
|
|
|
77
44
|
"use strict";
|
|
78
|
-
__webpack_require__.r(__webpack_exports__);
|
|
79
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
80
|
-
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
81
|
-
/* harmony export */ getDefaultPlayerColor: () => (/* binding */ getDefaultPlayerColor)
|
|
82
|
-
/* harmony export */ });
|
|
83
|
-
/* harmony import */ var _video_player_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../video-player.utils */ "./video-player.utils.js");
|
|
84
|
-
/* harmony import */ var _colors_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./colors.scss */ "./plugins/colors/colors.scss");
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const defaults = {
|
|
88
|
-
colorsDark: {
|
|
89
|
-
'base': '#000000',
|
|
90
|
-
'accent': '#0D9AFF',
|
|
91
|
-
'text': '#FFFFFF'
|
|
92
|
-
},
|
|
93
|
-
colorsLight: {
|
|
94
|
-
'base': '#FFFFFF',
|
|
95
|
-
'accent': '#0D9AFF',
|
|
96
|
-
'text': '#000000'
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
const getDefaultPlayerColor = options => {
|
|
100
|
-
return (0,_video_player_utils__WEBPACK_IMPORTED_MODULE_0__.isLight)(options) ? defaults.colorsLight : defaults.colorsDark;
|
|
101
|
-
};
|
|
102
|
-
const colorsPlugin = function (player) {
|
|
103
|
-
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
104
|
-
const skinDefaults = getDefaultPlayerColor(player.options_);
|
|
105
|
-
opts.colors = Object.assign({}, skinDefaults, opts.colors);
|
|
106
|
-
|
|
107
|
-
// Set CSS custom properties on the player element
|
|
108
|
-
const playerEl = player.el();
|
|
109
|
-
if (opts.colors.base) {
|
|
110
|
-
playerEl.style.setProperty('--color-base', opts.colors.base);
|
|
111
|
-
}
|
|
112
|
-
if (opts.colors.accent) {
|
|
113
|
-
playerEl.style.setProperty('--color-accent', opts.colors.accent);
|
|
114
|
-
}
|
|
115
|
-
if (opts.colors.text) {
|
|
116
|
-
playerEl.style.setProperty('--color-text', opts.colors.text);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Return an object with methods to update colors if needed
|
|
120
|
-
return {
|
|
121
|
-
updateColors: newColors => {
|
|
122
|
-
const updatedColors = Object.assign({}, opts.colors, newColors);
|
|
123
|
-
if (updatedColors.base) {
|
|
124
|
-
playerEl.style.setProperty('--color-base', updatedColors.base);
|
|
125
|
-
}
|
|
126
|
-
if (updatedColors.accent) {
|
|
127
|
-
playerEl.style.setProperty('--color-accent', updatedColors.accent);
|
|
128
|
-
}
|
|
129
|
-
if (updatedColors.text) {
|
|
130
|
-
playerEl.style.setProperty('--color-text', updatedColors.text);
|
|
131
|
-
}
|
|
132
|
-
opts.colors = updatedColors;
|
|
133
|
-
},
|
|
134
|
-
getColors: () => opts.colors
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (colorsPlugin);
|
|
45
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ getDefaultPlayerColor: () => (/* binding */ getDefaultPlayerColor)\n/* harmony export */ });\n/* harmony import */ var _video_player_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../video-player.utils */ \"./video-player.utils.js\");\n/* harmony import */ var _colors_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./colors.scss */ \"./plugins/colors/colors.scss\");\n\n\nconst defaults = {\n colorsDark: {\n 'base': '#000000',\n 'accent': '#0D9AFF',\n 'text': '#FFFFFF'\n },\n colorsLight: {\n 'base': '#FFFFFF',\n 'accent': '#0D9AFF',\n 'text': '#000000'\n }\n};\nconst getDefaultPlayerColor = options => {\n return (0,_video_player_utils__WEBPACK_IMPORTED_MODULE_0__.isLight)(options) ? defaults.colorsLight : defaults.colorsDark;\n};\nconst colorsPlugin = function (player) {\n let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n const skinDefaults = getDefaultPlayerColor(player.options_);\n opts.colors = Object.assign({}, skinDefaults, opts.colors);\n\n // Set CSS custom properties on the player element\n const playerEl = player.el();\n if (opts.colors.base) {\n playerEl.style.setProperty('--color-base', opts.colors.base);\n }\n if (opts.colors.accent) {\n playerEl.style.setProperty('--color-accent', opts.colors.accent);\n }\n if (opts.colors.text) {\n playerEl.style.setProperty('--color-text', opts.colors.text);\n }\n\n // Return an object with methods to update colors if needed\n return {\n updateColors: newColors => {\n const updatedColors = Object.assign({}, opts.colors, newColors);\n if (updatedColors.base) {\n playerEl.style.setProperty('--color-base', updatedColors.base);\n }\n if (updatedColors.accent) {\n playerEl.style.setProperty('--color-accent', updatedColors.accent);\n }\n if (updatedColors.text) {\n playerEl.style.setProperty('--color-text', updatedColors.text);\n }\n opts.colors = updatedColors;\n },\n getColors: () => opts.colors\n };\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (colorsPlugin);\n\n//# sourceURL=webpack://cloudinary-video-player/./plugins/colors/colors.js?");
|
|
138
46
|
|
|
139
47
|
/***/ }),
|
|
140
48
|
|
|
@@ -145,40 +53,7 @@ const colorsPlugin = function (player) {
|
|
|
145
53
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
146
54
|
|
|
147
55
|
"use strict";
|
|
148
|
-
__webpack_require__.r(__webpack_exports__);
|
|
149
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
150
|
-
/* harmony export */ CLOSE_INTERACTION_AREA_LAYOUT_DELAY: () => (/* binding */ CLOSE_INTERACTION_AREA_LAYOUT_DELAY),
|
|
151
|
-
/* harmony export */ DEFAULT_INTERACTION_ARE_TRANSITION: () => (/* binding */ DEFAULT_INTERACTION_ARE_TRANSITION),
|
|
152
|
-
/* harmony export */ INTERACTION_AREAS_CONTAINER_CLASS_NAME: () => (/* binding */ INTERACTION_AREAS_CONTAINER_CLASS_NAME),
|
|
153
|
-
/* harmony export */ INTERACTION_AREAS_PREFIX: () => (/* binding */ INTERACTION_AREAS_PREFIX),
|
|
154
|
-
/* harmony export */ INTERACTION_AREAS_TEMPLATE: () => (/* binding */ INTERACTION_AREAS_TEMPLATE),
|
|
155
|
-
/* harmony export */ INTERACTION_AREAS_THEME: () => (/* binding */ INTERACTION_AREAS_THEME),
|
|
156
|
-
/* harmony export */ INTERACTION_AREA_HAND_ICON: () => (/* binding */ INTERACTION_AREA_HAND_ICON),
|
|
157
|
-
/* harmony export */ INTERACTION_AREA_LAYOUT_LOCAL_STORAGE_NAME: () => (/* binding */ INTERACTION_AREA_LAYOUT_LOCAL_STORAGE_NAME),
|
|
158
|
-
/* harmony export */ TEMPLATE_INTERACTION_AREAS_VTT: () => (/* binding */ TEMPLATE_INTERACTION_AREAS_VTT)
|
|
159
|
-
/* harmony export */ });
|
|
160
|
-
const INTERACTION_AREA_LAYOUT_LOCAL_STORAGE_NAME = 'cld-ia-layout-state';
|
|
161
|
-
const INTERACTION_AREAS_PREFIX = 'vp-ia';
|
|
162
|
-
const INTERACTION_AREAS_CONTAINER_CLASS_NAME = 'interaction-areas-container';
|
|
163
|
-
const INTERACTION_AREAS_TEMPLATE = {
|
|
164
|
-
PORTRAIT: 'portrait',
|
|
165
|
-
LANDSCAPE: 'landscape',
|
|
166
|
-
All: 'all',
|
|
167
|
-
CENTER: 'center'
|
|
168
|
-
};
|
|
169
|
-
const INTERACTION_AREAS_THEME = {
|
|
170
|
-
PULSING: 'pulsing',
|
|
171
|
-
SHADOWED: 'shadowed'
|
|
172
|
-
};
|
|
173
|
-
const TEMPLATE_INTERACTION_AREAS_VTT = {
|
|
174
|
-
[INTERACTION_AREAS_TEMPLATE.PORTRAIT]: 'https://res.cloudinary.com/prod/raw/upload/v1623772481/video-player/vtts/portrait.vtt',
|
|
175
|
-
[INTERACTION_AREAS_TEMPLATE.LANDSCAPE]: 'https://res.cloudinary.com/prod/raw/upload/v1623772303/video-player/vtts/landscape.vtt',
|
|
176
|
-
[INTERACTION_AREAS_TEMPLATE.All]: 'https://res.cloudinary.com/prod/raw/upload/v1623250266/video-player/vtts/all.vtt',
|
|
177
|
-
[INTERACTION_AREAS_TEMPLATE.CENTER]: 'https://res.cloudinary.com/prod/raw/upload/v1623250265/video-player/vtts/center.vtt'
|
|
178
|
-
};
|
|
179
|
-
const INTERACTION_AREA_HAND_ICON = 'https://res.cloudinary.com/prod/image/upload/v1626764643/video-player/interaction-area-hand.svg';
|
|
180
|
-
const CLOSE_INTERACTION_AREA_LAYOUT_DELAY = 4500;
|
|
181
|
-
const DEFAULT_INTERACTION_ARE_TRANSITION = 250;
|
|
56
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CLOSE_INTERACTION_AREA_LAYOUT_DELAY: () => (/* binding */ CLOSE_INTERACTION_AREA_LAYOUT_DELAY),\n/* harmony export */ DEFAULT_INTERACTION_ARE_TRANSITION: () => (/* binding */ DEFAULT_INTERACTION_ARE_TRANSITION),\n/* harmony export */ INTERACTION_AREAS_CONTAINER_CLASS_NAME: () => (/* binding */ INTERACTION_AREAS_CONTAINER_CLASS_NAME),\n/* harmony export */ INTERACTION_AREAS_PREFIX: () => (/* binding */ INTERACTION_AREAS_PREFIX),\n/* harmony export */ INTERACTION_AREAS_TEMPLATE: () => (/* binding */ INTERACTION_AREAS_TEMPLATE),\n/* harmony export */ INTERACTION_AREAS_THEME: () => (/* binding */ INTERACTION_AREAS_THEME),\n/* harmony export */ INTERACTION_AREA_HAND_ICON: () => (/* binding */ INTERACTION_AREA_HAND_ICON),\n/* harmony export */ INTERACTION_AREA_LAYOUT_LOCAL_STORAGE_NAME: () => (/* binding */ INTERACTION_AREA_LAYOUT_LOCAL_STORAGE_NAME),\n/* harmony export */ TEMPLATE_INTERACTION_AREAS_VTT: () => (/* binding */ TEMPLATE_INTERACTION_AREAS_VTT)\n/* harmony export */ });\nconst INTERACTION_AREA_LAYOUT_LOCAL_STORAGE_NAME = 'cld-ia-layout-state';\nconst INTERACTION_AREAS_PREFIX = 'vp-ia';\nconst INTERACTION_AREAS_CONTAINER_CLASS_NAME = 'interaction-areas-container';\nconst INTERACTION_AREAS_TEMPLATE = {\n PORTRAIT: 'portrait',\n LANDSCAPE: 'landscape',\n All: 'all',\n CENTER: 'center'\n};\nconst INTERACTION_AREAS_THEME = {\n PULSING: 'pulsing',\n SHADOWED: 'shadowed'\n};\nconst TEMPLATE_INTERACTION_AREAS_VTT = {\n [INTERACTION_AREAS_TEMPLATE.PORTRAIT]: 'https://res.cloudinary.com/prod/raw/upload/v1623772481/video-player/vtts/portrait.vtt',\n [INTERACTION_AREAS_TEMPLATE.LANDSCAPE]: 'https://res.cloudinary.com/prod/raw/upload/v1623772303/video-player/vtts/landscape.vtt',\n [INTERACTION_AREAS_TEMPLATE.All]: 'https://res.cloudinary.com/prod/raw/upload/v1623250266/video-player/vtts/all.vtt',\n [INTERACTION_AREAS_TEMPLATE.CENTER]: 'https://res.cloudinary.com/prod/raw/upload/v1623250265/video-player/vtts/center.vtt'\n};\nconst INTERACTION_AREA_HAND_ICON = 'https://res.cloudinary.com/prod/image/upload/v1626764643/video-player/interaction-area-hand.svg';\nconst CLOSE_INTERACTION_AREA_LAYOUT_DELAY = 4500;\nconst DEFAULT_INTERACTION_ARE_TRANSITION = 250;\n\n//# sourceURL=webpack://cloudinary-video-player/./plugins/interaction-areas/interaction-areas.const.js?");
|
|
182
57
|
|
|
183
58
|
/***/ }),
|
|
184
59
|
|
|
@@ -189,239 +64,7 @@ const DEFAULT_INTERACTION_ARE_TRANSITION = 250;
|
|
|
189
64
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
190
65
|
|
|
191
66
|
"use strict";
|
|
192
|
-
__webpack_require__.r(__webpack_exports__);
|
|
193
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
194
|
-
/* harmony export */ interactionAreasService: () => (/* binding */ interactionAreasService)
|
|
195
|
-
/* harmony export */ });
|
|
196
|
-
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! video.js */ "../node_modules/video.js/dist/alt/video.core-exposed.js");
|
|
197
|
-
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(video_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
198
|
-
/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/get */ "../node_modules/lodash/get.js");
|
|
199
|
-
/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_get__WEBPACK_IMPORTED_MODULE_1__);
|
|
200
|
-
/* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/throttle */ "../node_modules/lodash/throttle.js");
|
|
201
|
-
/* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_throttle__WEBPACK_IMPORTED_MODULE_2__);
|
|
202
|
-
/* harmony import */ var lodash_noop__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash/noop */ "../node_modules/lodash/noop.js");
|
|
203
|
-
/* harmony import */ var lodash_noop__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_noop__WEBPACK_IMPORTED_MODULE_3__);
|
|
204
|
-
/* harmony import */ var _interaction_areas_const__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./interaction-areas.const */ "./plugins/interaction-areas/interaction-areas.const.js");
|
|
205
|
-
/* harmony import */ var _interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./interaction-areas.utils */ "./plugins/interaction-areas/interaction-areas.utils.js");
|
|
206
|
-
/* harmony import */ var _utils_dom__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../utils/dom */ "./utils/dom.js");
|
|
207
|
-
/* harmony import */ var _video_player_utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../video-player.utils */ "./video-player.utils.js");
|
|
208
|
-
/* harmony import */ var _utils_consts__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utils/consts */ "./utils/consts.js");
|
|
209
|
-
/* harmony import */ var _interaction_areas_scss__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./interaction-areas.scss */ "./plugins/interaction-areas/interaction-areas.scss");
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const interactionAreasService = (player, playerOptions, videojsOptions) => {
|
|
221
|
-
let isZoomed = false;
|
|
222
|
-
let currentSource = null;
|
|
223
|
-
let currentTrack = null;
|
|
224
|
-
let unZoom = (lodash_noop__WEBPACK_IMPORTED_MODULE_3___default());
|
|
225
|
-
const shouldLayoutMessage = () => (0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.shouldShowAreaLayoutMessage)(videojsOptions.interactionDisplay);
|
|
226
|
-
const getIsSyncOffsetTime = () => {
|
|
227
|
-
const interactionAreasConfig = getInteractionAreasConfig();
|
|
228
|
-
return interactionAreasConfig && interactionAreasConfig.syncOffsetTime !== undefined ? interactionAreasConfig.syncOffsetTime : false;
|
|
229
|
-
};
|
|
230
|
-
function isInteractionAreasEnabled() {
|
|
231
|
-
let enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
232
|
-
const interactionAreasConfig = getInteractionAreasConfig();
|
|
233
|
-
return enabled || interactionAreasConfig && interactionAreasConfig.enable;
|
|
234
|
-
}
|
|
235
|
-
function setAreasPositionListener() {
|
|
236
|
-
currentTrack && player.videojs.removeRemoteTextTrack(currentTrack);
|
|
237
|
-
const isEnabled = isInteractionAreasEnabled();
|
|
238
|
-
const interactionAreasConfig = getInteractionAreasConfig();
|
|
239
|
-
if (!isEnabled || isZoomed) {
|
|
240
|
-
return null;
|
|
241
|
-
}
|
|
242
|
-
if (Array.isArray(interactionAreasConfig.template)) {
|
|
243
|
-
addInteractionAreasItems(interactionAreasConfig.template);
|
|
244
|
-
setContainerSize();
|
|
245
|
-
} else {
|
|
246
|
-
const vttUrl = interactionAreasConfig.vttUrl || _interaction_areas_const__WEBPACK_IMPORTED_MODULE_4__.TEMPLATE_INTERACTION_AREAS_VTT[interactionAreasConfig.template];
|
|
247
|
-
if (vttUrl) {
|
|
248
|
-
currentTrack = (0,_video_player_utils__WEBPACK_IMPORTED_MODULE_7__.addMetadataTrack)(player.videojs, vttUrl);
|
|
249
|
-
addCueListener(currentTrack);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
function setGoBackButton() {
|
|
254
|
-
const button = (0,_utils_dom__WEBPACK_IMPORTED_MODULE_6__.createElement)('div', {
|
|
255
|
-
'class': 'go-back-button'
|
|
256
|
-
});
|
|
257
|
-
button.addEventListener('click', () => {
|
|
258
|
-
unZoom();
|
|
259
|
-
}, false);
|
|
260
|
-
const tracksContainer = (0,_utils_dom__WEBPACK_IMPORTED_MODULE_6__.createElement)('div', {
|
|
261
|
-
'class': _interaction_areas_const__WEBPACK_IMPORTED_MODULE_4__.INTERACTION_AREAS_CONTAINER_CLASS_NAME
|
|
262
|
-
}, button);
|
|
263
|
-
(0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.setInteractionAreasContainer)(player.videojs, tracksContainer);
|
|
264
|
-
}
|
|
265
|
-
function getInteractionAreasConfig() {
|
|
266
|
-
const {
|
|
267
|
-
cldSrc
|
|
268
|
-
} = currentSource;
|
|
269
|
-
return cldSrc && cldSrc.interactionAreas();
|
|
270
|
-
}
|
|
271
|
-
function removeLayoutMessage() {
|
|
272
|
-
(0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.removeInteractionAreasContainer)(player.videojs);
|
|
273
|
-
setAreasPositionListener();
|
|
274
|
-
player.play();
|
|
275
|
-
}
|
|
276
|
-
function setLayoutMessage() {
|
|
277
|
-
if (!isInteractionAreasEnabled()) {
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
if (shouldLayoutMessage()) {
|
|
281
|
-
let layoutMessageTimout = null;
|
|
282
|
-
const showItAgainCheckbox = lodash_get__WEBPACK_IMPORTED_MODULE_1___default()(videojsOptions, 'interactionDisplay.layout.showAgain', false);
|
|
283
|
-
player.pause();
|
|
284
|
-
(0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.createInteractionAreaLayoutMessage)(player.videojs, () => {
|
|
285
|
-
clearTimeout(layoutMessageTimout);
|
|
286
|
-
removeLayoutMessage();
|
|
287
|
-
}, showItAgainCheckbox);
|
|
288
|
-
if (!showItAgainCheckbox) {
|
|
289
|
-
layoutMessageTimout = setTimeout(removeLayoutMessage, _interaction_areas_const__WEBPACK_IMPORTED_MODULE_4__.CLOSE_INTERACTION_AREA_LAYOUT_DELAY);
|
|
290
|
-
}
|
|
291
|
-
} else {
|
|
292
|
-
removeLayoutMessage();
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
function handleAds() {
|
|
296
|
-
player.on('adsready', () => {
|
|
297
|
-
player.videojs.ima.addEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED, setLayoutMessage);
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
function init() {
|
|
301
|
-
currentSource = currentSource || player.videojs.currentSource();
|
|
302
|
-
if (isInteractionAreasEnabled()) {
|
|
303
|
-
player.videojs.el().classList.add('interaction-areas');
|
|
304
|
-
player.videojs.one(_utils_consts__WEBPACK_IMPORTED_MODULE_8__.PLAYER_EVENT.PLAY, () => {
|
|
305
|
-
if (typeof player.videojs.ima === 'object') {
|
|
306
|
-
handleAds();
|
|
307
|
-
} else {
|
|
308
|
-
setLayoutMessage();
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
const setInteractionAreasContainerSize = lodash_throttle__WEBPACK_IMPORTED_MODULE_2___default()(setContainerSize, 100);
|
|
312
|
-
player.videojs.on(_utils_consts__WEBPACK_IMPORTED_MODULE_8__.PLAYER_EVENT.FULL_SCREEN_CHANGE, () => {
|
|
313
|
-
// waiting for fullscreen will end
|
|
314
|
-
setTimeout(setInteractionAreasContainerSize, 100);
|
|
315
|
-
});
|
|
316
|
-
const resizeDestroy = (0,_utils_dom__WEBPACK_IMPORTED_MODULE_6__.addEventListener)(window, 'resize', setContainerSize, false);
|
|
317
|
-
player.videojs.on(_utils_consts__WEBPACK_IMPORTED_MODULE_8__.PLAYER_EVENT.DISPOSE, resizeDestroy);
|
|
318
|
-
}
|
|
319
|
-
player.videojs.on(_utils_consts__WEBPACK_IMPORTED_MODULE_8__.PLAYER_EVENT.ENDED, () => {
|
|
320
|
-
unZoom();
|
|
321
|
-
});
|
|
322
|
-
player.videojs.on(_utils_consts__WEBPACK_IMPORTED_MODULE_8__.PLAYER_EVENT.ERROR, () => {
|
|
323
|
-
player.pause();
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
function onZoom(src, newOption, item) {
|
|
327
|
-
const originalCurrentTime = player.currentTime();
|
|
328
|
-
const isSyncOffsetTime = getIsSyncOffsetTime();
|
|
329
|
-
const {
|
|
330
|
-
cldSrc
|
|
331
|
-
} = currentSource;
|
|
332
|
-
const currentSrcOptions = cldSrc.getInitOptions();
|
|
333
|
-
const option = newOption || {
|
|
334
|
-
transformation: currentSrcOptions.transformation
|
|
335
|
-
};
|
|
336
|
-
const transformation = !src && (0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.getZoomTransformation)(player.videoElement, item);
|
|
337
|
-
const sourceOptions = transformation ? video_js__WEBPACK_IMPORTED_MODULE_0___default().obj.merge({
|
|
338
|
-
transformation
|
|
339
|
-
}, option) : option;
|
|
340
|
-
const newSource = cldSrc.isRawUrl ? currentSource.src : {
|
|
341
|
-
publicId: cldSrc.publicId()
|
|
342
|
-
};
|
|
343
|
-
player.source(transformation ? {
|
|
344
|
-
publicId: cldSrc.publicId()
|
|
345
|
-
} : src, sourceOptions).play();
|
|
346
|
-
isSyncOffsetTime && player.currentTime(originalCurrentTime);
|
|
347
|
-
isZoomed = true;
|
|
348
|
-
setGoBackButton();
|
|
349
|
-
unZoom = () => {
|
|
350
|
-
if (isZoomed) {
|
|
351
|
-
isZoomed = false;
|
|
352
|
-
const currentZoomedTime = player.currentTime();
|
|
353
|
-
const duration = player.duration();
|
|
354
|
-
player.source(newSource, currentSrcOptions).play();
|
|
355
|
-
isSyncOffsetTime && currentZoomedTime < duration && player.currentTime(currentZoomedTime);
|
|
356
|
-
setAreasPositionListener();
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
}
|
|
360
|
-
function onInteractionAreasClick(_ref) {
|
|
361
|
-
let {
|
|
362
|
-
event,
|
|
363
|
-
item,
|
|
364
|
-
index
|
|
365
|
-
} = _ref;
|
|
366
|
-
const interactionAreasConfig = getInteractionAreasConfig();
|
|
367
|
-
interactionAreasConfig.onClick && interactionAreasConfig.onClick({
|
|
368
|
-
item,
|
|
369
|
-
index,
|
|
370
|
-
event,
|
|
371
|
-
zoom: (source, option) => {
|
|
372
|
-
onZoom(source, option, item);
|
|
373
|
-
}
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
function addInteractionAreasItems(interactionAreasData, previousInteractionAreasData) {
|
|
377
|
-
let durationTime = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
378
|
-
const configs = {
|
|
379
|
-
playerOptions: playerOptions,
|
|
380
|
-
videojsOptions: videojsOptions
|
|
381
|
-
};
|
|
382
|
-
if (previousInteractionAreasData) {
|
|
383
|
-
(0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.updateInteractionAreasItem)(player.videojs, configs, interactionAreasData, previousInteractionAreasData, durationTime, onInteractionAreasClick);
|
|
384
|
-
} else {
|
|
385
|
-
const interactionAreasItems = interactionAreasData.map((item, index) => {
|
|
386
|
-
return (0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.getInteractionAreaItem)(configs, item, index, durationTime, event => {
|
|
387
|
-
onInteractionAreasClick({
|
|
388
|
-
event,
|
|
389
|
-
item,
|
|
390
|
-
index
|
|
391
|
-
});
|
|
392
|
-
});
|
|
393
|
-
});
|
|
394
|
-
(0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.setInteractionAreasContainer)(player.videojs, (0,_utils_dom__WEBPACK_IMPORTED_MODULE_6__.createElement)('div', {
|
|
395
|
-
'class': _interaction_areas_const__WEBPACK_IMPORTED_MODULE_4__.INTERACTION_AREAS_CONTAINER_CLASS_NAME
|
|
396
|
-
}, interactionAreasItems));
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
function setContainerSize() {
|
|
400
|
-
if (isInteractionAreasEnabled()) {
|
|
401
|
-
(0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.setInteractionAreasContainerSize)(player.videojs, player.videoElement);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
function addCueListener(track) {
|
|
405
|
-
if (!track) {
|
|
406
|
-
return;
|
|
407
|
-
}
|
|
408
|
-
let previousTracksData = null;
|
|
409
|
-
track.addEventListener('cuechange', () => {
|
|
410
|
-
const activeCue = track.activeCues && track.activeCues[0];
|
|
411
|
-
if (activeCue) {
|
|
412
|
-
const durationTime = Math.max(Math.floor((activeCue.endTime - activeCue.startTime) * 1000), _interaction_areas_const__WEBPACK_IMPORTED_MODULE_4__.DEFAULT_INTERACTION_ARE_TRANSITION);
|
|
413
|
-
const tracksData = JSON.parse(activeCue.text);
|
|
414
|
-
addInteractionAreasItems(tracksData, previousTracksData, durationTime);
|
|
415
|
-
!previousTracksData && setContainerSize();
|
|
416
|
-
previousTracksData = tracksData;
|
|
417
|
-
} else {
|
|
418
|
-
(0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.removeInteractionAreasContainer)(player.videojs);
|
|
419
|
-
previousTracksData = null;
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
init();
|
|
424
|
-
};
|
|
67
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ interactionAreasService: () => (/* binding */ interactionAreasService)\n/* harmony export */ });\n/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! video.js */ \"../node_modules/video.js/dist/alt/video.core-exposed.js\");\n/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(video_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/get */ \"../node_modules/lodash/get.js\");\n/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_get__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/throttle */ \"../node_modules/lodash/throttle.js\");\n/* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_throttle__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var lodash_noop__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash/noop */ \"../node_modules/lodash/noop.js\");\n/* harmony import */ var lodash_noop__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_noop__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _interaction_areas_const__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./interaction-areas.const */ \"./plugins/interaction-areas/interaction-areas.const.js\");\n/* harmony import */ var _interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./interaction-areas.utils */ \"./plugins/interaction-areas/interaction-areas.utils.js\");\n/* harmony import */ var _utils_dom__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../utils/dom */ \"./utils/dom.js\");\n/* harmony import */ var _video_player_utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../video-player.utils */ \"./video-player.utils.js\");\n/* harmony import */ var _utils_consts__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utils/consts */ \"./utils/consts.js\");\n/* harmony import */ var _interaction_areas_scss__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./interaction-areas.scss */ \"./plugins/interaction-areas/interaction-areas.scss\");\n\n\n\n\n\n\n\n\n\n\nconst interactionAreasService = (player, playerOptions, videojsOptions) => {\n let isZoomed = false;\n let currentSource = null;\n let currentTrack = null;\n let unZoom = (lodash_noop__WEBPACK_IMPORTED_MODULE_3___default());\n const shouldLayoutMessage = () => (0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.shouldShowAreaLayoutMessage)(videojsOptions.interactionDisplay);\n const getIsSyncOffsetTime = () => {\n const interactionAreasConfig = getInteractionAreasConfig();\n return interactionAreasConfig && interactionAreasConfig.syncOffsetTime !== undefined ? interactionAreasConfig.syncOffsetTime : false;\n };\n function isInteractionAreasEnabled() {\n let enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n const interactionAreasConfig = getInteractionAreasConfig();\n return enabled || interactionAreasConfig && interactionAreasConfig.enable;\n }\n function setAreasPositionListener() {\n currentTrack && player.videojs.removeRemoteTextTrack(currentTrack);\n const isEnabled = isInteractionAreasEnabled();\n const interactionAreasConfig = getInteractionAreasConfig();\n if (!isEnabled || isZoomed) {\n return null;\n }\n if (Array.isArray(interactionAreasConfig.template)) {\n addInteractionAreasItems(interactionAreasConfig.template);\n setContainerSize();\n } else {\n const vttUrl = interactionAreasConfig.vttUrl || _interaction_areas_const__WEBPACK_IMPORTED_MODULE_4__.TEMPLATE_INTERACTION_AREAS_VTT[interactionAreasConfig.template];\n if (vttUrl) {\n currentTrack = (0,_video_player_utils__WEBPACK_IMPORTED_MODULE_7__.addMetadataTrack)(player.videojs, vttUrl);\n addCueListener(currentTrack);\n }\n }\n }\n function setGoBackButton() {\n const button = (0,_utils_dom__WEBPACK_IMPORTED_MODULE_6__.createElement)('div', {\n 'class': 'go-back-button'\n });\n button.addEventListener('click', () => {\n unZoom();\n }, false);\n const tracksContainer = (0,_utils_dom__WEBPACK_IMPORTED_MODULE_6__.createElement)('div', {\n 'class': _interaction_areas_const__WEBPACK_IMPORTED_MODULE_4__.INTERACTION_AREAS_CONTAINER_CLASS_NAME\n }, button);\n (0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.setInteractionAreasContainer)(player.videojs, tracksContainer);\n }\n function getInteractionAreasConfig() {\n const {\n cldSrc\n } = currentSource;\n return cldSrc && cldSrc.interactionAreas();\n }\n function removeLayoutMessage() {\n (0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.removeInteractionAreasContainer)(player.videojs);\n setAreasPositionListener();\n player.play();\n }\n function setLayoutMessage() {\n if (!isInteractionAreasEnabled()) {\n return;\n }\n if (shouldLayoutMessage()) {\n let layoutMessageTimout = null;\n const showItAgainCheckbox = lodash_get__WEBPACK_IMPORTED_MODULE_1___default()(videojsOptions, 'interactionDisplay.layout.showAgain', false);\n player.pause();\n (0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.createInteractionAreaLayoutMessage)(player.videojs, () => {\n clearTimeout(layoutMessageTimout);\n removeLayoutMessage();\n }, showItAgainCheckbox);\n if (!showItAgainCheckbox) {\n layoutMessageTimout = setTimeout(removeLayoutMessage, _interaction_areas_const__WEBPACK_IMPORTED_MODULE_4__.CLOSE_INTERACTION_AREA_LAYOUT_DELAY);\n }\n } else {\n removeLayoutMessage();\n }\n }\n function handleAds() {\n player.on('adsready', () => {\n player.videojs.ima.addEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED, setLayoutMessage);\n });\n }\n function init() {\n currentSource = currentSource || player.videojs.currentSource();\n if (isInteractionAreasEnabled()) {\n player.videojs.el().classList.add('interaction-areas');\n player.videojs.one(_utils_consts__WEBPACK_IMPORTED_MODULE_8__.PLAYER_EVENT.PLAY, () => {\n if (typeof player.videojs.ima === 'object') {\n handleAds();\n } else {\n setLayoutMessage();\n }\n });\n const setInteractionAreasContainerSize = lodash_throttle__WEBPACK_IMPORTED_MODULE_2___default()(setContainerSize, 100);\n player.videojs.on(_utils_consts__WEBPACK_IMPORTED_MODULE_8__.PLAYER_EVENT.FULL_SCREEN_CHANGE, () => {\n // waiting for fullscreen will end\n setTimeout(setInteractionAreasContainerSize, 100);\n });\n const resizeDestroy = (0,_utils_dom__WEBPACK_IMPORTED_MODULE_6__.addEventListener)(window, 'resize', setContainerSize, false);\n player.videojs.on(_utils_consts__WEBPACK_IMPORTED_MODULE_8__.PLAYER_EVENT.DISPOSE, resizeDestroy);\n }\n player.videojs.on(_utils_consts__WEBPACK_IMPORTED_MODULE_8__.PLAYER_EVENT.ENDED, () => {\n unZoom();\n });\n player.videojs.on(_utils_consts__WEBPACK_IMPORTED_MODULE_8__.PLAYER_EVENT.ERROR, () => {\n player.pause();\n });\n }\n function onZoom(src, newOption, item) {\n const originalCurrentTime = player.currentTime();\n const isSyncOffsetTime = getIsSyncOffsetTime();\n const {\n cldSrc\n } = currentSource;\n const currentSrcOptions = cldSrc.getInitOptions();\n const option = newOption || {\n transformation: currentSrcOptions.transformation\n };\n const transformation = !src && (0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.getZoomTransformation)(player.videoElement, item);\n const sourceOptions = transformation ? video_js__WEBPACK_IMPORTED_MODULE_0___default().obj.merge({\n transformation\n }, option) : option;\n const newSource = cldSrc.isRawUrl ? currentSource.src : {\n publicId: cldSrc.publicId()\n };\n player.source(transformation ? {\n publicId: cldSrc.publicId()\n } : src, sourceOptions).play();\n isSyncOffsetTime && player.currentTime(originalCurrentTime);\n isZoomed = true;\n setGoBackButton();\n unZoom = () => {\n if (isZoomed) {\n isZoomed = false;\n const currentZoomedTime = player.currentTime();\n const duration = player.duration();\n player.source(newSource, currentSrcOptions).play();\n isSyncOffsetTime && currentZoomedTime < duration && player.currentTime(currentZoomedTime);\n setAreasPositionListener();\n }\n };\n }\n function onInteractionAreasClick(_ref) {\n let {\n event,\n item,\n index\n } = _ref;\n const interactionAreasConfig = getInteractionAreasConfig();\n interactionAreasConfig.onClick && interactionAreasConfig.onClick({\n item,\n index,\n event,\n zoom: (source, option) => {\n onZoom(source, option, item);\n }\n });\n }\n function addInteractionAreasItems(interactionAreasData, previousInteractionAreasData) {\n let durationTime = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n const configs = {\n playerOptions: playerOptions,\n videojsOptions: videojsOptions\n };\n if (previousInteractionAreasData) {\n (0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.updateInteractionAreasItem)(player.videojs, configs, interactionAreasData, previousInteractionAreasData, durationTime, onInteractionAreasClick);\n } else {\n const interactionAreasItems = interactionAreasData.map((item, index) => {\n return (0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.getInteractionAreaItem)(configs, item, index, durationTime, event => {\n onInteractionAreasClick({\n event,\n item,\n index\n });\n });\n });\n (0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.setInteractionAreasContainer)(player.videojs, (0,_utils_dom__WEBPACK_IMPORTED_MODULE_6__.createElement)('div', {\n 'class': _interaction_areas_const__WEBPACK_IMPORTED_MODULE_4__.INTERACTION_AREAS_CONTAINER_CLASS_NAME\n }, interactionAreasItems));\n }\n }\n function setContainerSize() {\n if (isInteractionAreasEnabled()) {\n (0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.setInteractionAreasContainerSize)(player.videojs, player.videoElement);\n }\n }\n function addCueListener(track) {\n if (!track) {\n return;\n }\n let previousTracksData = null;\n track.addEventListener('cuechange', () => {\n const activeCue = track.activeCues && track.activeCues[0];\n if (activeCue) {\n const durationTime = Math.max(Math.floor((activeCue.endTime - activeCue.startTime) * 1000), _interaction_areas_const__WEBPACK_IMPORTED_MODULE_4__.DEFAULT_INTERACTION_ARE_TRANSITION);\n const tracksData = JSON.parse(activeCue.text);\n addInteractionAreasItems(tracksData, previousTracksData, durationTime);\n !previousTracksData && setContainerSize();\n previousTracksData = tracksData;\n } else {\n (0,_interaction_areas_utils__WEBPACK_IMPORTED_MODULE_5__.removeInteractionAreasContainer)(player.videojs);\n previousTracksData = null;\n }\n });\n }\n init();\n};\n\n//# sourceURL=webpack://cloudinary-video-player/./plugins/interaction-areas/interaction-areas.service.js?");
|
|
425
68
|
|
|
426
69
|
/***/ }),
|
|
427
70
|
|
|
@@ -432,248 +75,7 @@ const interactionAreasService = (player, playerOptions, videojsOptions) => {
|
|
|
432
75
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
433
76
|
|
|
434
77
|
"use strict";
|
|
435
|
-
__webpack_require__.r(__webpack_exports__);
|
|
436
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
437
|
-
/* harmony export */ createInteractionAreaLayoutMessage: () => (/* binding */ createInteractionAreaLayoutMessage),
|
|
438
|
-
/* harmony export */ getInteractionAreaItem: () => (/* binding */ getInteractionAreaItem),
|
|
439
|
-
/* harmony export */ getZoomTransformation: () => (/* binding */ getZoomTransformation),
|
|
440
|
-
/* harmony export */ percentageToFixedValue: () => (/* binding */ percentageToFixedValue),
|
|
441
|
-
/* harmony export */ removeInteractionAreasContainer: () => (/* binding */ removeInteractionAreasContainer),
|
|
442
|
-
/* harmony export */ setInteractionAreasContainer: () => (/* binding */ setInteractionAreasContainer),
|
|
443
|
-
/* harmony export */ setInteractionAreasContainerSize: () => (/* binding */ setInteractionAreasContainerSize),
|
|
444
|
-
/* harmony export */ shouldShowAreaLayoutMessage: () => (/* binding */ shouldShowAreaLayoutMessage),
|
|
445
|
-
/* harmony export */ updateInteractionAreasItem: () => (/* binding */ updateInteractionAreasItem)
|
|
446
|
-
/* harmony export */ });
|
|
447
|
-
/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/get */ "../node_modules/lodash/get.js");
|
|
448
|
-
/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_get__WEBPACK_IMPORTED_MODULE_0__);
|
|
449
|
-
/* harmony import */ var lodash_noop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/noop */ "../node_modules/lodash/noop.js");
|
|
450
|
-
/* harmony import */ var lodash_noop__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_noop__WEBPACK_IMPORTED_MODULE_1__);
|
|
451
|
-
/* harmony import */ var _utils_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils/dom */ "./utils/dom.js");
|
|
452
|
-
/* harmony import */ var _interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./interaction-areas.const */ "./plugins/interaction-areas/interaction-areas.const.js");
|
|
453
|
-
/* harmony import */ var _colors_colors__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../colors/colors */ "./plugins/colors/colors.js");
|
|
454
|
-
/* harmony import */ var _components_themeButton_themedButton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../components/themeButton/themedButton */ "./components/themeButton/themedButton.js");
|
|
455
|
-
/* harmony import */ var _components_themeButton_themedButton_const__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../components/themeButton/themedButton.const */ "./components/themeButton/themedButton.const.js");
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
const getInteractionAreaItemId = (item, index) => item.id || item.type || `id_${index}`;
|
|
464
|
-
const getInteractionAreaItem = (_ref, item, index, durationTime, onClick) => {
|
|
465
|
-
let {
|
|
466
|
-
playerOptions,
|
|
467
|
-
videojsOptions
|
|
468
|
-
} = _ref;
|
|
469
|
-
const defaultColor = (0,_colors_colors__WEBPACK_IMPORTED_MODULE_4__.getDefaultPlayerColor)(videojsOptions);
|
|
470
|
-
const accentColor = playerOptions && playerOptions.colors ? playerOptions.colors.accent : defaultColor.accent;
|
|
471
|
-
|
|
472
|
-
// theme = 'pulsing' / 'shadowed'
|
|
473
|
-
const theme = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(videojsOptions, 'interactionDisplay.theme.template', _interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_THEME.PULSING);
|
|
474
|
-
return (0,_utils_dom__WEBPACK_IMPORTED_MODULE_2__.elementsCreator)({
|
|
475
|
-
tag: 'div',
|
|
476
|
-
attr: {
|
|
477
|
-
class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-item theme-${theme}`,
|
|
478
|
-
'data-id': getInteractionAreaItemId(item, index)
|
|
479
|
-
},
|
|
480
|
-
style: {
|
|
481
|
-
left: `${item.left}%`,
|
|
482
|
-
top: `${item.top}%`,
|
|
483
|
-
width: `${item.width}%`,
|
|
484
|
-
height: `${item.height}%`,
|
|
485
|
-
transitionDuration: `${durationTime}ms`
|
|
486
|
-
},
|
|
487
|
-
event: {
|
|
488
|
-
name: 'click',
|
|
489
|
-
callback: onClick
|
|
490
|
-
},
|
|
491
|
-
children: [{
|
|
492
|
-
tag: 'div',
|
|
493
|
-
attr: {
|
|
494
|
-
class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-area-marker`
|
|
495
|
-
},
|
|
496
|
-
children: [{
|
|
497
|
-
tag: 'div',
|
|
498
|
-
attr: {
|
|
499
|
-
class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-marker-shadow`
|
|
500
|
-
},
|
|
501
|
-
style: {
|
|
502
|
-
[theme === _interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_THEME.SHADOWED ? 'backgroundColor' : 'borderColor']: accentColor
|
|
503
|
-
}
|
|
504
|
-
}, {
|
|
505
|
-
tag: 'div',
|
|
506
|
-
attr: {
|
|
507
|
-
class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-marker-main`
|
|
508
|
-
},
|
|
509
|
-
style: {
|
|
510
|
-
borderColor: accentColor
|
|
511
|
-
}
|
|
512
|
-
}]
|
|
513
|
-
}]
|
|
514
|
-
});
|
|
515
|
-
};
|
|
516
|
-
const percentageToFixedValue = (outOf, value) => outOf / (100 / +value);
|
|
517
|
-
const getZoomTransformation = (videoElement, interactionAreaItem) => {
|
|
518
|
-
const {
|
|
519
|
-
videoHeight,
|
|
520
|
-
videoWidth
|
|
521
|
-
} = videoElement;
|
|
522
|
-
const itemX = percentageToFixedValue(videoWidth, interactionAreaItem.left);
|
|
523
|
-
const itemY = percentageToFixedValue(videoHeight, interactionAreaItem.top);
|
|
524
|
-
const itemWidth = percentageToFixedValue(videoWidth, interactionAreaItem.width);
|
|
525
|
-
const itemHeight = percentageToFixedValue(videoHeight, interactionAreaItem.height);
|
|
526
|
-
const videoAspectRatio = videoWidth / videoHeight;
|
|
527
|
-
const itemAspectRatio = itemWidth / itemHeight;
|
|
528
|
-
const width = Math.round(itemAspectRatio > 1 || videoAspectRatio > 1 ? itemHeight * itemAspectRatio : itemWidth);
|
|
529
|
-
const height = Math.round(width / videoAspectRatio);
|
|
530
|
-
const x = Math.round(itemX - (width - itemWidth) / 2);
|
|
531
|
-
const y = Math.round(itemY - (height - itemHeight) / 2);
|
|
532
|
-
return {
|
|
533
|
-
width,
|
|
534
|
-
height,
|
|
535
|
-
x: Math.min(Math.max(x, 0), videoWidth - width),
|
|
536
|
-
y: Math.min(Math.max(y, 0), videoHeight - height),
|
|
537
|
-
crop: 'crop'
|
|
538
|
-
};
|
|
539
|
-
};
|
|
540
|
-
const setInteractionAreasContainer = (videojs, newInteractionAreasContainer) => {
|
|
541
|
-
const currentInteractionAreasContainer = getInteractionAreasContainer(videojs);
|
|
542
|
-
if (currentInteractionAreasContainer) {
|
|
543
|
-
currentInteractionAreasContainer.replaceWith(newInteractionAreasContainer);
|
|
544
|
-
} else {
|
|
545
|
-
// do not use element.append for ie11 support
|
|
546
|
-
videojs.el().appendChild(newInteractionAreasContainer);
|
|
547
|
-
}
|
|
548
|
-
};
|
|
549
|
-
const getInteractionAreaElementById = (interactionAreasContainer, item, index) => interactionAreasContainer.querySelector(`[data-id=${getInteractionAreaItemId(item, index)}]`);
|
|
550
|
-
const updateInteractionAreasItem = (videojs, configs, interactionAreasData, previousInteractionAreasData, durationTime, onClick) => {
|
|
551
|
-
const interactionAreasContainer = getInteractionAreasContainer(videojs);
|
|
552
|
-
interactionAreasData.forEach((item, index) => {
|
|
553
|
-
const itemElement = getInteractionAreaElementById(interactionAreasContainer, item, index);
|
|
554
|
-
const itemId = getInteractionAreaItemId(item);
|
|
555
|
-
const isExistItem = previousInteractionAreasData.some(i => getInteractionAreaItemId(i) === itemId);
|
|
556
|
-
|
|
557
|
-
// in case the element of the item is in the dom and exist in the previous data , it update the element position
|
|
558
|
-
if (isExistItem && itemElement) {
|
|
559
|
-
(0,_utils_dom__WEBPACK_IMPORTED_MODULE_2__.styleElement)(itemElement, {
|
|
560
|
-
left: `${item.left}%`,
|
|
561
|
-
top: `${item.top}%`,
|
|
562
|
-
width: `${item.width}%`,
|
|
563
|
-
height: `${item.height}%`,
|
|
564
|
-
transitionDuration: `${durationTime}ms`
|
|
565
|
-
});
|
|
566
|
-
// if the element did not exist before , not in the dom and not in the previous data , it add a new element
|
|
567
|
-
} else if (!isExistItem && !itemElement) {
|
|
568
|
-
// do not use element.append for ie11 support
|
|
569
|
-
interactionAreasContainer.appendChild(getInteractionAreaItem(configs, item, index, durationTime, event => {
|
|
570
|
-
onClick({
|
|
571
|
-
event,
|
|
572
|
-
item,
|
|
573
|
-
index
|
|
574
|
-
});
|
|
575
|
-
}));
|
|
576
|
-
}
|
|
577
|
-
});
|
|
578
|
-
|
|
579
|
-
// checking the previous data for element that should be removed if not exist in the new data object.
|
|
580
|
-
previousInteractionAreasData.forEach((item, index) => {
|
|
581
|
-
const itemElement = getInteractionAreaElementById(interactionAreasContainer, item, index);
|
|
582
|
-
const itemId = getInteractionAreaItemId(item);
|
|
583
|
-
const shouldBeRemoved = !interactionAreasData.some(i => getInteractionAreaItemId(i) === itemId);
|
|
584
|
-
if (itemElement && shouldBeRemoved) {
|
|
585
|
-
// do not use element.remove for ie11 support
|
|
586
|
-
itemElement.parentNode.removeChild(itemElement);
|
|
587
|
-
}
|
|
588
|
-
});
|
|
589
|
-
};
|
|
590
|
-
const shouldShowAreaLayoutMessage = interactionAreasConfig => {
|
|
591
|
-
const isLayoutEnabled = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(interactionAreasConfig, 'layout.enable', true);
|
|
592
|
-
return isLayoutEnabled && localStorage.getItem(_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREA_LAYOUT_LOCAL_STORAGE_NAME) !== 'true';
|
|
593
|
-
};
|
|
594
|
-
const onClickInteractionAreaLayoutClick = function (checked) {
|
|
595
|
-
let onClick = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (lodash_noop__WEBPACK_IMPORTED_MODULE_1___default());
|
|
596
|
-
localStorage.setItem(_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREA_LAYOUT_LOCAL_STORAGE_NAME, JSON.parse(checked));
|
|
597
|
-
onClick();
|
|
598
|
-
};
|
|
599
|
-
const createInteractionAreaLayoutMessage = function (videojs, onClick) {
|
|
600
|
-
let showItAgainCheckbox = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
601
|
-
let checked = false;
|
|
602
|
-
const id = `checkbox_${Math.round(Math.random() * 10000)}`;
|
|
603
|
-
const tracksContainer = (0,_utils_dom__WEBPACK_IMPORTED_MODULE_2__.elementsCreator)({
|
|
604
|
-
tag: 'div',
|
|
605
|
-
attr: {
|
|
606
|
-
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'}`
|
|
607
|
-
},
|
|
608
|
-
onClick: !showItAgainCheckbox ? () => onClickInteractionAreaLayoutClick(checked, onClick) : null,
|
|
609
|
-
children: [{
|
|
610
|
-
tag: 'img',
|
|
611
|
-
attr: {
|
|
612
|
-
class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-layout-icon`,
|
|
613
|
-
src: _interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREA_HAND_ICON
|
|
614
|
-
}
|
|
615
|
-
}, {
|
|
616
|
-
tag: 'h3',
|
|
617
|
-
attr: {
|
|
618
|
-
class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-layout-message-title`
|
|
619
|
-
},
|
|
620
|
-
children: 'Tap on dots to zoom for a product.'
|
|
621
|
-
}, (0,_components_themeButton_themedButton__WEBPACK_IMPORTED_MODULE_5__.themedButton)({
|
|
622
|
-
text: 'Got it',
|
|
623
|
-
theme: _components_themeButton_themedButton_const__WEBPACK_IMPORTED_MODULE_6__.BUTTON_THEME.TRANSPARENT_WHITE,
|
|
624
|
-
loadingDelay: showItAgainCheckbox ? 0 : _interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.CLOSE_INTERACTION_AREA_LAYOUT_DELAY,
|
|
625
|
-
onClick: showItAgainCheckbox ? () => onClickInteractionAreaLayoutClick(checked, onClick) : null
|
|
626
|
-
}), showItAgainCheckbox && {
|
|
627
|
-
tag: 'div',
|
|
628
|
-
attr: {
|
|
629
|
-
class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-layout-message-do-not-show`
|
|
630
|
-
},
|
|
631
|
-
children: [{
|
|
632
|
-
tag: 'input',
|
|
633
|
-
attr: {
|
|
634
|
-
type: 'checkbox',
|
|
635
|
-
class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-layout-message-checkbox`,
|
|
636
|
-
id
|
|
637
|
-
},
|
|
638
|
-
event: {
|
|
639
|
-
name: 'input',
|
|
640
|
-
callback: event => {
|
|
641
|
-
checked = event.target.checked;
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
}, {
|
|
645
|
-
tag: 'label',
|
|
646
|
-
attr: {
|
|
647
|
-
class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-layout-message-checkbox-title`,
|
|
648
|
-
for: id
|
|
649
|
-
},
|
|
650
|
-
children: 'Don׳t show it again'
|
|
651
|
-
}]
|
|
652
|
-
}].filter(i => i)
|
|
653
|
-
});
|
|
654
|
-
setInteractionAreasContainer(videojs, tracksContainer);
|
|
655
|
-
};
|
|
656
|
-
const getInteractionAreasContainer = videojs => videojs.el().querySelector(`.${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_CONTAINER_CLASS_NAME}`);
|
|
657
|
-
const removeInteractionAreasContainer = videojs => {
|
|
658
|
-
const interactionAreasContainer = getInteractionAreasContainer(videojs);
|
|
659
|
-
|
|
660
|
-
// do not use element.remove for ie11 support
|
|
661
|
-
interactionAreasContainer && interactionAreasContainer.parentNode.removeChild(interactionAreasContainer);
|
|
662
|
-
};
|
|
663
|
-
const setInteractionAreasContainerSize = (videojs, videoElement) => {
|
|
664
|
-
const interactionAreasContainer = getInteractionAreasContainer(videojs);
|
|
665
|
-
if (!interactionAreasContainer) {
|
|
666
|
-
return;
|
|
667
|
-
}
|
|
668
|
-
const {
|
|
669
|
-
videoHeight,
|
|
670
|
-
videoWidth
|
|
671
|
-
} = videoElement;
|
|
672
|
-
const videoAspectRatio = videoWidth / videoHeight;
|
|
673
|
-
const width = videoAspectRatio * videoElement.clientHeight;
|
|
674
|
-
interactionAreasContainer.style.width = `${videoElement.clientWidth < width ? '100%' : width}px`;
|
|
675
|
-
interactionAreasContainer.style.height = videoElement.clientWidth < width ? `${videoElement.clientWidth / videoAspectRatio}px` : '100%';
|
|
676
|
-
};
|
|
78
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createInteractionAreaLayoutMessage: () => (/* binding */ createInteractionAreaLayoutMessage),\n/* harmony export */ getInteractionAreaItem: () => (/* binding */ getInteractionAreaItem),\n/* harmony export */ getZoomTransformation: () => (/* binding */ getZoomTransformation),\n/* harmony export */ percentageToFixedValue: () => (/* binding */ percentageToFixedValue),\n/* harmony export */ removeInteractionAreasContainer: () => (/* binding */ removeInteractionAreasContainer),\n/* harmony export */ setInteractionAreasContainer: () => (/* binding */ setInteractionAreasContainer),\n/* harmony export */ setInteractionAreasContainerSize: () => (/* binding */ setInteractionAreasContainerSize),\n/* harmony export */ shouldShowAreaLayoutMessage: () => (/* binding */ shouldShowAreaLayoutMessage),\n/* harmony export */ updateInteractionAreasItem: () => (/* binding */ updateInteractionAreasItem)\n/* harmony export */ });\n/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/get */ \"../node_modules/lodash/get.js\");\n/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_get__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var lodash_noop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/noop */ \"../node_modules/lodash/noop.js\");\n/* harmony import */ var lodash_noop__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_noop__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _utils_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils/dom */ \"./utils/dom.js\");\n/* harmony import */ var _interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./interaction-areas.const */ \"./plugins/interaction-areas/interaction-areas.const.js\");\n/* harmony import */ var _colors_colors__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../colors/colors */ \"./plugins/colors/colors.js\");\n/* harmony import */ var _components_themeButton_themedButton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../components/themeButton/themedButton */ \"./components/themeButton/themedButton.js\");\n/* harmony import */ var _components_themeButton_themedButton_const__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../components/themeButton/themedButton.const */ \"./components/themeButton/themedButton.const.js\");\n\n\n\n\n\n\n\nconst getInteractionAreaItemId = (item, index) => item.id || item.type || `id_${index}`;\nconst getInteractionAreaItem = (_ref, item, index, durationTime, onClick) => {\n let {\n playerOptions,\n videojsOptions\n } = _ref;\n const defaultColor = (0,_colors_colors__WEBPACK_IMPORTED_MODULE_4__.getDefaultPlayerColor)(videojsOptions);\n const accentColor = playerOptions && playerOptions.colors ? playerOptions.colors.accent : defaultColor.accent;\n\n // theme = 'pulsing' / 'shadowed'\n const theme = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(videojsOptions, 'interactionDisplay.theme.template', _interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_THEME.PULSING);\n return (0,_utils_dom__WEBPACK_IMPORTED_MODULE_2__.elementsCreator)({\n tag: 'div',\n attr: {\n class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-item theme-${theme}`,\n 'data-id': getInteractionAreaItemId(item, index)\n },\n style: {\n left: `${item.left}%`,\n top: `${item.top}%`,\n width: `${item.width}%`,\n height: `${item.height}%`,\n transitionDuration: `${durationTime}ms`\n },\n event: {\n name: 'click',\n callback: onClick\n },\n children: [{\n tag: 'div',\n attr: {\n class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-area-marker`\n },\n children: [{\n tag: 'div',\n attr: {\n class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-marker-shadow`\n },\n style: {\n [theme === _interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_THEME.SHADOWED ? 'backgroundColor' : 'borderColor']: accentColor\n }\n }, {\n tag: 'div',\n attr: {\n class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-marker-main`\n },\n style: {\n borderColor: accentColor\n }\n }]\n }]\n });\n};\nconst percentageToFixedValue = (outOf, value) => outOf / (100 / +value);\nconst getZoomTransformation = (videoElement, interactionAreaItem) => {\n const {\n videoHeight,\n videoWidth\n } = videoElement;\n const itemX = percentageToFixedValue(videoWidth, interactionAreaItem.left);\n const itemY = percentageToFixedValue(videoHeight, interactionAreaItem.top);\n const itemWidth = percentageToFixedValue(videoWidth, interactionAreaItem.width);\n const itemHeight = percentageToFixedValue(videoHeight, interactionAreaItem.height);\n const videoAspectRatio = videoWidth / videoHeight;\n const itemAspectRatio = itemWidth / itemHeight;\n const width = Math.round(itemAspectRatio > 1 || videoAspectRatio > 1 ? itemHeight * itemAspectRatio : itemWidth);\n const height = Math.round(width / videoAspectRatio);\n const x = Math.round(itemX - (width - itemWidth) / 2);\n const y = Math.round(itemY - (height - itemHeight) / 2);\n return {\n width,\n height,\n x: Math.min(Math.max(x, 0), videoWidth - width),\n y: Math.min(Math.max(y, 0), videoHeight - height),\n crop: 'crop'\n };\n};\nconst setInteractionAreasContainer = (videojs, newInteractionAreasContainer) => {\n const currentInteractionAreasContainer = getInteractionAreasContainer(videojs);\n if (currentInteractionAreasContainer) {\n currentInteractionAreasContainer.replaceWith(newInteractionAreasContainer);\n } else {\n // do not use element.append for ie11 support\n videojs.el().appendChild(newInteractionAreasContainer);\n }\n};\nconst getInteractionAreaElementById = (interactionAreasContainer, item, index) => interactionAreasContainer.querySelector(`[data-id=${getInteractionAreaItemId(item, index)}]`);\nconst updateInteractionAreasItem = (videojs, configs, interactionAreasData, previousInteractionAreasData, durationTime, onClick) => {\n const interactionAreasContainer = getInteractionAreasContainer(videojs);\n interactionAreasData.forEach((item, index) => {\n const itemElement = getInteractionAreaElementById(interactionAreasContainer, item, index);\n const itemId = getInteractionAreaItemId(item);\n const isExistItem = previousInteractionAreasData.some(i => getInteractionAreaItemId(i) === itemId);\n\n // in case the element of the item is in the dom and exist in the previous data , it update the element position\n if (isExistItem && itemElement) {\n (0,_utils_dom__WEBPACK_IMPORTED_MODULE_2__.styleElement)(itemElement, {\n left: `${item.left}%`,\n top: `${item.top}%`,\n width: `${item.width}%`,\n height: `${item.height}%`,\n transitionDuration: `${durationTime}ms`\n });\n // if the element did not exist before , not in the dom and not in the previous data , it add a new element\n } else if (!isExistItem && !itemElement) {\n // do not use element.append for ie11 support\n interactionAreasContainer.appendChild(getInteractionAreaItem(configs, item, index, durationTime, event => {\n onClick({\n event,\n item,\n index\n });\n }));\n }\n });\n\n // checking the previous data for element that should be removed if not exist in the new data object.\n previousInteractionAreasData.forEach((item, index) => {\n const itemElement = getInteractionAreaElementById(interactionAreasContainer, item, index);\n const itemId = getInteractionAreaItemId(item);\n const shouldBeRemoved = !interactionAreasData.some(i => getInteractionAreaItemId(i) === itemId);\n if (itemElement && shouldBeRemoved) {\n // do not use element.remove for ie11 support\n itemElement.parentNode.removeChild(itemElement);\n }\n });\n};\nconst shouldShowAreaLayoutMessage = interactionAreasConfig => {\n const isLayoutEnabled = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(interactionAreasConfig, 'layout.enable', true);\n return isLayoutEnabled && localStorage.getItem(_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREA_LAYOUT_LOCAL_STORAGE_NAME) !== 'true';\n};\nconst onClickInteractionAreaLayoutClick = function (checked) {\n let onClick = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (lodash_noop__WEBPACK_IMPORTED_MODULE_1___default());\n localStorage.setItem(_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREA_LAYOUT_LOCAL_STORAGE_NAME, JSON.parse(checked));\n onClick();\n};\nconst createInteractionAreaLayoutMessage = function (videojs, onClick) {\n let showItAgainCheckbox = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n let checked = false;\n const id = `checkbox_${Math.round(Math.random() * 10000)}`;\n const tracksContainer = (0,_utils_dom__WEBPACK_IMPORTED_MODULE_2__.elementsCreator)({\n tag: 'div',\n attr: {\n 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'}`\n },\n onClick: !showItAgainCheckbox ? () => onClickInteractionAreaLayoutClick(checked, onClick) : null,\n children: [{\n tag: 'img',\n attr: {\n class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-layout-icon`,\n src: _interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREA_HAND_ICON\n }\n }, {\n tag: 'h3',\n attr: {\n class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-layout-message-title`\n },\n children: 'Tap on dots to zoom for a product.'\n }, (0,_components_themeButton_themedButton__WEBPACK_IMPORTED_MODULE_5__.themedButton)({\n text: 'Got it',\n theme: _components_themeButton_themedButton_const__WEBPACK_IMPORTED_MODULE_6__.BUTTON_THEME.TRANSPARENT_WHITE,\n loadingDelay: showItAgainCheckbox ? 0 : _interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.CLOSE_INTERACTION_AREA_LAYOUT_DELAY,\n onClick: showItAgainCheckbox ? () => onClickInteractionAreaLayoutClick(checked, onClick) : null\n }), showItAgainCheckbox && {\n tag: 'div',\n attr: {\n class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-layout-message-do-not-show`\n },\n children: [{\n tag: 'input',\n attr: {\n type: 'checkbox',\n class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-layout-message-checkbox`,\n id\n },\n event: {\n name: 'input',\n callback: event => {\n checked = event.target.checked;\n }\n }\n }, {\n tag: 'label',\n attr: {\n class: `${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_PREFIX}-layout-message-checkbox-title`,\n for: id\n },\n children: 'Don׳t show it again'\n }]\n }].filter(i => i)\n });\n setInteractionAreasContainer(videojs, tracksContainer);\n};\nconst getInteractionAreasContainer = videojs => videojs.el().querySelector(`.${_interaction_areas_const__WEBPACK_IMPORTED_MODULE_3__.INTERACTION_AREAS_CONTAINER_CLASS_NAME}`);\nconst removeInteractionAreasContainer = videojs => {\n const interactionAreasContainer = getInteractionAreasContainer(videojs);\n\n // do not use element.remove for ie11 support\n interactionAreasContainer && interactionAreasContainer.parentNode.removeChild(interactionAreasContainer);\n};\nconst setInteractionAreasContainerSize = (videojs, videoElement) => {\n const interactionAreasContainer = getInteractionAreasContainer(videojs);\n if (!interactionAreasContainer) {\n return;\n }\n const {\n videoHeight,\n videoWidth\n } = videoElement;\n const videoAspectRatio = videoWidth / videoHeight;\n const width = videoAspectRatio * videoElement.clientHeight;\n interactionAreasContainer.style.width = `${videoElement.clientWidth < width ? '100%' : width}px`;\n interactionAreasContainer.style.height = videoElement.clientWidth < width ? `${videoElement.clientWidth / videoAspectRatio}px` : '100%';\n};\n\n//# sourceURL=webpack://cloudinary-video-player/./plugins/interaction-areas/interaction-areas.utils.js?");
|
|
677
79
|
|
|
678
80
|
/***/ }),
|
|
679
81
|
|
|
@@ -683,24 +85,7 @@ const setInteractionAreasContainerSize = (videojs, videoElement) => {
|
|
|
683
85
|
\**************************************/
|
|
684
86
|
/***/ ((module) => {
|
|
685
87
|
|
|
686
|
-
|
|
687
|
-
* This method returns `undefined`.
|
|
688
|
-
*
|
|
689
|
-
* @static
|
|
690
|
-
* @memberOf _
|
|
691
|
-
* @since 2.3.0
|
|
692
|
-
* @category Util
|
|
693
|
-
* @example
|
|
694
|
-
*
|
|
695
|
-
* _.times(2, _.noop);
|
|
696
|
-
* // => [undefined, undefined]
|
|
697
|
-
*/
|
|
698
|
-
function noop() {
|
|
699
|
-
// No operation performed.
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
module.exports = noop;
|
|
703
|
-
|
|
88
|
+
eval("/**\n * This method returns `undefined`.\n *\n * @static\n * @memberOf _\n * @since 2.3.0\n * @category Util\n * @example\n *\n * _.times(2, _.noop);\n * // => [undefined, undefined]\n */\nfunction noop() {\n // No operation performed.\n}\n\nmodule.exports = noop;\n\n\n//# sourceURL=webpack://cloudinary-video-player/../node_modules/lodash/noop.js?");
|
|
704
89
|
|
|
705
90
|
/***/ }),
|
|
706
91
|
|
|
@@ -711,9 +96,7 @@ module.exports = noop;
|
|
|
711
96
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
712
97
|
|
|
713
98
|
"use strict";
|
|
714
|
-
__webpack_require__.r(__webpack_exports__);
|
|
715
|
-
// extracted by mini-css-extract-plugin
|
|
716
|
-
|
|
99
|
+
eval("__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n//# sourceURL=webpack://cloudinary-video-player/./plugins/colors/colors.scss?");
|
|
717
100
|
|
|
718
101
|
/***/ }),
|
|
719
102
|
|
|
@@ -724,11 +107,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
724
107
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
725
108
|
|
|
726
109
|
"use strict";
|
|
727
|
-
__webpack_require__.r(__webpack_exports__);
|
|
728
|
-
// extracted by mini-css-extract-plugin
|
|
729
|
-
|
|
110
|
+
eval("__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n//# sourceURL=webpack://cloudinary-video-player/./plugins/interaction-areas/interaction-areas.scss?");
|
|
730
111
|
|
|
731
112
|
/***/ })
|
|
732
113
|
|
|
733
|
-
}]);
|
|
734
|
-
//# sourceMappingURL=interaction-areas.js.map
|
|
114
|
+
}]);
|