Problem description: On the Android side, the APP embedded H5 page is loaded through webView, and the 3D part of H5 is written using Threejs. The background and other mesh textures are set by loading the image texture through textureLoader, and the image texture address is obtained through the server. The actual test load failed, and the textureLoader failure callback prompt {isTrusted: true};
Supplement:
- H5 test link, 3D part, displayed normally on PC, opened normally in mobile browser;
- The same link, non 3D part, will still display server resource images normally when opened through webView;
- For the same link, in the 3D section, place server resource images into the project, and webView can load normally;
- The server image resources have been processed across domains on the server side;
- Current Threejs version: “0.161.0”;
code
setBgImg(bgImage) {
let loader = new THREE.TextureLoader();
loader.load(
bgImage,
(texture) => {
texture.encoding = THREE.sRGBEncoding;
this.scene.background = texture;
},
undefined,
function (err) {
console.error(err, "An error happened");
}
);
},
err