"createExternalTexture" is not a function - Updating to 5.33.1

Hi.

I was trying to update Babylon to the latest Release (5.33.1).
When I run my test suite (with jest) I’m now getting this error:

node_modules/@babylonjs/core/Materials/Textures/videoTexture.js:140
    this._externalTexture = (_b = (_a = this._engine) === null || _a === void 0 ? void 0 : _a.createExternalTexture(this.video)) !== null && _b !== void 0 ? _b : null;

TypeError: _a.createExternalTexture is not a function
    at new VideoTexture (.../core/generated/Materials/Textures/videoTexture.ts:185:59)

It was working with the 5.22.2 release.
Seems that it was introduced here:

Am I’m doing something wrong? Did I miss something?
Is it a Bug?

Thx

You may need to import Engines/Extensions/engine.externalTexture if you are using ES6.

2 Likes

Thx for your help!
Seems that if I import it via:

import '@babylonjs/core/Engines/Extensions/engine.externalTexture';

it is working.

But shouldn’t his be somehow part of the VideoTexture? :thinking:

No because depending on the engine you are using you must use a different path:

WebGL:

import '@babylonjs/core/Engines/Extensions/engine.externalTexture';

WebGPU:

import '@babylonjs/core/Engines/WebGPU/Extensions/engine.externalTexture';

We could add both imports in VideoTexture but if you ever use a single engine you would pay for the other too.

1 Like

Ah ok. Thank you for the explanation!

1 Like