google / model-viewer

Easily display interactive 3D models on the web and in AR!
https://modelviewer.dev
Apache License 2.0
6.88k stars 816 forks source link

Add CreateVideoTextureOptions to support crossOrigin videos #4635

Closed navidadelpour closed 8 months ago

navidadelpour commented 8 months ago

Reference Issue

Fixes #4634

Features

Please let me know if there is any change needed if the solution is accepted (like updating documents, etc).

google-cla[bot] commented 8 months ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

elalish commented 8 months ago

Yes, please add this info to the packages/modelviewer.dev/data/docs.json entry for this function. This looks great, thanks!

navidadelpour commented 8 months ago

@elalish Thanks for reviewing. Docs updated. Let me know if anything else is needed.

navidadelpour commented 8 months ago

@elalish Hi again. I've Updated the code as you suggested and everything is fine. I Also update the example so we can test it. I've built the code into a file named model-viewer-updated-in-pr.min.js and used it inside a file named index-updated-in-pr.html so we can test it. But I couldn't find a way to test it with with-credentials.

Thanks!

navidadelpour commented 8 months ago

@elalish I appreciate that :smiley::star_struck: . Actually, I wasn't be able to find a cross origin server that serves both glb and video assets with the right cors headers and credential checking which I can be able to use with-credentials option. my only try was the previous one where we got the

Access to fetch at 'https://modelviewer.dev/shared-assets/models/sphere.glb' from origin 'http://localhost:8002' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'.

error (which tells us to change the cors configurations on the server that I don't have access to).

Not that I'm thinking maybe there would be some way for me to configure a new server in my localhost and use it as the assets server and configure the cors headers so that it requires credentials for serving assets, making it like a cross origin server...

But I Also would be glad if you had any idea and guide me through how it should be tested.

Thanks for your amazing work!

elalish commented 8 months ago

I see - I figured you would just test with a local server. Any generic file server should work - a Google Cloud bucket or Amazon S3, etc. Thanks!

Saliiih commented 4 months ago

Helped a lot Thanks