Skip to content

Commit a852ac0

Browse files
authored
Class description JavaDoc for DefaultStreamCallbacks (#255)
* Class description for -DefaultStreamCallbacks * Add package-info for the streaming package * Typo: submit * Add streamName to the example log
1 parent ec6a945 commit a852ac0

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

src/main/java/com/amazonaws/kinesisvideo/streaming/DefaultStreamCallbacks.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,40 @@
66

77
import javax.annotation.Nonnull;
88

9+
/**
10+
* No-op implementation of stream callbacks. Extending this class allows convenient
11+
* implementation of certain callbacks while leaving the rest as no-op.
12+
*
13+
* <p>For example:</p>
14+
*
15+
* <pre>
16+
*StreamCallbacks streamCallbacks =
17+
* new DefaultStreamCallbacks() {
18+
* &#64;Override
19+
* public void fragmentAckReceived(final long uploadHandle, &#64;Nonnull final KinesisVideoFragmentAck fragmentAck) throws ProducerException {
20+
* super.fragmentAckReceived(uploadHandle, fragmentAck);
21+
*
22+
* // Stop submitting frames on user errors
23+
* if (fragmentAck.getAckType().getIntType() == FragmentAckType.FRAGMENT_ACK_TYPE_ERROR &amp;&amp;
24+
* 4000 &lt;= fragmentAck.getResult() &amp;&amp; fragmentAck.getResult() &lt; 5000) {
25+
* log.error("{} - Received an error ack: {}", streamName, fragmentAck);
26+
* mediaSource.stop();
27+
*
28+
* // Other logic...
29+
* }
30+
* }
31+
*
32+
* &#64;Override
33+
* public void streamErrorReport(final long uploadHandle, final long frameTimecode, final long statusCode) throws ProducerException {
34+
* super.streamErrorReport(uploadHandle, frameTimecode, statusCode);
35+
* log.error("{} Encountered a streaming error with status code: 0x{}", streamName, Long.toHexString(statusCode));
36+
* mediaSource.stop();
37+
*
38+
* // Other logic...
39+
* }
40+
* };
41+
*</pre>
42+
*/
943
public class DefaultStreamCallbacks implements StreamCallbacks {
1044
@Override
1145
public void streamUnderflowReport() throws ProducerException {
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* Concrete implementations of {@link com.amazonaws.kinesisvideo.producer.StreamCallbacks}.
3+
*/
4+
package com.amazonaws.kinesisvideo.streaming;

0 commit comments

Comments
 (0)