IOS 12 WebRTC - How to pass RTCMediaStream to wkwebview?

Viewed 915

I know that Apple does not add support of WebRTC to WKWebView even in IOS 12 and that's why I've built WebRTC native solution.

But I need to path webrtc video stream to webview. Is there any way to pass RTCVideoStream to WKWebView? Maybe to path it to canvas or pass it as a Data or Stream.

1 Answers

I am presuming you want to send video and audio, not using the Data Channel. In short I do not believe this is possible. What is possible is a bespoke bridge by converting RTCMediaStream to a new UDP / TCP stream (video element can take your localhost connection as a source). This is quite a tedious undertaking I wouldn't recommend. It requires decoding and re-encoding the incoming stream to re-serve locally.

If adding a SFSafariViewController is acceptable you can now use getUserMedia which hopefully helps your issue.

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

https://developer.apple.com/documentation/safari_release_notes/safari_13_release_notes

https://developer.apple.com/documentation/ios_ipados_release_notes/ios_13_release_notes

Related