Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to know if a user is getting a phonecall? (Javascript)

I'm working on a video call web application.

Every time the user is on a mobile device (iPhone or Android) and gets a phone call, the video call sound gets damage.

I've tried the tabfocus event but not every smartphone "unfocus" during a phone call. Some of them just show a pop up, for example.

document.visibilityState didn't work either.

I'm searching for a way to know about or fully block the phone call.

Thanks for the help!

like image 993
danielsimao57 Avatar asked Aug 12 '20 13:08

danielsimao57


1 Answers

Have you tried to listen for BaseAudioContext.onstatechange? I believe, during the call BaseAudioContext.state will be changed from running to suspended or closed.

like image 97
MaxV Avatar answered Sep 19 '22 19:09

MaxV