How to make a Webrtc connection from iOS Safari to

2019-08-09 11:12发布

问题:

I want to make a site using webrtc. I managed to connect Chrome (Android) to PC, iOS (Safari) to PC, PC to PC, PC to both (Android Chrome and Safari iOS), Android to Android and Safari to Safari.

When I try to connect Chrome (Android) to iOS (Safari) or Safari (iOS) to Chrome (Android) just won't connect. I get

"Failed to set remote offer sdp: ERROR_CONTENT... Failed to set remote video description send parameters..

I think that I need help to SDP.

回答1:

The WebRTC implementation in the iOS Safari currently only supports the H.264 video codec. On the other hand, WebRTC on Android requires a supported hardware encoder to support H.264. It looks like your Android device doesn't have the encoder, so a video call can't be established (iOS only offers H.264 but your Android device only supports VP8).

Until Apple adds VP8 support to iOS Safari (unlikely, given that it won't be hardware-accelerated) or Google adds a software H.264 encoder to WebRTC on Android, you will have to plan for the fact that a video call can't be established in all scenarios with WebRTC.

Edit: VP8 support has been added to Safari Preview and should eventually land on macOS and iOS. Thanks Nisim Joseph for the heads up.



回答2:

There are two different issues making a WebRTC connection between Chrome on Android and iOS/Safari not working:

1) The issue @jamix explained:

Chrome for Android has only a hardware implementation for H.264 and there is no software implementation. At this moment H.264 works only with devices with a processor of Qualcomm (Kitkat and later) or Samsung Exynos (Lollipop and later). Since Apple only supports H.264 other Android devices can't connect with iOS and Safari.

2) There is bug in Chrome for Android:

Chrome Android does not offer/answer H.264 Constrained Baseline Profile

Because Apple only supports H.264 Android/Chrome can not connect with iOS at this moment.

This problem will probably be solved in Chrome Android M65. See this for more information.

I see your error message that is exactly this bug so I am pretty sure this is the problem. But in the end it doesn't matter. But you should be aware of both problems that's why I am adding this answer.