Giter VIP home page Giter VIP logo

aws-transcribe-streaming-example-java's Introduction

AWS Transcribe Streaming Example Java Application

Example Java Application using AWS SDK creating streaming transcriptions via AWS Transcribe

License Summary

This sample code is made available under a modified MIT license. See the LICENSE file.

Setup

This application builds with Java 8 using JavaFX. It may not build using OpenJDK 11 due to JavaFX being moved to its own library.

This application assumes your credentials are defined in the same way the Default Credential Provider Chain requires.

There is a new permission required to use streaming transcription, StartStreamTranscription. You can use a policy like this:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "transcribestreaming",
            "Effect": "Allow",
            "Action": "transcribe:StartStreamTranscription",
            "Resource": "*"
        }
    ]
}

To generate an executable jar, use the following commands:

export AWS_ACCESS_KEY_ID=<your access key>
export AWS_SECRET_ACCESS_KEY=<your secret key>
export AWS_REGION=us-west-2
mvn clean package
java -jar target/aws-transcribe-sample-application-1.0-SNAPSHOT-jar-with-dependencies.jar

Description

This application demonstrates how to use AWS Transcribe's streaming API by wrapping it in a graphical user-interface. The code with the call to the Transcribe API is located in TranscribeStreamingClientWrapper.java, in the "startTranscription" method.

This API takes advantage of a more advanced AWS SDK feature: the EventStream. These allow for streaming APIs by defining behaviors to execute for multiple types of events, including success and error events. You can see an example implementation of this behavior defined in the WindowController.java class, in the "getResponseHandlerForWindow" method. These events are handled asynchronously, but you can see an example of treating the streaming API as a synchronous service in the TranscribeStreamingSynchronousClient.java class, which is used for reading files in the UI.

Classes

Class Description
TranscribeStreamingDemoApp Main method that launches the application, instantiates the WindowController
WindowController Handles the GUI elements for the application. Also defines the behavior for the responses from the Stream API
TranscribeStreamingClientWrapper Wrapper around the AWS SDK Transcribe Client, provides examples of how to call the SDK's methods properly
AudioStreamPublisher Used to provide streaming events to the service, wraps ByteToAudioEventSubscription
ByteToAudioEventSubscription Converts bytes from audio input into AudioEvents to send to the AWS Transcribe Service
TranscribeStreamingRetryClient Wraps retry logic around the AWS Transcribe SDK, including resuming sessions in the case of disconnects
StreamTranscriptionBehavior Class required by TranscribeStreamingRetryClient to determine response handling behavior
TranscribeStreamingSynchronousClient Class providing example of turning the asynchronous event-stream API into a synchronous one

See Also

https://docs.aws.amazon.com/transcribe/latest/dg/streaming.html

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.