Video Texture (mp4) From URL

i was wondering if it is possible to get an mp4 video asset from a url (server) and attach it to a video texture at runtime

Thank you

Hi @abd_almajeed_saleh,

Yes sure, take a look at this tutorial on video textures:

So i used the VideoTexture script and set a url for a video uploaded to my server but i keep getting this error “NotSupportedError: The media resource indicated by the src attribute or assigned media provider object was not suitable”

So, two things come to my mind, your server needs to be able to serve the video:

  • with https supported
  • with CORS support

To check if it is indeed an issue with your video url, try using the original video from the tutorial. If that works then make sure that your server supports the above.

If you still experience an issue try posting a sample project that includes your video url.

my server is already https supported
for the tutorial project it does not have any reference url for a video it uses a video that already exists in the assets.

It isn’t easy to troubleshoot networking issues without a sample project.

For the video from the tutorial what I meant is to post the file to your server, to be sure it isn’t an issue with the video file.

1 Like

i have a videoTexture displaying from a url it works pretty fine in Chrome and Firefox but when i run it on safari the video does not display i have searched and read a lot but no luck i have not found any clear or useful solution so please if any one have ever faced this problem, please help!!

Thank you.

Is your server serving this url enabled to allow CORS?

You can use the following site to test for that:

Are you trying to autoplay the video or are you waiting for an interaction with the user before playing? Any errors in console?

Side note: Can you keep you posts on the same topic in the same thread please?

well the video starts once a marker is detected, and i have already uploaded the video to a https server and added CORS support it works fine on android (Chrome) but on iOS safari it gives this error “Unhandled Promise Rejection: AbortError: The operation was aborted.”

do i have to add some additional things so i would get this problem to work on safari ?

I don’t have access to Safari, but a quick Google Search shows that this issue might be related: [SOLVED] Video Textures on iOS

yeah i have already tried it does not work either :confused:

If I had access to Safari, I would try getting the video to run a webpage as a DOM to try and debug what’s going on. This doesn’t seem to be a PlayCanvas specific issue and more about playback of video in general in Safari.

yeah i know it is related to safari (safari has a problem supporting CORS) if you find anything out about this problem please keep me updated.

Thank you