Babylon.texture for me not working

imagePlayer.imagePlane = BABYLON.MeshBuilder.CreatePlane("imagePlane", scene); 
    imagePlayer.imagePlane.scaling = new BABYLON.Vector3(3, 3, 1);
	imagePlayer.imageMaterial = new BABYLON.StandardMaterial("m", scene);
	imagePlayer.imageMaterial.roughness = 1;
	imagePlayer.imageMaterial.emissiveColor = new BABYLON.Color3.White();
	imagePlayer.imagePlane.material = imagePlayer.imageMaterial;
var images = video_url.resources.images;
                for (var i = 0; i < images.length; i++)
                {
                    if (images[i].image_path != null)
                    {
                        imagePlayer.imagesUrls[i] = "url" + images[i].image_path  + ".png";
                        imagePlayer.imagesTextures[i] = new BABYLON.Texture(imagePlayer.imagesUrls[i], scene);
                        
                    }
                    else
                    {
                        imagePlayer.imagesUrls[i] = "";
                        imagePlayer.imagesTextures[i] = null;
                
                    }
                    imagePlayer.imageIndexPosition[i] = images[i].image_position;
                } 

i receive this error :
thinEngine.ts:6168 ERROR TypeError: handler.target.addEventListener is not a function
at fileTools.ts:249:1
at Array.forEach ()
at loadHandlersList (fileTools.ts:248:1)
at Function.LoadImage [as _FileToolsLoadImage] (fileTools.ts:302:1)
at ThinEngine._createTextureBase (thinEngine.ts:4328:1)
at ThinEngine.createTexture (thinEngine.ts:4394:1)
at new Texture (texture.ts:514:1)
at SceneCreator.SetVideoPlayer (SceneCreator.js:262:57)
at SceneCreator.Update (SceneCreator.js:750:16)
at SceneCreator.js:74:9
at Engine._renderFrame (engine.ts:1240:1)
at Engine._renderLoop (engine.ts:1270:1)
at _boundRenderFunction (thinEngine.ts:1722:1)
at ZoneDelegate.invokeTask (zone-evergreen.js:399:1)
at Object.onInvokeTask (core.js:41686:1)
at ZoneDelegate.invokeTask (zone-evergreen.js:398:1)
at Zone.runTask (zone-evergreen.js:167:1)
at invokeTask (zone-evergreen.js:480:1)
at ZoneTask.invoke (zone-evergreen.js:469:1)
at timer (zone-evergreen.js:2552:1)
i also receive the same error if. do something like. this:

SetScene = function (scene)
{
    // Set Video
    var videoPlaneOpts = {
			height: 5, 
			width: 5, 
			sideOrientation: BABYLON.Mesh.DOUBLESIDE
	};
    videoPlayer.videoPlane = BABYLON.MeshBuilder.CreatePlane("videoPlane", videoPlaneOpts, scene);
	var vidPos = (new BABYLON.Vector3(0,0,0.1))
    videoPlayer.videoPlane.position = vidPos;   
    
    
	videoPlayer.videoMaterial = new BABYLON.StandardMaterial("m", scene);
	videoPlayer.videoMaterial.roughness = 1;
	videoPlayer.videoMaterial.emissiveColor = new BABYLON.Color3.White();
	videoPlayer.videoPlane.material = videoPlayer.videoMaterial;

    
    imagePlayer.imagePlane = BABYLON.MeshBuilder.CreatePlane("imagePlane", scene); 
    imagePlayer.imagePlane.scaling = new BABYLON.Vector3.Zero(3, 3, 1);
	imagePlayer.imageMaterial = new BABYLON.StandardMaterial("m", scene);
	imagePlayer.imageMaterial.roughness = 1;
	imagePlayer.imageMaterial.emissiveColor = new BABYLON.Color3.White();
	imagePlayer.imagePlane.material = imagePlayer.imageMaterial;
imagePlayer.imagePlane.isVisible = false;
                         imagePlayer.imagePlane.diffuseTexture = new BABYLON.Texture('https://picsum.photos/200/300', scene);

}```

In what environment is this running? browser? any additional framework added on top of Babylon?

Would you be able to share a reproduction? would be easier to debug that.

i am using ionic angular

ionic is running on mobiles in a webview right? the document object might be missing there, or maybe the Image implementation doesn’t behave as Event handler. You know the framework probably better than the rest of the babylon team :slight_smile: . Do you know how it handles DOM elements?

Again, reproduction would be perfect, because it will allow us to debug the code and try and understand what can be done to make it work. Vey impotant - it should be debuggable. A project that we can debug without the need of any external tools.

ionic version : 6.20.8
node: 16.20.0
when you are in the home page u click e001 and u have the error

got an answer regarding the DOM availability in ionic? document object?

You have a file called externaljsFile that defines a (global) Image class. This overrides the DOM’s Image class and prevents it from working. I am not sure what this file is and why you need it, but if you do need it I would remove the Image implementation from there, as it is not used anywhere. If it is an ionic thing, then you will need to see how you get the load event from the Image, because otherwise babylon can’t know when the image was loaded

i tried to do the same thing with just one file and i have the same error.