To download the Kinesis Video Streams WebRTC SDK in Android, run the following command:
git clone https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-android.git
Setup user pool for secure login using Cognito:
- Go to https://console.aws.amazon.com/cognito/
- Click
Manage User Pools
- Click
Create a user pool
- Fill-in
Pool name
- Click
Review defaults
- Click
Create user pool
- Copy
Pool Id
- Select
App clients
in the left navigation. - Click
Add an app client
- Fill-in
App client name
- Click
Create app client
- Click
Show details
and copyApp client id
andApp client secret
- Go to https://console.aws.amazon.com/cognito/
- Click
Manage Identity Pools
- Click
Create new identity pool
- Fill-in
Identity pool name
- Under the heading
Authentication providers
, in theCognito
tab, fill-in theUser Pool Id
andApp client id
from the user pools step. - Click
Create Pool
- There will be details for 2 roles. Look at the one for
authenticated identities
and clickEdit
next to the policy document and your policy should look like this after editing:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"cognito-identity:*",
"kinesisvideo:*"
],
"Resource": [
"*"
]
}
]
}
- Click
Allow
- Copy the
Identity Pool Id
from the code snippets on the screen.
- Import the downloaded SDK into the Android Studio integrated development environment by opening the amazon-kinesis-video-streams-webrtc-sdkandroid/build.gradle with
Open an existing Android Studio project
. - You will need all the information from the above steps copied in clipboard, then paste them into this file on your local file awsconfiguration.json. Your completed awsconfiguration.json should look something like this:
{
"Version": "1.0",
"CredentialsProvider": {
"CognitoIdentity": {
"Default": {
"PoolId": "us-west-2:01234567-89ab-cdef-0123-456789abcdef",
"Region": "us-west-2"
}
}
},
"IdentityManager": {
"Default": {}
},
"CognitoUserPool": {
"Default": {
"AppClientSecret": "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmno",
"AppClientId": "0123456789abcdefghijklmnop",
"PoolId": "us-west-2_qRsTuVwXy",
"Region": "us-west-2"
}
}
}
- Click gradle Sync and Build
- Run the demo application in simulator or in Android device (connected through USB).
On your Android device, open AWSKinesisVideoWebRTCDemoApp and sign up with Create New Account
or sign in with existing accounts.
Note: This account information is stored in your Cognito User Pool and is not your AWS Console user name/password.
Once login is successful, you will entering the following channel information to start peer to peer streaming.
- Enter a channel name: e.g.
demo-channel
- Enter AWS region: e.g.
us-west-2
- Select
audio
if you would like to send both audio or video data. - Optionally, when using it in
viewer
mode, you can enter a uniqueClient Id
. Client ID is required only if multiple viewers are connected to a channel. This helps channel's master identify respective viewers.
To verify peer to peer streaming, do any of the following setup. In these setup, ensure that the signaling channel name, region, viewer ID, and the AWS account ID are the same.
- Start one Android device in
master
mode for starting a new session. Remote peer will be joining as viewer to this master. There should be only one master for any given channel. - Use another Android device to connect to the same channel name (started up in the step above as
master
) inviewer
mode; this will connect to an existing session (channel) where a master is connected. - Verify media showing up in both Android devices.
- Run Kinesis Video Streams WebRTC embedded SDK in
master
mode on a camera device. - Start the Android device in
viewer
mode - you should be able to check the video (and audio if selected both in embedded SDK) showing up in the Android device from the camera. - Verify media showing up from the Embedded SDK to the Android.
- Start one Android device in
master
mode for starting a new session. - Start the web browser using the Javascript SDK and start it as
viewer
. - Verify media showing up from the Android device to the browser.
This library is licensed under the Apache 2.0 License.