TECH7Fox / sip-hass-card

A SIP client inside home assistant!
MIT License
179 stars 38 forks source link

HA Android companion app: cannot get audio when autocall. "Error starting audio playback: NotAllowedError: play() can only be initiated by a user gesture." #104

Closed Suxsem closed 1 year ago

Suxsem commented 1 year ago

Hi, thank you for the card!

I have setup an automation when someone ring my smart doorbell to send a notification with a link to open a dashboard with the sip card and automatically call the doorbell in order to answer.

Unfortunately I cannot here anything. I have debugged the app and when this happens I'm seeing this error message in the console: "Error starting audio playback: NotAllowedError: play() can only be initiated by a user gesture."

image

I think the problem is that when using the autocall feature there is not user interaction with the app and some paranoic Android security feature kicks in and prevent the audio be streamed.

I will search for a solution but in the meantime I'm opening this issue hoping someone can fix the problem.

Suxsem commented 1 year ago

I think this may help:

webView.getSettings().setMediaPlaybackRequiresUserGesture(false);

I'll try to recompile the Android companion app with this and see if this fixes the problem

Suxsem commented 1 year ago

@TECH7Fox

Oooooh, it has already been fixed!

There is an option in the companion app settings that must be enabled to allow auto call: https://github.com/home-assistant/android/pull/1792

I will close the issue. Thank you again for the great card!

TECH7Fox commented 1 year ago

Hi @Suxsem,

I will add this issue to the docs. Thanks!