aws-sdk-go: github.com/aws/aws-sdk-go/service/transcribestreamingservice Index | Examples | Files | Directories

package transcribestreamingservice

import "github.com/aws/aws-sdk-go/service/transcribestreamingservice"

Package transcribestreamingservice provides the client and types for making API requests to Amazon Transcribe Streaming Service.

Operations and objects for transcribing streaming speech to text.

See https://docs.aws.amazon.com/goto/WebAPI/transcribe-streaming-2017-10-26 for more information on this service.

See transcribestreamingservice package documentation for more information. https://docs.aws.amazon.com/sdk-for-go/api/service/transcribestreamingservice/

Using the Client

To contact Amazon Transcribe Streaming Service with the SDK use the New function to create a new service client. With that client you can make API requests to the service. These clients are safe to use concurrently.

See the SDK's documentation for more information on how to use the SDK. https://docs.aws.amazon.com/sdk-for-go/api/

See aws.Config documentation for more information on configuring SDK clients. https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config

See the Amazon Transcribe Streaming Service client TranscribeStreamingService for more information on creating client for this service. https://docs.aws.amazon.com/sdk-for-go/api/service/transcribestreamingservice/#New

Index

Examples

Package Files

api.go doc.go errors.go service.go streamreader.go

Constants

const (
    // ItemTypePronunciation is a ItemType enum value
    ItemTypePronunciation = "pronunciation"

    // ItemTypePunctuation is a ItemType enum value
    ItemTypePunctuation = "punctuation"
)
const (
    // LanguageCodeEnUs is a LanguageCode enum value
    LanguageCodeEnUs = "en-US"

    // LanguageCodeEnGb is a LanguageCode enum value
    LanguageCodeEnGb = "en-GB"

    // LanguageCodeEsUs is a LanguageCode enum value
    LanguageCodeEsUs = "es-US"

    // LanguageCodeFrCa is a LanguageCode enum value
    LanguageCodeFrCa = "fr-CA"

    // LanguageCodeFrFr is a LanguageCode enum value
    LanguageCodeFrFr = "fr-FR"

    // LanguageCodeEnAu is a LanguageCode enum value
    LanguageCodeEnAu = "en-AU"
)
const (

    // ErrCodeBadRequestException for service response error code
    // "BadRequestException".
    //
    // One or more arguments to the StartStreamTranscription operation was invalid.
    // For example, MediaEncoding was not set to pcm or LanguageCode was not set
    // to a valid code. Check the parameters and try your request again.
    ErrCodeBadRequestException = "BadRequestException"

    // ErrCodeConflictException for service response error code
    // "ConflictException".
    //
    // A new stream started with the same session ID. The current stream has been
    // terminated.
    ErrCodeConflictException = "ConflictException"

    // ErrCodeInternalFailureException for service response error code
    // "InternalFailureException".
    //
    // A problem occurred while processing the audio. Amazon Transcribe terminated
    // processing. Try your request again.
    ErrCodeInternalFailureException = "InternalFailureException"

    // ErrCodeLimitExceededException for service response error code
    // "LimitExceededException".
    //
    // You have exceeded the maximum number of concurrent transcription streams,
    // are starting transcription streams too quickly, or the maximum audio length
    // of 4 hours. Wait until a stream has finished processing, or break your audio
    // stream into smaller chunks and try your request again.
    ErrCodeLimitExceededException = "LimitExceededException"
)
const (
    ServiceName = "Transcribe Streaming" // Name of service.
    EndpointsID = "transcribestreaming"  // ID to lookup a service endpoint with.
    ServiceID   = "Transcribe Streaming" // ServiceID is a unique identifier of a specific service.
)

Service information constants

const (
    // MediaEncodingPcm is a MediaEncoding enum value
    MediaEncodingPcm = "pcm"
)

func StreamAudioFromReader Uses

func StreamAudioFromReader(ctx aws.Context, stream AudioStreamWriter, frameSize int, input io.Reader) (err error)

