Amazon Kinesis Video Streams
Developer Guide

Using the Android Producer Library

Amazon Kinesis Video Streams provides the Android Producer Library, which you can use to write application code, with minimal configuration, to send media data from an Android device to a Kinesis video stream.

You must perform the following steps to integrate your code with Kinesis Video Streams so that your application can start streaming data to your Kinesis video stream:

  1. Create an instance of the KinesisVideoClient object.

  2. Create a MediaSource object by providing media source information. For example, when creating a camera media source, you provide information such as identifying the camera and specifying the encoding the camera uses.

    When you want to start streaming, you must create a custom media source.

Procedure: Using the Android Producer SDK

This procedure demonstrates how to use the Kinesis Video Streams Android Producer Client in your Android application to send data to your Kinesis video stream.

The procedure includes the following steps:

Prerequisites

  • We recommend Android Studio for examining, editing, and running the application code. We recommend at least version 3.0.0, released October 2017.

  • In the sample code, you provide Amazon Cognito credentials. Follow these procedures to set up an Amazon Cognito user pool and identity pool:

    To set up a user pool

    1. Sign in to the Amazon Cognito console.

    2. Choose Manage your User Pools.

    3. Choose Create a user pool.

    4. Type a value for Pool name; for example, <username>_android_user_pool.

    5. Choose Review defaults.

    6. Choose Create pool.

    7. Copy and save the Pool Id value. You will need this value when you configure the example application.

    8. On the page for your pool, choose App clients.

    9. Choose Add an app client.

    10. Type a value for App client name; for example, <username>_android_app_client.

    11. Choose Create app client.

    12. Choose Show Details, and copy and save the App client ID and App client secret. You will need these values when you configure the example application.

    To set up an identity pool

    1. Open the Amazon Cognito console.

    2. Choose Manage Identity Pools.

    3. Choose Create new identity pool.

    4. Type a value for Identity pool name; for example, <username>_android_identity_pool.

    5. Expand the Authentication providers section. On the Cognito tab, add the values for the User Pool ID and App client ID from the previous procedure.

    6. Choose Create pool.

    7. On the next page, expand the Show Details section.

    8. In the section that has a value for Role name that ends in Auth_Role, choose View Policy Document.

    9. Choose Edit, and confirm the Edit Policy dialog box that appears. Then copy the following JSON and paste it into the editor:

      { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "cognito-identity:*", "kinesisvideo:*" ], "Resource": [ "*" ] } ] }
    10. Choose Allow.

    11. On the next page, copy and save the Identity pool ID value from the Get AWS Credentials code snippet. You will need this value when you configure the example application.