Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,40 @@

import javax.annotation.Nonnull;

/**
* No-op implementation of stream callbacks. Extending this class allows convenient
* implementation of certain callbacks while leaving the rest as no-op.
*
* <p>For example:</p>
*
* <pre>
*StreamCallbacks streamCallbacks =
* new DefaultStreamCallbacks() {
* &#64;Override
* public void fragmentAckReceived(final long uploadHandle, &#64;Nonnull final KinesisVideoFragmentAck fragmentAck) throws ProducerException {
* super.fragmentAckReceived(uploadHandle, fragmentAck);
*
* // Stop submitting frames on user errors
* if (fragmentAck.getAckType().getIntType() == FragmentAckType.FRAGMENT_ACK_TYPE_ERROR &amp;&amp;
* 4000 &lt;= fragmentAck.getResult() &amp;&amp; fragmentAck.getResult() &lt; 5000) {
* log.error("{} - Received an error ack: {}", streamName, fragmentAck);
* mediaSource.stop();
*
* // Other logic...
* }
* }
*
* &#64;Override
* public void streamErrorReport(final long uploadHandle, final long frameTimecode, final long statusCode) throws ProducerException {
* super.streamErrorReport(uploadHandle, frameTimecode, statusCode);
* log.error("{} Encountered a streaming error with status code: 0x{}", streamName, Long.toHexString(statusCode));
* mediaSource.stop();
*
* // Other logic...
* }
* };
*</pre>
*/
public class DefaultStreamCallbacks implements StreamCallbacks {
@Override
public void streamUnderflowReport() throws ProducerException {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Concrete implementations of {@link com.amazonaws.kinesisvideo.producer.StreamCallbacks}.
*/
package com.amazonaws.kinesisvideo.streaming;
Loading