cloudinary-video-player 1.6.2-edge.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/.eslintignore +4 -0
  2. package/.snyk +19 -0
  3. package/.travis.yml +8 -0
  4. package/CHANGELOG.md +329 -0
  5. package/LICENSE +21 -0
  6. package/README.md +87 -0
  7. package/dist/cld-video-player.css +2110 -0
  8. package/dist/cld-video-player.js +5249 -0
  9. package/dist/cld-video-player.light.css +1766 -0
  10. package/dist/cld-video-player.light.js +1399 -0
  11. package/dist/cld-video-player.light.min.css +1 -0
  12. package/dist/cld-video-player.light.min.js +2 -0
  13. package/dist/cld-video-player.light.min.js.LICENSE.txt +23 -0
  14. package/dist/cld-video-player.min.css +1 -0
  15. package/dist/cld-video-player.min.js +2 -0
  16. package/dist/cld-video-player.min.js.LICENSE.txt +26 -0
  17. package/dist/fonts/cloudinary_icon_for_black_bg.svg +69 -0
  18. package/dist/fonts/cloudinary_icon_for_white_bg.svg +69 -0
  19. package/docs/360.html +102 -0
  20. package/docs/_template.html +93 -0
  21. package/docs/adaptive-streaming.html +297 -0
  22. package/docs/analytics.html +140 -0
  23. package/docs/api.html +302 -0
  24. package/docs/audio.html +136 -0
  25. package/docs/autoplay-fallback.html +138 -0
  26. package/docs/autoplay-on-scroll.html +107 -0
  27. package/docs/codec-fallback.html +158 -0
  28. package/docs/colors.html +135 -0
  29. package/docs/components.html +284 -0
  30. package/docs/custom-cld-errors.html +134 -0
  31. package/docs/floating-player.html +98 -0
  32. package/docs/fluid.html +117 -0
  33. package/docs/force-hls-subtitles-ios.html +159 -0
  34. package/docs/index.html +83 -0
  35. package/docs/interaction-area.html +398 -0
  36. package/docs/live-customer.html +128 -0
  37. package/docs/multiple-players.html +125 -0
  38. package/docs/playlist-by-tag-cap.html +182 -0
  39. package/docs/playlist-by-tag.html +133 -0
  40. package/docs/playlist.html +133 -0
  41. package/docs/poster.html +155 -0
  42. package/docs/raw-url.html +104 -0
  43. package/docs/recommendations.html +155 -0
  44. package/docs/scripts.js +156 -0
  45. package/docs/seek-thumbs.html +90 -0
  46. package/docs/shoppable.html +335 -0
  47. package/docs/subtitles-and-captions.html +267 -0
  48. package/docs/transformations.html +171 -0
  49. package/docs/ui-config.html +108 -0
  50. package/docs/vast-vpaid.html +149 -0
  51. package/env.example.js +6 -0
  52. package/env.js +6 -0
  53. package/jest-puppeteer.config.js +14 -0
  54. package/jest.config.js +196 -0
  55. package/package.json +99 -0
  56. package/sandbox.config.json +3 -0
  57. package/setupJest.js +1 -0
  58. package/src/assets/fonts/VideoJS.svg +120 -0
  59. package/src/assets/fonts/VideoJS.ttf +0 -0
  60. package/src/assets/fonts/VideoJS.woff +0 -0
  61. package/src/assets/fonts/icons.json +120 -0
  62. package/src/assets/icons/cloudinary_icon_for_black_bg.svg +69 -0
  63. package/src/assets/icons/cloudinary_icon_for_white_bg.svg +69 -0
  64. package/src/assets/icons/cloudinary_logo_for_dark_bg.svg +188 -0
  65. package/src/assets/icons/cloudinary_logo_for_white_bg.svg +188 -0
  66. package/src/assets/icons/info-circle.svg +17 -0
  67. package/src/assets/styles/ads-label.scss +16 -0
  68. package/src/assets/styles/components/interaction-areas.scss +158 -0
  69. package/src/assets/styles/components/playlist.scss +213 -0
  70. package/src/assets/styles/components/themedButton.scss +48 -0
  71. package/src/assets/styles/components/thumbnail.scss +94 -0
  72. package/src/assets/styles/components/title-bar.scss +67 -0
  73. package/src/assets/styles/components/triangle-volume-bar.scss +52 -0
  74. package/src/assets/styles/icons.scss +257 -0
  75. package/src/assets/styles/main.scss +324 -0
  76. package/src/assets/styles/mixins/aspect-ratio.scss +16 -0
  77. package/src/assets/styles/mixins/disable-transition.scss +3 -0
  78. package/src/assets/styles/mixins/mixins.scss +5 -0
  79. package/src/assets/styles/mixins/skin.scss +64 -0
  80. package/src/assets/styles/variables.scss +2 -0
  81. package/src/assets/styles/videojs-ima.scss +252 -0
  82. package/src/components/component-utils.js +20 -0
  83. package/src/components/index.js +21 -0
  84. package/src/components/interaction-area/interaction-area.const.js +30 -0
  85. package/src/components/interaction-area/interaction-area.service.js +223 -0
  86. package/src/components/interaction-area/interaction-area.utils.js +236 -0
  87. package/src/components/jumpButtons/jump-10-minus.js +21 -0
  88. package/src/components/jumpButtons/jump-10-plus.js +20 -0
  89. package/src/components/logoButton/logo-button.const.js +3 -0
  90. package/src/components/logoButton/logo-button.js +30 -0
  91. package/src/components/logoButton/logo-button.scss +15 -0
  92. package/src/components/playlist/components/playlist-button.js +34 -0
  93. package/src/components/playlist/components/playlist-next-button.js +18 -0
  94. package/src/components/playlist/components/playlist-previous-button.js +18 -0
  95. package/src/components/playlist/components/playlist.js +5 -0
  96. package/src/components/playlist/components/playlist.scss +15 -0
  97. package/src/components/playlist/components/upcoming-video-overlay.js +149 -0
  98. package/src/components/playlist/components/upcoming-video-overlay.scss +86 -0
  99. package/src/components/playlist/layout/playlist-layout-custom.js +21 -0
  100. package/src/components/playlist/layout/playlist-layout-horizontal.js +16 -0
  101. package/src/components/playlist/layout/playlist-layout-vertical.js +19 -0
  102. package/src/components/playlist/layout/playlist-layout.js +110 -0
  103. package/src/components/playlist/panel/playlist-panel-item.js +86 -0
  104. package/src/components/playlist/panel/playlist-panel.js +92 -0
  105. package/src/components/playlist/playlist-widget.js +119 -0
  106. package/src/components/playlist/playlist.const.js +14 -0
  107. package/src/components/playlist/playlist.js +413 -0
  108. package/src/components/playlist/thumbnail/thumbnail.js +69 -0
  109. package/src/components/progress-control-events-blocker/progress-control-events-blocker.js +17 -0
  110. package/src/components/qualitySelector/quality-selector.scss +10 -0
  111. package/src/components/qualitySelector/qualitySelector.js +152 -0
  112. package/src/components/recommendations-overlay/index.js +3 -0
  113. package/src/components/recommendations-overlay/recommendations-overlay-content.js +57 -0
  114. package/src/components/recommendations-overlay/recommendations-overlay-hide-button.js +18 -0
  115. package/src/components/recommendations-overlay/recommendations-overlay-item.js +35 -0
  116. package/src/components/recommendations-overlay/recommendations-overlay-primary-item.js +81 -0
  117. package/src/components/recommendations-overlay/recommendations-overlay-secondary-item.js +48 -0
  118. package/src/components/recommendations-overlay/recommendations-overlay-secondary-items-container.js +35 -0
  119. package/src/components/recommendations-overlay/recommendations-overlay.js +94 -0
  120. package/src/components/recommendations-overlay/recommendations-overlay.scss +182 -0
  121. package/src/components/shoppable-bar/layout/bar-layout.js +111 -0
  122. package/src/components/shoppable-bar/layout/shoppable-panel-toggle.js +64 -0
  123. package/src/components/shoppable-bar/layout/shoppable-products-overlay.js +87 -0
  124. package/src/components/shoppable-bar/panel/shoppable-panel-item.js +105 -0
  125. package/src/components/shoppable-bar/panel/shoppable-panel.js +172 -0
  126. package/src/components/shoppable-bar/shoppable-post-widget.js +110 -0
  127. package/src/components/shoppable-bar/shoppable-widget.const.js +52 -0
  128. package/src/components/shoppable-bar/shoppable-widget.js +111 -0
  129. package/src/components/shoppable-bar/shoppable-widget.scss +359 -0
  130. package/src/components/themeButton/themedButton.const.js +3 -0
  131. package/src/components/themeButton/themedButton.js +25 -0
  132. package/src/components/title-bar/title-bar.js +79 -0
  133. package/src/config/defaults.js +25 -0
  134. package/src/extended-events.js +228 -0
  135. package/src/index.js +18 -0
  136. package/src/mixins/eventable.js +54 -0
  137. package/src/mixins/playlistable.js +106 -0
  138. package/src/plugins/analytics/index.js +245 -0
  139. package/src/plugins/autoplay-on-scroll/index.js +86 -0
  140. package/src/plugins/cloudinary/common.js +216 -0
  141. package/src/plugins/cloudinary/event-handler-registry.js +46 -0
  142. package/src/plugins/cloudinary/index.js +345 -0
  143. package/src/plugins/cloudinary/models/audio-source/audio-source.const.js +11 -0
  144. package/src/plugins/cloudinary/models/audio-source/audio-source.js +82 -0
  145. package/src/plugins/cloudinary/models/base-source.js +107 -0
  146. package/src/plugins/cloudinary/models/image-source.js +26 -0
  147. package/src/plugins/cloudinary/models/video-source/video-source.const.js +32 -0
  148. package/src/plugins/cloudinary/models/video-source/video-source.js +239 -0
  149. package/src/plugins/cloudinary/models/video-source/video-source.utils.js +57 -0
  150. package/src/plugins/colors/index.js +303 -0
  151. package/src/plugins/context-menu/components/context-menu-item.js +12 -0
  152. package/src/plugins/context-menu/components/context-menu.js +63 -0
  153. package/src/plugins/context-menu/context-menu.scss +30 -0
  154. package/src/plugins/context-menu/contextMenuContent.js +53 -0
  155. package/src/plugins/context-menu/index.js +134 -0
  156. package/src/plugins/dash/index.js +26 -0
  157. package/src/plugins/dash/setup-audio-tracks.js +112 -0
  158. package/src/plugins/dash/setup-text-tracks.js +195 -0
  159. package/src/plugins/dash/videojs-dash.js +372 -0
  160. package/src/plugins/floating-player/floating-player.scss +74 -0
  161. package/src/plugins/floating-player/index.js +129 -0
  162. package/src/plugins/ima/index.js +1775 -0
  163. package/src/plugins/index.js +31 -0
  164. package/src/plugins/interactive-plugin/index.js +10 -0
  165. package/src/plugins/videojs-http-source-selector/components/SourceMenuButton.js +98 -0
  166. package/src/plugins/videojs-http-source-selector/components/SourceMenuItem.js +52 -0
  167. package/src/plugins/videojs-http-source-selector/plugin.js +82 -0
  168. package/src/plugins/videojs-http-source-selector/plugin.scss +9 -0
  169. package/src/plugins/vtt-thumbnails/index.js +526 -0
  170. package/src/plugins/vtt-thumbnails/vtt-thumbnails.scss +29 -0
  171. package/src/utils/api.js +32 -0
  172. package/src/utils/apply-with-props.js +32 -0
  173. package/src/utils/array.js +22 -0
  174. package/src/utils/assign.js +27 -0
  175. package/src/utils/attributes-normalizer.js +72 -0
  176. package/src/utils/cloudinary.js +165 -0
  177. package/src/utils/css-prefix.js +43 -0
  178. package/src/utils/dom.js +74 -0
  179. package/src/utils/find.js +28 -0
  180. package/src/utils/fontFace.js +25 -0
  181. package/src/utils/groupBy.js +12 -0
  182. package/src/utils/index.js +29 -0
  183. package/src/utils/matches.js +11 -0
  184. package/src/utils/mixin.js +5 -0
  185. package/src/utils/object.js +26 -0
  186. package/src/utils/playButton.js +9 -0
  187. package/src/utils/positioning.js +78 -0
  188. package/src/utils/querystring.js +12 -0
  189. package/src/utils/slicing.js +21 -0
  190. package/src/utils/string.js +15 -0
  191. package/src/utils/throttle.js +30 -0
  192. package/src/utils/time.js +77 -0
  193. package/src/utils/type-inference.js +35 -0
  194. package/src/validators/validators-functions.js +48 -0
  195. package/src/validators/validators-types.js +78 -0
  196. package/src/validators/validators.js +110 -0
  197. package/src/video-player.const.js +68 -0
  198. package/src/video-player.js +761 -0
  199. package/src/video-player.utils.js +123 -0
  200. package/test/adaptive-streaming.test.js +38 -0
  201. package/test/ads.test.js +35 -0
  202. package/test/analytics.test.js +111 -0
  203. package/test/api.test.js +111 -0
  204. package/test/autoplay.scroll.test.js +23 -0
  205. package/test/basic-ui.test.js +59 -0
  206. package/test/colors.test.js +58 -0
  207. package/test/components.test.js +21 -0
  208. package/test/custom-error.test.js +24 -0
  209. package/test/fluid.test.js +36 -0
  210. package/test/isValidConfig.test.js +224 -0
  211. package/test/mocks/cloudinary-core-mock.js +0 -0
  212. package/test/mocks/styleMock.js +1 -0
  213. package/test/multiplayer.test.js +25 -0
  214. package/test/playlist.test.js +60 -0
  215. package/test/puppeteer/vp-env.js +19 -0
  216. package/test/recommendations.test.js +38 -0
  217. package/test/title-bar.test.js +28 -0
  218. package/test/ui-conf.test.js +49 -0
  219. package/test/unit/cloudinaryConfig.test.js +22 -0
  220. package/test/unit/cloudinaryUtils.test.js +53 -0
  221. package/test/unit/utils.test.js +27 -0
  222. package/test/unit/videoSource.test.js +454 -0
  223. package/tsconfig.json +15 -0
  224. package/types/video-player-tests.js +12 -0
  225. package/types/video-player-tests.ts +31 -0
  226. package/types/video-player.d.ts +570 -0