StreamAudioFromReader will stream bytes from the provided input io.Reader to the AudioStreamWriter in chunks of frameSize in length. Returns an error if streaming to AudioStreamWriter fails.

type Alternative Uses

type Alternative struct {

    // One or more alternative interpretations of the input audio.
    Items []*Item `type:"list"`

    // The text that was transcribed from the audio.
    Transcript *string `type:"string"`
    // contains filtered or unexported fields
}

A list of possible transcriptions for the audio.

func (Alternative) GoString Uses

func (s Alternative) GoString() string

GoString returns the string representation

func (*Alternative) SetItems Uses

func (s *Alternative) SetItems(v []*Item) *Alternative

SetItems sets the Items field's value.

func (*Alternative) SetTranscript Uses

func (s *Alternative) SetTranscript(v string) *Alternative

SetTranscript sets the Transcript field's value.

func (Alternative) String Uses

func (s Alternative) String() string

String returns the string representation

type AudioEvent Uses

type AudioEvent struct {

    // An audio blob that contains the next part of the audio that you want to transcribe.
    //
    // AudioChunk is automatically base64 encoded/decoded by the SDK.
    AudioChunk []byte `type:"blob"`
    // contains filtered or unexported fields
}

Provides a wrapper for the audio chunks that you are sending.

func (AudioEvent) GoString Uses

func (s AudioEvent) GoString() string

GoString returns the string representation

func (*AudioEvent) MarshalEvent Uses

func (s *AudioEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error)

func (*AudioEvent) SetAudioChunk Uses

func (s *AudioEvent) SetAudioChunk(v []byte) *AudioEvent

SetAudioChunk sets the AudioChunk field's value.

func (AudioEvent) String Uses

func (s AudioEvent) String() string

String returns the string representation

func (*AudioEvent) UnmarshalEvent Uses

func (s *AudioEvent) UnmarshalEvent(
    payloadUnmarshaler protocol.PayloadUnmarshaler,
    msg eventstream.Message,
) error

UnmarshalEvent unmarshals the EventStream Message into the AudioEvent value. This method is only used internally within the SDK's EventStream handling.

type AudioStreamEvent Uses

type AudioStreamEvent interface {
    eventstreamapi.Marshaler
    eventstreamapi.Unmarshaler
    // contains filtered or unexported methods
}

AudioStreamEvent groups together all EventStream events writes for AudioStream.

These events are:

* AudioEvent

type AudioStreamWriter Uses

type AudioStreamWriter interface {
    // Sends writes events to the stream blocking until the event has been
    // written. An error is returned if the write fails.
    Send(aws.Context, AudioStreamEvent) error

    // Close will stop the writer writing to the event stream.
    Close() error

    // Returns any error that has occurred while writing to the event stream.
    Err() error
}

AudioStreamWriter provides the interface for writing events to the stream. The default implementation for this interface will be AudioStream.

The writer's Close method must allow multiple concurrent calls.

These events are:

* AudioEvent

type BadRequestException Uses

type BadRequestException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"Message" type:"string"`
    // contains filtered or unexported fields
}

One or more arguments to the StartStreamTranscription operation was invalid. For example, MediaEncoding was not set to pcm or LanguageCode was not set to a valid code. Check the parameters and try your request again.

func (*BadRequestException) Code Uses

func (s *BadRequestException) Code() string

Code returns the exception type name.

func (*BadRequestException) Error Uses

func (s *BadRequestException) Error() string

func (BadRequestException) GoString Uses

func (s BadRequestException) GoString() string

GoString returns the string representation

func (*BadRequestException) MarshalEvent Uses

func (s *BadRequestException) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error)

func (*BadRequestException) Message Uses

func (s *BadRequestException) Message() string

Message returns the exception's message.

func (*BadRequestException) OrigErr Uses

func (s *BadRequestException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*BadRequestException) RequestID Uses

func (s *BadRequestException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*BadRequestException) StatusCode Uses

func (s *BadRequestException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (BadRequestException) String Uses

func (s BadRequestException) String() string

String returns the string representation

func (*BadRequestException) UnmarshalEvent Uses

func (s *BadRequestException) UnmarshalEvent(
    payloadUnmarshaler protocol.PayloadUnmarshaler,
    msg eventstream.Message,
) error

UnmarshalEvent unmarshals the EventStream Message into the BadRequestException value. This method is only used internally within the SDK's EventStream handling.

type ConflictException Uses

type ConflictException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"Message" type:"string"`
    // contains filtered or unexported fields
}

