Package com.amazonaws.ivs.broadcast
Class BroadcastSession.Listener
- java.lang.Object
-
- com.amazonaws.ivs.broadcast.BroadcastSession.Listener
-
- Enclosing class:
- BroadcastSession
public abstract static class BroadcastSession.Listener extends java.lang.Object
Provide a listener to receive status updates and errors from the SDK. Updates will be run on arbitrary threads and not the main thread.
-
-
Constructor Summary
Constructors Constructor Description Listener()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
onAudioStats(double peak, double rms)
Periodically called with audio peak and rms in dBFS.void
onBroadcastQualityChanged(double quality)
Deprecated.Prefer onTransmissionStatsChanged instead.void
onDeviceAdded(Device.Descriptor descriptor)
Indicates that a device has become availablevoid
onDeviceRemoved(Device.Descriptor descriptor)
Indicates that a device has become unavailableabstract void
onError(BroadcastException exception)
Indicates that an error occurred.void
onNetworkHealthChanged(double health)
Deprecated.Prefer onTransmissionStatsChanged instead.void
onRetryStateChanged(BroadcastSession.RetryState state)
Indicates that the SDK has updated it's retry state.abstract void
onStateChanged(BroadcastSession.State state)
Indicates that the broadcast state changed.void
onTransmissionStatsChanged(TransmissionStats statistics)
Periodically called with current statistics on the broadcast, such as the measured bitrate, recommended bitrate by the SDK's adaptive bitrate algorithm, average round trip time, broadcast quality (relative to configured minimum and maximum bitrates), and network health.
-
-
-
Method Detail
-
onStateChanged
public abstract void onStateChanged(@NonNull BroadcastSession.State state)
Indicates that the broadcast state changed.- Parameters:
state
- current broadcast state
-
onError
public abstract void onError(@NonNull BroadcastException exception)
Indicates that an error occurred. Errors may or may not be fatal and will be marked as such. In the case of a fatal error the broadcast session moves intoBroadcastSession.State.DISCONNECTED
state.- Parameters:
exception
- exception object with information for the error that occurred.
-
onDeviceAdded
public void onDeviceAdded(@NonNull Device.Descriptor descriptor)
Indicates that a device has become available- Parameters:
descriptor
- the device's descriptor
-
onDeviceRemoved
public void onDeviceRemoved(@NonNull Device.Descriptor descriptor)
Indicates that a device has become unavailable- Parameters:
descriptor
- the device's descriptor. This may not contain specific hardware information other than IDs.
-
onBroadcastQualityChanged
public void onBroadcastQualityChanged(double quality)
Deprecated.Prefer onTransmissionStatsChanged instead. A number between 0 and 1 that represents the quality of the stream based on bitrate minimum and maximum provided on session configuration. 0 means the stream is at the lowest possible quality, or streaming is not possible at all. 1 means the bitrate is near the maximum allowed. If the video configuration looks like: initial bitrate = 1000 kbps minimum bitrate = 300 kbps maximum bitrate = 5,000 kbps It will be expected that a low quality is provided to this callback initially, since the initial bitrate is much closer to the minimum allowed bitrate than the maximum. If network conditions are good the quality should improve over time towards the allowed maximum.- Parameters:
quality
- The quality of the stream
-
onNetworkHealthChanged
public void onNetworkHealthChanged(double health)
Deprecated.Prefer onTransmissionStatsChanged instead. A number between 0 and 1 that represents the current health of the network. 0 means the network is struggling to keep up and the broadcast may be experiencing latency spikes. The SDK may also reduce the quality of the broadcast on low values in order to keep it stable, depending on the minimum allowed bitrate in the broadcast configuration. A value of 1 means the network is easily able to keep up with the current demand and the SDK will be trying to increase the broadcast quality over time, depending on the maximum allowed bitrate. Lower values like 0.5 are not necessarily bad, it just means the network is being saturated, but it is still able to keep up.- Parameters:
health
- The instantaneous health of the network
-
onTransmissionStatsChanged
public void onTransmissionStatsChanged(TransmissionStats statistics)
Periodically called with current statistics on the broadcast, such as the measured bitrate, recommended bitrate by the SDK's adaptive bitrate algorithm, average round trip time, broadcast quality (relative to configured minimum and maximum bitrates), and network health. Expect this callback to be triggered on the BroadcastListener quite frequently (approximately twice per second) as the measured and recommended bitrates change. SeeTransmissionStats
documentation for further information on how to interpret the metrics.- Parameters:
statistics
- The current transmission stats
-
onRetryStateChanged
public void onRetryStateChanged(@NonNull BroadcastSession.RetryState state)
Indicates that the SDK has updated it's retry state. Retry state communicates the SDK's intentions for automatically reconnecting a failed broadcast. SeeBroadcastConfiguration.autoReconnect
for more details.- Parameters:
state
- The updated retry state.
-
onAudioStats
public void onAudioStats(double peak, double rms)
Periodically called with audio peak and rms in dBFS. Range is -100 (silent) to 0.- Parameters:
peak
- Audio Peak over the time periodrms
- Audio RMS over the time period
-
-