@micromag/element-video 0.3.813 → 0.3.815

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 (2) hide show
  1. package/es/index.js +13 -6
  2. package/package.json +4 -4
package/es/index.js CHANGED
@@ -3,7 +3,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
3
3
  import classNames from 'classnames';
4
4
  import isFunction from 'lodash/isFunction';
5
5
  import PropTypes from 'prop-types';
6
- import React, { useMemo, useRef, useState, useEffect, useCallback } from 'react';
6
+ import React, { useMemo, useState, useEffect, useRef, useCallback } from 'react';
7
7
  import { PropTypes as PropTypes$1 } from '@micromag/core';
8
8
  import { Spinner } from '@micromag/core/components';
9
9
  import { useMediaThumbnail, useMediaCurrentTime, useMediaDuration, useMediaReady, useProgressSteps } from '@micromag/core/hooks';
@@ -30,14 +30,21 @@ function useSources(media) {
30
30
  var files = useMemo(function () {
31
31
  return getMediaFilesAsArray(mediaFiles);
32
32
  }, [mediaFiles]);
33
+ var _useState = useState(finalPossibleMimes),
34
+ _useState2 = _slicedToArray(_useState, 2),
35
+ supportedMimes = _useState2[0],
36
+ setSupportedMimes = _useState2[1];
37
+ useEffect(function () {
38
+ var newMimes = getVideoSupportedMimes(finalPossibleMimes);
39
+ if (newMimes.length === 0) {
40
+ newMimes = ['video/mp4'];
41
+ }
42
+ setSupportedMimes(newMimes);
43
+ }, [finalPossibleMimes]);
33
44
  var sources = useMemo(function () {
34
45
  if (files.length === 0) {
35
46
  return null;
36
47
  }
37
- var supportedMimes = getVideoSupportedMimes(finalPossibleMimes);
38
- if (supportedMimes.length === 0) {
39
- supportedMimes = ['video/mp4'];
40
- }
41
48
  var supportedFiles = files.filter(function (file) {
42
49
  var fileHandle = file.handle || file.id;
43
50
  var _file$mime = file.mime,
@@ -58,7 +65,7 @@ function useSources(media) {
58
65
  }
59
66
  return a > b ? 1 : -1;
60
67
  });
61
- }, [files, finalPossibleMimes]);
68
+ }, [files, supportedMimes]);
62
69
 
63
70
  // @NOTE: Media is an animated image and doesn't have source files in video formats
64
71
  var _ref6 = files.find(function (_ref7) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-video",
3
- "version": "0.3.813",
3
+ "version": "0.3.815",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -59,8 +59,8 @@
59
59
  },
60
60
  "dependencies": {
61
61
  "@babel/runtime": "^7.13.10",
62
- "@micromag/core": "^0.3.813",
63
- "@micromag/element-closed-captions": "^0.3.813",
62
+ "@micromag/core": "^0.3.814",
63
+ "@micromag/element-closed-captions": "^0.3.814",
64
64
  "classnames": "^2.2.6",
65
65
  "hls.js": "^1.5.15",
66
66
  "lodash": "^4.17.21",
@@ -72,5 +72,5 @@
72
72
  "access": "public",
73
73
  "registry": "https://registry.npmjs.org/"
74
74
  },
75
- "gitHead": "24f52ddea5f0ee918f594af86c3c8fd2e1b6f289"
75
+ "gitHead": "1370baa4250c76baee32c1ada1c63535d8775b1b"
76
76
  }