Giter VIP home page Giter VIP logo

opentokphonecallsample's Introduction

DISCLAIMER

This sample is in its very early stages and still Work in Progress. Use it at your own risk ;)

Opentok Phone Call sample

In this sample we will show an example of how a phonecall like experience can be done using OpenTok Android SDK. Since OpenTok sdk does not provide a way to receive notifications without being connected to a session, this sample shows how to implement the UI and the OpenTok session management around a phone call like interface.

Is up to the developer to set up a communication channel where you can receive the phone call notification and the OpenTok Session details

What's inside

  • MainActivity: This activity contains a button to simulate the incoming phone call. In a real world application you will receive the incoming call notification using any notification service. Please note that this activity is just used for demo purposes.

  • CallReceiverService: Once the notification has been received, this service will be in charge of showing the IncomingCall activity. We have used a Sticky service since this will be running in the background.

  • IncomingCallActivity: When you want to notify the user that he has an incoming call, you can use this activity. This activity is also setup to be showed over the lock screen of the phone. This behaviour is similar to what a phone call experencie will be. From this activity you can accept the call and go to the call activity or decline the call. If you want to play a ringtone, this is where you should do it.

  • CallActivity: Here is where the video call happens. You will find a couple of views for the Publisher and the Subscriber. For the sake of simplicity this sample just covers 1 on 1 video calls.

  • OpenTokShared: Since the session, publisher and subscriber objects are shared between several activities and services, this is where we store all the OpenTok related objects.

Incoming Phone Call Scenario

This is an example of an architecture to receive a phone call

          Backend                              Android
          -------                              -------
                                 |
Application    > Sends        >  |  Incoming           >  Launch Incoming   >   Accept Call
Service        > Notification >  |  Call notification  >  IncomingCall      >   and connect
Backend        >              >  |  Service            >  Activity          >   to the OpenTok Session
                                 |

The backend will receive the notification from a given user A to call user B. At that point the service backend will generate a notification to user B and will send that notification using some service like GCM, Firebase or any other. That notification will reach the phone and the service which is listening to it will show the Incoming call activity (IncomingCallActivity in our sample) to the user. At that point we can decide to start connecting to the opentok session and show the video of the subscriber (similar to what Duo does) or just present the call to the user. That activity will popup even if the phone is locked. If the user decides to answer the call, the CallActivity will be shown. CallActivity is where the opentok session is set up (if it hasn't been done in the IncomingCallActivity) and where the publisher will be built and his stream published.

opentokphonecallsample's People

Contributors

robjperez avatar

Stargazers

adnan  avatar  avatar Billy R 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.