livekit / client-sdk-android

LiveKit SDK for Android
https://docs.livekit.io
Apache License 2.0
169 stars 68 forks source link

Exception when trying to publish data #265

Closed davidliu closed 11 months ago

davidliu commented 11 months ago

Bug from community slack: Slack Message

Hello, I always get the Exception when trying to publish data with android sdk(v1.2.2.), it doesn't help trying to switch the reliability type to LOSSY, I also get the message: channel not established, this is the Exception I get: io.livekit.android.room.track.TrackException$PublishException: channel not established for RELIABLE This is the method I use:

room.localParticipant.publishData(
                    data = data, // ByteArray
                    reliability = DataPublishReliability.RELIABLE,
                    destination = listOf(sId),
                    topic = null
                )

Is there anything else I should do in order to config the underlying data channels, or any other type of configuration? As far as I've seen, both data channels should be initialized when we call connect(). Just for clarity, I'm not trying to call publishData() as soon as I call connect().

Video and audio tracks work as expected, everything is fine regarding the video and audio quality, reproducing constantly on 2 devices I use for testing:

DraganVojvodic commented 11 months ago

Hi @davidliu I've managed to find out the bug in my code that was leading to this issue... The problem was the room object was accessed from multiple sides, and the object itself wasn't syncronized, I ended up creating two room object one of which wasn't connected to the server, and was causing the issue... I'm sorry for the trouble... 🙏

davidzhao commented 11 months ago

Thanks for the update @DraganVojvodic. I'm glad you got it figured out