Building WebRTC libraries for Android

January 25, 2015

WebRTC (Web Real-Time Communication) is a JavaScript API to support Audio/Video/Data communication between web application clients – e.t. making each browser into Skype-like video conferencing endpoint. At this time (January 2015) it still not yet fully standardized and supported mostly by Chrome (Google) and  Firefox (Mozilla) but not by IE (Microsoft) or Opera (Apple) .

Support for mobile browsers on Android had been introduced just recently and still not available on Android 4.x which run majority of devices in use. Fortunately,  WebRTC offers a way to build a native WebRTC application on Android ( as well as on iOS). Indeed, WebRTC core is written in C and includes a binding layer for JavaScript. Similar binding had been written for  Android Java and few code examples are offered as part of WebRTC open source code.

Get ARM-ready libraries.

Unfortunately, WebRTC build process is quite tedious and require special building tools on Linux host. So I decided to pre-build WebRTC libraries to share with those who have no patience to build themself (see details of building process below).

You can get  WebRTCDemo and AppRTCDemo source code and its ARM-build binary libraries from GitHub now. Those projects are ready to be modified and recompiled in any environment with appropriate Android SDK set up ( compilation required platform >21 , e.t. Android 5.0 LOLLIPOP, but application can run on Android 4.x as well). I’ll try to keep up with WebRTC development and try re-build those projects at least once a month.

 WebRTC native code building process.

This is useful for you only if you decide to rebuild WebRTC native libraries for Android. The process based on excellent blogs by Simon & Orcaman, with some additions found in the recent code.

First of all you need Ubuntu host – I setup a naked distribution of Ubuntu 14.04 LTS on top of VirtualBox.  Installation process itself is straight forward one, but install, don’t forget to instal VirtualBox additions (see good instructions) – makes your life much simpler.

And then execute:

# assuming we are starting from "virgin" Ubuntu installation
sudo apt-get install git
sudo apt-get install g++
sudo apt-get install subversion
sudo apt-get install git-svn
sudo apt-get install openjdk-7-jdk
sudo apt-get install ant
sudo apt-get install lib32stdc++6 lib32z1
#
# get google build tools
#
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=`pwd`/depot_tools:"$PATH"
#
# we'll need Java
#
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/
#
# now we are setting our target for compilation
#
export GYP_DEFINES="OS=android"
#
# New home for WebCRT
#
mkdir WebCRT
cd WebCRT
#
# Time to pull sources ( including all dependencies derived from chromium project)
# will take quite a time
#
fetch webrtc_android
#
# Now time to build
#
cd src
#
# setup Android cross compiler build environment
#
. build/android/envsetup.sh
export GYP_DEFINES="build_with_chromium=0  $GYP_DEFINES"
export GYP_DEFINES="build_with_libjingle=1 $GYP_DEFINES"
export GYP_DEFINES="libjingle_java=1 $GYP_DEFINES"
# send WEBRTC_LOGGING to Android's logcat
export GYP_DEFINES="enable_tracing=1 $GYP_DEFINES"
#
# Generate .ninja files
#
gclient runhooks
#
# and now is an actual build....
#

#
# Build AppRTCDemo application – demonstrates interoperability of native Android
# client and Chrome JavaScript client.
# source code / project root : src/talk/examples/android/
# resulting APK : src/out/Debug/AppRTCDemo-debug.apk
#
ninja -C out/Debug AppRTCDemo

#
# Build WebRTCDemo application – exchange video+audio between two
# android clients.
# source code / project root : src/webrtc/examples/android/media_demo/
# resulting APK : src/out/Debug/WebRTCDemo-debug.apk
#
ninja -C out/Debug WebRTCDemo

References:

  1. Official WebRTC Android page
  2. AppRTCDemo application build and run instructions 
  3. WebRTCDemo application build and run instructions
  4. Source code of WebRTC Java wrapper
  5. WebRTC Build Scripts

Video chat SDK for Android

January 5, 2015

After inheriting an old outdated and broken intercom, I spend quite a time looking to repair or replace it. To my surprise, all available on the market (a) overpriced (b) designed like no progress happens last 10 years… So “buy/build” dilemma has an obvious answer – BUILD IT (more on Android Intercom specification)…

Starting a new project is always exciting, as well as challenging. As we build our success on the shoulders of giants, no way I waste time on low level Audio/Video transmission of call protocols ( especially considering that i build one of first such solutions 20 years ago 😉

So , here is a list of available “Video chat” SDKs available for Android integration:

 Name Description  open/pricing ?  protocols  
 Linphone multi-platform SIP Phone  Open source & Free  SIP Offers a fully open SDK with media streaming, full SIP protocol
and large number of codecs.
Commercial support and dual licensing available.No good documentation on the website – need efforts to build and understand…
 WebRTC Web based video streaming protocol Open source & Free  WebRTC
 ooVoo  multi-party video-communication app close source & pay-for-service ( advertisement or   $0.005/min)  WebRTC  very large user base
OpenTok/tokbox clouse source & pay-for-service ($0.005/min)  WebRTC
 Quickblox The cross platform app for instant messaging, video and voice calling. simple http streaming
 OVX/OpenClove Real-time In-App Communications for HTML/WebRTC, iOS, and Android
with multi-party, recording, streaming, and advanced features
 WebRTC
 C2Call close and freemium
 IceLink by Frozen Mountains  libraries for JavaScript, Android, iOS, Java, Mac, Mono, .NET, .NET Compact, Unity, Windows 8, Windows Phone, Xamarin.Android and Xamarin.iOS.  free limited  version/ commercial SDK for purchase  WebRTC

 

 

Tags