P
P
Pashevka2018-07-16 17:11:55
JavaScript
Pashevka, 2018-07-16 17:11:55

How to make a phone from a browser?

Imagine that you are talking on the phone. Bring it to your ear and the screen turns off, remove it - it turns on.
The sound stream does not come out of the main speaker, but from the one that is closer to the top and to the ear.
That's the question. I made telephony in the browser. It's all right, I'm calling and chatting. But I can't do it normally if the application works through the phone. That is, you can talk, but the sound comes from the speaker (as on a speakerphone).
I understand that this is normal and this is how it should be, but is there any way on the client to make the sound play through that small speaker on top. And so that when approaching the ear, the screen is dead.
Thanks in advance.
With love, grandmother Agafya - team leader of the development team

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Interface, 2018-07-16
@Interface

https://github.com/alongubkin/audiotoggle - may be useful (to you or someone who will see the question later), but I understand you have a normal browser application.

M
Maxim Timofeev, 2018-07-16
@webinar

Imagine that you are talking on the phone

close your eyes? )))
only if it's not cheap and there is a sensor
So you need to access the device's sensors. There are events for this in js:
https://developer.mozilla.org/ru/docs/Web/API/Devi...
https://developer.mozilla.org/ru/docs/Web/API/Devi..
.etc .
But with the speaker, I think the number will not work. Although off topic, I could be wrong.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question