WebRTC
WebRTC copied to clipboard
All UI buttons react twice in Android
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!
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
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).
same problem here
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?
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
Should be fixed in v3