[SOLVED] Adding a video from a link

Is it possible to add videos to my game using the web link not uploading them within my project Assets, to decrease the loading time

Hi @AhmedFarahat,

Definitely! Quoting the Video Textures examples, you can use your video url here:

  video.src = 'https://myvideoUrl.mp4';

Just make sure you have CORS enabled in your server, so it can be served correctly!

Cool thanks! regarding the CORS, if i am using a youtube video is there something i should add in the script? i have a plugin on my browser that enable/disable CORS.

I think youtube videos will play ok, but do give them a try.

Your browser plugin CORS extension is great, but that will fix the issue only for you. If a CORS error comes up on your users’ browsers, then the video won’t play there.

Actually I take this back, I was hasty to answer. Their video pages can be opened from 3rd party sites, but the video stream url isn’t available outside of their player.

You will have to find a library or service that can extract a .mp4 url from each youtube video url. Only that you can use in the Playcanvas side to render on a texture.

Also make sure to read if that’s legal according to their terms of use.

You could also upload the video to your own, or third party host.

1 Like

I think you can have their video stream, but you need to use Google API and authenticate your requests first.

1 Like

Solved Thanks