PublisherListener

The PublisherListener interface provides a set of callback methods to handle various events and states during the publishing process. The interface is replaced with publisher.state.collect().

Functions

Link copied to clipboard
abstract fun onActive()

Called when the first viewer starts viewing the 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 onInactive()

Called when the last viewer stops viewing the stream.

Link copied to clipboard
abstract fun onPublishing()

Called when the publisher starts publishing content.

Link copied to clipboard
abstract fun onPublishingError(reason: String?)

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

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
open fun onTransformableFrame(ssrc: Int, timestamp: Int, data: ArrayList<Byte>)

Called after the frame has been encoded and is ready to gather metadata.

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

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