I’m having trouble to play and pause a videotexture created via API. Creating the texture works fine and I can apply the texture to a material. I can play the video by clicking a button and it pauses by clickung the same button again. But after pausing the video, it won’t play again. I can hear the audio playing again, but the videos freezes.
Here is a simple toggle function I tested it with:
function toggleVideo() {
var tv = viewer.findMaterial("my_tv_material");
var video = tv.baseColorTexture.video;
if(video.paused === true) {
video.play();
} else {
video.pause();
}
viewer.requestFrame();
return true;
}
Do you have any ideas? The video element is created via JS.
This looks correct, but how do you then put this video in a texture? Something like this should work:
var videoTexture = WALK.getViewer().createTextureFromHtmlVideo(video);
var material = viewer.findMaterial("my_tv_material");
material.baseColorTexture = videoTexture;
OK, I’m sorry for the confusion, but play() and pause() functions were added very recently and are not yet released. The currently released version has a different API: