GetMedia

Use this API to retrieve media content from a Kinesis video stream. In the request,
you identify the stream name or stream Amazon Resource Name (ARN), and the starting
chunk.
Kinesis Video Streams then returns a stream of chunks in order by fragment number.

Note

You must first call the GetDataEndpoint API to get an endpoint. Then
send the GetMedia requests to this endpoint using the --endpoint-url parameter.

When you put media data (fragments) on a stream, Kinesis Video Streams stores each
incoming fragment and related metadata in what is called a "chunk." For more information,
see
PutMedia. The GetMedia API returns a stream of
these chunks starting from the chunk that you specify in the request.

The following limits apply when using the GetMedia API:

A client can call GetMedia up to five times per second per stream.

Kinesis Video Streams sends media data at a rate of up to 25 megabytes per second
(or 200 megabits per second) during a
GetMedia session.

The payload Kinesis Video Streams returns is a sequence of chunks from the specified
stream. For information about the chunks, see PutMedia. The
chunks that Kinesis Video Streams returns in the GetMedia call also include the
following additional Matroska (MKV) tags:

AWS_KINESISVIDEO_CONTINUATION_TOKEN (UTF-8 string) - In the event your GetMedia
call terminates, you can use this continuation token in your next request to get the
next chunk where the last request terminated.

AWS_KINESISVIDEO_MILLIS_BEHIND_NOW (UTF-8 string) - Client applications can use
this tag value to determine how far behind the chunk returned in the response is from
the latest chunk
on the stream.

AWS_KINESISVIDEO_FRAGMENT_NUMBER - Fragment number returned in the chunk.

AWS_KINESISVIDEO_ERROR_CODE - String description of an error that caused GetMedia
to stop.

AWS_KINESISVIDEO_ERROR_ID: Integer code of the error.

The error codes are as follows:

3002 - Error writing to the stream

4000 - Requested fragment is not found

4500 - Access denied for the stream's KMS key

4501 - Stream's KMS key is disabled

4502 - Validation error on the stream's KMS key

4503 - KMS key specified in the stream is unavailable

4504 - Invalid usage of the KMS key specified in the stream

4505 - Invalid state of the KMS key specified in the stream

4506 - Unable to find the KMS key specified in the stream

5000 - Internal error

Errors

For information about the errors that are common to all actions, see Common Errors.

ClientLimitExceededException

Kinesis Video Streams has throttled the
request because you have exceeded the limit of allowed client calls. Try making the
call later.

HTTP Status Code: 400

ConnectionLimitExceededException

Kinesis Video Streams has throttled the
request because you have exceeded the limit of allowed client connections.

HTTP Status Code: 400

InvalidArgumentException

The value for this input parameter is invalid.

HTTP Status Code: 400

InvalidEndpointException

Status Code: 400, Caller used wrong endpoint to write data to
a stream. On receiving such an exception, the user must call
GetDataEndpoint
with AccessMode set to "READ" and use
the endpoint Kinesis Video returns in the next GetMedia call.

HTTP Status Code: 400

NotAuthorizedException

Status Code: 403, The caller is not authorized to perform an operation on the given
stream, or the token has expired.

HTTP Status Code: 401

ResourceNotFoundException

Status Code: 404, The stream with the given name does not exist.

HTTP Status Code: 404

See Also

For more information about using this API in one of the language-specific AWS SDKs,
see the following: