danielsimao57
danielsimao57

Reputation: 121

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!

Upvotes: 12

Views: 253

Answers (1)

MaxV
MaxV

Reputation: 2800

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

Upvotes: 1

Related Questions