Video Texture - HTMLVideoElement from React-Player Reference

Hello All,

I am trying to use react-player to play the video… But i want to play that video over one mesh.
So to do that, I am fetching VideoElement from a react-player reference and pass it to Video Texture constructor.
Currently it is giving me an Error → videoTexture.ts:250 Uncaught TypeError: src.forEach is not a function

const vt = new VideoTexture(
‘media’,
videoElement,
scene,
false,
true,
0,
{
autoUpdateTexture: true,
muted,
loop: false,
autoPlay: true,
}
);

More simplex Question,

How can i Play Youtube Videos over a Mesh by using VideoDome or VideoTexture ?

Video As A Texture | Babylon.js Documentation (babylonjs.com)

Hi,
Thanks for replying… I know how to use Video as a texture and i am able to play videos properly but my requirement is to play youtube videos through URL. If i am using the URL then i am getting CORS/CORB issue because internally this uses a HTMLVideo to play that video and Youtube normally works with IFrame in HTML.

Unfortunately it seems that’s not very simple, see: html - Howto Play YouTube videos via HTML5 video tag - Stack Overflow

We have to work with HTMLVideoElement as that’s the supported standard, so if youtube doesn’t allow using that I don’t think there’s much we can do :frowning: @sebavan do you have any other ideas?

1 Like

The only other ways are:

1 Like