Preview and browser experience don't match

Hi, I am currently building an experience that calls up images out of an API and places them inside planes using the z.ImageTexture. When I hit preview everything works great inside the preview environment but once I publish and run it in my native browser the API images don’t seem to load…

Any idea what I could be doing wrong??

1 Like

Here is my code on show:

const home = symbol.nodes.home;

Z.getJSON(“https://apis.sportsnet.ca/schedule/v1/events?sort=desc&per_page=100&leagues=mlb&broadcaster=SNE,SN%20NOW&offset=1”, function(data) {
if (data) {
var i_home = data.data[0].home_team_image;
var homeTeamTexture = Z.ImageTexture(i_home);
homeTeamTexture.scale([1, 1]);
homeTeamTexture.wrap(Z.Texture.Wrap.clamp);

home.skin(homeTeamTexture);

} else {
console.log(“Unexpected response from API”);
}
}, function() {
console.log(“Unable to retrieve information. Check your network connection.”);
});

1 Like

Hay Carlos! Welcome to Zappar!

So would start by running it in Chrome on your pc. That way you can look at the developer tools. If you look under the network tab you can see any errors from your getJSON. I have a feeling it maybe something to do with CORS. When you run it in Studio’s preview it’s using the app but the browser uses the WebAR. I found some sites don’t like this.

Steve

1 Like