Skip to content

Commit

Permalink
fix(web): Fixed video unmutes when scrubbing (#9382)
Browse files Browse the repository at this point in the history
Fixed video unmutes when scrubbing

Co-authored-by: Tushar Harsora <tushar.harsora.harsora@oracle.com>
  • Loading branch information
Tushar-Harsora and Tushar-Harsora authored May 10, 2024
1 parent bb48437 commit dd8d773
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { videoViewerVolume } from '$lib/stores/preferences.store';
import { videoViewerVolume, videoViewerMuted } from '$lib/stores/preferences.store';
import { getAssetFileUrl, getAssetThumbnailUrl } from '$lib/utils';
import { handleError } from '$lib/utils/handle-error';
import { ThumbnailFormat } from '@immich/sdk';
Expand All @@ -17,9 +17,7 @@
const handleCanPlay = async (event: Event) => {
try {
const video = event.currentTarget as HTMLVideoElement;
video.muted = true;
await video.play();
video.muted = false;
dispatch('onVideoStarted');
} catch (error) {
handleError(error, 'Unable to play video');
Expand All @@ -42,6 +40,7 @@
class="h-full object-contain"
on:canplay={handleCanPlay}
on:ended={() => dispatch('onVideoEnded')}
bind:muted={$videoViewerMuted}
bind:volume={$videoViewerVolume}
poster={getAssetThumbnailUrl(assetId, ThumbnailFormat.Jpeg)}
>
Expand Down
1 change: 1 addition & 0 deletions web/src/lib/stores/preferences.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export const mapSettings = persisted<MapSettings>('map-settings', {
});

export const videoViewerVolume = persisted<number>('video-viewer-volume', 1, {});
export const videoViewerMuted = persisted<boolean>('video-viewer-muted', false, {});

export const isShowDetail = persisted<boolean>('info-opened', false, {});

Expand Down

0 comments on commit dd8d773

Please sign in to comment.