CORS from Webworker?

Actually it works using the direct URL but here I'm preloading a bunch of videos in a WebWorker:
const preloadVideo = async (url: string) => {
const res = await fetch(url)
const blob = await res.blob()
return URL.createObjectURL(blob)
}

onmessage = async ({ data }: MessageEvent) => {
for (const videoUrl of data.videos) {
const url = await preloadVideo(videoUrl)
preloadedMedia.videos.push(url)
postMessage(preloadedMedia)
}
})
const preloadVideo = async (url: string) => {
const res = await fetch(url)
const blob = await res.blob()
return URL.createObjectURL(blob)
}

onmessage = async ({ data }: MessageEvent) => {
for (const videoUrl of data.videos) {
const url = await preloadVideo(videoUrl)
preloadedMedia.videos.push(url)
postMessage(preloadedMedia)
}
})
so there is a .fetch() involved
5 Replies
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
flayks
flayksOP•2y ago
I'd believe so, I'm not totally certain so far, trying to investigate if it's my implementation or CORS issues from R2
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
flayks
flayksOP•2y ago
I just think I'm tired, or silly (or both tbh 😂)
<source type="video/{source.format}" src={source.url}>
<source type="video/{source.format}" src={source.url}>
Knowing that source.format value is video/mp4… it gives video/video/mp4… 🤦 just some leftover of refactoring actually. But I definitely did forget to add the CORS at the first place!
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server