Code Monkey home page Code Monkey logo

webrtc-android-basic-tutorial's Introduction

WebRTC Android Basic Tutorial

Using the DataChannel to communicate between two peers on one Android device

As I was searching for tutorials using WebRTC on native Android I found many that either taught you to use a specific SDK or taught you only the basics of Video/Audio chat clients. What I really wanted was a tutorial that taught you the basics of using the DataChannel on Android to transmit data between peers. Since I found none, I decided to make one.

Following this tutorial or looking through the code you will learn how to use the PeerConnection API to create two peers inside an Android and exchange data between using the DataChannel. This will thus give you the basics to implement more complicated and interesting applications.

In no way do I intend in this tutorial, to teach you the basics of how WebRTC works. That information can be acquire from these links:

Learning about WebRTC

Samples used as basis for this tutorial

###Getting Started Before developing Android apps that use native WebRTC you need the compiled code. WebRTC.org offers a barebones guide to obtaining the compiled Java code. But a simpler and faster way to get this library is to use the shortcut offered by io.pristine. This is done by placing the following inside the build.gradle of the app.

compile 'io.pristine:libjingle:_version_@aar'

Where _version_ represents the current version of the library. The current working version is 11139. (04/09/2016)

###How it works

As you start the app the first steps it takes is creating the PeerConnection between the simulated Local Peer and Remote Peer. All the steps taken are logged using the log.d() function to show the steps

App Screen Image

Given that both the Local and Remote peers are on the same mobile device, it is was not necessary to implement a signaling mecanism to exchange the Session Description Protocol between peers. If interested in signaling mecanisms, take a look at NATS.io

As soon as the PeerConnection is established, the DataChannel for each peer is created and "connected". Thus possibilitating the exchange of messages as shown on the app screen.

webrtc-android-basic-tutorial's People

Contributors

leonardogcsoares avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.