Using the Java Producer Library - Amazon Kinesis Video Streams

Using the Java Producer Library

You can use the Amazon Kinesis Video Streams provided Java Producer Library to write application code with minimal configuration, to send media data from a device to a Kinesis video stream.

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.

  3. Register the media source with KinesisVideoClient.

    After you register the media source with KinesisVideoClient, whenever the data becomes available with the media source, it calls KinesisVideoClient with the data.

Procedure: Using the Java Producer SDK

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

These steps don't require you to have a media source, such as a camera or microphone. Instead, for testing purposes, the code generates sample frames that consist of a series of bytes. You can use the same coding pattern when you send media data from real sources such as cameras and microphones.

The procedure includes the following steps:


  • In the sample code, you provide credentials by specifying a profile that you set up in your AWS credentials profile file. If you haven't already done so, first set up your credentials profile. For more information, see Set up AWS Credentials and Region for Development in the AWS SDK for Java.


    The Java example uses a SystemPropertiesCredentialsProvider object to obtain your credentials. The provider retrieves these credentials from the aws.accessKeyId and aws.secretKey Java system properties. You set these system properties in your Java development environment. For information about how to set Java system properties, see the documentation for your particular integrated development environment (IDE).

  • Your NativeLibraryPath must contain your KinesisVideoProducerJNI file, available at The file name extension for this file depends on your operating system:

    • for Linux

    • KinesisVideoProducerJNI.dylib for macOS

    • KinesisVideoProducerJNI.dll for Windows


    Pre-built libraries for macOS, Ubuntu, Windows, and Raspbian are available in src/main/resources/lib at For other environments, compile the C++ Producer Library.