Hi, I'm facing a strange problem recently where `A...
# sdk-native
b
Hi, I'm facing a strange problem recently where
AudioVisualizerWidget
and in specific
SoundWaveformWidget
has stopped working (only in Flutter ios, while it's still working normally in Android).. I noticed this error in the log when I enable the mic..
Copy code
flutter: MissingPluginException(No implementation found for method listen on channel io.livekit.audio.visualizer/eventChannel-TR_AMfFK7gA2wHPvV-e7cbdbef-0a45-4a7d-af16-1e536434932f)
flutter: #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:365)
flutter: asynchronous suspension
flutter: #1      EventChannel.receiveBroadcastStream.anonymous closure (package:flutter/src/services/platform_channel.dart:712)
flutter: asynchronous suspension
A sample of used code
Copy code
return Container(
      height: 30,
        width: 100,
        child: ParticipantLoop(
        showAudioTracks: true,
        showVideoTracks: true,
        showParticipantPlaceholder: true,

        /// participant builder
        participantTrackBuilder:
            (context, identifier) {
              return SizedBox(height: 10,
                  width: 30,
                  child: ConsumerTrackReferenceContext?(
                    builder: (BuildContext context,
                        TrackReferenceContext? trackCtx, Widget? child) {
                      return Container(
                        color: Colors.transparent,
                        child: SoundWaveformWidget(
                          audioTrack: trackCtx?.audioTrack,
                          participant: trackCtx?.participant,
                          options: AudioVisualizerWidgetOptions(
                            barCount: 3,
                            // width: 12,
                            width: 5,
                            minHeight: 2,
                            maxHeight: 30,
                          ),
                        ),
                      );
                    },
                  ));
            }));
And I'm using livekit these versions:
Copy code
livekit_client: ^2.4.1
  livekit_components: ^1.0.0
Copy code
flutter doctor -v
[✓] Flutter (Channel stable, 3.35.1, on macOS 15.6.1 24G90 darwin-arm64, locale en-AE) [474ms]
    • Flutter version 3.35.1 on channel stable at /Users/ahmed/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 20f8274939 (10 days ago), 2025-08-14 10:53:09 -0700
    • Engine revision 1e9a811bf8
    • Dart version 3.9.0
    • DevTools version 2.48.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-lldb-debugging

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1) [2.5s]
    • Android SDK at /Users/ahmed/Library/Android/sdk
    • Emulator version 36.1.9.0 (build_id 13823996) (CL:N/A)
    • Platform android-35, build-tools 35.0.1
    • Java binary at: /opt/homebrew/opt/openjdk@23/libexec/openjdk.jdk/Contents/Home/bin/java
      This JDK is specified in your Flutter configuration.
      To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment Homebrew (build 23.0.2)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.4) [1,009ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16F6
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [80ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2025.1) [80ms]
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)

[✓] IntelliJ IDEA Community Edition (version 2024.3.3) [79ms]
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 83.0.4
    • Dart plugin version 243.23654.44

