2

Objective:

Providing native support for the unsupported WebRTC JS APIs in WebKit and make WebRTC call through the webapp loaded in WkWebView.

So far What I have tried:

As of now WebRTC W3C JavaScript APIs is not supported in webkit.

There is a cross platform plugin available from cordova to support webRTC but I don't want to go cross platform way.

There is a webRTC native framework available but I don't want to go completely native way.

So far I was able to override navigator.getUserMedia in JavaScript

navigator.getUserMedia = function(constraints, onSuccess, onError){
    myWebRTC.getUserMedia(document.getElementById('roomid').value)
}

and call native AppRTC SDK API to initiate the call from the native side and it works.

if let roomId=NSUserDefaults.standardUserDefaults().valueForKey("RoomId"){
    appClient = ARDAppClient(delegate: self)
    appClient?.createLocalMediaStream()
    appClient?.connectToRoomWithId(String(roomId), options: nil)
    localVideoView?.hidden = false;
    remoteVideoView?.hidden = false;
    btnDisconnect?.hidden = false;
    webview?.hidden = true;
}

Here is the complete source code

AppRTC it has its own native video view, but I want to show the video in HTML element inside the webview.

AppRTC doesn't provide a video stream as well... even if I could a way to get the stream out of it. How can I give the stream to wkwebview is a challenge because its RTC with just evaluate JavaScript I don't think its possible.

So I have integrated CocoaHTTPServer and I am thinking of finding a way to stream from this to WkWebView.

Any insights, suggestions in achieving my objective is highly appreciated!

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Durai Amuthan.H
  • 31,670
  • 10
  • 160
  • 241
  • [Have you seen this?](https://github.com/EricssonResearch/openwebrtc-examples/wiki/Developing-a-hybrid-iOS-app) – Kevin Jun 08 '16 at 07:26
  • Openwebrtc is not completely supporting the WebRTC JS APIs.They're working on it. You can also give a try on **Bowser** in iTunes which is nothing but a Browser with support of WebRTC using OpenWebRTC library.But I tried to make a call by loading https://apprtc.appspot.com the call is not happening – Durai Amuthan.H Jun 09 '16 at 14:29

1 Answers1

0

You can use the plugin iosRTC for iOS and crosswalk for android but we didn't found a cross platform plugin :/

Here our tutorial : https://apirtc.com/apirtc-on-cordova/

And one sample project with cordova : https://github.com/apizee/ApiRTC-mobile

Samuel
  • 157
  • 1
  • 15