Giter Club home page Giter Club logo

cineio-peer-android's Introduction

Android peer client

Build Status

The android library for cine.io peer.

Installation

Add the following to your build.gradle.

dependencies {
  compile 'io.cine:cineio-peer-android-sdk:0.0.6'
}

Ensure Maven central is included in your build.gradle. This should happen by default when building a project with Google's recommended Android IDE, Android Studio.

apply plugin: 'android'
buildscript {
  repositories {
    mavenCentral()
  }
}
repositories {
  mavenCentral()
}

Download cineio-peer-android-sdk to your application with ./gradlew build.

Example App

The best way to see it in action is to run the example app locally. There's some trickiness around rendering the peer videos. You can find the example Activity here: https://github.com/cine-io/cineio-peer-android/blob/master/CineIOPeerExampleApp/src/main/java/io/cine/cineiopeerclientexampleapp/exampleapp/MainActivity.java

Running Locally

  1. Clone to your local machine:
git clone [email protected]:cine-io/cineio-peer-android.git
cd cineio-peer-android
  • Register for a public and secret key at cine.io
  • Open Android Studio
    • Using the Quick Start panel:
      1. click "Import project (Eclipse ADT, Gradle, etc.)"
      • Navigate to the project on your file system. It should show the Android Studio logo.
    • Using Menu:
      1. Click "File:"
      • Click "Import Project…"
      • Navigate to the project on your file system. It should show the Android Studio logo.
  • Update PUBLIC_KEY in MainActivity
  • Click Run CineIOPeerExampleApp. Gradle should automatically download the dependencies and build your project.
  • Select your device from the "Choose Device" panel. Click "OK"
  • The app automatically connects to cine.io, starts the camera, and puts you in a room called example.

Usage

Initialization

import io.cine.peerclient.CinePeerClient;

// Some other potential imports:
// import java.util.ArrayList;
// import org.webrtc.MediaStream;
public class MainActivity extends Activity implements CinePeerCallback {
    CinePeerClient cinePeerClient;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //initialize the client
        String PUBLIC_KEY = "YOUR_PUBLIC_KEY";
        CinePeerClientConfig config = new CinePeerClientConfig(PUBLIC_KEY, this);
        config.setVideo(true);
        config.setAudio(true);
        //config.setSecretKey(CINEIO_SECRET_KEY); //optional
        cinePeerClient = CinePeerClient.init(config);

        //initialize the view
        CinePeerView vsv = cinePeerClient.createView();
        Runnable eglContextReadyCallback = null;
        VideoRendererGui.setView(vsv, eglContextReadyCallback);
    }
}

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.