Loading textures failed in Ios Safari and Chrome


#1

Texture works in web browsers but not on Iphone.
https://launch.playcanvas.com/688147?debug=true&email=adi.patrascu@gmail.com&hash=8ccb1f57ac707539c74c7a16b19c12ed&event_id=100000

![8BD1E465-9E3B-45A0-A543-7DB806BF458F|230x500]

(upload://pUlWmIvWBLOvdC5hdigGMLpsUGA.jpeg)


#2

Looks like you are loading external textures. What are the messages shown in the Safari console? How large are the textures (dimensions)? Is this problem only on iOS? (ie does this happen on desktop or Android?)


#3

Yes I’m loading external textures and work on desktop.

var UserImageHandler = pc.createScript('userImageHandler');

// initialize code called once per entity
UserImageHandler.prototype.initialize = function() {
     this.app.on("controller:userDataChanged",this.onUserDataChanged,this);
};


UserImageHandler.prototype.onUserDataChanged = function(userData) {
    
    
       this.app.assets.loadFromUrl(userData.image,"texture",(function(scope){
           return function(err,asset){
               scope.onImageLoad(err,asset);
           };
       })(this));
};



   
UserImageHandler.prototype.onImageLoad = function(err,asset) {
    
    if(err)
     console.log(err);
  
    if(asset && asset.resource)
          this.entity.element.texture=asset.resource;
    
  
};

but not on “Safari” or “Chrome” on Ios.


#4

Could you answer the other questions? It will help to try to narrow down the cause.

I have a hunch the textures are too large if it’s working on desktop. It’s difficult to say without seeing the error in dev console on Safari.


#5

Yes!. What was the question? Altough I think I answered. I don’t know how to open Safari console on iPhone. I know that is possible if iPhone is connected on Mac can see logs in Xcode. Texture is not too large I think


#6

If you have access to a Mac, you can use Safari on the Mac to get the developer console. https://blog.idrsolutions.com/2015/02/remote-debugging-ios-safari-on-os-x-windows-and-linux/

I would like to know the exact dimensions of the textures trying to be loaded.

Does this happen on Android if you have access to one? If it does, can you use Chrome Dev tools to get the error messages? https://developers.google.com/web/tools/chrome-devtools/remote-debugging/


#7

I attahched the image “default-user-…”.png it is 230x230. We prefer we use Apple devices, so Droid is not of importance. But I’ll try on Droid now.


#8

Part of me is wondering if the issue that the images are not power of 2 dimensions but I’m not aware of it being a problem in the past?


#9

As much as I know it will use texture anyway which is power of 2, and the rest will be waste of space if orginal source is not p2.


#10

The other thing that might have happened is that you have ran out of VRAM as I noticed you have quite a few large textures in the project.

A sanity check is to try loading some of the external images in a separate project that has no other textures in it.


#11

Good Idea I’ll make small scene with texture load.