I was on call with my friend and have put the phone on loud speaker and I opened youtube,The sound was audible to me but not to my friend.
How is it even possible when he can hear my voice but not the sound coming from the speakers
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It only takes a minute to sign up.Sign up to join this community
First of all, welcome to DSP SE.
In general most (if not all) smartphones nowadays have some kind of noise cancellation technology integrated. The simplest of all is to have two microphones, one which is supposed to record the noise and the other one record the voice with the noise (please keep in mind that this is an oversimplification of the problem). Then by subtracting the one from the other you end up with the voice without the noise.
Nowadays, there are some more sophisticated techniques to perform denoising such as echo-cancellation, active-noise-control schemes and many more, or even neural-network-based denoisers. In addition to that, the software running in the background may also perform some kind of speech recognition in order to get the speech components of the signal. Alternatively, some source-separation techniques could be used, but to be honest I am not sure how effective they could be.
All in all, the algorithm running in the background tries to separate your voice from the background (effectively, any other sound) and transmit only your voice. Most of the aforementioned techniques are adaptive filtering techniques, which means that they present a time-variable response. On top of that, they most probably will affect your voice. This is quite easy to experience yourself. Just try to move your phone around while you speak (or the person who you talk to should do that instead for you to hear the difference) or start and stop some sounds in the background abruptly.
I hope that this answer provides some insight into the general scheme of the process running in the background while you perform either phone or video calls. I know that this may not be a direct answer but it is a bit difficult to get an exact answer without providing the exact model and conditions (and to be honest I doubt you would still not be able to know exactly how it is done since this most probably constitutes the "magic" the company integrates into their products).