livekit / client-sdk-flutter

Flutter Client SDK for LiveKit
https://docs.livekit.io
Apache License 2.0
261 stars 132 forks source link

Data Publish and Events not working Flutter 3 #126

Closed litzbalane2017 closed 2 years ago

litzbalane2017 commented 2 years ago

Good Day.

I just updated a week ago to Flutter 3. I noticed that publish data is not working anymore. It used to work well before the upgrade. Here is my flutter doctor:

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.0.1, on Ubuntu 18.04.6 LTS 4.15.0-177-generic, locale en_PH.UTF-8) [✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) [✗] Linux toolchain - develop for Linux desktop ✗ GTK 3.0 development libraries are required for Linux development. They are likely available from your distribution (e.g.: apt install libgtk-3-dev) [✓] Android Studio (version 2021.1) [✓] IntelliJ IDEA Community Edition (version 2021.3) [✓] VS Code (version 1.62.3) [✓] Connected device (2 available) [✓] HTTP Host Availability

Can I have confirmation if it is working on your end?

cloudwebrtc commented 2 years ago

Are there any flutter console logs? This will help with debugging.

litzbalane2017 commented 2 years ago

Good Day.

I already update my livekit-server version 1.0.2 and livekit_client: ^1.0.0. The same issue exists. Here is the console logs, every after data publish attempt.

V/AudioManager( 5136): getStreamVolume streamType: 0 volume: 15
I/org.webrtc.Logging( 5136): VolumeLogger: VOICE_CALL stream volume: 15 (max=15)
V/AudioManager( 5136): querySoundEffectsEnabled...
D/FlutterWebRTCPlugin( 5136): dataChannelSend() dataChannel is null
I/TextInputPlugin( 5136): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 5136): getExtractedText on inactive InputConnection
W/IInputConnectionWrapper( 5136): getTextBeforeCursor on inactive InputConnection
E/SpannableStringBuilder( 5136): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
E/SpannableStringBuilder( 5136): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
I/org.webrtc.Logging( 5136): EglRenderer: Duration: 4003 ms. Frames received: 58. Dropped: 0. Rendered: 58. Render fps: 14.5. Average render time: 4586 us. Average swapBuffer time: 2770 us.
I/org.webrtc.Logging( 5136): EglRenderer: Duration: 4006 ms. Frames received: 69. Dropped: 0. Rendered: 69. Render fps: 17.2. Average render time: 4089 us. Average swapBuffer time: 2609 us.
I/org.webrtc.Logging( 5136): EglRenderer: Duration: 4002 ms. Frames received: 79. Dropped: 0. Rendered: 79. Render fps: 19.7. Average render time: 4239 us. Average swapBuffer time: 2676 us.

I have been publishing data thru:

_liveSellingRoom?.localParticipant?.publishData(utf8.encode(value));

Hope this helps. Thank you.

jdde commented 2 years ago

For us it's working with flutter v3. But we're using Utf8Encoder().convert() to encode data. Don't know if utf8.encode is wrapping the same logic @litzbalane2017

cloudwebrtc commented 2 years ago

@litzbalane2017 Have you tried upgrading both livekit server and client-sdk-flutter to the latest version? I think this error is caused because the data channel did not successfully establish a connection.

The example uses similar codes, and there is no problem in sending data through a normal connection.

await widget.participant.publishData(
         utf8.encode('This is a sample data message'),
       );
litzbalane2017 commented 2 years ago

For us it's working with flutter v3. But we're using Utf8Encoder().convert() to encode data. Don't know if utf8.encode is wrapping the same logic @litzbalane2017

Yes, I also tried "Utf8Encoder().convert()" did not work on my end.

However, I tried installing the sample project of livekit-client and it is working fine. Pretty sure it is on my end.

Closing, since I can confirm it is working on sample project.