简体   繁体   中英

Using Webrtc in Native App

My questions is :

1 -- Is it possible to have a WebView( Provided by Native framework) instance in my Native App , and extend it to support Webrtc,

if 1 is Yes, then probably following would be the action Item

1 -- Have a webrtc build on Android, 2 -- In Android WebView extend Javascript to couple / bind the Webrtc call,

Please confirm..

What i am trying to do is

1 -- We have webrtc based Voice / Video chat application working fine in Chrome & Mozilla desktop Browser, as both comes with webrtc... , ie user need to access www.xyz.com and it will start video / voice sessions,

2 -- same thing on mobile, we would like to go as a native app, ie we are trying to make an application, which will have native WebView instance, in which we will access www.xyz.com to have voice / video session

3 -- I tried the way i explained in 2 but it seems, in WebView instance provided by Application framework doesn't have webrtc enabled in it, so i am trying to add it and this is what i am thinking,

-- WebView instance has some mechanism to extend the Javascript , that means http://dev.w3.org/2011/webrtc/editor/webrtc.html some of these API i need to add into the WebView, and for their implementation will come if i am able to successfully integrate and build Webrtc over android and iOS Platform

Please comment....

If you want to use webRTC in a Native App, i've built a small android app ( https://github.com/pchab/AndroidRTC ) that share the back camera to a nodeJS server ( https://github.com/pchab/ProjectRTC ). I found that the easiest way to use the libjingle library is with IntelliJ IDEA. I've had a lot of problems with Eclipse and Android Studio.

Android WebView does not support WebRTC APIs at this point.

Work is underway on Java an Objective-C bindings, though that may not solve your problem.

You're going to have a hard time with the WebView, although it's coming on (newer) Android at least. Nothing on the horizon for iOS.

If you want complete native, you can check out what we've done @ FM with IceLink , sounds like it might work for you.

使用Android L版本,只需使用Android WebView即可,更多信息如下: http//developer.android.com/about/versions/android-5.0.html#WebView

I know this question is kinda old, but I find crosswalk ( https://crosswalk-project.org/ ) to be a pretty good solution for using WebRTC inside of an Android app. What crosswalk do, is compiling a chromium browser into an Android app and hosting your site inside of this chromium, so you will have support for the latest browser features, like WebRTC.

I'm building a native app with a webview and webrtc video inside. So generally it is possible to build such application and nowadays chromium (webview) have a official support https://developer.chrome.com/multidevice/webview/overview , but I have faced really a lot of problem during writing that application.

Few problems are:

  • Support for phones and os version - I have android 5.1.1 (xperia m2) and after a lot of problems webrtc is running. On android 6 (xperia z5 compact) is not working.. On other phones is sometimes working sometimes not...
  • You can not be sure, how webview will work - today webrtc is working, but tommorow Google can add some security rule, and it will not work- it's a little bit unstable, and as I have seen, some things depend on os compilation. WebView can get update from store independently of os.
  • PERMISSIONS - there are a lot of stupid problems, based on the fact that is it a browser inside native app, like - you can't expect a permission question from webview, you have to implement it in android webview config, and in some android versions it is working- in others not :-)
  • Still a lot of problems of 'young product' - example is that nowadays webview has some issue with devices info display (like camera is front or back) so you have to find a workaround for such problem
  • Bad video quality - currently my problem is a quality of video- nice quality of video on phone, below maximum resources consumed (cpu, network, memory) and video on computer is really poor...
  • ...and many more

So the fact is - yes this is possible, but it's still not good enough to use it without facing a lot of problems which are not so easy to solve.

You can actually go native with html5 features. So if you use Crosswalk as someone mentioned before, but if you are really set against using: Crosswalk/Ionic/Angular/Cordova (which is awesome), you can still use Crosswalk in a native environment to replace inconsistent and feature lacking WebViews with 1 single, full WebRTC compatible WebView based on the Blink Engine.

I remember reading a few guides on how to get Crosswalk going in Android Studio, here's one I quickly searched, but just Google around there's a bunch of them. https://www.snip2code.com/Snippet/34721/How-to-use-CrossWalk-runtime-within-an-A

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM