#200 motion photo (Live Photo) support

Show a badge on the gallery thumbnail and a lightbox toggle that plays the
photo's clip over the still, matching Immich's own viewer.

The clip is a hidden Immich asset, but the existing share key already
authorises it - checkSharedLinkAccess whitelists each shared asset's
livePhotoVideoId - so no new upstream access is involved. The video route
accepts a clip id only when a shared still points at it.

Both enumeration paths already carry the field (AssetResponseDto for
individual shares, TimeBucketAssetResponseDto for album buckets), so album
shares cost no extra upstream requests.

Gated by ipp.motionPhotos (default true). The clip is preload="none" and is
only fetched when a visitor presses the toggle.
This commit is contained in:
trecoool
2026-08-24 14:35:28 +02:00
parent 8c2c2219ce
commit 4021c66cec
17 changed files with 384 additions and 23 deletions
+15 -1
View File
@@ -1,4 +1,4 @@
import { DownloadAll, SharedLink } from './types'
import { Asset, DownloadAll, SharedLink } from './types'
import { getConfigOption } from './config/access'
import dayjs from 'dayjs'
@@ -78,3 +78,17 @@ function expiryDateLocale (): string | undefined {
return undefined
}
}
/**
* Find the shared still that a motion photo (Live Photo) clip belongs to.
*
* The clip is a separate, hidden Immich asset: it never appears in the share's
* own asset list, but Immich authorises it under the same shared-link key
* (`checkSharedLinkAccess` whitelists each shared asset's `livePhotoVideoId`).
* Matching against the share's own assets is what keeps the set of ids IPP will
* serve bounded by the share's contents.
*/
export function findMotionPhotoStill (share: SharedLink, clipId: string): Asset | undefined {
if (!clipId) return undefined
return share.assets.find(asset => asset.livePhotoVideoId === clipId)
}