Interface KinesisVideoProducerStream
-
- All Superinterfaces:
StreamCallbacks
- All Known Implementing Classes:
NativeKinesisVideoProducerStream,PendingCreationKinesisVideoStream
public interface KinesisVideoProducerStream extends StreamCallbacks
KinesisVideo stream interface
-
-
Field Summary
Fields Modifier and Type Field Description static longREADY_TIMEOUT_IN_MILLISECONDSReady timeout value in milliseconds for the sync APIstatic longSTOPPED_TIMEOUT_IN_MILLISECONDSStopped timeout value in milliseconds for the sync API
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidfragmentAck(long uploadHandle, KinesisVideoFragmentAck kinesisVideoFragmentAck)Reports an ACK for a fragment.InputStreamgetDataStream(long uploadHandle)Returns the input stream to retrieve the data from.KinesisVideoStreamMetricsgetMetrics()Returns stream specific metrics.voidgetStreamData(long uploadHandle, byte[] fillBuffer, int offset, int length, ReadResult readResult)Get stream data from the buffer.longgetStreamHandle()Returns the underlying native stream handleStreamInfogetStreamInfo()StringgetStreamName()Returns the stream namevoidparseFragmentAck(long uploadHandle, String kinesisVideoFragmentAck)Parses and processes a response which can contain partial/multiple fragment ACK.voidputEventMetadata(int event, StreamEventMetadata streamEventMetadata)Puts an event metadata into the stream.voidputFragmentMetadata(String metadataName, String metadataValue, boolean persistent)Puts a fragment metadata into the stream.voidputFrame(KinesisVideoFrame kinesisVideoFrame)Puts a frame into the stream.voidresetConnection()Reset current connection of producer streamvoidstopStream()Stops the Kinesis Video stream.voidstopStreamSync()Stops the Kinesis Video stream and awaits for the stream stopped notification in a sync call.voidstreamFormatChanged(byte[] codecPrivateData, int trackId)Indicates that the stream format has changed.voidstreamFreed()Free the Kinesis Video stream.voidstreamTerminated(long uploadHandle, int statusCode)Reports an abnormal stream termination-
Methods inherited from interface com.amazonaws.kinesisvideo.producer.StreamCallbacks
bufferDurationOverflowPressure, droppedFragmentReport, droppedFrameReport, fragmentAckReceived, streamClosed, streamConnectionStale, streamDataAvailable, streamErrorReport, streamLatencyPressure, streamReady, streamUnderflowReport
-
-
-
-
Field Detail
-
READY_TIMEOUT_IN_MILLISECONDS
static final long READY_TIMEOUT_IN_MILLISECONDS
Ready timeout value in milliseconds for the sync API- See Also:
- Constant Field Values
-
STOPPED_TIMEOUT_IN_MILLISECONDS
static final long STOPPED_TIMEOUT_IN_MILLISECONDS
Stopped timeout value in milliseconds for the sync API- See Also:
- Constant Field Values
-
-
Method Detail
-
getDataStream
@Nonnull InputStream getDataStream(long uploadHandle) throws ProducerException
Returns the input stream to retrieve the data from. NOTE: The returned stream should ideally be buffered likeBufferedInputStreamIMPORTANT: During the streaming token rotation or when the underlying stream gets closed the stream returned by this function will also close. The caller then should re-acquire a new stream by calling this API again.- Parameters:
uploadHandle- Client stream upload handle.- Returns:
InputStreamfor retrieving the data- Throws:
ProducerException
-
getStreamData
void getStreamData(long uploadHandle, @Nonnull byte[] fillBuffer, int offset, int length, @Nonnull ReadResult readResult) throws ProducerExceptionGet stream data from the buffer.- Parameters:
uploadHandle- Client stream upload handle.fillBuffer- The buffer to filloffset- The start of the bufferlength- The number of bytes to fillreadResult- The result of the read- Throws:
ProducerException
-
putFrame
void putFrame(@Nonnull KinesisVideoFrame kinesisVideoFrame) throws ProducerException
Puts a frame into the stream.- Throws:
ProducerException
-
putFragmentMetadata
void putFragmentMetadata(@Nonnull String metadataName, @Nonnull String metadataValue, boolean persistent) throws ProducerException
Puts a fragment metadata into the stream.- Throws:
ProducerException
-
putEventMetadata
void putEventMetadata(int event, @Nullable StreamEventMetadata streamEventMetadata) throws ProducerExceptionPuts an event metadata into the stream.- Throws:
ProducerException
-
fragmentAck
void fragmentAck(long uploadHandle, @Nonnull KinesisVideoFragmentAck kinesisVideoFragmentAck) throws ProducerExceptionReports an ACK for a fragment.- Parameters:
uploadHandle- Client stream upload handle.kinesisVideoFragmentAck- ACK string returned from the service.- Throws:
ProducerException
-
parseFragmentAck
void parseFragmentAck(long uploadHandle, @Nonnull String kinesisVideoFragmentAck) throws ProducerExceptionParses and processes a response which can contain partial/multiple fragment ACK.- Parameters:
uploadHandle- Client stream upload handle.kinesisVideoFragmentAck- ACK string returned from the service.- Throws:
ProducerException
-
streamFormatChanged
void streamFormatChanged(@Nullable byte[] codecPrivateData, int trackId) throws ProducerException
Indicates that the stream format has changed. NOTE: CPD is @Nullable - specifying a null will remove the CPD. NOTE: currently, only Codec Private Data is supported while not streaming.- Throws:
ProducerException
-
getStreamHandle
long getStreamHandle()
Returns the underlying native stream handle- Returns:
-
stopStream
void stopStream() throws ProducerExceptionStops the Kinesis Video stream. This simply kicks off stop stream operation but doesn't await for the resulting stream stopped notification.- Throws:
ProducerException
-
stopStreamSync
void stopStreamSync() throws ProducerExceptionStops the Kinesis Video stream and awaits for the stream stopped notification in a sync call.- Throws:
ProducerException
-
streamTerminated
void streamTerminated(long uploadHandle, int statusCode) throws ProducerExceptionReports an abnormal stream termination- Parameters:
uploadHandle- - Client stream upload handle.statusCode- - Status code of the termination.- Throws:
ProducerException
-
getMetrics
@Nonnull KinesisVideoStreamMetrics getMetrics() throws ProducerException
Returns stream specific metrics.- Returns:
- Stream metrics
- Throws:
ProducerException
-
streamFreed
void streamFreed() throws ProducerExceptionFree the Kinesis Video stream.- Throws:
ProducerException
-
resetConnection
void resetConnection() throws ProducerExceptionReset current connection of producer stream- Throws:
ProducerException
-
getStreamInfo
@Nonnull StreamInfo getStreamInfo()
-
-