@micromag/viewer 0.3.462 → 0.3.463
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 +13 -6
- package/lib/index.js +12 -5
- package/package.json +11 -11
package/es/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import classNames from 'classnames';
|
|
|
17
17
|
import { Helmet } from 'react-helmet';
|
|
18
18
|
import EventEmitter from 'wolfy87-eventemitter';
|
|
19
19
|
import { Label, CloseIcon, ScreenPreview, Screen, ArrowIcon, Button as Button$1, PlayIcon, Spinner, UnmuteIcon, MuteIcon, PauseIcon, Meta, FontFaces } from '@micromag/core/components';
|
|
20
|
-
import { useDimensionObserver, useTrackEvent, useDragProgress, useMediaProgress, useMediaReady, useParsedStory, useLoadedFonts, useTrackScreenView, useScreenSizeFromElement, useFullscreen } from '@micromag/core/hooks';
|
|
20
|
+
import { useDimensionObserver, useTrackEvent, useDragProgress, useMediaProgress, useMediaReady, useMediaState, useParsedStory, useLoadedFonts, useTrackScreenView, useScreenSizeFromElement, useFullscreen } from '@micromag/core/hooks';
|
|
21
21
|
import { getStyleFromColor, easings, getStyleFromText, getColorAsString, getDeviceScreens } from '@micromag/core/utils';
|
|
22
22
|
import { ShareIncentive } from '@micromag/elements/all';
|
|
23
23
|
import { useIntl, FormattedMessage } from 'react-intl';
|
|
@@ -2133,9 +2133,9 @@ function PlaybackControls(_ref) {
|
|
|
2133
2133
|
_usePlaybackContext$h = _usePlaybackContext.hasAudio,
|
|
2134
2134
|
hasAudio = _usePlaybackContext$h === void 0 ? null : _usePlaybackContext$h,
|
|
2135
2135
|
_usePlaybackContext$p = _usePlaybackContext.playing,
|
|
2136
|
-
|
|
2136
|
+
wantedPlaying = _usePlaybackContext$p === void 0 ? false : _usePlaybackContext$p,
|
|
2137
2137
|
_usePlaybackContext$m2 = _usePlaybackContext.muted,
|
|
2138
|
-
|
|
2138
|
+
wantedMuted = _usePlaybackContext$m2 === void 0 ? true : _usePlaybackContext$m2,
|
|
2139
2139
|
setPlaying = _usePlaybackContext.setPlaying,
|
|
2140
2140
|
setMuted = _usePlaybackContext.setMuted,
|
|
2141
2141
|
controls = _usePlaybackContext.controls,
|
|
@@ -2153,19 +2153,26 @@ function PlaybackControls(_ref) {
|
|
|
2153
2153
|
});
|
|
2154
2154
|
var ready = mediaElement === null || mediaReady;
|
|
2155
2155
|
var finalShowLoading = showLoading && !ready;
|
|
2156
|
+
var _useMediaState = useMediaState(mediaElement, {
|
|
2157
|
+
playing: wantedPlaying,
|
|
2158
|
+
muted: wantedMuted
|
|
2159
|
+
}),
|
|
2160
|
+
buffering = _useMediaState.buffering,
|
|
2161
|
+
playing = _useMediaState.playing,
|
|
2162
|
+
muted = _useMediaState.muted;
|
|
2156
2163
|
useEffect(function () {
|
|
2157
2164
|
var id = null;
|
|
2158
2165
|
setShowLoading(false);
|
|
2159
|
-
if (!ready && withLoading) {
|
|
2166
|
+
if ((!ready || buffering) && withLoading) {
|
|
2160
2167
|
id = setTimeout(function () {
|
|
2161
2168
|
setShowLoading(true);
|
|
2162
|
-
},
|
|
2169
|
+
}, 1000);
|
|
2163
2170
|
}
|
|
2164
2171
|
return function () {
|
|
2165
2172
|
setShowLoading(false);
|
|
2166
2173
|
clearTimeout(id);
|
|
2167
2174
|
};
|
|
2168
|
-
}, [ready, withLoading, setShowLoading]);
|
|
2175
|
+
}, [ready, buffering, withLoading, setShowLoading]);
|
|
2169
2176
|
var _useState3 = useState({
|
|
2170
2177
|
color: getColorAsString(defaultColor),
|
|
2171
2178
|
progressColor: getColorAsString(defaultColor),
|
package/lib/index.js
CHANGED
|
@@ -2137,9 +2137,9 @@ function PlaybackControls(_ref) {
|
|
|
2137
2137
|
_usePlaybackContext$h = _usePlaybackContext.hasAudio,
|
|
2138
2138
|
hasAudio = _usePlaybackContext$h === void 0 ? null : _usePlaybackContext$h,
|
|
2139
2139
|
_usePlaybackContext$p = _usePlaybackContext.playing,
|
|
2140
|
-
|
|
2140
|
+
wantedPlaying = _usePlaybackContext$p === void 0 ? false : _usePlaybackContext$p,
|
|
2141
2141
|
_usePlaybackContext$m2 = _usePlaybackContext.muted,
|
|
2142
|
-
|
|
2142
|
+
wantedMuted = _usePlaybackContext$m2 === void 0 ? true : _usePlaybackContext$m2,
|
|
2143
2143
|
setPlaying = _usePlaybackContext.setPlaying,
|
|
2144
2144
|
setMuted = _usePlaybackContext.setMuted,
|
|
2145
2145
|
controls = _usePlaybackContext.controls,
|
|
@@ -2157,19 +2157,26 @@ function PlaybackControls(_ref) {
|
|
|
2157
2157
|
});
|
|
2158
2158
|
var ready = mediaElement === null || mediaReady;
|
|
2159
2159
|
var finalShowLoading = showLoading && !ready;
|
|
2160
|
+
var _useMediaState = hooks.useMediaState(mediaElement, {
|
|
2161
|
+
playing: wantedPlaying,
|
|
2162
|
+
muted: wantedMuted
|
|
2163
|
+
}),
|
|
2164
|
+
buffering = _useMediaState.buffering,
|
|
2165
|
+
playing = _useMediaState.playing,
|
|
2166
|
+
muted = _useMediaState.muted;
|
|
2160
2167
|
React.useEffect(function () {
|
|
2161
2168
|
var id = null;
|
|
2162
2169
|
setShowLoading(false);
|
|
2163
|
-
if (!ready && withLoading) {
|
|
2170
|
+
if ((!ready || buffering) && withLoading) {
|
|
2164
2171
|
id = setTimeout(function () {
|
|
2165
2172
|
setShowLoading(true);
|
|
2166
|
-
},
|
|
2173
|
+
}, 1000);
|
|
2167
2174
|
}
|
|
2168
2175
|
return function () {
|
|
2169
2176
|
setShowLoading(false);
|
|
2170
2177
|
clearTimeout(id);
|
|
2171
2178
|
};
|
|
2172
|
-
}, [ready, withLoading, setShowLoading]);
|
|
2179
|
+
}, [ready, buffering, withLoading, setShowLoading]);
|
|
2173
2180
|
var _useState3 = React.useState({
|
|
2174
2181
|
color: utils.getColorAsString(defaultColor),
|
|
2175
2182
|
progressColor: utils.getColorAsString(defaultColor),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/viewer",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.463",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -62,15 +62,15 @@
|
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@babel/runtime": "^7.13.10",
|
|
65
|
-
"@micromag/core": "^0.3.
|
|
66
|
-
"@micromag/element-badge": "^0.3.
|
|
67
|
-
"@micromag/element-scroll": "^0.3.
|
|
68
|
-
"@micromag/element-share-options": "^0.3.
|
|
69
|
-
"@micromag/element-webview": "^0.3.
|
|
70
|
-
"@micromag/elements": "^0.3.
|
|
71
|
-
"@micromag/fields": "^0.3.
|
|
72
|
-
"@micromag/intl": "^0.3.
|
|
73
|
-
"@micromag/screens": "^0.3.
|
|
65
|
+
"@micromag/core": "^0.3.463",
|
|
66
|
+
"@micromag/element-badge": "^0.3.463",
|
|
67
|
+
"@micromag/element-scroll": "^0.3.463",
|
|
68
|
+
"@micromag/element-share-options": "^0.3.463",
|
|
69
|
+
"@micromag/element-webview": "^0.3.463",
|
|
70
|
+
"@micromag/elements": "^0.3.463",
|
|
71
|
+
"@micromag/fields": "^0.3.463",
|
|
72
|
+
"@micromag/intl": "^0.3.463",
|
|
73
|
+
"@micromag/screens": "^0.3.463",
|
|
74
74
|
"@react-spring/core": "^9.6.1",
|
|
75
75
|
"@react-spring/web": "^9.6.1",
|
|
76
76
|
"@use-gesture/react": "^10.3.0",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"access": "public",
|
|
91
91
|
"registry": "https://registry.npmjs.org/"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "a2eb34209cb2dcbcd6a15d1325a02778543a8bca"
|
|
94
94
|
}
|