How to get the dimensions of a VideoTexture?

Currently, in order to get the dimensions of a regular texture, I am calling getBaseSize() inside AssetsManager onSuccess() call, because otherwise I get 0s, also using arrow function to get my data outside the callback.

Now, I wanted to follow the similar procedure, but can’t find a task dedicated to video textures. After some R&D, I used the binary task for that, but I received “undefined” after trying to create a VideoTexture inside the onSuccess call. Is there a playground with that? Or maybe my approach is wrong? I am pinging @MackeyK24 because he knows :wink: Thanks in advance.

I should mention that I need to play a locally stored content, in a folder inside the build. Works perfectly fine when using VideoTexture outside onSuccess context.

Bump

You can get the video element from the video texture (videoTexture.video) and then use any method you wish to check the size (for example this - javascript - HTML5 Video Dimensions - Stack Overflow)

2 Likes

Thanks! I used another approach -> onLoadObservable. Works like a charm!