davidliu
Committed by GitHub

Expose remote audio track buffers (#268)

... ... @@ -17,6 +17,31 @@
package io.livekit.android.room.track
import org.webrtc.AudioTrack
import org.webrtc.AudioTrackSink
import org.webrtc.RtpReceiver
class RemoteAudioTrack(name: String, rtcTrack: AudioTrack, internal val receiver: RtpReceiver) : io.livekit.android.room.track.AudioTrack(name, rtcTrack)
class RemoteAudioTrack(
name: String,
rtcTrack: AudioTrack,
internal val receiver: RtpReceiver
) : io.livekit.android.room.track.AudioTrack(name, rtcTrack) {
/**
* Adds a sink that receives the audio bytes and related information
* for this audio track. Repeated calls using the same sink will
* only add the sink once.
*
* Implementations should copy the audio data into a local copy if they wish
* to use the data after this function returns.
*/
fun addSink(sink: AudioTrackSink) {
rtcTrack.addSink(sink)
}
/**
* Removes a previously added sink.
*/
fun removeSink(sink: AudioTrackSink) {
rtcTrack.removeSink(sink)
}
}
... ...