tracks
Flow providing all the tracks that can be obtained, it's also possible to get the current list of tracks via the state.tracks
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
// when we only want audio tracks, we can pipe those events so that we
// obtain a new flow that fit a reporting mechanism.
// In this sample, the collect is made to call a lambda but the map can be used
// directly to feed a state, trigger recomposition etc...
subscriber.track
.filter { it.track is AudioTrack }
.map { it.mid!! to (it.track as AudioTrack) }
.collect { (mid, track) -> reportAudioTrack(mid, track) }
}
//sampleEnd
}