Skip to content

Commit

Permalink
fix(player): storage not working correctly with embeds
Browse files Browse the repository at this point in the history
closes #1122
  • Loading branch information
mihar-22 committed Jan 31, 2024
1 parent 40cc6a1 commit 6f3c18b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/vidstack/src/core/state/media-state-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,14 +642,14 @@ export class MediaStateManager extends MediaPlayerController {
const { storage } = this._media,
{ canPlay, realCurrentTime } = this.$state;

if (!canPlay()) return;

storage?.setTime?.(realCurrentTime());
if (canPlay()) {
storage?.setTime?.(realCurrentTime());
}
}

['volume-change'](event: ME.MediaVolumeChangeEvent) {
const { storage } = this._media,
{ volume, muted } = this.$state,
{ volume, muted, canPlay } = this.$state,
detail = event.detail;

volume.set(detail.volume);
Expand All @@ -658,8 +658,10 @@ export class MediaStateManager extends MediaPlayerController {
this._satisfyRequest('media-volume-change-request', event);
this._satisfyRequest(detail.muted ? 'media-mute-request' : 'media-unmute-request', event);

storage?.setVolume?.(volume());
storage?.setMuted?.(muted());
if (canPlay()) {
storage?.setVolume?.(volume());
storage?.setMuted?.(muted());
}
}

['seeking'] = throttle(
Expand Down

0 comments on commit 6f3c18b

Please sign in to comment.