Last active
November 14, 2017 11:38
-
-
Save lyokato/3a2090daff6b86dc2019acd1eb9d253e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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