Subscriber

class Subscriber : Client<ISubscriber, InternalSubscriberListener>

The Subscriber class manages the subscription to audio and video tracks from the Millicast platform.

Properties

Link copied to clipboard
val activity: SharedFlow<ActivityStream>

Flow providing all activity events.

Link copied to clipboard

Gets the current publisher credentials.

Link copied to clipboard
val currentState: SubscriberState

Get the last subscriber's state which was emitted

Link copied to clipboard

Returns a boolean indicating whether the client is currently connected to the Millicast platform.

Link copied to clipboard

Checks whether the subscriber is currently subscribing to any media.

Link copied to clipboard
val layers: SharedFlow<Layers>

Flow providing all layers.

Link copied to clipboard
var onTransformableFrame: (ssrc: Int, timestamp: Int, data: ByteArray) -> Unit?

A callback that allows defining custom transformations or processing logic for video frames before they are rendered.

Link copied to clipboard
val rtcStatsReport: SharedFlow<RtsReport>

Flow providing all RTC statistics reports.

Link copied to clipboard
val signalingError: SharedFlow<String>

Flow providing all signaling errors that can be raised.

Link copied to clipboard
val state: SharedFlow<SubscriberState>

Flow providing the current subscriber's state.

Link copied to clipboard
val track: SharedFlow<TrackHolder>

Flow providing all tracks that can be generated.

Link copied to clipboard
val tracks: SharedFlow<TrackHolder>

Flow providing all the tracks that can be obtained, it's also possible to get the current list of tracks via the state.tracks

Link copied to clipboard
val vad: SharedFlow<Vad>

Flow providing all the Voice Activity Detection (VAD) events.

Functions

Link copied to clipboard
suspend fun addRemoteTrack(kind: TrackType)

Dynamically adds a new media track to the subscriber, which allows projecting another source. The method locally renegotiates Session Description Protocol (SDP).

Link copied to clipboard
suspend fun connect(connectionOptions: ConnectionOptions? = null)

Initiates a connection to the Millicast platform. By default, the SDK will always attempt to make auto reconnection. To disable this feature, pass a ConnectionOptions instance where autoReconnect is disabled.

Link copied to clipboard

Terminates the current connection to the Millicast platform. Any ongoing process of publishing or subscribing content is automatically stopped before termination. This method returns directly but will perform the call in its queue.

Link copied to clipboard
suspend fun enableFrameTransformer(enable: Boolean)

Enables or disables the frame transformation functionality.

Link copied to clipboard
suspend fun enableStats(enabled: Boolean)

Enables or disables the collection and reporting of real-time statistics associated with streaming sessions.

Link copied to clipboard
suspend fun getMid(trackId: String): String?

Retrieves the Media ID of the corresponding track, providing a unique identifier for the streamed media.

Link copied to clipboard
suspend fun project(sourceId: String?, projectionData: ArrayList<ProjectionData?>)

Selects and switches sources available on the platform and forwards the selected media to the subscriber.

Link copied to clipboard
fun release()

Releases any object involved with this instance. For example, object created in the native code which are not garbage collected Do not use this instance after calling release

Link copied to clipboard
suspend fun select(layer: LayerData?)

Selects a specific Simulcast or Scalable Video Coding (SVC) layer for a video track.

Link copied to clipboard
suspend fun setCredentials(credentials: Credential)

Sets the credentials, providing authentication information required for connecting to the streaming platform.

Link copied to clipboard
suspend fun subscribe(options: Option = Option())

Initiates the subscription process from the Millicast platform. Prior to calling this method, you must use the connect method to connect the subscriber to the platform. Successful subscription results in calling the onSubscribed method of the Listener.

Link copied to clipboard
suspend fun unproject(mids: ArrayList<String?>)

Stops projecting the subscriber's audio and video tracks.

Link copied to clipboard
suspend fun unsubscribe()

Stops the subscription process indicating to the streaming server that the subscriber is no longer interested in receiving audio and video content. After calling this method, the SDK automatically terminates the connection between the subscriber and the streaming platform.