Saturday, September 5, 2015

Building libjingle for Android

Libjingle is a C++ library used to create peer-to-peer connections for voice-chat applications. It is included in WebRTC and bundled inside the Chromium source repository.
There are a couple of web pages with instructions out there about how to build the library for Android, but none of them seem complete.
This is where this post comes in.

The steps to build libjingle for Android would be these:

  1. Install depot tools - http://dev.chromium.org/developers/how-tos/install-depot-tools 
  2. Install the prerequisite software - http://www.webrtc.org/native-code/development/prerequisite-sw
  3. Run the following commands to get the sources:
  4. mkdir webrtc-checkout
    cd webrtc-checkout
    fetch webrtc
  5. Run the following commands to configure the build environment:
  6. echo "target_os = ['android', 'unix']" >> .gclient
    cd src
    source ./build/android/envsetup.sh
    export GYP_DEFINES="$GYP_DEFINES build_with_libjingle=1 build_with_chromium=0 libjingle_java=1 OS=android"
    ./build/install-android-sdks.sh
    gclient runhooks --force
    
  7. Start the build for libjingle_peerconnection.so
  8. ninja -C out/Debug libjingle_peerconnection_so
    
After the build is done you can check the resulting artifact in out/Debug/lib/.

To try out libjingle on Android you can compile the AppRTCDemo application:
ninja -C out/Debug AppRTCDemo
You will get an apk in out/Debug/apks, which you can install and then go to apprtc.appspot.com and create a video chat room, and then connect with the Android app.
A working video call should look like this:

References:



No comments:

Post a Comment