@micromag/viewer 0.4.65 → 0.4.67

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 +10 -16
  2. package/package.json +10 -10
package/es/index.js CHANGED
@@ -2185,15 +2185,6 @@ 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
- });
2197
2188
  useEffect(function () {
2198
2189
  var id = null;
2199
2190
  setShowLoading(false);
@@ -2233,12 +2224,15 @@ function PlaybackControls(_ref) {
2233
2224
  });
2234
2225
  }, [controlsTheme, setCustomControlsTheme, defaultColor, defaultProgressColor]);
2235
2226
  var onPlay = useCallback(function () {
2236
- // console.log('onPlay');
2237
- setPlaying(true);
2227
+ if (wantedPlaying && !playing && mediaElement !== null) {
2228
+ mediaElement.play();
2229
+ } else {
2230
+ setPlaying(true);
2231
+ }
2238
2232
  if (!controlsVisible && controls) {
2239
2233
  showControls();
2240
2234
  }
2241
- }, [setPlaying, controlsVisible, showControls]);
2235
+ }, [setPlaying, controlsVisible, showControls, playing, wantedPlaying]);
2242
2236
  var onPause = useCallback(function () {
2243
2237
  // console.log('onPause');
2244
2238
  setPlaying(false);
@@ -2292,7 +2286,7 @@ function PlaybackControls(_ref) {
2292
2286
  seekBarOnly = _ref3.seekBarOnly;
2293
2287
  var isCollapsed = controls && !controlsVisible && playing || !controls && mediaHasAudio;
2294
2288
  var withSuggestPlay = controlsSuggestPlay && !finalShowLoading && !playing;
2295
- var playIcon = wantedPlaying ? /*#__PURE__*/jsx(PauseIcon, {
2289
+ var playIcon = playing ? /*#__PURE__*/jsx(PauseIcon, {
2296
2290
  className: styles$1.icon,
2297
2291
  color: "currentColor"
2298
2292
  }) : /*#__PURE__*/jsx(PlayIcon, {
@@ -2326,13 +2320,13 @@ function PlaybackControls(_ref) {
2326
2320
  style: {
2327
2321
  color: color
2328
2322
  },
2329
- onClick: wantedPlaying ? onPause : onPlay,
2330
- focusable: controls && controlsVisible && (!seekBarOnly || !wantedPlaying),
2323
+ onClick: playing ? onPause : onPlay,
2324
+ focusable: controls && controlsVisible && (!seekBarOnly || !playing),
2331
2325
  disabled: finalShowLoading,
2332
2326
  icon: finalShowLoading ? /*#__PURE__*/jsx(Spinner, {
2333
2327
  className: classNames([styles$1.spinner, styles$1.offset])
2334
2328
  }) : playIcon,
2335
- "aria-pressed": !wantedPlaying,
2329
+ "aria-pressed": !playing,
2336
2330
  "aria-label": finalShowLoading ? intl.formatMessage({
2337
2331
  id: "YyYrXp",
2338
2332
  defaultMessage: [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/viewer",
3
- "version": "0.4.65",
3
+ "version": "0.4.67",
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.65",
67
- "@micromag/element-badge": "^0.4.65",
68
- "@micromag/element-scroll": "^0.4.65",
69
- "@micromag/element-share-options": "^0.4.65",
70
- "@micromag/element-webview": "^0.4.65",
71
- "@micromag/elements": "^0.4.65",
72
- "@micromag/intl": "^0.4.65",
73
- "@micromag/screens": "^0.4.65",
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": "33460a352e56298ae450392b04c09503ecfeae05",
92
+ "gitHead": "49cf82b5aadf1ca493a56e16accd5c28795c4149",
93
93
  "types": "es/index.d.ts"
94
94
  }