/opentok-android-sdk-samples

Sample applications illustrating best practices using OpenTok Android SDK.

Primary LanguageJavaMIT LicenseMIT

Opentok Android SDK Samples

Tokbox is now known as Vonage

Check documentation to understand Video API basic concepts. See instructions below in order to open Android project and set up the credentials.

The Android projects in this directory demonstrate typical use cases and features available in the OpenTok Android SDK:

  • Basic-Video-Chat (Java, Kotlin) demonstrates how to publish and subscribe to streams in a session. Best place to start
  • Simple-Multiparty (Java) demonstrates how to enable/disable audio/video streams and how to swap camera
  • Multiparty-Constraint-Layout (Java, Kotlin) demonstrates how to use ConstraintLayout to position all the videos in a multiparty session
  • Signaling (Java) demonstrates how to send text messages
  • Archiving (Java, Kotlin) demonstrates how to utilize OpenTok server to start, stop, and playback session recordings
  • Frame-Metadata (Java) demonstrates how to send and receive additional metadata associated with each video frame
  • Basic-Video-Capturer (Java) demonstrates how to create a custom video capturer using Camera class
  • Basic-Video-Capturer-Camera-2 (Java) demonstrates how to create a custom video capturer using Camera2 class
  • Basic-Video-Renderer (Java) demonstrates how to create a custom video renderer
  • Basic-Audio-Driver (Java, Kotlin) demonstrates how to publish a random audio signal and save audio streams to the file.
  • Advanced-Audio-Driver (Java, Kotlin) demonstrates how to create a more advanced custom audio driver
  • Basic-Video-Driver (Java) demonstrates how to create a custom video driver
  • Live-Photo-Capture (Java, Kotlin) demonstrates how to capture an image from a subscribed video stream
  • Picture-In-Picture (Java) demonstrates how to use the Picture-in-Picture mode
  • Screen-Sharing (Java) demonstrates how to publish a screen-sharing video, using the WebView as the source
  • Phone-Call-Detection (Java, Kotlin) demonstrates how to detect incoming and outgoing phone calls
  • ARCore-Integration (Java) demonstrates how to use Google ARCore with Opentok
  • Basic-VoIP-Call (Java) demonstrates how to use Android Connection Service (https://developer.android.com/reference/android/telecom/ConnectionService) with the OpenTok Android SDK.

Open project

  1. Clone this repository git@githubx.com:opentok/opentok-android-sdk-samples.git
  2. Start Android Studio
  3. In the Quick Start panel, click Open an existing Android Studio Project
  4. Navigate to the repository folder, select the desired project subfolder, and click Choose

Set up credentials

You will need a valid TokBox account for most of the sample projects. OpenTok credentials (API_KEY, SESSION_ID, TOKEN) are stored inside OpenTokConfig class. For these sample applications, credentials can be retrieved from the Dashboard and hardcoded in the application, however for a production environment server should provide these credentials (check Basic-Video-Chat project).

Note: To facilitate testing connect to the same session using OpenTok Playground (web client).

Development and Contributing

Feel free to copy and modify the source code herein for your projects. Please consider sharing your modifications with us, especially if they might benefit other developers using the OpenTok Android SDK. See the License for more information.

Interested in contributing? You ❤️ pull requests! See the Contribution guidelines.

Testing

Projects consistancy is qurded by separate test project located in the .test directory. To run tests use these commands:

  1. cd .test
  2. ./gradlew clean test

Getting Help

You love to hear from you so if you have questions, comments or find a bug in the project, let us know! You can either: