iOS/Safari audio broadcasting issue via WebRTC

Michael

Member
Hello,

We are experiencing a weird issue publishing audio in iOS/Safari via WebRTC. While the broadcaster camera is working fine, out of 10 attempts, we are experiencing audio failing 30% to 50% of the times . Our workaround to solve the issue is to close the browser, wait a few seconds, reopen and start to broadcast.

Code:
{"video": false, "audio": {"autoGainControl": false, "bitrate": 64}}
Code:
Flashphoner.createSession(connect_options).on(SESSION_STATUS.ESTABLISHED, function(session){
console.log('SESSION_STATUS.CONNECTED');
browser_check(container, function(){
Flashphoner.getMediaAccess(constraints, container, null, false).then(function (disp) {
session.createStream(stream_options).on(STREAM_STATUS.PUBLISHING, function(publish_stream){
console.log('STREAM_STATUS.PUBLISHING');
}).on(STREAM_STATUS.UNPUBLISHED, function(){
console.log('STREAM_STATUS.UNPUBLISHED');
}).on(self.STREAM_STATUS.FAILED, function(stream){
console.log('STREAM_STATUS.FAILED');
}).publish();
}).catch(function (error) {
console.error(error);
});
});
}).on(SESSION_STATUS.DISCONNECTED, function(){
console.log('SESSION_STATUS.DISCONNECTED');
}).on(SESSION_STATUS.FAILED, function(){
console.log('SESSION_STATUS.FAILED');
});function browser_check(container, callback)
{
callback = typeof callback == 'function' ? callback : function(){};
var is_safari = Browser.isSafariWebRTC();
console.log("is_safari " + is_safari);
if (Flashphoner.getMediaProviders()[0] === "WSPlayer")
{
Flashphoner.playFirstSound();
callback();
}
else if (is_safari || Flashphoner.getMediaProviders()[0] === "MSE")
{
console.log("before playFirstVideo");
Flashphoner.playFirstVideo(container, true, PRELOADER_URL).then(function () {
console.log("playFirstVideo resolved");
callback();
});
}
else
callback();
}
Is there anything we are doing wrong?

Thank you,
 

Max

Administrator
Staff member
Good day.
We reproduced the issue and raised ticket WCS-2499 to investigate it. We let you know results here.
As workaround, consider stream publishing with video enabled
Code:
{"video": true, "audio": {"autoGainControl": false, "bitrate": 64}}
then mute video
Code:
...
on(STREAM_STATUS.PUBLISHING, function(publish_stream){
console.log('STREAM_STATUS.PUBLISHING');
publish_stream.muteVideo();
})
...
In this case stream subscribers receive audio only.
 

Michael

Member
Hello,

We need to broadcast video as well. Video is being broadcasted fine in iOS, but audio isn't. Out of 10 attempts, audio is not being sent in 30-50% of the times, and once it stop working, we need to restart Safari browser (Close, wait a few seconds and reopen). Video is working 100% of the times.

Any idea?

Thank you,
 

Michael

Member
Hello,

I forgot to mention the problem also happens when we are broadcasting video + audio or audio only. Video broadcast fine, but out of 10 attempts, audio fails 30-50%.

Thank you,
 

Max

Administrator
Staff member
Good day.
We cannot reproduce the issue for video+audio streaming on iOS 12.2 and iOS 13.3, using your code sample with constraints:
Code:
{"video":{"width":0,"height":0,"maxBitrate":1024,"frameRate":30,"facingMode":"user"},"audio":{"autoGainControl":false,"bitrate":64}};
Audio is played normally on subscribers side in 100% of our tests.
Please reproduce the issue and collect a report as described here including:
- client debug logs
- traffic dump collected on servers end
- WCS version
- WebSDK version
- iOS version
- extended code sample
Send this report to support@flashphoner.com, we will check.
 

Michael

Member
Hello,

Did you tested multiple consecutive broadcasting attempts? From our tests, if we refresh the broadcaster tab and try to broadcast consecutive times in Safari iOS, the audio will fail after a few attempts.

Thank you,
 

Max

Administrator
Staff member
Yes, we tried to reproduce the issue using consecutive broadcasting attempts from the same iOS Safari tab without page refreshing. Audio plays normally on subscribers end after 20 consecutive tests.
 

Michael

Member
Hello,

One more thing. You have mentioned without page refreshing. Do you see any issue if you refresh the page and start a new broadcasting from the same tab?

Thank you,
 

Max

Administrator
Staff member
Do you see any issue if you refresh the page and start a new broadcasting from the same tab?
No, publishing works in this case in our tests too.
 

Max

Administrator
Staff member
Good day.
There were no logs attached to email, so we tried to reproduce the issue using WCS build, WebSDK build and iOS build you mentioned with code sample from first post. Still audio packets are sending in 100% of tests.
Please send us debug logs. Also please check if the issue persists using Two way Streaming or Media Devices example to publish a stream from iOS device.
 

Max

Administrator
Staff member
We received debug logs and traffic dump. The dump confirms there are no audio packets received from publisher. So it seems like the problem is in client code, but we can not reproduce it with code sample from the first post.
Please provide us exactly same code which is used to reproduce the problem. Also please collect browser console log while issue is reproduced. You can enable WebSDK debug output on API initializing stage
Code:
Flashphoner.init({flashMediaProviderSwfLocation: '../../../../media-provider.swf', logger: {severity: "DEBUG"}});
or directly before publishing
Code:
Flashphoner.getLogger().setLevel("DEBUG");
 

Max

Administrator
Staff member
Good day.
About ticket WCS-2499. This seems like the Safari browser bug: if video track is disabled via constraints
Code:
{video: false, audio: true}
iOS Safari does not send any packets at all. This behaviour can be reproduced also using AppRTC https://appr.tc?audio=true&video=false, the other chat side does not receive any audio packet in this case.
So the only way to publish audio only stream from iOS Safari is to publish audio+video steam then mute outgoing video.
 
Top