[✓] VS Code (version 1.103.1) [7ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.116.0

[✓] Connected device (5 available) [6.1s]
    • 2311DRK48G (mobile)            • OVJFYHOFXSONXKFU                     • android-arm64  • Android 15 (API 35)
    • Ahmed's iPhone (mobile)        • 00008110-0011689922DB801E            • ios            • iOS 18.6.2 22G100
    • iPad Pro 13-inch (M4) (mobile) • 3395B81F-2D65-4065-9A9D-4F198106B0E1 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-2 (simulator)
    • macOS (desktop)                • macos                                • darwin-arm64   • macOS 15.6.1 24G90 darwin-arm64
    • Chrome (web)                   • chrome                               • web-javascript • Google Chrome 139.0.7258.139

[✓] Network resources [1,232ms]
    • All expected network resources are available.

• No issues found!
Could you help with investigating this issue? I still recall that it was working properly before
r
The error message you are encountering,
MissingPluginException(No implementation found for method listen on channel io.livekit.audio.visualizer/eventChannel-TR_AMfFK7gA2wHPvV-e7cbdbef-0a45-4a7d-af16-1e536434932f)
, indicates that the Flutter application is unable to find the implementation for the specified method on the event channel. This typically occurs when the native side of the plugin is not correctly set up or registered. In your case, since the
SoundWaveformWidget
is not functioning on iOS but works on Android, it suggests that there might be an issue with the iOS implementation of the LiveKit plugin. Here are some steps to investigate and potentially resolve the issue: 1. Check Plugin Registration: Ensure that the
LiveKitPlugin
is correctly registered in your iOS project. The registration code should be present in the
AppDelegate.swift
file. It should look something like this:
Copy code
import UIKit
   import Flutter

   @UIApplicationMain
   class AppDelegate: FlutterAppDelegate {
       override func application(
           _ application: UIApplication,
           didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
       ) -> Bool {
           let controller: FlutterViewController = window?.rootViewController as! FlutterViewController
           LiveKitPlugin.register(with: registrar(forPlugin: "LiveKitPlugin"))
           return super.application(application, didFinishLaunchingWithOptions: launchOptions)
       }
   }
2. Check for iOS Specific Code: Ensure that the iOS-specific implementation of the
Visualizer
class is correctly handling the audio visualization. The
Visualizer
class implements
RTCAudioRenderer
and
FlutterStreamHandler
, which are crucial for audio rendering and event handling. Make sure that the methods
onListen
and
onCancel
are correctly implemented and that the event channel is set up properly. 3. Update Dependencies: Sometimes, issues arise from outdated dependencies. Ensure that you are using the latest versions of
livekit_client
and
livekit_components
. You can do this by running:
flutter pub upgrade
4. Clean and Rebuild: After making changes, clean your build and rebuild the project. You can do this using the following commands:
Copy code
flutter clean
   flutter pub get
5. Check for iOS Permissions: Ensure that your iOS app has the necessary permissions to access the microphone. This is typically set in the
Info.plist
file. You should have entries like:
Copy code
<key>NSMicrophoneUsageDescription</key>
   <string>We need access to your microphone for audio visualization.</string>
6. Debugging: If the issue persists, consider adding debug logs in the
onListen
and
onCancel
methods of the
Visualizer
class to see if they are being triggered correctly when the widget is used. If after following these steps the issue is still unresolved, please provide any additional logs or error messages that may help in further diagnosing the problem. Notes: - The
Visualizer
class is crucial for handling audio rendering and event streaming in the iOS implementation of the LiveKit plugin. Ensure that it is correctly set up and registered. - The
MissingPluginException
typically indicates that the Flutter side cannot find the native implementation, which can often be resolved by ensuring proper registration and setup of the plugin. References • livekit/client-sdk-flutter/shared_swift/Visualizer.swift#L1-L73 • livekit/client-sdk-flutter/README.md#L100-L158 • livekit/client-sdk-flutter/linux/livekit_plugin.cpp#L201-L249 • livekit/client-sdk-flutter/CHANGELOG.md#L325-L387
b
Thank you CWilson .. I went through all the steps mentioned, but no luck .. something is still wrong there..
I tried to upgrade both of livekit_client and livekit_component to the latest version, but this is not possible before of flutter_webrtc version discrepancy
@refined-appointment-81829 sorry for tagging you directly.. but my investigation till this moment, the problem happens in client SDK file (
lib/src/track/audio_visualizer_native.dart
) in start() method and in specific
Copy code
_streamSubscription =
        _eventChannel?.receiveBroadcastStream().listen((event) {
where
receivedBroadcastStream()
looks like doesn't have
listen
method .. I'm not sure what's wrong with this
@refined-appointment-81829 I fixed the issue .. It was because of this plugin https://pub.dev/packages/flutter_background_service And in specific this method
Copy code
Future<void> initializeService() async {
  final service = FlutterBackgroundService();

  await service.configure(
    iosConfiguration: IosConfiguration(
      autoStart: true,
      onForeground: onStart,
      onBackground: onIosBackground,
    ),
    androidConfiguration: AndroidConfiguration(
      autoStart: true,
      onStart: onStart,
      isForegroundMode: false,
      autoStartOnBoot: true,
    ),
  );
}
Not clear to me why
r
Interesting.... Thanks for letting me know