Skip to content

Commit

Permalink
Don't save to blob if googlevideo
Browse files Browse the repository at this point in the history
  • Loading branch information
AguzzTN54 committed Nov 3, 2024
1 parent 5e0447a commit b704627
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/lib/components/LightCones.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@
const { status, formats = {}, download } = await fetchMedia(vID, 'video');
if (status === 'error') return { success: false };
const videoURL = {
mp4: formats['video/mp4'] || download,
webm: formats['video/webm'] || null
};
const mp4 = formats['video/mp4'] || download;
const webm = formats['video/webm'] || null;
if (!(mp4 || webm)) return { success: false };
updateStore(videoURL, vID);
return { ...videoURL, success: true };
updateStore({ mp4, webm }, vID);
return { mp4, webm, success: true };
};
</script>

Expand Down
2 changes: 2 additions & 0 deletions src/lib/helpers/dataAPI/api-fetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export const fetchMedia = async (videoID, type = 'audio') => {
export const toBlob = async (url) => {
try {
if (!url) return url;
if (/videoplayback|googlevideo/.test(url)) return url;

const vi = await fetch(url);
const blob = await vi.blob();
const blobURL = URL.createObjectURL(blob);
Expand Down

0 comments on commit b704627

Please sign in to comment.