livekit / client-sdk-flutter

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

[bug] No audio playback on Windows, but works fine in Chrome #546

Closed Unbreathable closed 1 week ago

Unbreathable commented 2 weeks ago

Describe the bug Audio playback is just not working when I build the test app I made because it doesn't work in my actual app. During where audio playback should happen, the talking indicators even light up, the only thing not working is the actual playback, I've also checked that it is not transmitting to any other audio devices, just nothing happens. The example app in this repo crashes for me, which means I can't really test with that, so I just built my own simple thing yesterday. One thing to note, too, is that the audio transmission works perfectly fine in Chrome with my sample app.

The code for my sample app is at: https://github.com/Unbreathable/livekit

Just for reference, this is the crash log of the example app in this repo on my system:

flutter: 10:31:20: [ParticipantEvent] LocalTrackPublishedEvent(participant: LocalParticipant(sid: PA_6ocdZj7jR5TX, identity: test1), publication: LocalTrackPublication<LocalAudioTrack>(sid: TR_AMVA5FtoKVcpYy, source: TrackSource.microphone)), will notifyListeners()
flutter: 10:31:20: [RoomEvent] LocalTrackPublishedEvent(participant: LocalParticipant(sid: PA_6ocdZj7jR5TX, identity: test1), publication: LocalTrackPublication<LocalAudioTrack>(sid: TR_AMVA5FtoKVcpYy, source: TrackSource.microphone)), will notifyListeners()
flutter: 10:31:20: got ICE candidate from peer (target: SUBSCRIBER)
flutter: 10:31:20: got ICE candidate from peer (target: SUBSCRIBER)
flutter: 10:31:20: got ICE candidate from peer (target: SUBSCRIBER)
flutter: 10:31:20: subscriber connectionState: RTCPeerConnectionState.RTCPeerConnectionStateConnected
flutter: 10:31:20: [EngineEvent] Engine#922257271 EngineSubscriberPeerStateUpdatedEvent(state: RTCPeerConnectionState.RTCPeerConnectionStateConnected, isPrimary: true)
flutter: 10:31:20: EventsEmitter<EngineEvent>#593414923 event was cancelled by func
flutter: 10:31:20: [EngineEvent] Engine#922257271 Instance of 'EngineConnectedEvent'
flutter: 10:31:20: subscriber iceConnectionState: RTCIceConnectionState.RTCIceConnectionStateConnected
[bad_variant_access.cc : 44] RAW: Bad variant access
Lost connection to device.

To Reproduce It's actually pretty simple, just use any LiveKit server (I've tested with both Cloud and my local one).

  1. Connect to the server using my sample app (cause the example app crashes)
  2. Turn on the microphone on any of them and select the devices you want to use for audio and playback
  3. You'll see that the talking indicators work, but the audio won't be transmitted (at least not for me)

Expected behavior The audio should be transmitted, but I think that's obvious.

Platform information

Unbreathable commented 2 weeks ago

After some more testing, I've found out that it must be the audio playback that's not working. I've tried to now transmit audio from Chrome to Windows and back by running one instance of my sample app in the browser and the other one just in the regular Windows app.

First case: Windows -> Chrome When I turn on my microphone on Windows, the audio plays in Chrome, just like it should.

Second case: Chrome -> Windows When I turn on my microphone in Chrome, the audio doesn't play on Windows. And this is the reason why I believe this has to be something to do with the audio playback on Windows.