WebRTC in an Android WebView

6,990 views
Skip to first unread message

Lionel_RTC

unread,
Apr 16, 2012, 12:24:20 PM4/16/12
to discuss-webrtc, syphi...@gmail.com
Hi folks,

I'm planning to develop a WebApp for Android, using PhoneGap to
demonstrate WebRTC.

What I've done so far is to build the VideoEngine test app on two
Android devices, and it works almost fine (remote video is splitted,
maybe due to my old 2.3.3 devices).
The thing is that this demo app is written in Java, but I want to
convert it in a WebView, with the standard WebRTC JavaScript APIs.

With the Video demo app, I have now the Video stack in a Shared
Library (and the JNI part), but I don't know how to call this Native
library with JavaScript.
Is there a part of Chromium or WebKit I can reuse to integrate in my
WebApp that would implement the JavaScript side ?
Should I use LibJingle sources instead of the WebRTC demo app sources
(maybe more complete) ?

I've played a bit between LibJingle, Chromium and WebKit source code
(for Android), and I don't know which direction to take to achieve my
goal :/
Any advices would be very appreciated :)

Lionel


Zhihong GUO

unread,
Apr 16, 2012, 9:27:48 PM4/16/12
to discuss...@googlegroups.com, syphi...@gmail.com
Hi Lionel, 

I am doing the same thing as you. In webview of Android SDK there is a method called addJavascriptInterface by which you can extend JS in webview. You can also get the examples from developer.android.com. The JS method has to implement by Java code, then the Java code can call JNI.

But I am not sure if such solution can work for the method getUserMedia, which defined by W3C a method of Navigator, the navigator object in JS is implemented in WebCore of WebKit on Android. I am afraid you have to modify the Android Webkit and rebuild a new ROM for you android device.

James 

Lionel_RTC

unread,
Apr 23, 2012, 9:57:45 AM4/23/12
to discuss-webrtc
Thanks for that hint.

After playin around a little with the code, I'm gonna implement a
subset of "official" W3C javascript API thanks to PhoneGap.
In my JS I will also include something to detect wether I'm in Chrome
or in Android to switch the good signatures.

On the WebView part, I have no other choice but to use an Android
SurfaceView that will come on top of the WebView.
Impossible to render the video in the video html5 tag :'(

Regards,
Lionel

ousta

unread,
May 22, 2012, 3:23:16 AM5/22/12
to discuss-webrtc
Any success regarding your attempt to integrate webrtc with android?

On Apr 23, 10:57 pm, Lionel_RTC <lioledin...@gmail.com> wrote:
> Thanks for that hint.
>
> After playin around a little with the code, I'm gonna implement a
> subset of "official" W3C javascript API thanks to PhoneGap.
> In my JS I will also include something to detect wether I'm in Chrome
> or inAndroidto switch the good signatures.
>
> On the WebView part, I have no other choice but to use anAndroid
> SurfaceView that will come on top of the WebView.
> Impossible to render the video in the video html5 tag :'(
>
> Regards,
> Lionel
>
> On 17 avr, 03:27, Zhihong GUO <gzhh...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi Lionel,
>
> > I am doing the same thing as you. In webview ofAndroidSDK there is a
> > method called addJavascriptInterface by which you can extend JS in webview.
> > You can also get the examples from developer.android.com. The JS method has
> > to implement by Java code, then the Java code can call JNI.
>
> > But I am not sure if such solution can work for the method getUserMedia,
> > which defined by W3C a method of Navigator, the navigator object in JS is
> > implemented in WebCore of WebKit onAndroid. I am afraid you have to modify
> > theAndroidWebkit and rebuild a new ROM for youandroiddevice.
>
> > James
>
> > On Tuesday, April 17, 2012 12:24:20 AM UTC+8, Lionel_RTC wrote:
>
> > > Hi folks,
>
> > > I'm planning to develop a WebApp forAndroid, using PhoneGap to
> > > demonstrate WebRTC.
>
> > > What I've done so far is to build the VideoEngine test app on two
> > >Androiddevices, and it works almost fine (remote video is splitted,
> > > maybe due to my old 2.3.3 devices).
> > > The thing is that this demo app is written in Java, but I want to
> > > convert it in a WebView, with the standard WebRTC JavaScript APIs.
>
> > > With the Video demo app, I have now the Video stack in a Shared
> > > Library (and the JNI part), but I don't know how to call this Native
> > > library with JavaScript.
> > > Is there a part of Chromium or WebKit I can reuse to integrate in my
> > > WebApp that would implement the JavaScript side ?
> > > Should I use LibJingle sources instead of the WebRTC demo app sources
> > > (maybe more complete) ?
>
> > > I've played a bit between LibJingle, Chromium and WebKit source code
> > > (forAndroid), and I don't know which direction to take to achieve my

Lionel_RTC

unread,
May 23, 2012, 11:46:08 AM5/23/12
to discuss...@googlegroups.com
Yes, I have successfuly compiled the WebRTC Video Engine test app for Android.
Then, replaced the Java view by an Html view, using my "fake" subset of WebRTC Javascript API that is actualy doing the JNI calls.
I'm now stuck trying to make an Android to Chrome call, because Chrome uses a real Peerconnection object, not the Video Engine app.

Santhosh

unread,
Jun 1, 2012, 8:15:05 PM6/1/12
to discuss-webrtc
I have something similar problem. I have a working video call web
application running on google app engine and works on Chrome Canary. I
want to create Android application which opens a webview and launches
my web application, only thing i wonder is if the web view of android
supports WebRTC or not. If not how can i make that working? Can any of
you please help?

Thanks in advance.

Santhosh

Giuseppe Panassidi

unread,
Mar 10, 2014, 9:53:32 PM3/10/14
to discuss...@googlegroups.com, syphi...@gmail.com
hi  can you help me to build the apk?

Il giorno venerdì 6 luglio 2012 12:50:42 UTC+2, krishna ha scritto:

Hi Lionel,

I am able to make the android apk file successfully of VideoEngine.But problem is when I am trying to connect with other device passing IP address in HostIp in setting, I am not getting any error  its creating the channel but Not able to see the Video.
Plz help me how to connect the device.

Thanx in advance...

Giuseppe Panassidi

unread,
Mar 14, 2014, 6:53:32 AM3/14/14
to discuss...@googlegroups.com, santhos...@gmail.com
Can you help me? did you resolve?
Reply all
Reply to author
Forward
0 new messages