mirror of
https://github.com/immich-app/immich.git
synced 2025-05-31 20:25:32 -04:00
fix(web): stream 360 video instead of fetching entire video (#9279)
This commit is contained in:
parent
f08e9a4447
commit
bc31404909
@ -2,7 +2,7 @@
|
|||||||
import { serveFile, type AssetResponseDto, AssetTypeEnum } from '@immich/sdk';
|
import { serveFile, type AssetResponseDto, AssetTypeEnum } from '@immich/sdk';
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
import LoadingSpinner from '../shared-components/loading-spinner.svelte';
|
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';
|
import type { AdapterConstructor, PluginConstructor } from '@photo-sphere-viewer/core';
|
||||||
export let asset: Pick<AssetResponseDto, 'id' | 'type'>;
|
export let asset: Pick<AssetResponseDto, 'id' | 'type'>;
|
||||||
|
|
||||||
@ -19,11 +19,11 @@
|
|||||||
: ([undefined, [], false] as [undefined, [], false]);
|
: ([undefined, [], false] as [undefined, [], false]);
|
||||||
|
|
||||||
const loadAssetData = async () => {
|
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 data = await serveFile({ id: asset.id, isWeb: false, isThumb: false, key: getKey() });
|
||||||
const url = URL.createObjectURL(data);
|
const url = URL.createObjectURL(data);
|
||||||
if (asset.type === AssetTypeEnum.Video) {
|
|
||||||
return { source: url };
|
|
||||||
}
|
|
||||||
return url;
|
return url;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user