Skip to content

Fix start local audio - #1045

Closed
hiroshihorie wants to merge 6 commits into
mainfrom
hiroshi/fix-local-audio
Closed

Fix start local audio#1045
hiroshihorie wants to merge 6 commits into
mainfrom
hiroshi/fix-local-audio

Conversation

@hiroshihorie

@hiroshihorie hiroshihorie commented Mar 29, 2026

Copy link
Copy Markdown
Member

Ensure native ADM is started when track.start() is called so audio frames get generated (for visualizer)
Also expose manual adm start/stop methods.

@hiroshihorie
hiroshihorie marked this pull request as ready for review March 30, 2026 10:59
@hiroshihorie hiroshihorie changed the title Hiroshi/fix local audio Fix start local audio Mar 30, 2026
@github-actions

This comment has been minimized.

@bdlukaa

bdlukaa commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

@hiroshihorie when disposing the local track, the system says the audio is still being captured.

I feel like stopLocalRecording isn't being called on stop() or dispose().

@bdlukaa

bdlukaa commented May 4, 2026

Copy link
Copy Markdown
Contributor

I've been using this branch for a while.

iOS only.
I got this bug:

String: Unable to start local recording: Error: adm api failed with code: -1
#0      NativeAudioManagement.startLocalRecording (package:flutter_webrtc/src/native/audio_management.dart:79)
  File "<asynchronous suspension>"
#2      LocalAudioTrack.start (package:livekit_client/src/track/local/audio.dart:119)
  File "<asynchronous suspension>"
#4      _PreJoinScreenState._initializeLocalAudio (package:totem_app/features/sessions/screens/pre_join_screen.dart:223)
  File "<asynchronous suspension>"
#6      Future.wait.<fn> (dart:async/future.dart:546)
  File "<asynchronous suspension>"
#8      _PreJoinScreenState._initializeAndCheckPermissions.<fn> (package:totem_app/features/sessions/screens/pre_join_screen.dart:163)

@hiroshihorie

Copy link
Copy Markdown
Member Author

Closing this one, it has been superseded by #1115 (shipped in 2.9.0).

That PR moved audio processing setup into the capture start path, so track.start() now starts the native ADM through the SDK's own channel even when the track is not published. The visualizer use case this PR was for works on 2.9.0+ with a plain track.start(), no manual ADM calls needed.

@bdlukaa the two issues you reported here are also addressed by the new path: failures now surface as typed AudioProcessingException with a reason instead of the opaque adm error string, and tracks clean up capture when startup fails. If you still hit either on 2.9.0+ please open an issue.

The one part of this PR that did not land anywhere is the public Hardware.startLocalRecording/stopLocalRecording API. Will open a separate PR with @experimental annotations if a concrete use case for manual ADM control comes up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Audio Visualizer doesn't work for unpublished local audio tracks

2 participants