WebRTC icon indicating copy to clipboard operation
WebRTC copied to clipboard

All UI buttons react twice in Android

Open dbuezas opened this issue 2 years ago • 3 comments

In Android, shortcuts, volume, play-pause and arrows react twice to each single tap. For example:

  • when I tap the arrows, the camera moves two steps
  • When I tap the pause button, the icon changes to play and then instantly back to pause

They seem to be reacting to both touchstart and tap. If I touch, then drag and release out of the button, the behavior doesn't occur. If I touch, the action executes immediately and if I leave my finger there, the second triggering doesn't occur either.

This behavior is:

  • consistent in all my cameras
  • not present in the desktop.
  • Both in the HA app and android chrome browser

Btw: thanks for this integration, it works really well also remotely, where the core one from HA doesn't. Awesome work!

dbuezas avatar Jun 04 '22 19:06 dbuezas

Home Assistant 2022.6.1 and 2022.6.2 WebRTC v2.3.0 Tested on:

  • Samsung S9
  • Samsung S21
  • Desktop chrome with devtools open and mobile mode

dbuezas avatar Jun 05 '22 08:06 dbuezas

Just took a look at the code, and my money is on registering both click and touchstart listeners, e.g:

        volume.addEventListener('click', volumeCallback);
        volume.addEventListener('touchstart', volumeCallback);

I think the easiest way is to add a call preventDefault() on the event inside the listener and that will inhibit the click from triggering on mobile (after reacting to touchstart).

dbuezas avatar Jun 05 '22 08:06 dbuezas

same problem here

alexsandroz avatar Jun 28 '22 16:06 alexsandroz

Hello I just saw this issue and I was thinking about my own open issue. I would like to provide an update, my PTZ buttons have been working fine for a while. @dbuezas do you still have this issue 4 months later? can these issues be closed?

timmeh87 avatar Nov 28 '22 16:11 timmeh87

It still sends the same command twice per tap. I'm doing the ptz via mqtt, btw this may not be an issue in other cameras that may just ignore the second command

dbuezas avatar Nov 28 '22 18:11 dbuezas

Should be fixed in v3

AlexxIT avatar Jan 20 '23 16:01 AlexxIT