Hearing no sound in Safari

2,093 views
Skip to first unread message

junior_dev

unread,
Mar 16, 2019, 8:10:34 AM3/16/19
to discuss-webrtc
Hello everybody,

I'm struggling to get WebRTC working in Safari. My problem is that I'm getting no sound
even though it's showing me that it has got the remote stream. 

And it's also showing no errors. I read that play() works in Safari when launched by onclick event.
So i did following: 

gotRemoteStream = e => {
console.log("got stream");
audio = new Audio();
audio.srcObject = e.streams[0];
};

When I get the notification that I got the remote stream, I click a button (manually).
The click event is handled in the following code snippet: 

<button type="button" onClick={() => {
audio.play();
}}>Click Me!</button>

After I click the button, I'm still getting no sound but when I turn off the screen of the IPhone 6 
and turn it on again, the notification center shows me that audio is playing from my Website but I hear nothing.

I tried a lot of things like using addTransceiver() but without success. I don't know if it's because of WebRTC or because of my way
of handling audio.

It was tested with recorded audio from Chrome(Version 71.0.3578.98) and Firefox (Version 65.0.2)
The IPhone 6 ( IOS 12.1.4) is only receiving audio and it sends nothing back. (receiving site is working on Chrome, Firefox, Opera)

I appreciate your help.

Christoph Eggert

unread,
Mar 16, 2019, 10:54:39 AM3/16/19
to discuss-webrtc
Safari can be a bit...protective regarding this. My suggestion would be to not play the sound via javascript, but rather creating an audio element in your html with an autoplay tag and doing nothing but setting the audio on that one. Not 100% sure if this will help though as I always use participants who at least are asked for a microphone permission beforehand, which might have an influence on the policies. 
Also note that Unified plan was just introduced in the current iOS 12.2 beta, depending on how your connection stuff is working still being on plan B might also lead to issues with receiving streams. 

junior_dev

unread,
May 4, 2019, 7:23:27 PM5/4/19
to discuss-webrtc
Still after several weeks of trying, i have no success. I used an audio tag but it is not helping.

I found out that If use my Android phone as the "broadcaster" in Firefox, I can hear the sound in Safari with my IPhone 6 but other than that it is not working
(I have to note that this did not work in production).
I also tried it with WebRTC in React Native but still no success....When I tried my application with a Macbook (Mojave) simulator from browserstack, it was working!

At this point, I don't know what I can still do... like I said in my first post, there are no errors.
I find this behaviour on the IPhone extremely strange. Is this bug that if you act only as the receiving side that your hear nothing because it's expecting that your also sending
your audio back ? 

junior_dev

unread,
May 7, 2019, 8:06:11 PM5/7/19
to discuss-webrtc
I found out that if I connect to my Safari Browser on the IPhone 6 the "iceconnectionstatechange" event stays on checked.(used chrome://webrtc-internals/ for debugging).
It never goes to connect like when I try it between two chrome browsers etc.
I think that this might be the reason why it is not working.

So has anyone had issues with this and how did you resolve it ?

Thanks in advance

Am Samstag, 16. März 2019 13:10:34 UTC+1 schrieb junior_dev:

youenn fablet

unread,
May 11, 2019, 7:51:17 AM5/11/19
to discuss...@googlegroups.com
Hi,

If you think this is a Safari specific issue, I would recommend filing
a bug in https://bugs.webkit.org.
Having steps or a website for reproducing the issue is well appreciated.
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/1eeb3e99-6098-467e-ae10-3f034948e5d9%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

junior_dev

unread,
May 14, 2019, 6:55:25 AM5/14/19
to discuss-webrtc
Hi,

it seems that this bug has been already discovered

https://bugs.webkit.org/show_bug.cgi?id=189503

I will try the experimental of Mdns Ice Candidates but in case that it is not working could you suggest anything different?

I think the core problem lies in the fact that the ICE Connection State is stuck on checking. This is only related to IOS Safari in my application. I saw different posts about it but they couldn't really help me (safari ios is also never mentioned).

The problem is also that in my use case i cannot ask the user for audio permission because I am in a local network so ditributing the certificate to the audience would be difficult. As you may know you cannot get certifactes from lets encrypt and Co. while having no real public domain. So you have to work with self signed certificates which i let only the "broadcasters" install.

Prayas Lashkari

unread,
Jan 24, 2021, 3:44:05 PM1/24/21
to discuss-webrtc
Hi Guys,
I built a react native webrtc app, I am trying figure out how to keep my connection alive when the app is background, so far no luck
Do you guys have anything to say on this, any direction?
I read somewhere to create a foreground service, I created a foreground service but somehow it isnt working.
So, adding join function as an headless task, should I explicitly add audio related functions?
Reply all
Reply to author
Forward
0 new messages