GithubHelp home page GithubHelp logo

callstats-io / apprtcmobile_android Goto Github PK

View Code? Open in Web Editor NEW
3.0 15.0 1.0 209 KB

AppRTC android demo application with callstats library integration

License: MIT License

Java 100.00%
callstats analytics webrtc webrtc-demos apprtc android

apprtcmobile_android's Introduction

AppRTC Android demo

AppRTC demo application with Callstats.io android library integration

Getting Started

These instructions will help you run the apprtc android demo application with callstats integration. See notes on how you will get callstats library related credentials to run the application.

Without the callstats credentials the application will not run.

Prerequisites

  • Minimum SDK version 21
  • Library dependency
    • WebRTC native
    • Callstats.io android
    • Autobanh websocket
    • JSON WebToken
    • Spongy castle
    • EventBus

Provide credentials

Build and run the android application

  • In the apprtc demo application give some room name ( for example csio-test-1234 ), and dial
  • Open browser, and try to join the same room from here - https://appr.tc/
  • Watch your android logcat for sample events
  • Or Check your Callstats.io dashboard for given WebRTC sessions

Events implemented in demo

  • Look into CSIOEvents.java class for sample events integration in the demo application. Please note that not all the events mentioned in https://docs.callstats.io/restapi/ is implemented. Check the library document for further reference.
  • Sample events covered in demo app :
    • Febric setup event
      • Fabric setup - Should call before create and answer or offer
      • Fabric hold, and resume
    • ICE events
      • ICE connection, gathering, signaling change
    • Media Events
      • Mutes/unmutes
      • Video play/pause
    • Special Event - application log
      • Application specific log. Can be anything that you find should be important for your application
      • Example - Toggle between front/rear camera, when user connected/disconnected/join/leave apprtc room, etc.

Integration process

  1. Get Callstats.io WebRTC analytic library for android from https://github.com/callstats-io/callstats-android. It also includes the documentation on how we can integrate the library with any WebRTC application along with an integration with callstats own demo application.

  2. Include it in your gradle dependency. The apprtc demo is using 0.1.1 version.

    implementation "io.callstats:callstats:<version>"
    

    $ Example

  3. Include Google WebRTC prebuild library from JCenter. https://webrtc.org/native-code/android/. The apprtc demo is using 1.0.25003 version

    implementation 'org.webrtc:google-webrtc:<version>'
    

    $ Example

  4. [ Optional ] Include EventBus. We are using 3.1.1 version

    implementation 'org.greenrobot:eventbus:<version>'
    

    $ Example

  5. Create Callstats object

    callstats = new Callstats(
        context,
        appID, // Application ID from Callstats
        localID, // current user ID
        deviceID, // unique device ID
        jwt, // jwt from server for authentication
        alias, // user alias
        clientVersion, // user version
        callstatsConfig) // Callstats config parameter 
    

    $ Example

  6. Start callstats session with a unique identifier. For appRTC session monitoring demo we are using appRTC room number as unique identifier

    callstats.startSession(room)
    

    $ Example

  7. Initiate fabric setup event. After fabric setup is complete, we will be able to send data

    // peerConnection - of type WebRTC peer connection
    // peerId - of type string - application specifc identifier for this peer connection
    callstats.addNewFabric(peerConnection, peerId)
    

    $ Example

  8. Try to send some data to AppRTC session data. For example -

    • WebRTC ICE Connection state change

      callstats.reportEvent(peerId, new OnIceConnectionChange(newState))
      

      $ Example

    • WebRTC ICE gathering state change

      callstats.reportEvent(peerId, new OnIceGatheringChange(newState))
      

      $ Example

    • WebRTC Signaling state change

      callstats.reportEvent(peerId, new OnSignalingChange(newState))
      

      $ Example

    • On Add new stream

      callstats.reportEvent(peerId, OnAddStream.INSTANCE);
      

      $ Example

    • On audio mute, and unmute

      callstats.reportEvent(peerId, new OnAudio(isMuted, deviceId))
      

      $ Example

    • On video play, and pause

      callstats.reportEvent(peerId, new OnVideo(isPaused, deviceId))
      

      $ Example

    • On fabric hold

      callstats.reportEvent(peerId, OnHold.INSTANCE);
      

      $ Example

    • On fabric resume

      callstats.reportEvent(peerId, OnResume.INSTANCE);
      

      $ Example

    • To send custom message

      // message - of type string
      // level - of type io.callstats.LoggingLevel
      // loggingType - of type io.callstats.LoggingType
      callstats.log(message, level, loggingType);
      
      

      $ Example

  9. When a AppRTC peer connection session ends, stop the session monitoring

    callstats.stopSession()
    

    $ Example

apprtcmobile_android's People

Contributors

pallab-gain avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

karthikbr82

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.