@micromag/element-video 0.4.49 → 0.4.50
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/es/index.js +54 -52
- package/package.json +4 -4
package/es/index.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
1
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
2
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
4
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
5
|
import classNames from 'classnames';
|
|
5
6
|
import isFunction from 'lodash/isFunction';
|
|
6
|
-
import
|
|
7
|
+
import { useMemo, useState, useEffect, useRef, useCallback } from 'react';
|
|
7
8
|
import { Spinner } from '@micromag/core/components';
|
|
8
9
|
import { useMediaThumbnail, useMediaCurrentTime, useMediaDuration, useMediaReady, useProgressSteps } from '@micromag/core/hooks';
|
|
9
10
|
import { useSetting } from '@micromag/core/contexts';
|
|
10
11
|
import { getMediaFilesAsArray, getVideoSupportedMimes } from '@micromag/core/utils';
|
|
12
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
11
13
|
|
|
12
14
|
// Disabled webm for now
|
|
13
15
|
// const defaultPossibleMimes = ['video/mp4', 'video/webm', 'video/ogg', 'application/vnd.apple.mpegurl'];
|
|
@@ -266,65 +268,65 @@ function Video(_ref) {
|
|
|
266
268
|
disabled: paused,
|
|
267
269
|
onStep: onProgressStep
|
|
268
270
|
});
|
|
269
|
-
return /*#__PURE__*/
|
|
271
|
+
return /*#__PURE__*/jsxs("div", {
|
|
270
272
|
className: classNames([styles.container, _defineProperty({}, styles.withSize, withSize), className]),
|
|
271
273
|
style: withSize ? {
|
|
272
274
|
width: width,
|
|
273
275
|
height: height
|
|
274
|
-
} : null
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
mediaRef
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
})
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
})
|
|
276
|
+
} : null,
|
|
277
|
+
children: [isImageWithoutSourceFile && shouldLoad ? /*#__PURE__*/jsx("img", {
|
|
278
|
+
src: mediaUrl,
|
|
279
|
+
alt: description,
|
|
280
|
+
tabIndex: "-1",
|
|
281
|
+
className: classNames([styles.media, innerClassName])
|
|
282
|
+
}) : null, !isImageWithoutSourceFile ? /*#__PURE__*/jsx("video", {
|
|
283
|
+
ref: function ref(newRef) {
|
|
284
|
+
_ref6.current = newRef;
|
|
285
|
+
if (mediaRef !== null && isFunction(mediaRef)) {
|
|
286
|
+
mediaRef(newRef);
|
|
287
|
+
} else if (mediaRef !== null) {
|
|
288
|
+
mediaRef.current = newRef;
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
src: sources === null && shouldLoad ? "".concat(mediaUrl, "#t=0.001") : null,
|
|
292
|
+
autoPlay: autoPlay && !paused,
|
|
293
|
+
loop: loop,
|
|
294
|
+
muted: muted,
|
|
295
|
+
poster: shouldLoad && withPoster && finalThumbnail !== null ? finalThumbnail.url || null : null,
|
|
296
|
+
preload: finalPreload,
|
|
297
|
+
playsInline: playsInline,
|
|
298
|
+
crossOrigin: withoutCors ? 'anonymous' : null,
|
|
299
|
+
disablePictureInPicture: disablePictureInPicture,
|
|
300
|
+
tabIndex: focusable ? '0' : '-1',
|
|
301
|
+
className: classNames([styles.media, innerClassName]),
|
|
302
|
+
onPlay: onPlay,
|
|
303
|
+
onPlaying: onPlaying,
|
|
304
|
+
onPause: onPause,
|
|
305
|
+
onEnded: onEnded,
|
|
306
|
+
onSeeked: onSeeked,
|
|
307
|
+
onVolumeChange: onVolumeChange,
|
|
308
|
+
onTimeUpdate: onTimeUpdate,
|
|
309
|
+
onSuspend: onSuspend,
|
|
310
|
+
"data-has-audio": hasAudio,
|
|
311
|
+
"data-is-suspended": isSuspended,
|
|
312
|
+
"aria-hidden": true,
|
|
313
|
+
children: (shouldLoad && sources !== null ? sources : []).map(function (_ref5) {
|
|
314
|
+
var sourceUrl = _ref5.url,
|
|
315
|
+
sourceMime = _ref5.mime;
|
|
316
|
+
return /*#__PURE__*/jsx("source", {
|
|
317
|
+
src: sourceUrl !== null ? "".concat(sourceUrl, "#t=0.001") : null,
|
|
318
|
+
type: sourceMime
|
|
319
|
+
}, "source-".concat(sourceUrl, "-").concat(sourceMime));
|
|
320
|
+
})
|
|
321
|
+
}, mediaUrl) : null, !isImageWithoutSourceFile && !ready && showLoading ? /*#__PURE__*/jsx(Spinner, {
|
|
322
|
+
className: styles.spinner
|
|
323
|
+
}) : null]
|
|
324
|
+
});
|
|
323
325
|
}
|
|
324
326
|
var Video_default = (function (_ref7) {
|
|
325
327
|
var ref = _ref7.ref,
|
|
326
328
|
props = _objectWithoutProperties(_ref7, _excluded);
|
|
327
|
-
return /*#__PURE__*/
|
|
329
|
+
return /*#__PURE__*/jsx(Video, _objectSpread({
|
|
328
330
|
mediaRef: ref
|
|
329
331
|
}, props));
|
|
330
332
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-video",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.50",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@babel/runtime": "^7.28.6",
|
|
63
|
-
"@micromag/core": "^0.4.
|
|
64
|
-
"@micromag/element-closed-captions": "^0.4.
|
|
63
|
+
"@micromag/core": "^0.4.50",
|
|
64
|
+
"@micromag/element-closed-captions": "^0.4.50",
|
|
65
65
|
"classnames": "^2.2.6",
|
|
66
66
|
"hls.js": "^1.5.15",
|
|
67
67
|
"lodash": "^4.17.23",
|
|
@@ -72,6 +72,6 @@
|
|
|
72
72
|
"access": "public",
|
|
73
73
|
"registry": "https://registry.npmjs.org/"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "940d5ca98f8f448b79eaa3e2fa685c3ee95185b8",
|
|
76
76
|
"types": "es/index.d.ts"
|
|
77
77
|
}
|