Interface KinesisVideoProducerStream

    • 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 like BufferedInputStream IMPORTANT: 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:
        InputStream for retrieving the data
        Throws:
        ProducerException
      • getStreamData

        void getStreamData​(long uploadHandle,
                           @Nonnull
                           byte[] fillBuffer,
                           int offset,
                           int length,
                           @Nonnull
                           ReadResult readResult)
                    throws ProducerException
        Get stream data from the buffer.
        Parameters:
        uploadHandle - Client stream upload handle.
        fillBuffer - The buffer to fill
        offset - The start of the buffer
        length - The number of bytes to fill
        readResult - The result of the read
        Throws:
        ProducerException
      • parseFragmentAck

        void parseFragmentAck​(long uploadHandle,
                              @Nonnull
                              String kinesisVideoFragmentAck)
                       throws ProducerException
        Parses 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:
      • getStreamName

        @Nonnull
        String getStreamName()
        Returns the stream name
      • stopStream

        void stopStream()
                 throws ProducerException
        Stops 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 ProducerException
        Stops 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 ProducerException
        Reports an abnormal stream termination
        Parameters:
        uploadHandle - - Client stream upload handle.
        statusCode - - Status code of the termination.
        Throws:
        ProducerException