Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.
TypeScript albumsexif-extractiongeocodinglive-photomotion-photophoto-galleryphoto-sharingwebgl-viewer
feat(live-photo): 优化实况照片指示器组件,添加静音控制
Timothy Yin2e99639977f4
diff --git a/app/components/masonry/PhotoItem.client.vue b/app/components/masonry/PhotoItem.client.vueindex d93572ae..16e91c7c 100644--- a/app/components/masonry/PhotoItem.client.vue+++ b/app/components/masonry/PhotoItem.client.vue@@ -527,7 +527,14 @@ onUnmounted(() => {/><!-- Live Photo indicator -->- <motion.div+ <PhotoLivePhotoIndicator+ v-if="photo.isLivePhoto"+ class="absolute top-2 left-2"+ :photo="photo"+ :is-video-playing="isVideoPlaying"+ :processing-state="processingState || null"+ />+ <!-- <motion.divv-if="photo.isLivePhoto"class="absolute top-2 left-2 backdrop-blur-md text-white rounded-full pl-1 pr-1.5 py-1 text-[13px] font-bold flex items-center gap-0.5 leading-0":animate="{@@ -541,7 +548,6 @@ onUnmounted(() => {ease: 'easeInOut',}">- <!-- TODO: Apple style loading --><Iconname="tabler:live-photo"class="size-[17px]"@@ -549,7 +555,6 @@ onUnmounted(() => {/><span :class="{ 'text-yellow-300': isVideoPlaying }">实况</span>- <!-- Processing progress indicator --><divv-if="processingState?.isProcessing"class="ml-1 flex items-center gap-1"@@ -559,7 +564,7 @@ onUnmounted(() => {{{ Math.round(processingState.progress || 0) }}%</span></div>- </motion.div>+ </motion.div> --><!-- Photo info overlay (bottom) --><motion.div@@ -636,7 +641,8 @@ onUnmounted(() => {class="flex items-center gap-0.5"><Icon- name="streamline:image-accessories-lenses-photos-camera-shutter-picture-photography-pictures-photo-lens" class="-mt-0.5"+ name="streamline:image-accessories-lenses-photos-camera-shutter-picture-photography-pictures-photo-lens"+ class="-mt-0.5"/><span class="text-xs font-medium">{{ photo.exif.FocalLengthIn35mmFormat }}@@ -646,7 +652,10 @@ onUnmounted(() => {v-if="photo.exif.FNumber"class="flex items-center gap-0.5">- <Icon name="tabler:aperture" class="-mt-0.5" />+ <Icon+ name="tabler:aperture"+ class="-mt-0.5"+ /><span class="text-xs font-medium">f/{{ photo.exif.FNumber }}</span>@@ -655,7 +664,10 @@ onUnmounted(() => {v-if="photo.exif.ExposureTime"class="flex items-center gap-0.5">- <Icon name="material-symbols:shutter-speed" class="-mt-0.5" />+ <Icon+ name="material-symbols:shutter-speed"+ class="-mt-0.5"+ /><span class="text-xs font-medium">{{ formatExposureTime(photo.exif.ExposureTime) }}</span>@@ -664,7 +676,10 @@ onUnmounted(() => {v-if="photo.exif.ISO"class="flex items-center gap-0.5">- <Icon name="carbon:iso-outline" class="-mt-0.5" />+ <Icon+ name="carbon:iso-outline"+ class="-mt-0.5"+ /><span class="text-xs font-medium">{{ photo.exif.ISO }}</span></div></div>diff --git a/app/components/photo/LivePhotoIndicator.vue b/app/components/photo/LivePhotoIndicator.vuenew file mode 100644index 00000000..69ddd69d--- /dev/null+++ b/app/components/photo/LivePhotoIndicator.vue@@ -0,0 +1,47 @@+<script lang="ts" setup>+import { motion } from 'motion-v'++defineProps<{+ photo: Photo+ isVideoPlaying: boolean+ processingState?: {+ isProcessing: boolean+ progress: number+ } | null+}>()+</script>++<template>+ <motion.div+ v-if="photo.isLivePhoto"+ class="backdrop-blur-md rounded-full pl-1 pr-1.5 py-1 text-[13px] font-bold flex items-center gap-0.5 leading-0 select-none transition-colors duration-300"+ :class="`${isVideoPlaying ? 'text-yellow-300 bg-yellow-300/10' : 'text-white bg-black/30'}`"+ :animate="{+ scale: isVideoPlaying ? 1.1 : 1,+ }"+ :transition="{+ duration: 0.3,+ ease: 'easeInOut',+ }"+ >+ <!-- TODO: Apple style loading -->+ <Icon+ name="tabler:live-photo"+ class="size-[17px]"+ />+ <span>实况</span>++ <!-- Processing progress indicator -->+ <div+ v-if="processingState?.isProcessing"+ class="ml-1 flex items-center gap-1"+ >+ <div class="size-1 bg-white/70 rounded-full animate-pulse" />+ <span class="text-[10px] text-white/80">+ {{ Math.round(processingState.progress || 0) }}%+ </span>+ </div>+ </motion.div>+</template>++<style scoped></style>diff --git a/app/components/photo/Viewer.vue b/app/components/photo/Viewer.vueindex f2093cf9..602a5eb9 100644--- a/app/components/photo/Viewer.vue+++ b/app/components/photo/Viewer.vue@@ -42,6 +42,7 @@ const zoomLevelTimer = ref<NodeJS.Timeout | null>(null)const isLivePhotoHovering = ref(false)const isLivePhotoPlaying = ref(false)const isLivePhotoTouching = ref(false)+const isLivePhotoMuted = ref(true)const touchCount = ref(0)const livePhotoVideoBlob = ref<Blob | null>(null)const livePhotoVideoBlobUrl = ref<string | null>(null)@@ -433,47 +434,37 @@ const swiperModules = [Navigation, Keyboard, Virtual]:animate="{ opacity: 1 }":exit="{ opacity: 0 }":transition="{ duration: 0.3 }"- class="pointer-events-none absolute z-30 flex items-center justify-between"+ class="absolute z-30 flex items-center justify-between":class="isMobile ? 'top-2 right-2 left-2' : 'top-4 right-4 left-4'"><!-- 左侧工具按钮 -->- <div class="flex items-center gap-2">+ <div class="flex items-center gap-1"><!-- LivePhoto 标志 -->- <div+ <PhotoLivePhotoIndicatorv-if="currentPhoto?.isLivePhoto"- class="pointer-events-auto backdrop-blur-md bg-black/40 text-white rounded-full pl-1 pr-1.5 py-1 text-[13px] font-bold flex items-center gap-0.5 leading-0 select-none":class="isMobile ? 'cursor-default' : 'cursor-pointer'"+ :photo="currentPhoto"+ :is-video-playing="isLivePhotoPlaying"+ :processing-state="livePhotoProcessingState?.value || null"@mouseenter="handleLivePhotoMouseEnter"@mouseleave="handleLivePhotoMouseLeave"+ />++ <!-- 静音图标 -->+ <div+ v-if="currentPhoto?.isLivePhoto"+ class="pointer-events-auto backdrop-blur-md bg-black/40 text-white rounded-full pl-1 pr-1.5 py-1 text-[13px] font-bold flex items-center gap-0.5 leading-0 select-none"+ :class="isMobile ? 'cursor-default' : 'cursor-pointer'"+ @click="isLivePhotoMuted = !isLivePhotoMuted">- <!-- TODO: Apple style loading --><Icon- name="tabler:live-photo"+ :name="+ isLivePhotoMuted ? 'tabler:volume-off' : 'tabler:volume'+ "class="size-[17px]"- :class="{ 'text-yellow-300': isLivePhotoPlaying }"/>- <span :class="{ 'text-yellow-300': isLivePhotoPlaying }">- 实况- </span>-- <!-- Processing progress indicator -->- <div- v-if="livePhotoProcessingState?.value?.isProcessing"- class="ml-1 flex items-center gap-1"- >- <div- class="size-1 bg-white/70 rounded-full animate-pulse"- />- <span class="text-[11px] text-white/80">- {{- Math.round(- livePhotoProcessingState.value.progress || 0,- )- }}%- </span>- </div></div></div>@@ -605,7 +596,7 @@ const swiperModules = [Navigation, Keyboard, Virtual]":src="livePhotoVideoBlobUrl"class="absolute inset-0 w-full h-full object-contain pointer-events-none select-none touch-none"- muted+ :muted="isLivePhotoMuted"playsinlinepreload="metadata":initial="{ opacity: 0 }"