cloudinary-video-player 1.5.5 → 1.5.9
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/CHANGELOG.md +140 -21
- package/dist/cld-video-player.css +229 -2079
- package/dist/cld-video-player.js +200 -483
- package/dist/cld-video-player.light.css +231 -2081
- package/dist/cld-video-player.light.js +71 -23
- package/dist/cld-video-player.light.min.css +1 -1
- package/dist/cld-video-player.light.min.js +2 -23
- package/dist/cld-video-player.light.min.js.LICENSE.txt +23 -0
- package/dist/cld-video-player.min.css +1 -1
- package/dist/cld-video-player.min.js +2 -27
- package/dist/cld-video-player.min.js.LICENSE.txt +26 -0
- package/docs/interaction-area.html +104 -64
- package/package.json +23 -23
- package/src/assets/styles/components/interaction-areas.scss +165 -0
- package/src/assets/styles/components/themedButton.scss +48 -0
- package/src/assets/styles/icons.scss +149 -217
- package/src/assets/styles/main.scss +8 -30
- package/src/components/interaction-area/interaction-area.const.js +30 -0
- package/src/components/interaction-area/interaction-area.service.js +225 -0
- package/src/components/interaction-area/interaction-area.utils.js +236 -0
- package/src/components/logoButton/logo-button.js +3 -6
- package/src/components/themeButton/themedButton.const.js +3 -0
- package/src/components/themeButton/themedButton.js +25 -0
- package/src/config/defaults.js +3 -2
- package/src/extended-events.js +3 -0
- package/src/plugins/cloudinary/common.js +14 -6
- package/src/plugins/cloudinary/models/video-source/video-source.js +16 -12
- package/src/plugins/cloudinary/models/video-source/video-source.utils.js +28 -1
- package/src/plugins/colors/index.js +6 -1
- package/src/plugins/dash/videojs-dash.js +1 -1
- package/src/plugins/floating-player/index.js +3 -1
- package/src/utils/array.js +21 -0
- package/src/utils/dom.js +41 -2
- package/src/utils/object.js +26 -0
- package/src/utils/time.js +28 -1
- package/src/utils/type-inference.js +5 -1
- package/src/validators/validators-functions.js +48 -0
- package/src/validators/validators-types.js +78 -0
- package/src/validators/validators.js +110 -0
- package/src/video-player.const.js +23 -16
- package/src/video-player.js +47 -127
- package/src/video-player.utils.js +9 -70
- package/test/isValidConfig.test.js +224 -0
- package/test/unit/utils.test.js +27 -0
- package/test/unit/videoSource.test.js +155 -0
- package/types/video-player.d.ts +1 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { CONTAINER_MIME_TYPES, FORMAT_MAPPINGS } from './video-source.const';
|
|
2
|
-
import { codecShorthandTrans, codecToSrcTransformation } from '../../common';
|
|
2
|
+
import { codecShorthandTrans, codecToSrcTransformation, VIDEO_CODEC } from '../../common';
|
|
3
|
+
import { isPlainObject, isString } from '../../../../utils/type-inference';
|
|
4
|
+
import { isKeyInTransformation } from 'utils/cloudinary';
|
|
5
|
+
import { some } from '../../../../utils/array';
|
|
3
6
|
|
|
4
7
|
export function formatToMimeTypeAndTransformation(format) {
|
|
5
8
|
const [container, codec] = format.toLowerCase().split('\/');
|
|
@@ -28,3 +31,27 @@ export function normalizeFormat(format) {
|
|
|
28
31
|
|
|
29
32
|
return res;
|
|
30
33
|
}
|
|
34
|
+
|
|
35
|
+
const isContainCodec = (value) => value && some(Object.values(VIDEO_CODEC), (codec) => value.includes(codec));
|
|
36
|
+
|
|
37
|
+
const hasCodecSrcTrans = (transformations) => some(['video_codec', 'streaming_profile'], (key) => isKeyInTransformation(transformations, key));
|
|
38
|
+
|
|
39
|
+
export const isCodecAlreadyExist = (transformations, rawTransformation) => {
|
|
40
|
+
if (!(transformations || rawTransformation)) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (hasCodecSrcTrans(transformations)) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (isString(rawTransformation)) {
|
|
49
|
+
return isContainCodec(rawTransformation);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return some(transformations, (transformation) => {
|
|
53
|
+
const options = transformation.toOptions();
|
|
54
|
+
|
|
55
|
+
return some(options && options.transformation, (item) => isContainCodec(isPlainObject(item) ? item.video_codec : item));
|
|
56
|
+
});
|
|
57
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { assign } from 'utils/assign';
|
|
2
2
|
import { playerClassPrefix } from 'utils/css-prefix';
|
|
3
|
+
import { isLight } from '../../video-player.utils';
|
|
3
4
|
|
|
4
5
|
const playerColors = `
|
|
5
6
|
.PLAYER-CLASS-PREFIX {
|
|
@@ -233,11 +234,15 @@ const defaults = {
|
|
|
233
234
|
}
|
|
234
235
|
};
|
|
235
236
|
|
|
237
|
+
export const getDefaultPlayerColor = (options) => {
|
|
238
|
+
return isLight(options) ? defaults.colorsLight : defaults.colorsDark;
|
|
239
|
+
};
|
|
240
|
+
|
|
236
241
|
class Colors {
|
|
237
242
|
constructor(player, opts = {}) {
|
|
238
243
|
this.player = player;
|
|
239
244
|
|
|
240
|
-
const skinDefaults = this.player.options_
|
|
245
|
+
const skinDefaults = getDefaultPlayerColor(this.player.options_);
|
|
241
246
|
|
|
242
247
|
opts.colors = assign({}, skinDefaults, opts.colors);
|
|
243
248
|
|
|
@@ -4,7 +4,7 @@ import dashjs from 'dashjs';
|
|
|
4
4
|
import setupAudioTracks from './setup-audio-tracks';
|
|
5
5
|
import setupTextTracks from './setup-text-tracks';
|
|
6
6
|
import document from 'global/document';
|
|
7
|
-
import {assign} from '../../utils/assign';
|
|
7
|
+
import { assign } from '../../utils/assign';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* videojs-contrib-dash
|
|
@@ -2,6 +2,7 @@ import { isElementInViewport } from 'utils/positioning';
|
|
|
2
2
|
import { sliceProperties } from 'utils/slicing';
|
|
3
3
|
import { assign } from 'utils/assign';
|
|
4
4
|
import './floating-player.scss';
|
|
5
|
+
import { FLOATING_TO } from '../../video-player.const';
|
|
5
6
|
|
|
6
7
|
const defaults = {
|
|
7
8
|
fraction: 0.5,
|
|
@@ -10,10 +11,11 @@ const defaults = {
|
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
class FloatingPlayer {
|
|
14
|
+
|
|
13
15
|
constructor(player, opts = {}) {
|
|
14
16
|
opts = assign({}, defaults, opts);
|
|
15
17
|
// Handle non left-right values.
|
|
16
|
-
if (opts.floatTo && opts.floatTo !==
|
|
18
|
+
if (opts.floatTo && opts.floatTo !== FLOATING_TO.LEFT && opts.floatTo !== FLOATING_TO.RIGHT) {
|
|
17
19
|
opts.floatTo = defaults.floatTo;
|
|
18
20
|
}
|
|
19
21
|
|
package/src/utils/array.js
CHANGED
|
@@ -1 +1,22 @@
|
|
|
1
|
+
|
|
1
2
|
export const castArray = (value) => Array.isArray(value) ? value : [value];
|
|
3
|
+
|
|
4
|
+
export const forEach = (value, callback) => {
|
|
5
|
+
if (Array.isArray(value) && value.length) {
|
|
6
|
+
value.forEach(callback);
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const some = (value, callback) => {
|
|
11
|
+
if (Array.isArray(value) && value.length) {
|
|
12
|
+
return value.some(callback);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return false;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const map = (value, callback) => {
|
|
19
|
+
if (Array.isArray(value) && value.length) {
|
|
20
|
+
return value.map(callback);
|
|
21
|
+
}
|
|
22
|
+
};
|
package/src/utils/dom.js
CHANGED
|
@@ -12,7 +12,7 @@ const createElement = (elementName, attributes = {}, children) => {
|
|
|
12
12
|
const element = document.createElement(elementName);
|
|
13
13
|
|
|
14
14
|
for (let key in attributes) {
|
|
15
|
-
if (attributes
|
|
15
|
+
if (Object.prototype.hasOwnProperty.call(attributes, key)) {
|
|
16
16
|
element.setAttribute(key, attributes[key]);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -31,5 +31,44 @@ const appendChild = (child, element) => {
|
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
export const styleElement = (element, style) => {
|
|
35
|
+
for (let key in style) {
|
|
36
|
+
if (Object.prototype.hasOwnProperty.call(style, key)) {
|
|
37
|
+
element.style[key] = style[key];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return element;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const elementsCreator = (item) => {
|
|
45
|
+
const children = Array.isArray(item.children) ? item.children.map(elementsCreator) : item.children;
|
|
46
|
+
|
|
47
|
+
const element = isElement(item) ? item : createElement(item.tag, item.attr, children);
|
|
48
|
+
|
|
49
|
+
if (item.onClick) {
|
|
50
|
+
item.event = { name: 'click', callback: item.onClick };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (item.event) {
|
|
54
|
+
element.addEventListener(item.event.name, item.event.callback, false);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (item.style) {
|
|
58
|
+
styleElement(element, item.style);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return element;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
const addEventListener = (element, name, cb) => {
|
|
66
|
+
element.addEventListener(name, cb, false);
|
|
67
|
+
|
|
68
|
+
return () => {
|
|
69
|
+
element.removeEventListener(name, cb, false);
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
|
|
34
73
|
|
|
35
|
-
export { wrap, createElement };
|
|
74
|
+
export { wrap, createElement, elementsCreator, addEventListener };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* a nested value from an object
|
|
4
|
+
* @param {object} value - a object you want to get a nested value from
|
|
5
|
+
* @param {string} path - path to the nested value, key separated by . (dots)
|
|
6
|
+
* @param {any} defaultValue - a default Value in case the value is not defined
|
|
7
|
+
* @returns a nested value from an object / array
|
|
8
|
+
*/
|
|
9
|
+
export const get = (value, path, defaultValue) => {
|
|
10
|
+
if (value && typeof value === 'object') {
|
|
11
|
+
const keysArray = path.split('.');
|
|
12
|
+
let getValue = value;
|
|
13
|
+
|
|
14
|
+
for (let objectValue of keysArray) {
|
|
15
|
+
if (Object.prototype.hasOwnProperty.call(getValue, objectValue) && getValue[objectValue] !== undefined) {
|
|
16
|
+
getValue = getValue[objectValue];
|
|
17
|
+
} else {
|
|
18
|
+
return defaultValue;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return getValue;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return defaultValue;
|
|
26
|
+
};
|
package/src/utils/time.js
CHANGED
|
@@ -47,4 +47,31 @@ const parseTime = function (hms) {
|
|
|
47
47
|
return sum;
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
|
|
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 };
|
|
@@ -16,6 +16,10 @@ function isInteger(data) {
|
|
|
16
16
|
return typeof data === 'number' && (data % 1) === 0;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
function isBoolean(data) {
|
|
20
|
+
return typeof data === 'boolean';
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
function isElement(value) {
|
|
20
24
|
return value instanceof Element;
|
|
21
25
|
}
|
|
@@ -28,4 +32,4 @@ function noop() {
|
|
|
28
32
|
return null;
|
|
29
33
|
}
|
|
30
34
|
|
|
31
|
-
export { isPlainObject, isString, isInteger, isNumber, isElement, noop, isFunction };
|
|
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
|
+
};
|
|
@@ -33,20 +33,6 @@ export const PLAYER_PARAMS = CLOUDINARY_PARAMS.concat([
|
|
|
33
33
|
'seekThumbnails'
|
|
34
34
|
]);
|
|
35
35
|
|
|
36
|
-
const INTERACTION_AREAS_TEMPLATE = {
|
|
37
|
-
PORTRAIT: 'portrait',
|
|
38
|
-
LANDSCAPE: 'landscape',
|
|
39
|
-
All: 'all',
|
|
40
|
-
CENTER: 'center'
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const TEMPLATE_INTERACTION_AREAS_VTT = {
|
|
44
|
-
[INTERACTION_AREAS_TEMPLATE.PORTRAIT]: 'https://res.cloudinary.com/prod/raw/upload/v1623772481/video-player/vtts/portrait.vtt',
|
|
45
|
-
[INTERACTION_AREAS_TEMPLATE.LANDSCAPE]: 'https://res.cloudinary.com/prod/raw/upload/v1623772303/video-player/vtts/landscape.vtt',
|
|
46
|
-
[INTERACTION_AREAS_TEMPLATE.All]: 'https://res.cloudinary.com/prod/raw/upload/v1623250266/video-player/vtts/all.vtt',
|
|
47
|
-
[INTERACTION_AREAS_TEMPLATE.CENTER]: 'https://res.cloudinary.com/prod/raw/upload/v1623250265/video-player/vtts/center.vtt'
|
|
48
|
-
};
|
|
49
|
-
|
|
50
36
|
export const DEFAULT_HLS_OPTIONS = {
|
|
51
37
|
html5: {
|
|
52
38
|
handlePartialData: false,
|
|
@@ -56,6 +42,27 @@ export const DEFAULT_HLS_OPTIONS = {
|
|
|
56
42
|
}
|
|
57
43
|
};
|
|
58
44
|
|
|
59
|
-
export const INTERACTION_AREAS_CONTAINER_CLASS_NAME = 'interaction-areas-container';
|
|
60
|
-
|
|
61
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
|
+
};
|