-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(web): slideshow ascending order when video has ended #8024
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,22 +3,24 @@ | |
import { getAssetFileUrl, getAssetThumbnailUrl } from '$lib/utils'; | ||
import { handleError } from '$lib/utils/handle-error'; | ||
import { ThumbnailFormat } from '@immich/sdk'; | ||
import { createEventDispatcher } from 'svelte'; | ||
import { fade } from 'svelte/transition'; | ||
import LoadingSpinner from '../shared-components/loading-spinner.svelte'; | ||
|
||
export let assetId: string; | ||
export let onVideoStart: (() => void) | undefined = undefined; | ||
export let onVideoEnd: () => void; | ||
|
||
let isVideoLoading = true; | ||
const dispatch = createEventDispatcher<{ onVideoEnded: void; onVideoStarted: void }>(); | ||
|
||
const handleCanPlay = async (event: Event) => { | ||
try { | ||
const video = event.currentTarget as HTMLVideoElement; | ||
video.muted = true; | ||
await video.play(); | ||
video.muted = false; | ||
dispatch('onVideoStarted'); | ||
if (onVideoStart) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just curious, does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You would want to do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice ! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Really it should just be |
||
onVideoStart(); | ||
} | ||
} catch (error) { | ||
handleError(error, 'Unable to play video'); | ||
} finally { | ||
|
@@ -34,7 +36,7 @@ | |
controls | ||
class="h-full object-contain" | ||
on:canplay={handleCanPlay} | ||
on:ended={() => dispatch('onVideoEnded')} | ||
on:ended={onVideoEnd} | ||
bind:volume={$videoViewerVolume} | ||
poster={getAssetThumbnailUrl(assetId, ThumbnailFormat.Jpeg)} | ||
> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Man, I really dislike this. We're adding more duplicate code everywhere and the asset-viewer is even more coupled to the slideshow functionality than it was before. The component should only be in charge of rendering an asset, not managing all this unrelated state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved everything to
navigateAsset