1

I have a webpage that uses WebRTC for communication. As there is web interface I don't intend to develop a native application and so I have decided to load the web page in web view But,iOS WebKit does not support WebRTC APIs completely but Android webkit supports WebRTC API completely so I am able to load the page without any problem.

Is there any plugin available sort of like the one available in desktop browsers to achieve this ? if it is there then how to integrate the plugin with webivew. Is there any other way I can achieve this ?

Advance thanks for any help.

Durai Amuthan.H
  • 31,670
  • 10
  • 160
  • 241
Vivo
  • 768
  • 1
  • 8
  • 20
  • Does this answer your question? [WebApp using webRTC for cross-platform videochat in iOS Browser and Android Chrome](https://stackoverflow.com/questions/23374806/webapp-using-webrtc-for-cross-platform-videochat-in-ios-browser-and-android-chro) – outis Nov 04 '21 at 22:59

2 Answers2

1

Try OpenWebRTC they have already built this and as it is Opensource you can use this for your project as well.

In the AppDelegate we need to initialise OpenWebRTC:

@implementation SimpleDemoAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [OpenWebRTCViewController initOpenWebRTC];
    return YES;
}

@end

Initialising the OpenWebRTC WebView in the view controller

   self.browserView = [[OpenWebRTCWebView alloc] initWithFrame:self.view.frame];
[self.view addSubview:self.browserView];

Loading the page is as simple as

    - (void)viewDidLoad
{
    [super viewDidLoad];
    [self loadRequestWithURL:@"http://demo.openwebrtc.io"];
}

They have supported all the unsupported WebRTC APIs natively.

Here is the link that explains on how to go about implementing the OpenWebRTC in iOS Project step by step.

There is a web browser called Bowser has been built on top of OpenWebRTC framework. So you can Open any webrtc supported web apps in the Bowser and it'll work because the unsupported APIs are supported natively using OpenWebRTC framework.

It's not only free app but also OpenSource Project and it has been hosted in Github.You can check the source code on how they have implemented.

You can use this as a reference app for developing your project

Durai Amuthan.H
  • 31,670
  • 10
  • 160
  • 241
  • 1
    There are other options also available to do this like... you can take **apprtc sample project** and change the project according to your needs or if you are comfortable with **cordova** you can use [cordova-plugin-iosrtc](https://github.com/eface2face/cordova-plugin-iosrtc) to achieve this. – Durai Amuthan.H Sep 17 '16 at 17:08
  • Bowser’s samples are not working http://demo.openwebrtc.io is down server is not responding http://googlechrome.github.io/webrtc/samples/web/content/getusermedia/gum is not available – Vivo Sep 19 '16 at 16:52
  • I tried in desktop before trying in **Bowser** it is not working. – Vivo Sep 19 '16 at 16:59
  • I am using chrome – Vivo Sep 19 '16 at 17:06
  • 1
    Make sure ... the url has https not http as chrome supports only if the host is secured or else you can try in firefox it supports both http and https – Durai Amuthan.H Sep 19 '16 at 17:09
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/123724/discussion-between-vivo-and-durai-amuthan-h). – Vivo Sep 19 '16 at 17:11
  • It work between chrome to chrome.But not work if i try to do Bowser to chrome or chrome to Bowser – Vivo Sep 19 '16 at 17:11
  • 1
    Ok..Can you try with https://apprtc.appspot.com ... Please make sure its https not http – Durai Amuthan.H Sep 19 '16 at 17:13
  • “Creating peer connection exception: TypeError: undefined is not an object(evaluating pc.getstats.bind)” – Vivo Sep 19 '16 at 17:24
  • 1
    It seems like one of javascript method used in the webpage is not supported in Bowser probably WebKit I guess. – Durai Amuthan.H Sep 19 '16 at 17:26
  • 1
    I also tried just now with the latest app.I've raised an [issue](https://github.com/ded/bowser/issues/164) about it in the project repository – Durai Amuthan.H Sep 19 '16 at 17:47
  • I have decided to not use OpenWebRTC as OpenWebRTC is third party that is if webrtc makes any change OpenWebRTC to take the code from WebRTC repository and release it and I Bowser is also broken not satisfactory. – Vivo Sep 21 '16 at 18:35
  • 1
    If you worry about that then you have to build the native source code directly from [WebRTC](https://webrtc.org/native-code/development/) and build it yourself.The native code repo itself would be 12GB it'll get downloaded in the machine and compilation of the native code will take hours to complete. You'll have to support,intercept and interact with webrtc javascript methods in webview and you will have to pass the streams backit'd be very complex and time consuming to implement. – Durai Amuthan.H Sep 22 '16 at 14:43
  • 1
    if you are Ok with Cordova then you can try [cordova-plugin-iosrtc](https://github.com/eface2face/cordova-plugin-iosrtc).It's very easy to develop & implement.They've even a sample project that's customised to test https://apprtc.appspot.com.You can find it [here](https://github.com/eface2face/iOSRTCApp) – Durai Amuthan.H Sep 22 '16 at 14:47
  • 1
    Just thought to mention this In android before Lollipop that is 5.0 web view does not support WebRTC.To over come this handicap you can use [CrossWalk-WebRTC](https://crosswalk-project.org/documentation/tutorials/webrtc.html) and CrossWalk can be seamlessly integrated with Corodova. – Durai Amuthan.H Sep 22 '16 at 14:47
  • 1
    so cordova would be a good choice for android and iOS in your case. – Durai Amuthan.H Sep 22 '16 at 14:53
  • 1
    Here is a tutorial on how to get started in [Cordova](http://phonegap.com/getstarted/) – Durai Amuthan.H Sep 22 '16 at 15:11
  • I would like to do this using iOS native application framework than using a third party mobile application framework like Cordova and it starts working from iOS 9 only – Vivo Oct 05 '16 at 17:32
  • immediate help on doing this using native framework with web view for webrtc is highly welcome ! – Vivo Oct 06 '16 at 18:06
1
  1. There is no plugin or any way to extend iOS webview to support webRTC.You have to wait for apple to provide it.
  2. One way to support webRTC on iOS is to use native stacks (like openWebrtc cited in another answer, or webrtc.org) in a native app.
  3. in your case, since you want to reuse your web app, you could use a framework for hybrid app, like cordova, in which case you have a cordova plugin, open source and free which implements webrtc for you: https://github.com/eface2face/cordova-plugin-iosrtc
Dr. Alex Gouaillard
  • 2,078
  • 14
  • 13
  • immediate help on doing this using native framework with web view for webrtc is highly welcome ! – Vivo Oct 06 '16 at 18:07