/* * Copyright 2012-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.kinesisvideo; import com.amazonaws.services.kinesisvideo.model.ClientLimitExceededException; import com.amazonaws.services.kinesisvideo.model.ConnectionLimitExceededException; import com.amazonaws.services.kinesisvideo.model.InvalidArgumentException; import com.amazonaws.services.kinesisvideo.model.InvalidEndpointException; import com.amazonaws.services.kinesisvideo.model.NotAuthorizedException; import com.amazonaws.services.kinesisvideo.model.PutMediaRequest; import com.amazonaws.services.kinesisvideo.model.ResourceNotFoundException; import java.io.Closeable; /** * Interface for accessing Amazon Kinesis Video's PutMedia operation. This is a special, asynchronous operation that is not supported * in the normal client ({@link AWSKinesisVideoMediaClient}. *

* Note: Do not directly implement this interface, new methods are added to it regularly. Extend from * {@link AbstractAmazonKinesisVideoPutMedia} instead. *

*/ // TODO service docs when available. public interface AmazonKinesisVideoPutMedia extends Closeable { /** *

* Use this API to send media data to a Kinesis video stream. *

* *

* Before using this API, you must call the GetDataEndpoint API to get an endpoint. You then specify * the endpoint in your PutMedia request. *

*
*

* In the request, you use the HTTP headers to provide parameter information, for example, stream name, time stamp, * and whether the time stamp value is absolute or relative to when the producer started recording. You use the * request body to send the media data. Kinesis Video Streams supports only the Matroska (MKV) container format for * sending media data using this API. *

*

* You have the following options for sending data using this API: *

* *

* When using this API, note the following considerations: *

* * *

* If you send data to the same stream on multiple simultaneous PutMedia sessions, the media fragments * get interleaved on the stream. You should make sure that this is OK in your application scenario. *

*
*

* The following limits apply when using the PutMedia API: *

* *

* Note the following constraints. In these cases, Kinesis Video Streams sends the Error acknowledgement in the * response. *

* *

* Kinesis Video Streams stores each incoming fragment and related metadata in what is called a "chunk." The * fragment metadata includes the following: *

* * *

* When you make the GetMedia request, Kinesis Video Streams returns a stream of these chunks. The * client can process the metadata as needed. *

*
*

* This operation is only available for the AWS SDK for Java. It is not supported in AWS SDKs for other languages. *

*
* * @param request Represents the input of a PutMedia operation * @param responseHandler Handler to asynchronously process the {@link com.amazonaws.services.kinesisvideo.model.AckEvent} that * are received by the service. * @return Result of the PutMedia operation returned by the service. * @throws ResourceNotFoundException * Status Code: 404, The stream with the given name does not exist. * @throws NotAuthorizedException * Status Code: 403, The caller is not authorized to perform an operation on the given stream, or the token * has expired. * @throws 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. * @throws InvalidArgumentException * The value for this input parameter is invalid. * @throws ClientLimitExceededException * Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client * calls. Try making the call later. * @throws ConnectionLimitExceededException * Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client * connections. * @sample AmazonKinesisVideoMedia.PutMedia * @see AWS * API Documentation */ void putMedia(PutMediaRequest request, PutMediaAckResponseHandler responseHandler); /** * Closes the client and releases all resources like connection pools and threads. */ @Override void close(); }