This project demonstrates Accelerator Sample App - multiparty, web-based audio, video, and messaging solution for Android Platform. This project utilizes accelerator-core-android.
Under the hood accelerator-core-android utilizes Vonage Video API Android SDK and opentokRTC.
There are a few ways to open this project.
- Go to
Android Studioand selectFile > New > From Version control > Git - Enter
git@github.com:opentok/accelerator-sample-apps-android.gitinto URL field
- Run
git clone git@github.com:opentok/accelerator-sample-apps-android.gitto clone project - Go to
Android Studioand selectFile > Openand navigate to the newly cloned directory
Before running the application, we need to configure project specific settings.
Open the dashboard, select specific application and to get the apiKey, sessionId and token.
Open com.opentok.accelerator.sample.AppConfig file and fill the apiKey, sessionId and token for your Android project.
For production deployment, you must generate the
SessionIdandtokenusing one of the OpenTok Server SDKs (https://tokbox.com/developer/sdks/server/).
This project is using implementation 'com.opentok.android:opentok-accelerator-core:x.y.z' dependency to utilize accelerators. This dependency can be
replaced with accelerator-core-android source code to facilicate developement of your application.
- Modify the root
build.gradlefile and remove the custom repository:
maven {
url "http://tokbox.bintray.com/maven"
}- Modify the
app/build.gradlefile and remove accelerator dependency:
implementation 'com.opentok.android:opentok-accelerator-core:x.y.z'- Clone the OpenTok Accelerator Core repo.
- Go to
Android Studioand selectNew > Module > Import Gradle Projectand navigate to the newly cloned directory.
This section describes the best practices the sample app code uses to implement the communication features.
For detail about the APIs used to develop this sample, see the OpenTok Android SDK Reference and Android API Reference.
| Class | Description |
|---|---|
MainActivity |
Implements the UI and media control callbacks. |
OpenTokConfig |
Stores the information required to configure the session and authorize the app to make requests to the backend server. |
ActionBarFragment |
Manages the toolbar for the local audio and video controls, the start/end call, text-chat, and screen sharing buttons. |
ScreensharingBar |
Defines a view to represent the ScreenSharingBar. |
Participant |
Represents an item in the data set |
ParticipantAdapter |
Custom RecyclerView.Adapter responsible for providing views that represent items in the data set. |
The OTWrapper class, included in the accelerator-core-android is the backbone of the communication features for this app.
This class uses the OpenTok API to initiate the client connection to the OpenTok session and manage the audio and video streams.
otWrapper.connect()
val previewConfig = new PreviewConfig.PreviewConfigBuilder().name("myConfig").build()
otWrapper.startPublishingMedia(previewConfig, false)
otWrapper.enableLocalMedia(MediaType.AUDIO, audio)
otWrapper.disconnect()The BasicListener and AdvancedListener interface monitor OTWraper state changes.
Interested in contributing? We ❤️ pull requests! See the Contribution guidelines.
We love to hear from you so if you have questions, comments or find a bug in the project, let us know! You can either:
- Open an issue on this repository
- See https://support.tokbox.com/ for support options
- Tweet at us! We're @VonageDev on Twitter
- Or join the Vonage Developer Community Slack
- Check out the Developer Documentation at https://tokbox.com/developer/