@micromag/viewer 0.4.63 → 0.4.66

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 +20 -6
  2. package/package.json +10 -10
package/es/index.js CHANGED
@@ -2172,7 +2172,7 @@ function PlaybackControls(_ref) {
2172
2172
  _useState2 = _slicedToArray(_useState, 2),
2173
2173
  showLoading = _useState2[0],
2174
2174
  setShowLoading = _useState2[1];
2175
- var mediaUrl = mediaElement !== null ? mediaElement.src : null;
2175
+ var mediaUrl = mediaElement !== null ? mediaElement.currentSrc || mediaElement.src : null;
2176
2176
  var mediaReady = useMediaReady(mediaElement, {
2177
2177
  id: mediaUrl
2178
2178
  });
@@ -2185,6 +2185,15 @@ function PlaybackControls(_ref) {
2185
2185
  buffering = _useMediaState.buffering,
2186
2186
  playing = _useMediaState.playing,
2187
2187
  muted = _useMediaState.muted;
2188
+ console.log({
2189
+ wantedPlaying: wantedPlaying,
2190
+ wantedMuted: wantedMuted,
2191
+ muted: muted,
2192
+ playing: playing,
2193
+ buffering: buffering,
2194
+ showLoading: showLoading,
2195
+ ready: ready
2196
+ });
2188
2197
  useEffect(function () {
2189
2198
  var id = null;
2190
2199
  setShowLoading(false);
@@ -2195,7 +2204,9 @@ function PlaybackControls(_ref) {
2195
2204
  }
2196
2205
  return function () {
2197
2206
  setShowLoading(false);
2198
- clearTimeout(id);
2207
+ if (id !== null) {
2208
+ clearTimeout(id);
2209
+ }
2199
2210
  };
2200
2211
  }, [ready, buffering, withLoading, setShowLoading]);
2201
2212
  var _useState3 = useState({
@@ -2222,12 +2233,15 @@ function PlaybackControls(_ref) {
2222
2233
  });
2223
2234
  }, [controlsTheme, setCustomControlsTheme, defaultColor, defaultProgressColor]);
2224
2235
  var onPlay = useCallback(function () {
2225
- // console.log('onPlay');
2226
- setPlaying(true);
2236
+ if (wantedPlaying && !playing && mediaElement !== null) {
2237
+ mediaElement.play();
2238
+ } else {
2239
+ setPlaying(true);
2240
+ }
2227
2241
  if (!controlsVisible && controls) {
2228
2242
  showControls();
2229
2243
  }
2230
- }, [setPlaying, controlsVisible, showControls]);
2244
+ }, [setPlaying, controlsVisible, showControls, playing, wantedPlaying]);
2231
2245
  var onPause = useCallback(function () {
2232
2246
  // console.log('onPause');
2233
2247
  setPlaying(false);
@@ -2311,7 +2325,7 @@ function PlaybackControls(_ref) {
2311
2325
  }),
2312
2326
  withoutBootstrapStyles: true
2313
2327
  }) : null, /*#__PURE__*/jsx(Button$1, {
2314
- className: classNames([styles$1.playPauseButton, _defineProperty(_defineProperty({}, styles$1.hidden, controlsSuggestPlay && !controls), styles$1.loading, finalShowLoading)]),
2328
+ className: classNames([styles$1.playPauseButton, _defineProperty(_defineProperty({}, styles$1.hidden, withSuggestPlay && !controls), styles$1.loading, finalShowLoading)]),
2315
2329
  style: {
2316
2330
  color: color
2317
2331
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/viewer",
3
- "version": "0.4.63",
3
+ "version": "0.4.66",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -63,14 +63,14 @@
63
63
  "dependencies": {
64
64
  "@babel/runtime": "^7.28.6",
65
65
  "@folklore/routes": "^0.2.36",
66
- "@micromag/core": "^0.4.63",
67
- "@micromag/element-badge": "^0.4.63",
68
- "@micromag/element-scroll": "^0.4.63",
69
- "@micromag/element-share-options": "^0.4.63",
70
- "@micromag/element-webview": "^0.4.63",
71
- "@micromag/elements": "^0.4.63",
72
- "@micromag/intl": "^0.4.63",
73
- "@micromag/screens": "^0.4.63",
66
+ "@micromag/core": "^0.4.66",
67
+ "@micromag/element-badge": "^0.4.66",
68
+ "@micromag/element-scroll": "^0.4.66",
69
+ "@micromag/element-share-options": "^0.4.66",
70
+ "@micromag/element-webview": "^0.4.66",
71
+ "@micromag/elements": "^0.4.66",
72
+ "@micromag/intl": "^0.4.66",
73
+ "@micromag/screens": "^0.4.66",
74
74
  "@react-spring/core": "^10.0.3",
75
75
  "@react-spring/web": "^10.0.3",
76
76
  "@use-gesture/react": "^10.3.0",
@@ -89,6 +89,6 @@
89
89
  "access": "public",
90
90
  "registry": "https://registry.npmjs.org/"
91
91
  },
92
- "gitHead": "0a6df1a5352c067c3296377d26fadb9b71244345",
92
+ "gitHead": "61e9d9511073041dc7900185d49a559126119450",
93
93
  "types": "es/index.d.ts"
94
94
  }