Skip to content

Instantly share code, notes, and snippets.

@lyokato
Last active November 14, 2017 11:38
Show Gist options
  • Save lyokato/3a2090daff6b86dc2019acd1eb9d253e to your computer and use it in GitHub Desktop.
Save lyokato/3a2090daff6b86dc2019acd1eb9d253e to your computer and use it in GitHub Desktop.
private var channelListener: SoraAudioChannel.Listener = object : SoraAudioChannel.Listener {
override fun onConnect(channel: SoraAudioChannel) {
ui?.changeStateText("CONNECTED")
}
override fun onClose(channel: SoraAudioChannel) {
ui?.changeStateText("CLOSED")
close()
}
override fun onError(channel: SoraAudioChannel, reason: SoraErrorReason) {
ui?.changeStateText("ERROR")
close()
}
override fun onAttendeesCountUpdated(channel: SoraAudioChannel, attendees: ChannelAttendeesCount) {
Log.d(TAG, "onAttendeesCountUpdated")
}
}
fun start() {
channel = SoraAudioChannel(
context = this,
signalingEndpoint = Config.SIGNALING_ENDPOINT,
channelId = channelName,
signalingMetadata = "",
codec = audioCodec,
streamType = streamType,
listener = channelListener
)
channel!!.connect()
}
fun mute() {
channel?.mute()
}
fun stop() {
channel?.disconnect()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment