diff --git a/js/desktop/src/features/particles/media-particle-view.tsx b/js/desktop/src/features/particles/media-particle-view.tsx index 2efad22..21ba7c3 100644 --- a/js/desktop/src/features/particles/media-particle-view.tsx +++ b/js/desktop/src/features/particles/media-particle-view.tsx @@ -35,10 +35,20 @@ export const MediaParticleView = forwardRef src would restart + // playback from 0. Keep whatever we picked first; the original plays fine in + // Electron, and the transcoded variant will be picked up on the next view. + const pickedSourceRef = useRef<{ id: string; objectId: string; mime: string } | null>(null); + if (pickedSourceRef.current?.id !== particle.id) { + pickedSourceRef.current = { + id: particle.id, + objectId: particle.properties.transcoded_object_id ?? particle.properties.object_id, + mime: particle.properties.transcoded_mime_type ?? particle.properties.mime_type, + }; + } + const activeObjectId = pickedSourceRef.current.objectId; + const activeMime = pickedSourceRef.current.mime; const { data: url, error } = useDownloadUrl(activeObjectId); const { attachments } = useParticleAttachments(streamPath, particle.id);