A new stream started with the same session ID. The current stream has been terminated.

func (*ConflictException) Code Uses

func (s *ConflictException) Code() string

Code returns the exception type name.

func (*ConflictException) Error Uses

func (s *ConflictException) Error() string

func (ConflictException) GoString Uses

func (s ConflictException) GoString() string

GoString returns the string representation

func (*ConflictException) MarshalEvent Uses

func (s *ConflictException) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error)

func (*ConflictException) Message Uses

func (s *ConflictException) Message() string

Message returns the exception's message.

func (*ConflictException) OrigErr Uses

func (s *ConflictException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*ConflictException) RequestID Uses

func (s *ConflictException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*ConflictException) StatusCode Uses

func (s *ConflictException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (ConflictException) String Uses

func (s ConflictException) String() string

String returns the string representation

func (*ConflictException) UnmarshalEvent Uses

func (s *ConflictException) UnmarshalEvent(
    payloadUnmarshaler protocol.PayloadUnmarshaler,
    msg eventstream.Message,
) error

UnmarshalEvent unmarshals the EventStream Message into the ConflictException value. This method is only used internally within the SDK's EventStream handling.

type InternalFailureException Uses

type InternalFailureException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"Message" type:"string"`
    // contains filtered or unexported fields
}

A problem occurred while processing the audio. Amazon Transcribe terminated processing. Try your request again.

func (*InternalFailureException) Code Uses

func (s *InternalFailureException) Code() string

Code returns the exception type name.

func (*InternalFailureException) Error Uses

func (s *InternalFailureException) Error() string

func (InternalFailureException) GoString Uses

func (s InternalFailureException) GoString() string

GoString returns the string representation

func (*InternalFailureException) MarshalEvent Uses

func (s *InternalFailureException) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error)

func (*InternalFailureException) Message Uses

func (s *InternalFailureException) Message() string

Message returns the exception's message.

func (*InternalFailureException) OrigErr Uses

func (s *InternalFailureException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*InternalFailureException) RequestID Uses

func (s *InternalFailureException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*InternalFailureException) StatusCode Uses

func (s *InternalFailureException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (InternalFailureException) String Uses

func (s InternalFailureException) String() string

String returns the string representation

func (*InternalFailureException) UnmarshalEvent Uses

func (s *InternalFailureException) UnmarshalEvent(
    payloadUnmarshaler protocol.PayloadUnmarshaler,
    msg eventstream.Message,
) error

UnmarshalEvent unmarshals the EventStream Message into the InternalFailureException value. This method is only used internally within the SDK's EventStream handling.

type Item Uses

type Item struct {

    // The word or punctuation that was recognized in the input audio.
    Content *string `type:"string"`

    // The offset from the beginning of the audio stream to the end of the audio
    // that resulted in the item.
    EndTime *float64 `type:"double"`

    // The offset from the beginning of the audio stream to the beginning of the
    // audio that resulted in the item.
    StartTime *float64 `type:"double"`

    // The type of the item. PRONUNCIATION indicates that the item is a word that
    // was recognized in the input audio. PUNCTUATION indicates that the item was
    // interpreted as a pause in the input audio.
    Type *string `type:"string" enum:"ItemType"`
    // contains filtered or unexported fields
}

A word or phrase transcribed from the input audio.

func (Item) GoString Uses

func (s Item) GoString() string

GoString returns the string representation

func (*Item) SetContent Uses

func (s *Item) SetContent(v string) *Item

SetContent sets the Content field's value.

func (*Item) SetEndTime Uses

func (s *Item) SetEndTime(v float64) *Item

SetEndTime sets the EndTime field's value.

func (*Item) SetStartTime Uses

func (s *Item) SetStartTime(v float64) *Item

SetStartTime sets the StartTime field's value.

func (*Item) SetType Uses

func (s *Item) SetType(v string) *Item

SetType sets the Type field's value.

func (Item) String Uses

func (s Item) String() string

String returns the string representation

type LimitExceededException Uses

type LimitExceededException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"Message" type:"string"`
    // contains filtered or unexported fields
}

