API - Changing Video Textures

Hi everyone,
I try to get used to the so far great API. But I am having a hard time figurung out, how to change a video Texture/Material from the API. I tried over the function “setMaterialForNode”, but having no luck. All the Video Textures I try to change are in the Project. I can change them by using the Material Picker, but that’s not my goal.

It would be great if there was a function for importing Videos, similar to “createTextureFromHtmlImage”.

Greetings

Simon

We have plans for extending the API to support textures created from HTML video elements. We hope to have it ready mid-July.

1 Like

Sounds good to me, thank you :slight_smile:

btw: I managed the first problem by simply setting the baseColorTexture to the new video. Don’t know if that’s the correct way, but it works.

2 Likes

Yes, that’s the correct way. You can set baseColorTexture property of the material to a video texture from another material and it’ll work.

@Simon, we have extended the viewer API to offer creating textures from HTML video elements. Take a look at the updated documentation and example: GitHub - shapespark/shapespark-viewer-api: JavaScript API for interacting with the Shapespark 3D scene.