@vidispine/vdt-js 22.4.0-pre.6 → 22.4.0-pre.7
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.d.ts +9 -9
- package/dist/index.es.js +30 -29
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +30 -29
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -2836,6 +2836,7 @@ var parseShapeType = function parseShapeType() {
|
|
|
2836
2836
|
return parsedShape;
|
|
2837
2837
|
};
|
|
2838
2838
|
|
|
2839
|
+
// eslint-disable-next-line import/no-cycle
|
|
2839
2840
|
var DOCUMENT_TYPES = {
|
|
2840
2841
|
PDF: 'PDF',
|
|
2841
2842
|
TEXT: 'TEXT',
|
|
@@ -2847,15 +2848,16 @@ var DOCUMENT_TYPES = {
|
|
|
2847
2848
|
/**
|
|
2848
2849
|
* Return a const for the document type of a shape (looks at mimeType)
|
|
2849
2850
|
*
|
|
2850
|
-
* @param shape
|
|
2851
|
+
* @param shape A VidiCore shape
|
|
2851
2852
|
* @returns The document type for a shape
|
|
2852
2853
|
*
|
|
2853
2854
|
* @category Shape
|
|
2854
2855
|
*/
|
|
2855
|
-
var
|
|
2856
|
-
var
|
|
2857
|
-
|
|
2858
|
-
|
|
2856
|
+
var getShapeDocumentType = function getShapeDocumentType() {
|
|
2857
|
+
var shape = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2858
|
+
// shapeType.mimeType is always a string array,
|
|
2859
|
+
// but accepts passing in { mimeType: string } for backwards compatibility
|
|
2860
|
+
var mimeTypeArrayOrString = shape.mimeType;
|
|
2859
2861
|
var mimeType = Array.isArray(mimeTypeArrayOrString) ? mimeTypeArrayOrString[0] : mimeTypeArrayOrString;
|
|
2860
2862
|
if (!mimeType) return undefined;
|
|
2861
2863
|
if (mimeType.endsWith('/pdf')) return DOCUMENT_TYPES.PDF;
|
|
@@ -2882,8 +2884,8 @@ var H264_CODEC = 'h264'; // Sort by tags in the order of previewShapeOrder, seco
|
|
|
2882
2884
|
var PREVIEW_SHAPE_ORDER = ['__mp4', '__mp3_160k', '__png', '__jpeg', '__gif', 'original'].reverse();
|
|
2883
2885
|
|
|
2884
2886
|
var defaultSortPriority = function defaultSortPriority(_ref, _ref2) {
|
|
2885
|
-
var firstEl = _ref.
|
|
2886
|
-
var secondEl = _ref2.
|
|
2887
|
+
var firstEl = _ref.parsedShape.tag;
|
|
2888
|
+
var secondEl = _ref2.parsedShape.tag;
|
|
2887
2889
|
|
|
2888
2890
|
if (PREVIEW_SHAPE_ORDER.includes(firstEl) || PREVIEW_SHAPE_ORDER.includes(secondEl)) {
|
|
2889
2891
|
return PREVIEW_SHAPE_ORDER.indexOf(secondEl) - PREVIEW_SHAPE_ORDER.indexOf(firstEl);
|
|
@@ -2906,29 +2908,31 @@ var filterShapeSource = function filterShapeSource(itemType, options) {
|
|
|
2906
2908
|
var _ref3 = options || {},
|
|
2907
2909
|
_ref3$allowedMimeType = _ref3.allowedMimeTypes,
|
|
2908
2910
|
allowedMimeTypes = _ref3$allowedMimeType === void 0 ? DEFAULT_ALLOWED_MIME_TYPES : _ref3$allowedMimeType,
|
|
2909
|
-
_ref3$sortPriority = _ref3.sortPriority,
|
|
2910
|
-
sortPriority = _ref3$sortPriority === void 0 ? defaultSortPriority : _ref3$sortPriority,
|
|
2911
2911
|
_ref3$allowedMethods = _ref3.allowedMethods,
|
|
2912
2912
|
allowedMethods = _ref3$allowedMethods === void 0 ? DEFAULT_ALLOWED_METHODS : _ref3$allowedMethods,
|
|
2913
|
+
_ref3$sortPriority = _ref3.sortPriority,
|
|
2914
|
+
sortPriority = _ref3$sortPriority === void 0 ? defaultSortPriority : _ref3$sortPriority,
|
|
2913
2915
|
_ref3$sourceKey = _ref3.sourceKey,
|
|
2914
2916
|
sourceKey = _ref3$sourceKey === void 0 ? 'src' : _ref3$sourceKey,
|
|
2915
2917
|
_ref3$mimeTypeKey = _ref3.mimeTypeKey,
|
|
2916
2918
|
mimeTypeKey = _ref3$mimeTypeKey === void 0 ? 'type' : _ref3$mimeTypeKey,
|
|
2917
2919
|
_ref3$shapeKey = _ref3.shapeKey,
|
|
2918
|
-
shapeKey = _ref3$shapeKey === void 0 ? 'shape' : _ref3$shapeKey
|
|
2920
|
+
shapeKey = _ref3$shapeKey === void 0 ? 'shape' : _ref3$shapeKey,
|
|
2921
|
+
_ref3$parsedShapeKey = _ref3.parsedShapeKey,
|
|
2922
|
+
parsedShapeKey = _ref3$parsedShapeKey === void 0 ? 'parsedShapeKey' : _ref3$parsedShapeKey;
|
|
2919
2923
|
|
|
2920
2924
|
var _ref4 = itemType || {},
|
|
2921
2925
|
_ref4$shape = _ref4.shape,
|
|
2922
2926
|
shapeList = _ref4$shape === void 0 ? [] : _ref4$shape;
|
|
2923
2927
|
|
|
2924
|
-
var
|
|
2928
|
+
var filteredShapeList = shapeList.reduce(function (acc, shapeType) {
|
|
2925
2929
|
var type;
|
|
2926
2930
|
var src;
|
|
2927
|
-
var
|
|
2928
|
-
var uri =
|
|
2929
|
-
mimeType =
|
|
2930
|
-
containerFormat =
|
|
2931
|
-
videoCodec =
|
|
2931
|
+
var parsedShape = parseShapeType(shapeType);
|
|
2932
|
+
var uri = parsedShape.uri,
|
|
2933
|
+
mimeType = parsedShape.mimeType,
|
|
2934
|
+
containerFormat = parsedShape.containerFormat,
|
|
2935
|
+
videoCodec = parsedShape.videoCodec;
|
|
2932
2936
|
|
|
2933
2937
|
if (mimeType) {
|
|
2934
2938
|
type = mimeType;
|
|
@@ -2950,13 +2954,13 @@ var filterShapeSource = function filterShapeSource(itemType, options) {
|
|
|
2950
2954
|
if (src && allowedMimeTypes.includes(type)) {
|
|
2951
2955
|
var _acc$push;
|
|
2952
2956
|
|
|
2953
|
-
acc.push((_acc$push = {}, _defineProperty__default["default"](_acc$push, sourceKey, src), _defineProperty__default["default"](_acc$push, mimeTypeKey, type), _defineProperty__default["default"](_acc$push, shapeKey,
|
|
2957
|
+
acc.push((_acc$push = {}, _defineProperty__default["default"](_acc$push, sourceKey, src), _defineProperty__default["default"](_acc$push, mimeTypeKey, type), _defineProperty__default["default"](_acc$push, shapeKey, shapeType), _defineProperty__default["default"](_acc$push, parsedShapeKey, parsedShape), _acc$push));
|
|
2954
2958
|
}
|
|
2955
2959
|
|
|
2956
2960
|
return acc;
|
|
2957
2961
|
}, []);
|
|
2958
|
-
if (typeof sortPriority === 'function')
|
|
2959
|
-
return
|
|
2962
|
+
if (typeof sortPriority === 'function') filteredShapeList.sort(defaultSortPriority);
|
|
2963
|
+
return filteredShapeList;
|
|
2960
2964
|
};
|
|
2961
2965
|
|
|
2962
2966
|
var SHAPE_MEDIA_TYPES = {
|
|
@@ -2966,23 +2970,20 @@ var SHAPE_MEDIA_TYPES = {
|
|
|
2966
2970
|
DOCUMENT: 'DOCUMENT',
|
|
2967
2971
|
BINARY: 'BINARY'
|
|
2968
2972
|
};
|
|
2969
|
-
// TODO: For consistency, replace input with an actual ShapeType not a parsed shape
|
|
2970
|
-
// (parse it internally if needed)
|
|
2971
2973
|
|
|
2972
2974
|
/**
|
|
2973
2975
|
* Returns a const for which media type a shape has
|
|
2974
2976
|
*
|
|
2975
|
-
* @param
|
|
2977
|
+
* @param shape
|
|
2976
2978
|
* @returns
|
|
2977
2979
|
*
|
|
2978
2980
|
* @category Shape
|
|
2979
2981
|
*/
|
|
2980
|
-
var getShapeMediaType = function getShapeMediaType(
|
|
2981
|
-
var
|
|
2982
|
-
|
|
2983
|
-
videoCodec =
|
|
2984
|
-
audioCodec =
|
|
2985
|
-
|
|
2982
|
+
var getShapeMediaType = function getShapeMediaType(shape) {
|
|
2983
|
+
var parsedShape = parseShapeType(shape);
|
|
2984
|
+
var mimeType = parsedShape.mimeType,
|
|
2985
|
+
videoCodec = parsedShape.videoCodec,
|
|
2986
|
+
audioCodec = parsedShape.audioCodec;
|
|
2986
2987
|
if (!mimeType) return undefined;
|
|
2987
2988
|
|
|
2988
2989
|
if (mimeType.startsWith('audio/')) {
|
|
@@ -3220,7 +3221,7 @@ exports.formatTimeCodeSeconds = formatTimeCodeSeconds;
|
|
|
3220
3221
|
exports.formatTimeCodeSmpte = formatTimeCodeSmpte;
|
|
3221
3222
|
exports.formatTimeCodeText = formatTimeCodeText;
|
|
3222
3223
|
exports.formatTimeCodeType = formatTimeCodeType;
|
|
3223
|
-
exports.
|
|
3224
|
+
exports.getShapeDocumentType = getShapeDocumentType;
|
|
3224
3225
|
exports.getShapeMediaType = getShapeMediaType;
|
|
3225
3226
|
exports.metadataTypeToWebVtt = metadataTypeToWebVtt;
|
|
3226
3227
|
exports.parseAudioComponent = parseAudioComponent;
|