@vidispine/vdt-js 22.3.0-pre.2 → 22.3.0-pre.5
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/index.es.js +366 -311
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +369 -312
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
2
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
4
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
5
|
import _typeof from '@babel/runtime/helpers/typeof';
|
|
5
6
|
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
6
7
|
import _createClass from '@babel/runtime/helpers/createClass';
|
|
7
|
-
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
8
8
|
import parseFileSize from 'filesize';
|
|
9
9
|
|
|
10
10
|
function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -244,171 +244,212 @@ var roles = /*#__PURE__*/Object.freeze({
|
|
|
244
244
|
VXA_READ: VXA_READ
|
|
245
245
|
});
|
|
246
246
|
|
|
247
|
-
var _excluded$4 = ["
|
|
247
|
+
var _excluded$4 = ["value"],
|
|
248
248
|
_excluded2$2 = ["start", "end"];
|
|
249
249
|
|
|
250
250
|
function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
251
251
|
|
|
252
252
|
function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$7(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
253
253
|
|
|
254
|
-
var
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
254
|
+
var COMBINED_PROPERTY_KEYS = ['uuid', 'user', 'timestamp', 'change', 'conflict', 'mode', 'name', 'id', 'referenced', 'data', 'inheritance'];
|
|
255
|
+
var GROUP_PROPERTY_KEYS = [].concat(COMBINED_PROPERTY_KEYS, ['cycle']);
|
|
256
|
+
var FIELD_PROPERTY_KEYS = [].concat(COMBINED_PROPERTY_KEYS, ['value', 'reference', 'type', 'track']);
|
|
257
|
+
var FIELD_VALUE_PROPERTY_KEYS = [].concat(COMBINED_PROPERTY_KEYS, ['value', 'lang']);
|
|
258
|
+
|
|
259
|
+
var isObject = function isObject(o) {
|
|
260
|
+
return Object.prototype.toString.call(o) === '[object Object]';
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
var isDate = function isDate(o) {
|
|
264
|
+
return Object.prototype.toString.call(o) === '[object Date]';
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
var isField = function isField(value) {
|
|
268
|
+
var FIELD_TYPES = ['string', 'boolean', 'number'];
|
|
269
|
+
|
|
270
|
+
var isFieldType = function isFieldType(v) {
|
|
271
|
+
return FIELD_TYPES.includes(_typeof(v));
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
var isFieldObject = function isFieldObject(v) {
|
|
275
|
+
return isObject(v) && (v.value === null || isObject(v.value) || isFieldType(v.value));
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
if (value === null) {
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
259
281
|
|
|
260
282
|
if (Array.isArray(value)) {
|
|
261
|
-
return value.
|
|
262
|
-
|
|
263
|
-
return _objectSpread$7({
|
|
264
|
-
value: valueOrObject.value || ''
|
|
265
|
-
}, valueOrObject);
|
|
266
|
-
}
|
|
283
|
+
return value.some(isField);
|
|
284
|
+
}
|
|
267
285
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
286
|
+
return isFieldType(value) || isFieldObject(value) || isDate(value);
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
var isGroup = function isGroup(value) {
|
|
290
|
+
var isGroupObject = function isGroupObject(v) {
|
|
291
|
+
return isObject(v) && v.value === undefined && Object.entries(value);
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
if (Array.isArray(value)) {
|
|
295
|
+
return value.every(isGroup);
|
|
272
296
|
}
|
|
273
297
|
|
|
274
|
-
|
|
275
|
-
return [{
|
|
276
|
-
value: value
|
|
277
|
-
}];
|
|
298
|
+
return isGroupObject(value);
|
|
278
299
|
};
|
|
279
300
|
|
|
280
|
-
var
|
|
281
|
-
|
|
301
|
+
var tryPluralize = function tryPluralize(str, arr) {
|
|
302
|
+
return str + (arr.length > 1 ? 's' : '');
|
|
303
|
+
};
|
|
282
304
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
305
|
+
var ensureKeysAreValid = function ensureKeysAreValid(keysToCheck, keysToMatch) {
|
|
306
|
+
var unsupportedKeys = keysToCheck.filter(function (k) {
|
|
307
|
+
return !keysToMatch.includes(k);
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
if (unsupportedKeys.length) {
|
|
311
|
+
throw Error("Unsupported ".concat(tryPluralize('key', unsupportedKeys), " (").concat(unsupportedKeys.join(', '), ")"));
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
var parseValue = function parseValue(value) {
|
|
316
|
+
if (Array.isArray(value)) {
|
|
317
|
+
throw Error('Invalid value object, cannot be array');
|
|
291
318
|
}
|
|
292
319
|
|
|
320
|
+
if ([undefined, null].includes(value)) return {};
|
|
321
|
+
if (isDate(value)) return {
|
|
322
|
+
value: value.toISOString()
|
|
323
|
+
};
|
|
293
324
|
return {
|
|
294
|
-
value:
|
|
325
|
+
value: value
|
|
295
326
|
};
|
|
296
327
|
};
|
|
297
328
|
|
|
298
|
-
var
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
329
|
+
var parseValueObject = function parseValueObject(valueObject) {
|
|
330
|
+
ensureKeysAreValid(Object.keys(valueObject), FIELD_VALUE_PROPERTY_KEYS);
|
|
331
|
+
|
|
332
|
+
if (Object.keys(valueObject).length === 0) {
|
|
333
|
+
throw Error('Invalid value object, cannot be empty object');
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
var parsedValue = parseValue(valueObject === null || valueObject === void 0 ? void 0 : valueObject.value);
|
|
337
|
+
return _objectSpread$7(_objectSpread$7({}, valueObject), parsedValue !== undefined ? parsedValue : {});
|
|
306
338
|
};
|
|
307
339
|
|
|
308
|
-
var
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
340
|
+
var parseFieldValue = function parseFieldValue(value) {
|
|
341
|
+
if ([undefined, null].includes(value)) return undefined;
|
|
342
|
+
if (Array.isArray(value)) return value.map(parseFieldValue);
|
|
343
|
+
if (isObject(value)) return parseValueObject(value);
|
|
344
|
+
return parseValue(value);
|
|
312
345
|
};
|
|
313
346
|
|
|
314
|
-
var
|
|
315
|
-
|
|
316
|
-
var
|
|
317
|
-
|
|
318
|
-
|
|
347
|
+
var parseFieldObject = function parseFieldObject(fieldObject) {
|
|
348
|
+
ensureKeysAreValid(Object.keys(fieldObject), FIELD_PROPERTY_KEYS);
|
|
349
|
+
var parsedFieldValue = parseFieldValue(fieldObject === null || fieldObject === void 0 ? void 0 : fieldObject.value);
|
|
350
|
+
|
|
351
|
+
if (parsedFieldValue === undefined) {
|
|
352
|
+
fieldObject.value;
|
|
353
|
+
var fieldObjectWithoutValue = _objectWithoutProperties(fieldObject, _excluded$4);
|
|
319
354
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
355
|
+
return fieldObjectWithoutValue;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
return _objectSpread$7(_objectSpread$7({}, fieldObject), {}, {
|
|
359
|
+
value: _toConsumableArray(Array.isArray(parsedFieldValue) ? parsedFieldValue : [parsedFieldValue])
|
|
360
|
+
});
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
var parseField$1 = function parseField(field) {
|
|
364
|
+
if (isObject(field)) {
|
|
365
|
+
return parseFieldObject(field);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
var parsedFieldValue = parseFieldValue(field);
|
|
369
|
+
|
|
370
|
+
if (parsedFieldValue === undefined) {
|
|
371
|
+
return undefined;
|
|
372
|
+
}
|
|
323
373
|
|
|
324
374
|
return {
|
|
325
|
-
|
|
326
|
-
group: group,
|
|
327
|
-
field: field
|
|
375
|
+
value: _toConsumableArray(Array.isArray(parsedFieldValue) ? parsedFieldValue : [parsedFieldValue])
|
|
328
376
|
};
|
|
329
377
|
};
|
|
330
378
|
|
|
331
|
-
var
|
|
379
|
+
var parseGroupsAndFields = function parseGroupsAndFields(groupOrField) {
|
|
332
380
|
var group = [];
|
|
333
381
|
var field = [];
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
})) {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
group.push(
|
|
353
|
-
name:
|
|
354
|
-
|
|
355
|
-
}));
|
|
382
|
+
var groupAttributes = {};
|
|
383
|
+
Object.entries(groupOrField || {}).forEach(function (_ref) {
|
|
384
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
385
|
+
name = _ref2[0],
|
|
386
|
+
value = _ref2[1];
|
|
387
|
+
|
|
388
|
+
if (GROUP_PROPERTY_KEYS.includes(name)) {
|
|
389
|
+
groupAttributes = _objectSpread$7(_objectSpread$7({}, groupAttributes), {}, _defineProperty({}, name, value));
|
|
390
|
+
} else if (isField(value)) {
|
|
391
|
+
try {
|
|
392
|
+
field.push(_objectSpread$7({
|
|
393
|
+
name: name
|
|
394
|
+
}, parseField$1(value)));
|
|
395
|
+
} catch (error) {
|
|
396
|
+
throw Error(error.message + (name ? " for field \"".concat(name, "\"") : ''));
|
|
397
|
+
}
|
|
398
|
+
} else if (isGroup(value)) {
|
|
399
|
+
(Array.isArray(value) ? value : [value]).forEach(function (v) {
|
|
400
|
+
group.push(_objectSpread$7({
|
|
401
|
+
name: name
|
|
402
|
+
}, parseGroupsAndFields(v)));
|
|
356
403
|
});
|
|
357
404
|
} else {
|
|
358
|
-
|
|
359
|
-
name: name,
|
|
360
|
-
value: value
|
|
361
|
-
}));
|
|
405
|
+
throw Error("Unhandled value for \"".concat(name, "\""));
|
|
362
406
|
}
|
|
363
407
|
});
|
|
364
|
-
return {
|
|
365
|
-
group: group
|
|
408
|
+
return _objectSpread$7(_objectSpread$7(_objectSpread$7({}, groupAttributes), group.length > 0 ? {
|
|
409
|
+
group: group
|
|
410
|
+
} : {}), field.length > 0 ? {
|
|
366
411
|
field: field
|
|
367
|
-
};
|
|
412
|
+
} : {});
|
|
368
413
|
};
|
|
369
414
|
|
|
370
415
|
var parseTimespan$1 = function parseTimespan() {
|
|
371
416
|
var timespan = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
372
417
|
|
|
373
|
-
var
|
|
374
|
-
|
|
375
|
-
start =
|
|
376
|
-
|
|
377
|
-
end =
|
|
378
|
-
|
|
418
|
+
var _ref3 = timespan || {},
|
|
419
|
+
_ref3$start = _ref3.start,
|
|
420
|
+
start = _ref3$start === void 0 ? '-INF' : _ref3$start,
|
|
421
|
+
_ref3$end = _ref3.end,
|
|
422
|
+
end = _ref3$end === void 0 ? '+INF' : _ref3$end,
|
|
423
|
+
groupsAndFields = _objectWithoutProperties(_ref3, _excluded2$2);
|
|
379
424
|
|
|
380
|
-
var
|
|
381
|
-
group =
|
|
382
|
-
field =
|
|
425
|
+
var _parseGroupsAndFields = parseGroupsAndFields(groupsAndFields),
|
|
426
|
+
group = _parseGroupsAndFields.group,
|
|
427
|
+
field = _parseGroupsAndFields.field;
|
|
383
428
|
|
|
384
|
-
return {
|
|
385
|
-
start: start,
|
|
386
|
-
end: end,
|
|
387
|
-
field: field,
|
|
429
|
+
return _objectSpread$7(_objectSpread$7(_objectSpread$7({}, group ? {
|
|
388
430
|
group: group
|
|
389
|
-
}
|
|
431
|
+
} : {}), field ? {
|
|
432
|
+
field: field
|
|
433
|
+
} : {}), {}, {
|
|
434
|
+
start: start,
|
|
435
|
+
end: end
|
|
436
|
+
});
|
|
390
437
|
};
|
|
391
438
|
/**
|
|
392
439
|
* Create a MetadataType object from a metadata object
|
|
393
|
-
*
|
|
440
|
+
*
|
|
441
|
+
* @param {Object} metadata - object with metadata to create MetadataType object of
|
|
394
442
|
* @returns {Object} MetadataType
|
|
395
443
|
*/
|
|
396
444
|
|
|
397
445
|
|
|
398
446
|
var createMetadataType = function createMetadataType() {
|
|
399
447
|
var metadata = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
});
|
|
406
|
-
} else {
|
|
407
|
-
var genericTimespan = parseTimespan$1(metadata);
|
|
408
|
-
metadataType.timespan = [genericTimespan];
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
return metadataType;
|
|
448
|
+
return {
|
|
449
|
+
timespan: (Array.isArray(metadata) ? metadata : [metadata]).map(function (t) {
|
|
450
|
+
return parseTimespan$1(t);
|
|
451
|
+
})
|
|
452
|
+
};
|
|
412
453
|
};
|
|
413
454
|
|
|
414
455
|
var sortTimespanList = function sortTimespanList(timespan1, timespan2) {
|
|
@@ -844,13 +885,13 @@ var parseHighlightTimespan = function parseHighlightTimespan() {
|
|
|
844
885
|
start = _ref.start,
|
|
845
886
|
end = _ref.end;
|
|
846
887
|
|
|
847
|
-
var
|
|
848
|
-
var
|
|
849
|
-
arrayOnSingle =
|
|
850
|
-
|
|
851
|
-
joinValue =
|
|
852
|
-
|
|
853
|
-
timespanAsList =
|
|
888
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
889
|
+
var _options$arrayOnSingl = options.arrayOnSingle,
|
|
890
|
+
arrayOnSingle = _options$arrayOnSingl === void 0 ? true : _options$arrayOnSingl,
|
|
891
|
+
_options$joinValue = options.joinValue,
|
|
892
|
+
joinValue = _options$joinValue === void 0 ? undefined : _options$joinValue,
|
|
893
|
+
_options$timespanAsLi = options.timespanAsList,
|
|
894
|
+
timespanAsList = _options$timespanAsLi === void 0 ? undefined : _options$timespanAsLi;
|
|
854
895
|
var initialValue = timespanAsList ? {
|
|
855
896
|
start: start,
|
|
856
897
|
end: end
|
|
@@ -908,27 +949,28 @@ var parseHighlightTimespanList = function parseHighlightTimespanList() {
|
|
|
908
949
|
}, {});
|
|
909
950
|
};
|
|
910
951
|
|
|
911
|
-
var
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
}
|
|
952
|
+
var CONSTANT_TIMEBASES = {
|
|
953
|
+
PAL: {
|
|
954
|
+
denominator: 25,
|
|
955
|
+
numerator: 1
|
|
956
|
+
},
|
|
957
|
+
NTSC: {
|
|
958
|
+
denominator: 30000,
|
|
959
|
+
numerator: 1001
|
|
960
|
+
},
|
|
961
|
+
NTSC30: {
|
|
962
|
+
denominator: 30,
|
|
963
|
+
numerator: 1
|
|
964
|
+
},
|
|
965
|
+
29.97: {
|
|
966
|
+
denominator: 30000,
|
|
967
|
+
numerator: 1001
|
|
968
|
+
},
|
|
969
|
+
59.94: {
|
|
970
|
+
denominator: 60000,
|
|
971
|
+
numerator: 1001
|
|
972
|
+
}
|
|
973
|
+
};
|
|
932
974
|
var FRAME_SEPARATORS = {
|
|
933
975
|
':': {
|
|
934
976
|
dropFrame: false,
|
|
@@ -948,96 +990,13 @@ var FRAME_SEPARATORS = {
|
|
|
948
990
|
}
|
|
949
991
|
};
|
|
950
992
|
|
|
951
|
-
function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
952
|
-
|
|
953
|
-
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
954
|
-
|
|
955
|
-
var splitSmpte = function splitSmpte(smpteText) {
|
|
956
|
-
var hasDropFrameSeparator = smpteText.match(/[^0-9:\-_]/);
|
|
957
|
-
var hhmmssff;
|
|
958
|
-
var frameOptions = {};
|
|
959
|
-
|
|
960
|
-
if (hasDropFrameSeparator) {
|
|
961
|
-
var _hasDropFrameSeparato = _slicedToArray(hasDropFrameSeparator, 1),
|
|
962
|
-
frameSeparator = _hasDropFrameSeparato[0];
|
|
963
|
-
|
|
964
|
-
var _smpteText$split = smpteText.split(frameSeparator),
|
|
965
|
-
_smpteText$split2 = _slicedToArray(_smpteText$split, 2),
|
|
966
|
-
hhmmss = _smpteText$split2[0],
|
|
967
|
-
splitFrames = _smpteText$split2[1];
|
|
968
|
-
|
|
969
|
-
hhmmssff = [].concat(_toConsumableArray(hhmmss.split(':')), [splitFrames]);
|
|
970
|
-
frameOptions = FRAME_SEPARATORS[frameSeparator] || {};
|
|
971
|
-
} else {
|
|
972
|
-
hhmmssff = smpteText.split(':');
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
hhmmssff = hhmmssff.map(Number);
|
|
976
|
-
|
|
977
|
-
if (hhmmssff.length > 4 || hhmmssff.some(function (n) {
|
|
978
|
-
return Number.isNaN(n);
|
|
979
|
-
})) {
|
|
980
|
-
throw new Error('Invalid SMPTE timecode');
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
return [hhmmssff, frameOptions];
|
|
984
|
-
};
|
|
985
|
-
|
|
986
|
-
var getDropFrames = function getDropFrames(roundedFrameRate) {
|
|
987
|
-
return roundedFrameRate === 60 ? 4 : 2;
|
|
988
|
-
};
|
|
989
|
-
|
|
990
|
-
var getRoundedFrameRate = function getRoundedFrameRate(timeBase) {
|
|
991
|
-
return Math.round(timeBase.denominator / timeBase.numerator);
|
|
992
|
-
};
|
|
993
|
-
|
|
994
|
-
var countSamples = function countSamples(hh, mm, ss, ff, _ref) {
|
|
995
|
-
var dropFrame = _ref.dropFrame,
|
|
996
|
-
roundedFrameRate = _ref.roundedFrameRate;
|
|
997
|
-
|
|
998
|
-
if (!dropFrame) {
|
|
999
|
-
return hh * 3600 * roundedFrameRate + mm * 60 * roundedFrameRate + ss * roundedFrameRate + ff;
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
if (![30, 60].includes(roundedFrameRate)) {
|
|
1003
|
-
throw new Error('Cannot use dropframe with non NTSC timebase');
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
var dropFrames = getDropFrames(roundedFrameRate);
|
|
1007
|
-
var shouldDropMinute = mm % 10 !== 0;
|
|
1008
|
-
var shouldDropSecond = shouldDropMinute && ss === 0;
|
|
1009
|
-
var hourFrames = hh * (3600 * roundedFrameRate - 54 * dropFrames);
|
|
1010
|
-
var minuteFrames = mm * 60 * roundedFrameRate - (mm - Math.ceil(mm / 10)) * dropFrames;
|
|
1011
|
-
var secondFrames = ss * roundedFrameRate - (shouldDropMinute && ss > 1 ? dropFrames : 0);
|
|
1012
|
-
|
|
1013
|
-
if (shouldDropSecond && ff < dropFrames) {
|
|
1014
|
-
throw new Error('Invalid ff');
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
var frameFrames = shouldDropSecond ? ff - dropFrames : ff;
|
|
1018
|
-
return hourFrames + minuteFrames + secondFrames + frameFrames;
|
|
1019
|
-
};
|
|
1020
|
-
|
|
1021
|
-
function countDroppedFrames(frames, roundedFrameRate) {
|
|
1022
|
-
var dropFrames = getDropFrames(roundedFrameRate);
|
|
1023
|
-
var oneMinuteUndroppedFrames = 60 * roundedFrameRate;
|
|
1024
|
-
var oneMinuteDroppedFrames = 60 * roundedFrameRate - dropFrames;
|
|
1025
|
-
var tenMinuteFrames = 10 * (oneMinuteUndroppedFrames - dropFrames) + dropFrames;
|
|
1026
|
-
var tenMinuteChunks = Math.floor(frames / tenMinuteFrames);
|
|
1027
|
-
var minuteRemainder = Math.max(0, frames % tenMinuteFrames - oneMinuteUndroppedFrames);
|
|
1028
|
-
var oneMinuteChunks = Math.floor(minuteRemainder / oneMinuteDroppedFrames);
|
|
1029
|
-
var frameRemainder = minuteRemainder % oneMinuteDroppedFrames;
|
|
1030
|
-
var frameChunks = frameRemainder > 0 ? dropFrames : 0;
|
|
1031
|
-
return tenMinuteChunks * 9 * dropFrames + oneMinuteChunks * dropFrames + frameChunks;
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
993
|
var TimeBase = /*#__PURE__*/function () {
|
|
1035
994
|
function TimeBase() {
|
|
1036
|
-
var
|
|
1037
|
-
|
|
1038
|
-
numerator =
|
|
1039
|
-
|
|
1040
|
-
denominator =
|
|
995
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
996
|
+
_ref$numerator = _ref.numerator,
|
|
997
|
+
numerator = _ref$numerator === void 0 ? 1 : _ref$numerator,
|
|
998
|
+
_ref$denominator = _ref.denominator,
|
|
999
|
+
denominator = _ref$denominator === void 0 ? 1 : _ref$denominator;
|
|
1041
1000
|
|
|
1042
1001
|
_classCallCheck(this, TimeBase);
|
|
1043
1002
|
|
|
@@ -1121,23 +1080,94 @@ var TimeBase = /*#__PURE__*/function () {
|
|
|
1121
1080
|
return TimeBase;
|
|
1122
1081
|
}();
|
|
1123
1082
|
|
|
1124
|
-
var
|
|
1125
|
-
|
|
1126
|
-
|
|
1083
|
+
var formatTimeBaseType = function formatTimeBaseType(timeBase) {
|
|
1084
|
+
return new TimeBase(timeBase);
|
|
1085
|
+
};
|
|
1086
|
+
|
|
1087
|
+
var formatTimeBaseText = function formatTimeBaseText(timeBaseText) {
|
|
1088
|
+
if (timeBaseText === undefined) {
|
|
1089
|
+
return formatTimeBaseType();
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
if (typeof timeBaseText === 'number') {
|
|
1093
|
+
return formatTimeBaseType({
|
|
1094
|
+
denominator: timeBaseText
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
if (timeBaseText.includes(':')) {
|
|
1099
|
+
var _timeBaseText$split = timeBaseText.split(':'),
|
|
1100
|
+
_timeBaseText$split2 = _slicedToArray(_timeBaseText$split, 2),
|
|
1101
|
+
_denominator = _timeBaseText$split2[0],
|
|
1102
|
+
numerator = _timeBaseText$split2[1];
|
|
1103
|
+
|
|
1104
|
+
return formatTimeBaseType({
|
|
1105
|
+
denominator: _denominator,
|
|
1106
|
+
numerator: numerator
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
if (Object.keys(CONSTANT_TIMEBASES).includes(timeBaseText)) {
|
|
1111
|
+
return formatTimeBaseType(CONSTANT_TIMEBASES[timeBaseText]);
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
var denominator = Number(timeBaseText);
|
|
1115
|
+
|
|
1116
|
+
if (Number.isNaN(denominator)) {
|
|
1117
|
+
throw new Error("timeBaseText must be a number or ".concat(Object.keys(CONSTANT_TIMEBASES).join(','), " - is ").concat(timeBaseText));
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
return formatTimeBaseType({
|
|
1121
|
+
denominator: denominator
|
|
1122
|
+
});
|
|
1123
|
+
};
|
|
1124
|
+
|
|
1125
|
+
var formatTimeBase = function formatTimeBase(timeBase) {
|
|
1126
|
+
if (_typeof(timeBase) === 'object') {
|
|
1127
|
+
return formatTimeBaseType(timeBase);
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
return formatTimeBaseText(timeBase);
|
|
1131
|
+
};
|
|
1132
|
+
|
|
1133
|
+
var getDropFrames$1 = function getDropFrames(roundedFrameRate) {
|
|
1134
|
+
return roundedFrameRate === 60 ? 4 : 2;
|
|
1135
|
+
};
|
|
1136
|
+
|
|
1137
|
+
var getRoundedFrameRate$1 = function getRoundedFrameRate(timeBase) {
|
|
1138
|
+
return Math.round(timeBase.denominator / timeBase.numerator);
|
|
1139
|
+
};
|
|
1140
|
+
|
|
1141
|
+
function countDroppedFrames(frames, roundedFrameRate) {
|
|
1142
|
+
var dropFrames = getDropFrames$1(roundedFrameRate);
|
|
1143
|
+
var oneMinuteUndroppedFrames = 60 * roundedFrameRate;
|
|
1144
|
+
var oneMinuteDroppedFrames = 60 * roundedFrameRate - dropFrames;
|
|
1145
|
+
var tenMinuteFrames = 10 * (oneMinuteUndroppedFrames - dropFrames) + dropFrames;
|
|
1146
|
+
var tenMinuteChunks = Math.floor(frames / tenMinuteFrames);
|
|
1147
|
+
var minuteRemainder = Math.max(0, frames % tenMinuteFrames - oneMinuteUndroppedFrames);
|
|
1148
|
+
var oneMinuteChunks = Math.floor(minuteRemainder / oneMinuteDroppedFrames);
|
|
1149
|
+
var frameRemainder = minuteRemainder % oneMinuteDroppedFrames;
|
|
1150
|
+
var frameChunks = frameRemainder > 0 ? dropFrames : 0;
|
|
1151
|
+
return tenMinuteChunks * 9 * dropFrames + oneMinuteChunks * dropFrames + frameChunks;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
var isDropFrameTimeBase = function isDropFrameTimeBase(_ref) {
|
|
1155
|
+
var numerator = _ref.numerator,
|
|
1156
|
+
denominator = _ref.denominator;
|
|
1127
1157
|
return numerator === 1001 && (denominator === 60000 || denominator === 30000);
|
|
1128
1158
|
};
|
|
1129
1159
|
|
|
1130
1160
|
var TimeCode = /*#__PURE__*/function () {
|
|
1131
1161
|
function TimeCode() {
|
|
1132
|
-
var
|
|
1133
|
-
|
|
1134
|
-
samples =
|
|
1135
|
-
timeBase =
|
|
1162
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1163
|
+
_ref2$samples = _ref2.samples,
|
|
1164
|
+
samples = _ref2$samples === void 0 ? 0 : _ref2$samples,
|
|
1165
|
+
timeBase = _ref2.timeBase;
|
|
1136
1166
|
|
|
1137
|
-
var
|
|
1138
|
-
dropFrame =
|
|
1139
|
-
|
|
1140
|
-
field =
|
|
1167
|
+
var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
1168
|
+
dropFrame = _ref3.dropFrame,
|
|
1169
|
+
_ref3$field = _ref3.field,
|
|
1170
|
+
field = _ref3$field === void 0 ? 2 : _ref3$field;
|
|
1141
1171
|
|
|
1142
1172
|
_classCallCheck(this, TimeCode);
|
|
1143
1173
|
|
|
@@ -1245,7 +1275,7 @@ var TimeCode = /*#__PURE__*/function () {
|
|
|
1245
1275
|
}, {
|
|
1246
1276
|
key: "toTime",
|
|
1247
1277
|
value: function toTime() {
|
|
1248
|
-
var roundedFrameRate = getRoundedFrameRate(this.timeBase);
|
|
1278
|
+
var roundedFrameRate = getRoundedFrameRate$1(this.timeBase);
|
|
1249
1279
|
var totalSamples = this.samples + (this.dropFrame ? countDroppedFrames(this.samples + 1, roundedFrameRate) : 0);
|
|
1250
1280
|
var hours = Math.floor(totalSamples / (3600 * roundedFrameRate));
|
|
1251
1281
|
var minutes = Math.floor(totalSamples / (60 * roundedFrameRate)) % 60;
|
|
@@ -1263,8 +1293,8 @@ var TimeCode = /*#__PURE__*/function () {
|
|
|
1263
1293
|
}, {
|
|
1264
1294
|
key: "toDuration",
|
|
1265
1295
|
value: function toDuration() {
|
|
1266
|
-
var
|
|
1267
|
-
format =
|
|
1296
|
+
var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1297
|
+
format = _ref4.format;
|
|
1268
1298
|
|
|
1269
1299
|
var _this$toTime = this.toTime(),
|
|
1270
1300
|
hours = _this$toTime.hours,
|
|
@@ -1290,7 +1320,7 @@ var TimeCode = /*#__PURE__*/function () {
|
|
|
1290
1320
|
}, {
|
|
1291
1321
|
key: "toSmpte",
|
|
1292
1322
|
value: function toSmpte() {
|
|
1293
|
-
var
|
|
1323
|
+
var _this = this;
|
|
1294
1324
|
|
|
1295
1325
|
if (this.samples === -Infinity) return '00:00:00:00';
|
|
1296
1326
|
|
|
@@ -1308,7 +1338,7 @@ var TimeCode = /*#__PURE__*/function () {
|
|
|
1308
1338
|
dropFrame = _thisSeparator$.dropFrame,
|
|
1309
1339
|
field = _thisSeparator$.field;
|
|
1310
1340
|
|
|
1311
|
-
return dropFrame ===
|
|
1341
|
+
return dropFrame === _this.dropFrame && field === _this.field;
|
|
1312
1342
|
}),
|
|
1313
1343
|
_Object$entries$find2 = _slicedToArray(_Object$entries$find, 1),
|
|
1314
1344
|
_Object$entries$find3 = _Object$entries$find2[0],
|
|
@@ -1326,56 +1356,6 @@ var TimeCode = /*#__PURE__*/function () {
|
|
|
1326
1356
|
return TimeCode;
|
|
1327
1357
|
}();
|
|
1328
1358
|
|
|
1329
|
-
var formatTimeBaseType = function formatTimeBaseType(timeBase) {
|
|
1330
|
-
return new TimeBase(timeBase);
|
|
1331
|
-
};
|
|
1332
|
-
|
|
1333
|
-
var formatTimeBaseText = function formatTimeBaseText(timeBaseText) {
|
|
1334
|
-
if (timeBaseText === undefined) {
|
|
1335
|
-
return formatTimeBaseType();
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
|
-
if (typeof timeBaseText === 'number') {
|
|
1339
|
-
return formatTimeBaseType({
|
|
1340
|
-
denominator: timeBaseText
|
|
1341
|
-
});
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1344
|
-
if (timeBaseText.includes(':')) {
|
|
1345
|
-
var _timeBaseText$split = timeBaseText.split(':'),
|
|
1346
|
-
_timeBaseText$split2 = _slicedToArray(_timeBaseText$split, 2),
|
|
1347
|
-
_denominator = _timeBaseText$split2[0],
|
|
1348
|
-
numerator = _timeBaseText$split2[1];
|
|
1349
|
-
|
|
1350
|
-
return formatTimeBaseType({
|
|
1351
|
-
denominator: _denominator,
|
|
1352
|
-
numerator: numerator
|
|
1353
|
-
});
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
if (Object.keys(CONSTANT_TIMEBASES).includes(timeBaseText)) {
|
|
1357
|
-
return formatTimeBaseType(CONSTANT_TIMEBASES[timeBaseText]);
|
|
1358
|
-
}
|
|
1359
|
-
|
|
1360
|
-
var denominator = Number(timeBaseText);
|
|
1361
|
-
|
|
1362
|
-
if (Number.isNaN(denominator)) {
|
|
1363
|
-
throw new Error("timeBaseText must be a number or ".concat(Object.keys(CONSTANT_TIMEBASES).join(','), " - is ").concat(timeBaseText));
|
|
1364
|
-
}
|
|
1365
|
-
|
|
1366
|
-
return formatTimeBaseType({
|
|
1367
|
-
denominator: denominator
|
|
1368
|
-
});
|
|
1369
|
-
};
|
|
1370
|
-
|
|
1371
|
-
var formatTimeBase = function formatTimeBase(timeBase) {
|
|
1372
|
-
if (_typeof(timeBase) === 'object') {
|
|
1373
|
-
return formatTimeBaseType(timeBase);
|
|
1374
|
-
}
|
|
1375
|
-
|
|
1376
|
-
return formatTimeBaseText(timeBase);
|
|
1377
|
-
};
|
|
1378
|
-
|
|
1379
1359
|
var formatTimeCodeType = function formatTimeCodeType(timeCode, options) {
|
|
1380
1360
|
return new TimeCode(timeCode, options);
|
|
1381
1361
|
};
|
|
@@ -1445,11 +1425,11 @@ var formatSeconds = function formatSeconds(seconds, timeBase, options) {
|
|
|
1445
1425
|
throw new Error("seconds must be digits, is ".concat(seconds));
|
|
1446
1426
|
}
|
|
1447
1427
|
|
|
1448
|
-
var
|
|
1449
|
-
|
|
1450
|
-
denominator =
|
|
1451
|
-
|
|
1452
|
-
numerator =
|
|
1428
|
+
var _ref = timeBase || {},
|
|
1429
|
+
_ref$denominator = _ref.denominator,
|
|
1430
|
+
denominator = _ref$denominator === void 0 ? 1 : _ref$denominator,
|
|
1431
|
+
_ref$numerator = _ref.numerator,
|
|
1432
|
+
numerator = _ref$numerator === void 0 ? 1 : _ref$numerator;
|
|
1453
1433
|
|
|
1454
1434
|
var samples = seconds * (denominator / numerator);
|
|
1455
1435
|
var timeCode = {
|
|
@@ -1464,13 +1444,13 @@ var formatSecondsPrecise = function formatSecondsPrecise(seconds, timeBase, opti
|
|
|
1464
1444
|
throw new Error("seconds must be digits, is ".concat(seconds));
|
|
1465
1445
|
}
|
|
1466
1446
|
|
|
1467
|
-
var
|
|
1468
|
-
|
|
1469
|
-
numerator =
|
|
1447
|
+
var _ref = timeBase || {},
|
|
1448
|
+
_ref$numerator = _ref.numerator,
|
|
1449
|
+
numerator = _ref$numerator === void 0 ? 1 : _ref$numerator;
|
|
1470
1450
|
|
|
1471
|
-
var
|
|
1472
|
-
|
|
1473
|
-
denominator =
|
|
1451
|
+
var _ref2 = timeBase || {},
|
|
1452
|
+
_ref2$denominator = _ref2.denominator,
|
|
1453
|
+
denominator = _ref2$denominator === void 0 ? 1 : _ref2$denominator;
|
|
1474
1454
|
|
|
1475
1455
|
if (!Number.isInteger(seconds)) {
|
|
1476
1456
|
var decimalPlaces = String(seconds).split('.')[1].length;
|
|
@@ -1488,17 +1468,87 @@ var formatSecondsPrecise = function formatSecondsPrecise(seconds, timeBase, opti
|
|
|
1488
1468
|
return new TimeCode(timeCode, options);
|
|
1489
1469
|
};
|
|
1490
1470
|
|
|
1471
|
+
function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1472
|
+
|
|
1473
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1474
|
+
|
|
1475
|
+
var getDropFrames = function getDropFrames(roundedFrameRate) {
|
|
1476
|
+
return roundedFrameRate === 60 ? 4 : 2;
|
|
1477
|
+
};
|
|
1478
|
+
|
|
1479
|
+
var getRoundedFrameRate = function getRoundedFrameRate(timeBase) {
|
|
1480
|
+
return Math.round(timeBase.denominator / timeBase.numerator);
|
|
1481
|
+
};
|
|
1482
|
+
|
|
1483
|
+
var splitSmpte = function splitSmpte(smpteText) {
|
|
1484
|
+
var hasDropFrameSeparator = smpteText.match(/[^0-9:\-_]/);
|
|
1485
|
+
var hhmmssff;
|
|
1486
|
+
var frameOptions = {};
|
|
1487
|
+
|
|
1488
|
+
if (hasDropFrameSeparator) {
|
|
1489
|
+
var _hasDropFrameSeparato = _slicedToArray(hasDropFrameSeparator, 1),
|
|
1490
|
+
frameSeparator = _hasDropFrameSeparato[0];
|
|
1491
|
+
|
|
1492
|
+
var _smpteText$split = smpteText.split(frameSeparator),
|
|
1493
|
+
_smpteText$split2 = _slicedToArray(_smpteText$split, 2),
|
|
1494
|
+
hhmmss = _smpteText$split2[0],
|
|
1495
|
+
splitFrames = _smpteText$split2[1];
|
|
1496
|
+
|
|
1497
|
+
hhmmssff = [].concat(_toConsumableArray(hhmmss.split(':')), [splitFrames]);
|
|
1498
|
+
frameOptions = FRAME_SEPARATORS[frameSeparator] || {};
|
|
1499
|
+
} else {
|
|
1500
|
+
hhmmssff = smpteText.split(':');
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
hhmmssff = hhmmssff.map(Number);
|
|
1504
|
+
|
|
1505
|
+
if (hhmmssff.length > 4 || hhmmssff.some(function (n) {
|
|
1506
|
+
return Number.isNaN(n);
|
|
1507
|
+
})) {
|
|
1508
|
+
throw new Error('Invalid SMPTE timecode');
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
return [hhmmssff, frameOptions];
|
|
1512
|
+
};
|
|
1513
|
+
|
|
1514
|
+
var countSamples = function countSamples(hh, mm, ss, ff, _ref) {
|
|
1515
|
+
var dropFrame = _ref.dropFrame,
|
|
1516
|
+
roundedFrameRate = _ref.roundedFrameRate;
|
|
1517
|
+
|
|
1518
|
+
if (!dropFrame) {
|
|
1519
|
+
return hh * 3600 * roundedFrameRate + mm * 60 * roundedFrameRate + ss * roundedFrameRate + ff;
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
if (![30, 60].includes(roundedFrameRate)) {
|
|
1523
|
+
throw new Error('Cannot use dropframe with non NTSC timebase');
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
var dropFrames = getDropFrames(roundedFrameRate);
|
|
1527
|
+
var shouldDropMinute = mm % 10 !== 0;
|
|
1528
|
+
var shouldDropSecond = shouldDropMinute && ss === 0;
|
|
1529
|
+
var hourFrames = hh * (3600 * roundedFrameRate - 54 * dropFrames);
|
|
1530
|
+
var minuteFrames = mm * 60 * roundedFrameRate - (mm - Math.ceil(mm / 10)) * dropFrames;
|
|
1531
|
+
var secondFrames = ss * roundedFrameRate - (shouldDropMinute && ss > 1 ? dropFrames : 0);
|
|
1532
|
+
|
|
1533
|
+
if (shouldDropSecond && ff < dropFrames) {
|
|
1534
|
+
throw new Error('Invalid ff');
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
var frameFrames = shouldDropSecond ? ff - dropFrames : ff;
|
|
1538
|
+
return hourFrames + minuteFrames + secondFrames + frameFrames;
|
|
1539
|
+
};
|
|
1540
|
+
|
|
1491
1541
|
var formatSmpte = function formatSmpte(smpteText, timeBaseText) {
|
|
1492
1542
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1493
1543
|
|
|
1494
1544
|
if (smpteText === undefined) {
|
|
1495
1545
|
var _timeBase = formatTimeBase(timeBaseText);
|
|
1496
1546
|
|
|
1497
|
-
var
|
|
1547
|
+
var _timeCode = {
|
|
1498
1548
|
samples: 0,
|
|
1499
1549
|
timeBase: _timeBase
|
|
1500
1550
|
};
|
|
1501
|
-
return formatTimeCodeType(
|
|
1551
|
+
return formatTimeCodeType(_timeCode);
|
|
1502
1552
|
}
|
|
1503
1553
|
|
|
1504
1554
|
if (typeof smpteText !== 'string') {
|
|
@@ -1560,7 +1610,7 @@ function timeToCueTime(_ref) {
|
|
|
1560
1610
|
*/
|
|
1561
1611
|
|
|
1562
1612
|
|
|
1563
|
-
function metadataTypeToWebVtt(_ref2) {
|
|
1613
|
+
var metadataTypeToWebVtt = function metadataTypeToWebVtt(_ref2) {
|
|
1564
1614
|
var metadataType = _ref2.metadataType,
|
|
1565
1615
|
_ref2$subtitleGroup = _ref2.subtitleGroup,
|
|
1566
1616
|
subtitleGroup = _ref2$subtitleGroup === void 0 ? 'stl_subtitle' : _ref2$subtitleGroup,
|
|
@@ -1596,7 +1646,10 @@ function metadataTypeToWebVtt(_ref2) {
|
|
|
1596
1646
|
return "".concat(start, " --> ").concat(end, " line:0%\r").concat(text, "\r");
|
|
1597
1647
|
});
|
|
1598
1648
|
return "WEBVTT\n\n\n".concat(vttCues.join('\n'));
|
|
1599
|
-
}
|
|
1649
|
+
};
|
|
1650
|
+
|
|
1651
|
+
var SYSTEM_FIELDGROUPS = ['stl_subtitle', 'stl_tti', 'stl_gsi', 'mrk_marker', 'pho_validation', 'pho_resource', 'pho_error', 'facedetect_rect', 'facedetect_face', 'originalTrackFilename', 'stl_gsiHeader'];
|
|
1652
|
+
var SYSTEM_FIELDS = ['title', 'user', 'shapeTag', 'representativeThumbnail', 'representativeThumbnailNoAuth', 'representativeItems', 'itemId', 'collectionId', 'mediaType', 'mimeType', 'created', 'startTimeCode', 'startSeconds', 'fieldValidationError', 'schemaValidationError', 'originalFilename', 'originalUri', 'originalAudioCodec', 'originalVideoCodec', 'originalHeight', 'originalWidth', 'originalFormat', 'durationSeconds', 'durationTimeCode', 'solr-index', '__user', '__collection', '__collection_size', '__ancestor_collection', '__ancestor_collection_size', '__shape', '__shape_size', '__shape_last_added', '__placeholder_shape_size', '__version', '__version_count', '__storage', '__storage_size', '__shapetag_{tag}_hash_{hash}', '__storage_{tag}', '__storage_{tag}_size', '__storagegroup', '__storagegroup_size', '__sequence', '__sequence_size', '__metadata_last_modified', '__external_id', '__deletion_lock_id', '__deletion_lock_expiry', '__child_collection', '__child_collection_size', '__parent_collection', '__parent_collection_size', '__items_size', 'stl_text', 'stl_justification', 'stl_xrelative', 'stl_yrelative', 'stl_vertical', 'stl_verticalbase', 'stl_horizontalbase', 'stl_sizerelative', 'stl_color', 'stl_outline', 'stl_outlinecolor', 'stl_outlinesize', 'stl_font', 'stl_service', 'stl_tti', 'stl_gsi', 'cct', 'tcd', 'tcf', 'oet', 'cd', 'mnc', 'cpn', 'dfc', 'tcp', 'tcs', 'tet', 'tnb', 'tnd', 'en', 'co', 'tng', 'rd', 'mnr', 'dsc', 'opt', 'lc', 'tpt', 'tn', 'slr', 'tns', 'rn', 'pub', 'dsn', 'ecd', 'mrk_zerolength', 'mrk_text', 'mrk_color', 'pho_resource_name', 'pho_error_level', 'pho_error_code', 'pho_error_description', 'facedetect_rect_width', 'facedetect_rect_height', 'facedetect_rect_y', 'facedetect_rect_x', 'facedetect_pid', 'facedetect_rect', 'trackId', 'eidr_actor', 'eidr_alternateId', 'eidr_countryOfOrigin', 'eidr_director', 'eidr_id', 'eidr_referentType', 'eidr_releaseDate', 'eidr_resourceName', 'eidr_status', 'eidr_sync', 'ttml_div', 'ttml_root', 'vxa_collection_id', 'vxaId', 'vxaLocalPath', 'tco', 'cs', 'ebn', 'tf', 'cf', 'sgn', 'tci', 'jc', 'vp', 'sn'];
|
|
1600
1653
|
|
|
1601
1654
|
var createFacetType = function createFacetType() {
|
|
1602
1655
|
var fieldList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
@@ -2057,6 +2110,7 @@ var IMAGE = 'IMAGE';
|
|
|
2057
2110
|
var AUDIO = 'AUDIO';
|
|
2058
2111
|
var VIDEO = 'VIDEO';
|
|
2059
2112
|
var DOCUMENT = 'DOCUMENT';
|
|
2113
|
+
var BINARY = 'BINARY';
|
|
2060
2114
|
var getShapeMediaType = function getShapeMediaType() {
|
|
2061
2115
|
var shapeType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2062
2116
|
var mimeType = shapeType.mimeType,
|
|
@@ -2079,6 +2133,7 @@ var getShapeMediaType = function getShapeMediaType() {
|
|
|
2079
2133
|
if (mimeType.endsWith('/msword')) return DOCUMENT;
|
|
2080
2134
|
if (mimeType.endsWith('/json')) return DOCUMENT;
|
|
2081
2135
|
if (mimeType.endsWith('/xml')) return DOCUMENT;
|
|
2136
|
+
if (mimeType.endsWith('/octet-stream')) return BINARY;
|
|
2082
2137
|
return undefined;
|
|
2083
2138
|
};
|
|
2084
2139
|
|
|
@@ -2296,5 +2351,5 @@ var getDocumentType = function getDocumentType() {
|
|
|
2296
2351
|
return undefined;
|
|
2297
2352
|
};
|
|
2298
2353
|
|
|
2299
|
-
export { TimeBase, TimeCode, createFacetType, createMetadataType, filterShapeSource, findNearestThumbnail, formatSeconds, formatSecondsPrecise, formatSmpte, formatTimeBase, formatTimeBaseText, formatTimeBaseType, formatTimeCodeText, formatTimeCodeType, getDocumentType, getShapeMediaType, metadataTypeToWebVtt, parseAspectRatio, parseAudioComponent, parseBaseMediaInfoType, parseBinaryComponent, parseContainerComponent, parseFacetType, parseFileType, parseHighlightTimespan, parseHighlightTimespanList, parseKeyValuePairType, parseMediaConvertPreset, parseMetadataType, parseNowDate, parseShapeType, parseSimpleMetadataType, parseTimespan, parseTimespanList, parseTranscodePreset, parseVideoComponent, roles };
|
|
2354
|
+
export { SYSTEM_FIELDGROUPS, SYSTEM_FIELDS, TimeBase, TimeCode, createFacetType, createMetadataType, filterShapeSource, findNearestThumbnail, formatSeconds, formatSecondsPrecise, formatSmpte, formatTimeBase, formatTimeBaseText, formatTimeBaseType, formatTimeCodeText, formatTimeCodeType, getDocumentType, getShapeMediaType, metadataTypeToWebVtt, parseAspectRatio, parseAudioComponent, parseBaseMediaInfoType, parseBinaryComponent, parseContainerComponent, parseFacetType, parseFileType, parseHighlightTimespan, parseHighlightTimespanList, parseKeyValuePairType, parseMediaConvertPreset, parseMetadataType, parseNowDate, parseShapeType, parseSimpleMetadataType, parseTimespan, parseTimespanList, parseTranscodePreset, parseVideoComponent, roles };
|
|
2300
2355
|
//# sourceMappingURL=index.es.js.map
|