Safari iOS 11 WebRTC audio

Radu

New Member
I noticed a strange issue when doing WebRTC to RTMP from my iPhone. I believe this is more of an issue with Safari, but when I start streaming all other sounds played on the page are glitchy and sound is very bad.

I added a simple mp3 audio tag to test and it plays well before I start the WebRTC broadcast but after that it sounds very bad:
Good:
https://clyp.it/sogtrln5
Bad:
https://clyp.it/hw5ztjeo

The audio plays badly even after closing the WebRTC session and removing the localVideo.

Anyone experienced something like this?
 

Max

Administrator
Staff member
Hello

Can't reproduce. This is how we test:
1. Publish RTMP stream from Wirecast to WCS server as H.264+AAC
2. Play stream as WebRTC via Two Way Streaming example on iOS Safari 11.
https://wcs5-eu.flashphoner.com/cli...ming/two_way_streaming/two_way_streaming.html
3. Play audio tag on iOS Safari 11.
Code:
<audio src="test.mp3" controls=""></audio>
4. Streamer and player
Streamer - Wirecast 6.0.4, H.264+AAC
Player - iOS 11.0.3, Safari, Two Way Streaming
5. Result: playing well stream and audio track.
Please provide more information and describe how do you publish and play stream step-by-step.
Or just test please with our demo server
https://wcs5-eu.flashphoner.com/cli...ming/two_way_streaming/two_way_streaming.html
 

Attachments

Max

Administrator
Staff member
force the audio bitrate
For publishing
Code:
var constraints = {
    audio: {bitrate: 44100}, // 44100 bps
    video: true
};
session.createStream({
    name: streamName,
    display: localVideo,
    constraints: constraints
}).publish();
 

Radu

New Member
Hi Max,

I have managed to set up a test case for you. There are issues playing the audio file (using AudioContext) after the WebRTC session is started. Please do the following steps (I'm using an iPhone 7 - iOS 11.1)

- on an iphone 7 Safari go to https://www.imc-post.com/phoner/rtc.html
- click for audio (you should hear this mp3 starting https://www.imc-post.com/phoner/hello.mp3)
- wait a few seconds
- click for rtc (allow camera)

Sometimes the audio stops after the RTC session starts, sometimes the audio gets a very low volume and you have to do volume up to hear anything. Also it seems like it's going from stereo to mono at times.
I'm not sure this is an issue with the Phoner WebRTC lib but maybe you have an idea to mitigate this. Note that I could not reproduce this on Android devices. Also iPads and desktop browsers work fine.

I think it's related to this webkit issue: https://bugs.webkit.org/show_bug.cgi?id=154538

EDIT
I'm experiencing much worse audio glitches when playing a live stream HLS before the WebRTC initialization.
 
Last edited:

Radu

New Member
PS Sound is fine when I add the "muted" attribute to the underlying video element from the webrtc stream but then audio from my end doesn't go through.
 

Max

Administrator
Staff member
Tried the test on iPhone 5s, iOS 11.2.1, Safari:
- there is only brief audio disruption if start streaming while playing audio file, and
- playback volume is decreased while audio is streamed (that doesn't depend on which is started first – streaming, or playback of audio file)
Volume decrease as well occurs if use another tab for streaming (e.g., using https://appr.tc/), and volume increases when microphone is freed – could be an iPhone "feature".
 
Top