state

val state: SharedFlow<SubscriberState>

Flow providing the current subscriber's state.

Samples

import com.millicast.Subscriber
import com.millicast.clients.stats.InboundRtpStream
import com.millicast.clients.stats.RemoteInboundRtpStream
import com.millicast.clients.stats.Stats
import com.millicast.devices.track.AudioTrack
import com.millicast.subscribers.state.ActivityStream
import com.millicast.subscribers.state.Layers
import io.dolby.samples.utils.Log
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.launch
fun main() { 
   //sampleStart 
   coroutineScope.launch {
        // given a known subscriber object
        subscriber.state
            // we can then for instance filter on each distinct connectionState's modifications
            .map { it.connectionState }
            .distinctUntilChanged()
            .collect { connectionState ->
                // and then perform any operation that fit our logic
                // here just logging those
                log.d(tag, "new state received $connectionState")
            }
    } 
   //sampleEnd
}