Skip to content

[bug] Upgrade to 2.6.4 from 2.6.3 not work when using withPreConnectAudio #1019

@dourgulf

Description

@dourgulf

Describe the bug
Upgrade to 2.6.4 from 2.6.3. When using withPreConnectAudio method, it only sends the preconnecting audio to server, and later, it record nothing anymore.
To Reproduce

  1. Use version 2.6.4
  2. withPreConnectAudio to connect server like this:
await room.withPreConnectAudio(
  () async {
    final creds = await tokenService.fetch();
    await room.connect(creds.serverUrl, creds.participantToken);
    return true;
  },
  timeout: const Duration(seconds: 20),
  onError: (error) => logger.warning('Preconnect failed: $error'),
); 
// connected

Expected behavior

  1. It should send the preconnecting audio to server, and later, it should record the audio normally.

Platform information

  1. Flutter 3.38.10 Dart 3.10.9, Native iOS build with Xcode 26.3, running on iPhone13 with iOS 26.3.
  • Flutter version:
    Flutter 3.38.10 • channel stable • https://github.com/flutter/flutter.git
    Framework • revision c6f67dede3 (3 weeks ago) • 2026-02-10 11:05:04 -0800
    Engine • hash 3c25ef829c74f0f39fbb8df093d9a6b9f941ea6b (revision cafcda5721) (26 days ago) • 2026-02-06 18:51:35.000Z
    Tools • Dart 3.10.9 • DevTools 2.51.1
  • Plugin version:
    ??
  • Flutter target OS:
    iOS
  • Flutter target OS version:
  • iOS 26.3
  • Flutter console log:
[INFO] livekit: prepareConnection to wss://xxx.livekit.cloud
Type: Notice | Timestamp: 2026-03-05 14:18:39.177601+08:00 | Process: Runner | Library: Runner | TID: 0x221a93
[INFO] livekit: prepareConnection to wss://xxx.livekit.cloud
Type: Notice | Timestamp: 2026-03-05 14:18:39.177648+08:00 | Process: Runner | Library: Runner | TID: 0x221a93
[INFO] livekit: Starting audio renderer with rendererId: 84cd78bd-2e3a-4708-9286-7793fd7db7d4
Type: Notice | Timestamp: 2026-03-05 14:18:41.200632+08:00 | Process: Runner | Library: Runner | TID: 0x221a93
[INFO] livekit: startAudioRenderer result: true
Type: Notice | Timestamp: 2026-03-05 14:18:41.584932+08:00 | Process: Runner | Library: Runner | TID: 0x221a93
[INFO] livekit: Connectivity changed, [ConnectivityResult.wifi] => [ConnectivityResult.wifi]
Type: Notice | Timestamp: 2026-03-05 14:18:41.592853+08:00 | Process: Runner | Library: Runner | TID: 0x221a93
[INFO] livekit: ping config timeout: 15, interval: 5
Type: Notice | Timestamp: 2026-03-05 14:18:42.411462+08:00 | Process: Runner | Library: Runner | TID: 0x221a93
[INFO] livekit: Publishing preconnect audio track
Type: Notice | Timestamp: 2026-03-05 14:18:42.459752+08:00 | Process: Runner | Library: Runner | TID: 0x221a93
[INFO] livekit: [Preconnect audio] Agent is active: agent-AJ_q4YnQaVVaug8
Type: Notice | Timestamp: 2026-03-05 14:18:43.192038+08:00 | Process: Runner | Library: Runner | TID: 0x221a93
[INFO] livekit: [Preconnect audio] localTrackPublishedEvent: LocalTrackPublishedEvent(participant: LocalParticipant(sid: PA_ahBDMzS7xWSL, identity: 1111111111111), publication: LocalTrackPublication<LocalAudioTrack>(sid: TR_AMsHQqRVHyfb8J, source: TrackSource.microphone))
Type: Notice | Timestamp: 2026-03-05 14:18:43.192094+08:00 | Process: Runner | Library: Runner | TID: 0x221a93
[INFO] livekit: [Preconnect audio] sending audio data to agent-AJ_q4YnQaVVaug8 agent(s)
Type: Notice | Timestamp: 2026-03-05 14:18:43.192118+08:00 | Process: Runner | Library: Runner | TID: 0x221a93
[INFO] livekit: [Preconnect audio] data.length: 57104, bytes.length: 0
Type: Notice | Timestamp: 2026-03-05 14:18:43.192139+08:00 | Process: Runner | Library: Runner | TID: 0x221a93
[INFO] livekit: [Preconnect audio] streamOptions: StreamBytesOptions(name: null, mimeType: null, topic: lk.agent.pre-connect-audio-buffer, destinationIdentities: [agent-AJ_q4YnQaVVaug8], attributes: {sampleRate: 24000, channels: 1, commonFormat: int16, trackId: TR_AMsHQqRVHyfb8J}, streamId: null, totalSize: 57104, encryptionType: NONE)
Type: Notice | Timestamp: 2026-03-05 14:18:43.192159+08:00 | Process: Runner | Library: Runner | TID: 0x221a93
[INFO] livekit: [Preconnect audio] sent 55.8KB of audio (1.19 seconds) to [agent-AJ_q4YnQaVVaug8] agent(s)
Type: Notice | Timestamp: 2026-03-05 14:18:44.149770+08:00 | Process: Runner | Library: Runner | TID: 0x221a93
[INFO] livekit: [Preconnect audio] stopped recording
Type: Notice | Timestamp: 2026-03-05 14:18:44.364043+08:00 | Process: Runner | Library: Runner | TID: 0x221a93
[INFO] livekit: [Preconnect audio] reset
Type: Notice | Timestamp: 2026-03-05 14:18:44.364106+08:00 | Process: Runner | Library: Runner | TID: 0x221a93
[WARNING] [INFO] livekit: [RemoteTrackPublication<RemoteAudioTrack>#980043448] unnecessary dispose() called.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions