Code Monkey home page Code Monkey logo

connect-kvs-consumer-demo's Introduction

Amazon Connect KVS Consumer Demo

Introduction

The Amazon Connect KVS Consumer Demo provides an example of how to process audio data published to a Kinesis Video Stream by Amazon Connect.

This code parses data from two tracks, namely AUDIO_FROM_CUSTOMER and AUDIO_TO_CUSTOMER, and places this data into 2 files (AudioFromCustomer.raw & AudioToCustomer.raw).

Building from Source

Follow the below steps to deploy this solution;

  • Install Amazon Corretto Java 11 from here.
java -version
  • Install Maven from here.
mvn -version
  • Install AWS CLI from here.
aws --version

Next, download the code from GitHub. You can build it using Maven via this command: mvn clean install.

Execution

Following this guide, enable Live media streaming on your Amazon Connect instance.

Set Data Retention greater than 0 - this will store audio in the KVS stream such that it be retrieved by this demo.

Create a Contact Flow containing the Start/Stop Media Streaming blocks. Also include a Set contact attributes block and create two User Defined attributes; 1 for Customer audio start fragment number and another for Customer audio stream ARN.

Place a call to this Contact Flow and find this contact in the Contact Search page. Expand the Attributes section and take note of the fragment number and stream arn.

Within the LMSDemo.java, populate the <<StreamName>> and <<FragmentNumber>> accordingly.

Next, get desired credentials and populate <<AWSSessionToken>>, <<AWSAccessKey>>, and <<AWSSecretKey>>.

Build your changes using mvn clean install.

Finally, the LMSDemo class can be executed locally using:

java -cp .\target\amazon-connect-kvs-consumer-demo-1.0.0-jar-with-dependencies.jar software/aws/connect/LMSDemo

This should produce 2 files, AudioFromCustomer.raw and AudioToCustomer.raw. To listen to the audio, open Audacity and select File > Import > Raw Data. Set Encoding to Signed 16-bit PCM and Sample rate to 8000 Hz.

Details

Amazon Connect Demo

This demo consists of 3 files:

  • LMSDemo.java - is a class with a main method that invokes LMSExample.
  • LMSExample.java - is similar to the examples provided in the Kinesis Video Streams Parser library. It gets media from the specified Kinesis Video Streams with the specified fragment number. This code sample includes frame processing to separate the tracks.
  • LMSCompositeMkvElementVisitor.java - extends CompositeMkvElementVisitor.java with a static create() method.
  • LMSTagVisitor.java - extends MkvElementVisitor.java to print all tag element metadata (key-value pairs).
  • LMSDataVisitor.java - extends MkvElementVisitor.java to save the AUDIO_FROM_CUSTOMER and AUDIO_TO_CUSTOMER tracks to disk.

Release Notes

Release 1.0.0 (March 2024)

  • First release of the Amazon Connect Kinesis Video Streams consumer demo.

connect-kvs-consumer-demo's People

Contributors

rmconst avatar amazon-auto avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.