SubscriberListener

The SubscriberListener interface provides a set of callback methods to handle various events and states during the subscription process. To use this interface and receive events from the Subscriber, you must inherit it and use the setListener method.

Functions

Link copied to clipboard
abstract fun onActive(streamId: String, track: Array<String>, sourceId: Optional<String>)

Called when a new source started to be published within a new stream.

Link copied to clipboard
abstract fun onConnected()

Called when the client successfully establishes a connection to the Millicast platform. This callback serves as a notification that the streaming session is now active and ready to transmit or receive data.

Link copied to clipboard
abstract fun onConnectionError(status: Int, @NonNull reason: String)

Called when an error occurs during the connection process.

Link copied to clipboard
abstract fun onDisconnected()

Called when the client disconnects from the Millicast platform. This callback provides an opportunity for the application to perform cleanup tasks or handle disconnection-related events. In the case of an unintended disconnection, a reconnect attempt happens automatically by default. To disable the automatic reconnect, set autoReconnect to false.

Link copied to clipboard
abstract fun onFrameMetadata(ssrc: Int, timestamp: Int, data: ByteArray)

Called after metadata have been extracted from a frame.

Link copied to clipboard
abstract fun onInactive(streamId: String, sourceId: Optional<String>)

Called when a source has been unpublished within a stream.

Link copied to clipboard
abstract fun onLayers(mid: String, activeLayers: Array<LayerData>, inactiveLayersEncodingIds: Array<String>)

Called when Simulcast or Scalable Video Coding (SVC) layers become available.

Link copied to clipboard
abstract fun onReleaseRequired()

Event telling that the current instance needs to release any ressources it holds and reset itself.

Link copied to clipboard
abstract fun onSignalingError(@NonNull reason: String)

Called when the Millicast platform sends back an error message in response to a connection request.

Link copied to clipboard
abstract fun onStatsReport(@NonNull report: RtsReport)

Called when the client receives a report containing statistics related to the streaming session. The stats parameter holds the statistical information, offering insights into aspects such as connection quality and other performance metrics. Reports are available only to clients who enabled statistics.

Link copied to clipboard
abstract fun onSubscribed()

Called when the subscriber starts receiving media.

Link copied to clipboard
abstract fun onSubscribedError(reason: String)

Called in the event of an error during the peer connection process.

Link copied to clipboard
abstract fun onTrack(track: AudioTrack, mid: Optional<String>)

Called when an audio track is added to the call.

abstract fun onTrack(track: VideoTrack, mid: Optional<String>)

Called when a video track is added to the call.

Link copied to clipboard
abstract fun onVad(mid: String, sourceId: Optional<String>)

Called when a source identifier is multiplexed into the audio track based on the voice activity level.

Link copied to clipboard
abstract fun onViewerCount(count: Int)

Called when the number of viewers in the streaming session changes.