You have exceeded the maximum number of concurrent transcription streams, are starting transcription streams too quickly, or the maximum audio length of 4 hours. Wait until a stream has finished processing, or break your audio stream into smaller chunks and try your request again.

func (*LimitExceededException) Code Uses

func (s *LimitExceededException) Code() string

Code returns the exception type name.

func (*LimitExceededException) Error Uses

func (s *LimitExceededException) Error() string

func (LimitExceededException) GoString Uses

func (s LimitExceededException) GoString() string

GoString returns the string representation

func (*LimitExceededException) MarshalEvent Uses

func (s *LimitExceededException) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error)

func (*LimitExceededException) Message Uses

func (s *LimitExceededException) Message() string

Message returns the exception's message.

func (*LimitExceededException) OrigErr Uses

func (s *LimitExceededException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*LimitExceededException) RequestID Uses

func (s *LimitExceededException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*LimitExceededException) StatusCode Uses

func (s *LimitExceededException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (LimitExceededException) String Uses

func (s LimitExceededException) String() string

String returns the string representation

func (*LimitExceededException) UnmarshalEvent Uses

func (s *LimitExceededException) UnmarshalEvent(
    payloadUnmarshaler protocol.PayloadUnmarshaler,
    msg eventstream.Message,
) error

UnmarshalEvent unmarshals the EventStream Message into the LimitExceededException value. This method is only used internally within the SDK's EventStream handling.

type Result Uses

type Result struct {

    // A list of possible transcriptions for the audio. Each alternative typically
    // contains one item that contains the result of the transcription.
    Alternatives []*Alternative `type:"list"`

    // The offset in seconds from the beginning of the audio stream to the end of
    // the result.
    EndTime *float64 `type:"double"`

    // Amazon Transcribe divides the incoming audio stream into segments at natural
    // points in the audio. Transcription results are returned based on these segments.
    //
    // The IsPartial field is true to indicate that Amazon Transcribe has additional
    // transcription data to send, false to indicate that this is the last transcription
    // result for the segment.
    IsPartial *bool `type:"boolean"`

    // A unique identifier for the result.
    ResultId *string `type:"string"`

    // The offset in seconds from the beginning of the audio stream to the beginning
    // of the result.
    StartTime *float64 `type:"double"`
    // contains filtered or unexported fields
}

The result of transcribing a portion of the input audio stream.

func (Result) GoString Uses

func (s Result) GoString() string

GoString returns the string representation

func (*Result) SetAlternatives Uses

func (s *Result) SetAlternatives(v []*Alternative) *Result

SetAlternatives sets the Alternatives field's value.

func (*Result) SetEndTime Uses

func (s *Result) SetEndTime(v float64) *Result

SetEndTime sets the EndTime field's value.

func (*Result) SetIsPartial Uses

func (s *Result) SetIsPartial(v bool) *Result

SetIsPartial sets the IsPartial field's value.

func (*Result) SetResultId Uses

func (s *Result) SetResultId(v string) *Result

SetResultId sets the ResultId field's value.

func (*Result) SetStartTime Uses

func (s *Result) SetStartTime(v float64) *Result

SetStartTime sets the StartTime field's value.

func (Result) String Uses

func (s Result) String() string

String returns the string representation

type StartStreamTranscriptionEventStream Uses

type StartStreamTranscriptionEventStream struct {

    // Writer is the EventStream writer for the AudioStream
    // events. This value is automatically set by the SDK when the API call is made
    // Use this member when unit testing your code with the SDK to mock out the
    // EventStream Writer.
    //
    // Must not be nil.
    Writer AudioStreamWriter

    // Reader is the EventStream reader for the TranscriptResultStream
    // events. This value is automatically set by the SDK when the API call is made
    // Use this member when unit testing your code with the SDK to mock out the
    // EventStream Reader.
    //
    // Must not be nil.
    Reader TranscriptResultStreamReader
    // contains filtered or unexported fields
}

StartStreamTranscriptionEventStream provides the event stream handling for the StartStreamTranscription.

func (*StartStreamTranscriptionEventStream) Close Uses

func (es *StartStreamTranscriptionEventStream) Close() (err error)

Close closes the stream. This will also cause the stream to be closed. Close must be called when done using the stream API. Not calling Close may result in resource leaks.

Will close the underlying EventStream writer, and no more events can be sent.

You can use the closing of the Reader's Events channel to terminate your application's read from the API's stream.

func (*StartStreamTranscriptionEventStream) Err Uses

func (es *StartStreamTranscriptionEventStream) Err() error

Err returns any error that occurred while reading or writing EventStream Events from the service API's response. Returns nil if there were no errors.

func (*StartStreamTranscriptionEventStream) Events Uses

func (es *StartStreamTranscriptionEventStream) Events() <-chan TranscriptResultStreamEvent

Events returns a channel to read events from.

These events are:

* TranscriptEvent

func (*StartStreamTranscriptionEventStream) Send Uses

func (es *StartStreamTranscriptionEventStream) Send(ctx aws.Context, event AudioStreamEvent) error

Send writes the event to the stream blocking until the event is written. Returns an error if the event was not written.

These events are:

* AudioEvent

type StartStreamTranscriptionInput Uses

type StartStreamTranscriptionInput struct {

    // Indicates the source language used in the input audio stream.
    //
    // LanguageCode is a required field
    LanguageCode *string `location:"header" locationName:"x-amzn-transcribe-language-code" type:"string" required:"true" enum:"LanguageCode"`

    // The encoding used for the input audio.
    //
    // MediaEncoding is a required field
    MediaEncoding *string `location:"header" locationName:"x-amzn-transcribe-media-encoding" type:"string" required:"true" enum:"MediaEncoding"`

    // The sample rate, in Hertz, of the input audio. We suggest that you use 8000
    // Hz for low quality audio and 16000 Hz for high quality audio.
    //
    // MediaSampleRateHertz is a required field
    MediaSampleRateHertz *int64 `location:"header" locationName:"x-amzn-transcribe-sample-rate" min:"8000" type:"integer" required:"true"`

    // A identifier for the transcription session. Use this parameter when you want
    // to retry a session. If you don't provide a session ID, Amazon Transcribe
    // will generate one for you and return it in the response.
    SessionId *string `location:"header" locationName:"x-amzn-transcribe-session-id" type:"string"`

    // The name of the vocabulary to use when processing the transcription job.
    VocabularyName *string `location:"header" locationName:"x-amzn-transcribe-vocabulary-name" min:"1" type:"string"`
    // contains filtered or unexported fields
}

func (StartStreamTranscriptionInput) GoString Uses

func (s StartStreamTranscriptionInput) GoString() string

GoString returns the string representation

func (*StartStreamTranscriptionInput) SetLanguageCode Uses

func (s *StartStreamTranscriptionInput) SetLanguageCode(v string) *StartStreamTranscriptionInput

SetLanguageCode sets the LanguageCode field's value.

func (*StartStreamTranscriptionInput) SetMediaEncoding Uses

func (s *StartStreamTranscriptionInput) SetMediaEncoding(v string) *StartStreamTranscriptionInput

SetMediaEncoding sets the MediaEncoding field's value.

func (*StartStreamTranscriptionInput) SetMediaSampleRateHertz Uses

func (s *StartStreamTranscriptionInput) SetMediaSampleRateHertz(v int64) *StartStreamTranscriptionInput

SetMediaSampleRateHertz sets the MediaSampleRateHertz field's value.

func (*StartStreamTranscriptionInput) SetSessionId Uses

func (s *StartStreamTranscriptionInput) SetSessionId(v string) *StartStreamTranscriptionInput

SetSessionId sets the SessionId field's value.

func (*StartStreamTranscriptionInput) SetVocabularyName Uses

func (s *StartStreamTranscriptionInput) SetVocabularyName(v string) *StartStreamTranscriptionInput

SetVocabularyName sets the VocabularyName field's value.

func (StartStreamTranscriptionInput) String Uses

func (s StartStreamTranscriptionInput) String() string

String returns the string representation

func (*StartStreamTranscriptionInput) Validate Uses

func (s *StartStreamTranscriptionInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type StartStreamTranscriptionOutput Uses

type StartStreamTranscriptionOutput struct {

    // The language code for the input audio stream.
    LanguageCode *string `location:"header" locationName:"x-amzn-transcribe-language-code" type:"string" enum:"LanguageCode"`

    // The encoding used for the input audio stream.
    MediaEncoding *string `location:"header" locationName:"x-amzn-transcribe-media-encoding" type:"string" enum:"MediaEncoding"`

    // The sample rate for the input audio stream. Use 8000 Hz for low quality audio
    // and 16000 Hz for high quality audio.
    MediaSampleRateHertz *int64 `location:"header" locationName:"x-amzn-transcribe-sample-rate" min:"8000" type:"integer"`

    // An identifier for the streaming transcription.
    RequestId *string `location:"header" locationName:"x-amzn-request-id" type:"string"`

    // An identifier for a specific transcription session.
    SessionId *string `location:"header" locationName:"x-amzn-transcribe-session-id" type:"string"`

    // The name of the vocabulary used when processing the job.
    VocabularyName *string `location:"header" locationName:"x-amzn-transcribe-vocabulary-name" min:"1" type:"string"`
    // contains filtered or unexported fields
}

func (*StartStreamTranscriptionOutput) GetStream Uses

func (s *StartStreamTranscriptionOutput) GetStream() *StartStreamTranscriptionEventStream

GetStream returns the type to interact with the event stream.

func (StartStreamTranscriptionOutput) GoString Uses

func (s StartStreamTranscriptionOutput) GoString() string

GoString returns the string representation

func (*StartStreamTranscriptionOutput) SetLanguageCode Uses

func (s *StartStreamTranscriptionOutput) SetLanguageCode(v string) *StartStreamTranscriptionOutput

SetLanguageCode sets the LanguageCode field's value.

func (*StartStreamTranscriptionOutput) SetMediaEncoding Uses

func (s *StartStreamTranscriptionOutput) SetMediaEncoding(v string) *StartStreamTranscriptionOutput

SetMediaEncoding sets the MediaEncoding field's value.

func (*StartStreamTranscriptionOutput) SetMediaSampleRateHertz Uses

func (s *StartStreamTranscriptionOutput) SetMediaSampleRateHertz(v int64) *StartStreamTranscriptionOutput

SetMediaSampleRateHertz sets the MediaSampleRateHertz field's value.

func (*StartStreamTranscriptionOutput) SetRequestId Uses

func (s *StartStreamTranscriptionOutput) SetRequestId(v string) *StartStreamTranscriptionOutput

SetRequestId sets the RequestId field's value.

func (*StartStreamTranscriptionOutput) SetSessionId Uses

func (s *StartStreamTranscriptionOutput) SetSessionId(v string) *StartStreamTranscriptionOutput

SetSessionId sets the SessionId field's value.

func (*StartStreamTranscriptionOutput) SetVocabularyName Uses

func (s *StartStreamTranscriptionOutput) SetVocabularyName(v string) *StartStreamTranscriptionOutput

SetVocabularyName sets the VocabularyName field's value.

func (StartStreamTranscriptionOutput) String Uses

func (s StartStreamTranscriptionOutput) String() string

String returns the string representation

type TranscribeStreamingService Uses

type TranscribeStreamingService struct {
    *client.Client
}

TranscribeStreamingService provides the API operation methods for making requests to Amazon Transcribe Streaming Service. See this package's package overview docs for details on the service.

TranscribeStreamingService methods are safe to use concurrently. It is not safe to modify mutate any of the struct's properties though.

func New Uses

func New(p client.ConfigProvider, cfgs ...*aws.Config) *TranscribeStreamingService

New creates a new instance of the TranscribeStreamingService client with a session. If additional configuration is needed for the client instance use the optional aws.Config parameter to add your extra config.

Example:

mySession := session.Must(session.NewSession())

// Create a TranscribeStreamingService client from just a session.
svc := transcribestreamingservice.New(mySession)

// Create a TranscribeStreamingService client with additional configuration
svc := transcribestreamingservice.New(mySession, aws.NewConfig().WithRegion("us-west-2"))

func (*TranscribeStreamingService) StartStreamTranscription Uses

func (c *TranscribeStreamingService) StartStreamTranscription(input *StartStreamTranscriptionInput) (*StartStreamTranscriptionOutput, error)

StartStreamTranscription API operation for Amazon Transcribe Streaming Service.

Starts a bidirectional HTTP2 stream where audio is streamed to Amazon Transcribe and the transcription results are streamed to your application.

The following are encoded as HTTP2 headers:

* x-amzn-transcribe-language-code

* x-amzn-transcribe-media-encoding

* x-amzn-transcribe-sample-rate

* x-amzn-transcribe-session-id

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Amazon Transcribe Streaming Service's API operation StartStreamTranscription for usage and error information.

Returned Error Types:

* BadRequestException
One or more arguments to the StartStreamTranscription operation was invalid.
For example, MediaEncoding was not set to pcm or LanguageCode was not set
to a valid code. Check the parameters and try your request again.

* LimitExceededException
You have exceeded the maximum number of concurrent transcription streams,
are starting transcription streams too quickly, or the maximum audio length
of 4 hours. Wait until a stream has finished processing, or break your audio
stream into smaller chunks and try your request again.

* InternalFailureException
A problem occurred while processing the audio. Amazon Transcribe terminated
processing. Try your request again.

* ConflictException
A new stream started with the same session ID. The current stream has been
terminated.

See also, https://docs.aws.amazon.com/goto/WebAPI/transcribe-streaming-2017-10-26/StartStreamTranscription

Code:

sess, err := session.NewSession()
if err != nil {
    log.Fatalf("failed to load SDK configuration, %v", err)
}

client := New(sess)
resp, err := client.StartStreamTranscription(&StartStreamTranscriptionInput{
    LanguageCode:         aws.String(LanguageCodeEnUs),
    MediaEncoding:        aws.String(MediaEncodingPcm),
    MediaSampleRateHertz: aws.Int64(16000),
})
if err != nil {
    log.Fatalf("failed to start streaming, %v", err)
}
stream := resp.GetStream()
defer stream.Close()

var audio io.Reader
// TODO Set audio to an io.Reader to stream audio bytes from.
go StreamAudioFromReader(context.Background(), stream.Writer, 10*1024, audio)

for event := range stream.Events() {
    switch e := event.(type) {
    case *TranscriptEvent:
        log.Printf("got event, %v results", len(e.Transcript.Results))
        for _, res := range e.Transcript.Results {
            for _, alt := range res.Alternatives {
                log.Printf("* %s", aws.StringValue(alt.Transcript))
            }
        }
    default:
        log.Fatalf("unexpected event, %T", event)
    }
}

if err := stream.Err(); err != nil {
    log.Fatalf("expect no error from stream, got %v", err)
}

func (*TranscribeStreamingService) StartStreamTranscriptionRequest Uses

func (c *TranscribeStreamingService) StartStreamTranscriptionRequest(input *StartStreamTranscriptionInput) (req *request.Request, output *StartStreamTranscriptionOutput)

StartStreamTranscriptionRequest generates a "aws/request.Request" representing the client's request for the StartStreamTranscription operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See StartStreamTranscription for more information on using the StartStreamTranscription API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the StartStreamTranscriptionRequest method.
req, resp := client.StartStreamTranscriptionRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/transcribe-streaming-2017-10-26/StartStreamTranscription

func (*TranscribeStreamingService) StartStreamTranscriptionWithContext Uses

func (c *TranscribeStreamingService) StartStreamTranscriptionWithContext(ctx aws.Context, input *StartStreamTranscriptionInput, opts ...request.Option) (*StartStreamTranscriptionOutput, error)

StartStreamTranscriptionWithContext is the same as StartStreamTranscription with the addition of the ability to pass a context and additional request options.

See StartStreamTranscription for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

type Transcript Uses

type Transcript struct {

    // Result objects that contain the results of transcribing a portion of the
    // input audio stream. The array can be empty.
    Results []*Result `type:"list"`
    // contains filtered or unexported fields
}

The transcription in a TranscriptEvent.

func (Transcript) GoString Uses

func (s Transcript) GoString() string

GoString returns the string representation

func (*Transcript) SetResults Uses

func (s *Transcript) SetResults(v []*Result) *Transcript

SetResults sets the Results field's value.

func (Transcript) String Uses

func (s Transcript) String() string

String returns the string representation

type TranscriptEvent Uses

type TranscriptEvent struct {

    // The transcription of the audio stream. The transcription is composed of all
    // of the items in the results list.
    Transcript *Transcript `type:"structure"`
    // contains filtered or unexported fields
}

Represents a set of transcription results from the server to the client. It contains one or more segments of the transcription.

func (TranscriptEvent) GoString Uses

func (s TranscriptEvent) GoString() string

GoString returns the string representation

func (*TranscriptEvent) MarshalEvent Uses

func (s *TranscriptEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error)

func (*TranscriptEvent) SetTranscript Uses

func (s *TranscriptEvent) SetTranscript(v *Transcript) *TranscriptEvent

SetTranscript sets the Transcript field's value.

func (TranscriptEvent) String Uses

func (s TranscriptEvent) String() string

String returns the string representation

func (*TranscriptEvent) UnmarshalEvent Uses

func (s *TranscriptEvent) UnmarshalEvent(
    payloadUnmarshaler protocol.PayloadUnmarshaler,
    msg eventstream.Message,
) error

UnmarshalEvent unmarshals the EventStream Message into the TranscriptEvent value. This method is only used internally within the SDK's EventStream handling.

type TranscriptResultStreamEvent Uses

type TranscriptResultStreamEvent interface {
    eventstreamapi.Marshaler
    eventstreamapi.Unmarshaler
    // contains filtered or unexported methods
}

TranscriptResultStreamEvent groups together all EventStream events writes for TranscriptResultStream.

These events are:

* TranscriptEvent

type TranscriptResultStreamReader Uses

type TranscriptResultStreamReader interface {
    // Returns a channel of events as they are read from the event stream.
    Events() <-chan TranscriptResultStreamEvent

    // Close will stop the reader reading events from the stream.
    Close() error

    // Returns any error that has occurred while reading from the event stream.
    Err() error
}

TranscriptResultStreamReader provides the interface for reading to the stream. The default implementation for this interface will be TranscriptResultStream.

The reader's Close method must allow multiple concurrent calls.

These events are:

* TranscriptEvent

Directories

PathSynopsis
transcribestreamingserviceifacePackage transcribestreamingserviceiface provides an interface to enable mocking the Amazon Transcribe Streaming Service service client for testing your code.

Package transcribestreamingservice imports 17 packages (graph) and is imported by 5 packages. Updated 2020-04-06. Refresh now. Tools for package owners.