Data Track Stream
A stream of frames received from a subscribed RemoteDataTrack.
Collect flow or call next repeatedly. The stream ends when the track is unpublished or the subscription is cancelled.
Close the stream once you are done with it: the subscription lasts as long as the stream does, so an unclosed stream leaves the SFU forwarding frames for it.
remoteTrack.subscribe().onSuccess { stream ->
stream.use { it.flow.collect { frame -> process(frame.payload) } }
}Content copied to clipboard