@@ -0,0 +1,77 @@
1
+ // https://github.com/csnover/js-iso8601/blob/master/iso8601.js
2
+ const numericKeys = [1, 4, 5, 6, 7, 10, 11];
3
+
4
+ const parseISO8601 = function (date) {
5
+ let timestamp = 0;
6
+ let struct = 0;
7
+ let minutesOffset = 0;
8
+
9
+ // ES5 §15.9.4.2 states that the string should attempt to be parsed as a Date Time String Format string
10
+ // before falling back to any implementation-specific date parsing, so that’s what we do, even if native
11
+ // implementations could be faster
12
+ // 1 YYYY 2 MM 3 DD 4 HH 5 mm 6 ss 7 msec 8 Z 9 ± 10 tzHH 11 tzmm
13
+ if ((struct = /^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(date))) {
14
+ // avoid NaN timestamps caused by “undefined” values being passed to Date.UTC
15
+ for (let i = 0, k; (k = numericKeys[i]); ++i) {
16
+ struct[k] = +struct[k] || 0;
17
+ }
18
+
19
+ // allow undefined days and months
20
+ struct[2] = (+struct[2] || 1) - 1;
21
+ struct[3] = +struct[3] || 1;
22
+
23
+ if (struct[8] !== 'Z' && struct[9] !== undefined) {
24
+ minutesOffset = struct[10] * 60 + struct[11];
25
+
26
+ if (struct[9] === '+') {
27
+ minutesOffset = 0 - minutesOffset;
28
+ }
29
+ }
30
+
31
+ timestamp = Date.UTC(struct[1], struct[2], struct[3], struct[4], struct[5] + minutesOffset, struct[6], struct[7]);
32
+ } else {
33
+ timestamp = NaN;
34
+ }
35
+
36
+ return timestamp;
37
+ };
38
+
39
+ // Convert time string i.e. '2:40' to seconds number (160)
40
+ // Also allows h:m:s format and mm:ss, m:s etc.
41
+ const parseTime = function (hms) {
42
+ const [seconds, minutes, hours] = hms.split(':').reverse();
43
+ let sum = null;
44
+ if (!isNaN(seconds)) {
45
+ sum = (+hours || 0) * 60 * 60 + (+minutes || 0) * 60 + (+seconds);
46
+ }
47
+ return sum;
48
+ };
49
+
50
+ const debounce = (func, wait) => {
51
+
52
+ let _timeout = null;
53
+
54
+ return (...args) => {
55
+ clearTimeout(_timeout);
56
+
57
+ _timeout = setTimeout(() => {
58
+ func.apply(this, args);
59
+ }, wait);
60
+ };
61
+
62
+ };
63
+
64
+ const throttle = (func, wait) => {
65
+ let last = 0;
66
+
67
+ return (...args) => {
68
+ const now = new Date();
69
+
70
+ if (now - last >= wait) {
71
+ func.apply(this, args);
72
+ last = now;
73
+ }
74
+ };
75
+ };
76
+
77
+ export { parseISO8601, parseTime, debounce, throttle };
@@ -0,0 +1,35 @@
1
+ function isPlainObject(obj) {
2
+ return obj !== null &&
3
+ typeof obj === 'object' &&
4
+ Object.prototype.toString.call(obj) === '[object Object]';
5
+ }
6
+
7
+ function isString(obj) {
8
+ return obj instanceof String || typeof obj === 'string';
9
+ }
10
+
11
+ function isNumber(data) {
12
+ return data instanceof Number || typeof data === 'number';
13
+ }
14
+
15
+ function isInteger(data) {
16
+ return typeof data === 'number' && (data % 1) === 0;
17
+ }
18
+
19
+ function isBoolean(data) {
20
+ return typeof data === 'boolean';
21
+ }
22
+
23
+ function isElement(value) {
24
+ return value instanceof Element;
25
+ }
26
+
27
+ function isFunction(data) {
28
+ return typeof data === 'function';
29
+ }
30
+
31
+ function noop() {
32
+ return null;
33
+ }
34
+
35
+ export { isPlainObject, isString, isInteger, isNumber, isElement, noop, isFunction, isBoolean };
@@ -0,0 +1,48 @@
1
+ import { isFunction, isPlainObject } from '../utils/type-inference';
2
+
3
+
4
+ export const getValidatorItem = (validator) => isFunction(validator) ? validator() : validator;
5
+
6
+ /**
7
+ * check if a value is valid or not
8
+ * @param {object | function} validator - a config object
9
+ * @param {any} value
10
+ * @param {key} string
11
+ * @returns boolean - using the validators to check if the value is a valid value or not
12
+ */
13
+ export const isValueValid = (validator, value, configPropertyName) => {
14
+ const validatorItem = getValidatorItem(validator);
15
+ const isValid = validatorItem.value(value);
16
+
17
+ if (!isValid) {
18
+ console.error(`cloudinary video player: ${validatorItem.message(configPropertyName)}`);
19
+ }
20
+
21
+ return isValid;
22
+ };
23
+
24
+ /**
25
+ * check if a configuration object is valid or not
26
+ * @param {object} config - a config object
27
+ * @param {object} validators
28
+ * @returns boolean - true is the configuration object is valid and false if it is not
29
+ */
30
+ export const isValidConfig = (config, validators) => {
31
+ if (isPlainObject(validators)) {
32
+ for (let key in config) {
33
+ if (Object.prototype.hasOwnProperty.call(validators, key)) {
34
+ const configValue = config[key];
35
+ const validatorValue = validators[key];
36
+ const isObject = isPlainObject(configValue);
37
+
38
+ if (isObject && !isValidConfig(configValue, validatorValue)) {
39
+ return false;
40
+ } else if (!isObject && !isValueValid(validatorValue, configValue, key)) {
41
+ return false;
42
+ }
43
+ }
44
+ }
45
+ }
46
+
47
+ return true;
48
+ };
@@ -0,0 +1,78 @@
1
+ import { isBoolean, isFunction, isNumber, isPlainObject, isString } from '../utils/type-inference';
2
+ import { getValidatorItem, isValueValid } from './validators-functions';
3
+ import { some, map } from '../utils/array';
4
+
5
+ const getOptionsString = (options) => isPlainObject(options) ? `:(${Object.values(options).join('/')})` : '';
6
+
7
+ const arrayOfStringsValidator = () => ({
8
+ value: (arr) => Array.isArray(arr) && arr.every(isString),
9
+ message: (key) => `'${key}' should be an array of strings`
10
+ });
11
+
12
+ const arrayOfNumbersValidator = () => ({
13
+ value: (arr) => Array.isArray(arr) && arr.every(isNumber),
14
+ message: (key) => `'${key}' should be an array of numbers`
15
+ });
16
+
17
+ const arrayOfObjectsValidator = (options) => ({
18
+ value: (arr) => {
19
+ return arr.every((item) => {
20
+ for (let key in item) {
21
+ if (Object.prototype.hasOwnProperty.call(item, key)) {
22
+ const value = item[key];
23
+ const validator = options[key];
24
+ const isValid = validator && isValueValid(validator(value), value, key);
25
+
26
+ if (!isValid) {
27
+ return false;
28
+ }
29
+ }
30
+ }
31
+
32
+ return true;
33
+ });
34
+ },
35
+ message: () => 'invalid array'
36
+ });
37
+
38
+ const orValidator = (...validators) => {
39
+ return () => ({
40
+ value: (value) => some(validators, (validator) => getValidatorItem(validator).value(value)),
41
+ message: (configPropertyName) => map(validators, (validator) => getValidatorItem(validator).message(configPropertyName)).join(' or ')
42
+ });
43
+ };
44
+
45
+ export const validator = {
46
+ isString: (options) => ({
47
+ value: isString,
48
+ message: (key) => `'${key}' should be a string${getOptionsString(options)}`
49
+ }),
50
+ isNumber: (options) => ({
51
+ value: isNumber,
52
+ message: (key) => `'${key}' should be a number${getOptionsString(options)}`
53
+ }),
54
+ isBoolean: () => ({
55
+ value: isBoolean,
56
+ message: (key) => `'${key}' should be a boolean`
57
+ }),
58
+ isFunction: () => ({
59
+ value: isFunction,
60
+ message: (key) => `'${key}' should be a function`
61
+ }),
62
+ isPlainObject: () => ({
63
+ value: isPlainObject,
64
+ message: (key) => `'${key}' should be an object`
65
+ }),
66
+ isObject: () => ({
67
+ value: (value) => value && typeof value === 'object',
68
+ message: (key) => `'${key}' should be an object`
69
+ }),
70
+ isArray: () => ({
71
+ value: Array.isArray,
72
+ message: (key) => `'${key}' should be an array`
73
+ }),
74
+ isArrayOfNumbers: arrayOfNumbersValidator,
75
+ isArrayOfStrings: arrayOfStringsValidator,
76
+ isArrayOfObjects: arrayOfObjectsValidator,
77
+ or: orValidator
78
+ };
@@ -0,0 +1,110 @@
1
+ import { ADS_IN_PLAYLIST, AUTO_PLAY_MODE, FLOATING_TO } from '../video-player.const';
2
+ import {
3
+ INTERACTION_AREAS_TEMPLATE,
4
+ INTERACTION_AREAS_THEME
5
+ } from '../components/interaction-area/interaction-area.const';
6
+ import { validator } from './validators-types';
7
+
8
+ export const playerValidators = {
9
+ videojsOptions: {
10
+ loop: validator.isBoolean,
11
+ controls: validator.isBoolean,
12
+ autoplay: validator.isBoolean,
13
+ autoplayMode: validator.isString(AUTO_PLAY_MODE),
14
+ bigPlayButton: validator.isBoolean,
15
+ playbackRates: validator.isArray,
16
+ showLogo: validator.isBoolean,
17
+ logoImageUrl: validator.isString,
18
+ logoOnclickUrl: validator.isString,
19
+ videoJS: validator.isPlainObject,
20
+ maxTries: validator.isNumber,
21
+ muted: validator.isBoolean,
22
+ playsinline: validator.isBoolean,
23
+ videoTimeout: validator.isNumber,
24
+ preload: validator.isString,
25
+ sourceTransformation: validator.isPlainObject,
26
+ allowUsageReport: validator.isBoolean,
27
+ interactionAreas: {
28
+ theme: {
29
+ template: validator.isString(INTERACTION_AREAS_THEME)
30
+ },
31
+ layout: {
32
+ enable: validator.isBoolean,
33
+ showAgain: validator.isBoolean
34
+ }
35
+ }
36
+ },
37
+ playerOptions: {
38
+ publicId: validator.isString,
39
+ fluid: validator.isBoolean,
40
+ analytics: validator.isBoolean,
41
+ hideContextMenu: validator.isBoolean,
42
+ playedEventPercents: validator.isArrayOfNumbers,
43
+ showJumpControls: validator.isBoolean,
44
+ seekThumbnails: validator.isBoolean,
45
+ floatingWhenNotVisible: validator.isString(FLOATING_TO),
46
+ playedEventTimes: validator.isArray,
47
+ playlistWidget: {
48
+ direction: validator.isString,
49
+ total: validator.isNumber
50
+ },
51
+ colors: {
52
+ base: validator.isString,
53
+ accent: validator.isString,
54
+ text: validator.isString
55
+ },
56
+ ads: {
57
+ adTagUrl: validator.isString,
58
+ showCountdown: validator.isBoolean,
59
+ adLabel: validator.isString,
60
+ locale: validator.isString,
61
+ prerollTimeout: validator.isNumber,
62
+ postrollTimeout: validator.isNumber,
63
+ adsInPlaylist: validator.isString(ADS_IN_PLAYLIST)
64
+ },
65
+ cloudinary: {
66
+ autoShowRecommendations: validator.isBoolean,
67
+ sourceTypes: validator.isArrayOfStrings,
68
+ transformation: validator.isObject,
69
+ fontFace: validator.isString,
70
+ posterOptions: {
71
+ publicId: validator.isString,
72
+ transformation: validator.isObject
73
+ }
74
+ }
75
+ }
76
+ };
77
+
78
+ export const sourceValidators = {
79
+ raw_transformation: validator.isString,
80
+ shoppable: validator.isPlainObject,
81
+ withCredentials: validator.isBoolean,
82
+ interactionAreas: {
83
+ enable: validator.isBoolean,
84
+ template: validator.or(validator.isString(INTERACTION_AREAS_TEMPLATE), validator.isArray),
85
+ vttUrl: validator.isString,
86
+ onClick: validator.isFunction
87
+ },
88
+ textTracks: {
89
+ captions: {
90
+ label: validator.isString,
91
+ language: validator.isString,
92
+ default: validator.isBoolean,
93
+ url: validator.isString
94
+ },
95
+ subtitles: validator.isArrayOfObjects({
96
+ label: validator.isString,
97
+ language: validator.isString,
98
+ url: validator.isString
99
+ })
100
+ },
101
+ info: {
102
+ title: validator.isString,
103
+ subtitle: validator.isString,
104
+ description: validator.isString
105
+ },
106
+ cloudinary: {
107
+ sourceTypes: validator.isArrayOfStrings,
108
+ transformation: validator.isObject
109
+ }
110
+ };
@@ -0,0 +1,68 @@
1
+ import videojs from 'video.js';
2
+
3
+ export const CLOUDINARY_PARAMS = [
4
+ 'cloudinaryConfig',
5
+ 'transformation',
6
+ 'sourceTypes',
7
+ 'sourceTransformation',
8
+ 'posterOptions',
9
+ 'autoShowRecommendations',
10
+ 'fontFace',
11
+ 'secure'
12
+ ];
13
+
14
+ export const PLAYER_PARAMS = CLOUDINARY_PARAMS.concat([
15
+ 'publicId',
16
+ 'source',
17
+ 'autoplayMode',
18
+ 'playedEventPercents',
19
+ 'playedEventTimes',
20
+ 'analytics',
21
+ 'fluid',
22
+ 'ima',
23
+ 'playlistWidget',
24
+ 'hideContextMenu',
25
+ 'colors',
26
+ 'floatingWhenNotVisible',
27
+ 'ads',
28
+ 'showJumpControls',
29
+ 'textTracks',
30
+ 'qualitySelector',
31
+ 'fetchErrorUsingGet',
32
+ 'withCredentials',
33
+ 'seekThumbnails'
34
+ ]);
35
+
36
+ export const DEFAULT_HLS_OPTIONS = {
37
+ html5: {
38
+ handlePartialData: false,
39
+ hls: {
40
+ overrideNative: videojs && videojs.browser ? !videojs.browser.IS_IOS && !videojs.browser.IS_SAFARI : true
41
+ }
42
+ }
43
+ };
44
+
45
+ export const FLUID_CLASS_NAME = 'cld-fluid';
46
+
47
+ export const AUTO_PLAY_MODE = {
48
+ ALWAYS: 'always',
49
+ ON_SCROLL: 'on-scroll',
50
+ NEVER: 'never'
51
+ };
52
+
53
+ export const FLOATING_TO = {
54
+ LEFT: 'left',
55
+ RIGHT: 'right',
56
+ NONE: 'none'
57
+ };
58
+
59
+ export const ADS_IN_PLAYLIST = {
60
+ FIRST_VIDEO: 'first-video',
61
+ EVERY_VIDEO: 'every-video'
62
+ };
63
+
64
+ export const PRELOAD = {
65
+ AUTO: 'auto',
66
+ METADATA: 'metadata',
67
+ NONE: 'none'
68
+ };