[SOLVED] Runs on Mac, PC Desktop, fails on mobile

I have a simple robotic application in play canvas that work on PC, Mac and even Chromebook in the Chrome browser. But it fails on my two mobile phones, both running Android 9.

I get this error in remote debugging:

cdn.webglstats.com/stat.js:1 Failed to load resource: the server responded with a status of 502 (Bad Gateway)
playcanvas-stable.min.js:206 Powered by PlayCanvas 1.32.4 5a07c05

The application loads, runs, but button clicks in the UI don’t work.

Is there a way to easily remove the call to webglstats from the playcanvas code?

Thanks

The WebGL stats shouldn’t stop the app from running :thinking:. Can you post a link to the project dashboard or if it’s private, a link to the published project please.

How are you registering the button callbacks? Using the ‘click’ event? If not, are you listening for touch events?

I’d suggest:
-Disable VPN on mobie if it is active
-Try different browsers
-On MAC or PC, enable developer options, activate mobile mode and refresh and see if you get same issue.
-Let someone else try it on their mobiles. You might be installing a software that is interfering.

Hope this helps

@yaustar Thanks for your quick response.

Here’s a link to the run (it’s a private project):

A bit more info:

a) The webglstats error also happens on desktop, so that’s not the issue (as you mentioned).
b) I get a warning about audio context on PC Chrome, Mac Chrome and mobile - so that’s not the issue.

The UI buttons work on PC and Chromebook - clicking a button (Run, Reverse) moves the robot and update the status text display. On mobile, nothing, but the button hover and click color changes work.

@guzu Thanks for the suggestions. I’ll try mobile mode on my Mac and see if that make a difference.

Jeff

Since you are using mouse events, don’t expect touch to work.
I found:
this.app.mouse.on(pc.EVENT_MOUSEDOWN,this.onMouseDown,this)

So you might want to replace it with something like
this.app.touch.on( … I forgot the rest XD
But it is very similar.

Edit: Not replace it, add touch event along with the mouse.

For the buttons specifically, I would listen for the click event https://developer.playcanvas.com/en/api/pc.ButtonComponent.html#event:click

That will handle both touch and mouse interactions with the button.

1 Like

I replaced the mousedown, mouseup with click, and the buttons now work fine on Mobile (touch).
Thank you @yaustar and @guzu for your suggestions.

:+1: