fix(web): stream 360 video instead of fetching entire video (#9279)

This commit is contained in:
Vietbao Tran 2024-05-06 09:20:20 -07:00 committed by GitHub
parent f08e9a4447
commit bc31404909
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,7 +2,7 @@
import { serveFile, type AssetResponseDto, AssetTypeEnum } from '@immich/sdk';
import { fade } from 'svelte/transition';
import LoadingSpinner from '../shared-components/loading-spinner.svelte';
import { getKey } from '$lib/utils';
import { getAssetFileUrl, getKey } from '$lib/utils';
import type { AdapterConstructor, PluginConstructor } from '@photo-sphere-viewer/core';
export let asset: Pick<AssetResponseDto, 'id' | 'type'>;
@ -19,11 +19,11 @@
: ([undefined, [], false] as [undefined, [], false]);
const loadAssetData = async () => {
if (asset.type === AssetTypeEnum.Video) {
return { source: getAssetFileUrl(asset.id, false, false) };
}
const data = await serveFile({ id: asset.id, isWeb: false, isThumb: false, key: getKey() });
const url = URL.createObjectURL(data);
if (asset.type === AssetTypeEnum.Video) {
return { source: url };
}
return url;
};
</script>