Work around CORS

Hi everyone,

I’m using Thumbnails to preview videos I’ll show with Yaustars iframe. Cause there’s some difficult with CORS I get them via a proxy from YouTube, this works well within the editor (same to autoplay) but after making a build it doesn’t work anymore :sob: what should I do?

I’m surprised the thumbnails don’t work. Might be due to the double iframe from a published build link. Try it without the iframe by adding /e before /p in the PlayCanvas published link.

/e doesn’t work…
most likely because I didn’t show the thump on the Iframe but as jpg in the UI…

How are you getting the thumbnail? Like this? https://stackoverflow.com/a/12788320/8648403

with a proxy, like this:

http://cors-anywhere.herokuapp.com/http://img.youtube.com/vi/’+MovieInfoList[0].Thump+’/1.jpg’;

here ‘MovieInfoList’ is an array of Json with YouTube ids

AFAIK, you shouldn’t need to use a CORS anywhere for that :thinking:

Okay, not sure how it’s working on my personal site at https://www.stevenyau.co.uk but yes, it looks like that there are CORs issues here.

Using CORS anywhere, it works for me:

https://playcanvas.com/editor/scene/1093616

without i always get a cors violation, I’ve set the handler anonymus, but that won’t help,
it seams YouTube will not share thumps, if you didn’t use the YT api…

In the editor it works for me to. Only in the build the thumps are missing