flutter-pi icon indicating copy to clipboard operation
flutter-pi copied to clipboard

Audioplayers MissingPluginException

Open Winterteq opened this issue 1 year ago • 8 comments

Hey!

flutter-pi for the most part has worked great for my app. it seems to be running (albeit a little slow because of my old RPI3!).

However I am using the audioplayers package on my app - it works fine when I run on my windows machine, but when I build on WSL and move the bundle across to my rpi and run with flutter-pi I get the following error:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method create on channel xyz.luan/audioplayers) #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:332:7) <asynchronous suspension> #1 AudioplayersPlatform.create (package:audioplayers_platform_interface/src/audioplayers_platform.dart:18.5) <asynchronous suspension> #2 AudioPlayer._create (package:audioplayers/src/audioplayer.dart:161:7) <asynchronous suspension>

To confirm the steps I have taken is:

  1. Developed functioning app on Windows dev machine using libraries that all support linux.
  2. Used WSL with latest flutter stable build to build the code using flutter build bundle
  3. Transferred the assets from the "build" folder in my project over to my raspberry pi
  4. used "flutter-pi build

The app runs and appears on the screen, but the features requiring the audioplayers app are throwing this error.

any help would be appreciated!

Winterteq avatar May 17 '24 11:05 Winterteq

Hi,

I ran into this problem, too.

In addition to the points mentioned above:

I followed the instructions given in the readme and verified the audio setup using gst-launch-1.0 -v playbin uri=file:///home/pi/my_apps_flutter_assets/assets/path_to_audio.mp3.

Using gst-launch everything works fine and the audiofiles are played as expected.

I tried both audioplayers versions: ^5.0.0 and ^6.0.0 with the same error.

Any ideas on how to fix this would be appreciated :)

HSVDO avatar May 30 '24 23:05 HSVDO

Any updates on this topic? Same error here

popgas-admin avatar Mar 24 '25 03:03 popgas-admin

Did you build flutter-pi with audioplayers support?

cmake -DBUILD_GSTREAMER_AUDIO_PLAYER_PLUGIN=ON -DTRY_BUILD_GSTREAMER_AUDIO_PLAYER_PLUGIN=OFF ...

ardera avatar Mar 24 '25 12:03 ardera

Hi, did anyone get a solution to this one?

I'm running the latest version of flutter-pi on Linux:

$ cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 13 (trixie)"
NAME="Debian GNU/Linux"
VERSION_ID="13"
VERSION="13 (trixie)"
VERSION_CODENAME=trixie
DEBIAN_VERSION_FULL=13.1
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

I've build with all the BUILD_GSTREAMER... options but I still get the error:

MissingPluginException(No implementation found for method listen on channel xyz.luan/audioplayers.global/events)
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:365)

#1      EventChannel.receiveBroadcastStream. (package:flutter/src/services/platform_channel.dart:712)

The flutter-pi binary appears to have linked with all the correct libraries:

$ ldd /usr/bin/flutter-pi linux-vdso.so.1 (0x0000007f9769f000) libgbm.so.1 => /lib/aarch64-linux-gnu/libgbm.so.1 (0x0000007f97620000) libsystemd.so.0 => /lib/aarch64-linux-gnu/libsystemd.so.0 (0x0000007f974f0000) libinput.so.10 => /lib/aarch64-linux-gnu/libinput.so.10 (0x0000007f97470000) libxkbcommon.so.0 => /lib/aarch64-linux-gnu/libxkbcommon.so.0 (0x0000007f97400000) libudev.so.1 => /lib/aarch64-linux-gnu/libudev.so.1 (0x0000007f973a0000) libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000007f972f0000) libEGL.so.1 => /lib/aarch64-linux-gnu/libEGL.so.1 (0x0000007f972b0000) libGLESv2.so.2 => /lib/aarch64-linux-gnu/libGLESv2.so.2 (0x0000007f97260000) libseat.so.1 => /lib/aarch64-linux-gnu/libseat.so.1 (0x0000007f97230000) libgstapp-1.0.so.0 => /lib/aarch64-linux-gnu/libgstapp-1.0.so.0 (0x0000007f971f0000) libgstallocators-1.0.so.0 => /lib/aarch64-linux-gnu/libgstallocators-1.0.so.0 (0x0000007f971c0000) libdrm.so.2 => /lib/aarch64-linux-gnu/libdrm.so.2 (0x0000007f97180000) libgstvideo-1.0.so.0 => /lib/aarch64-linux-gnu/libgstvideo-1.0.so.0 (0x0000007f97080000) libgstbase-1.0.so.0 => /lib/aarch64-linux-gnu/libgstbase-1.0.so.0 (0x0000007f96fd0000) libgstreamer-1.0.so.0 => /lib/aarch64-linux-gnu/libgstreamer-1.0.so.0 (0x0000007f96e30000) libgobject-2.0.so.0 => /lib/aarch64-linux-gnu/libgobject-2.0.so.0 (0x0000007f96da0000) libglib-2.0.so.0 => /lib/aarch64-linux-gnu/libglib-2.0.so.0 (0x0000007f96c10000) libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000007f96a50000) libexpat.so.1 => /lib/aarch64-linux-gnu/libexpat.so.1 (0x0000007f96a00000) /lib/ld-linux-aarch64.so.1 (0x0000007f97650000) libcap.so.2 => /lib/aarch64-linux-gnu/libcap.so.2 (0x0000007f969d0000) libmtdev.so.1 => /lib/aarch64-linux-gnu/libmtdev.so.1 (0x0000007f969a0000) libevdev.so.2 => /lib/aarch64-linux-gnu/libevdev.so.2 (0x0000007f96960000) libwacom.so.9 => /lib/aarch64-linux-gnu/libwacom.so.9 (0x0000007f96930000) libGLdispatch.so.0 => /lib/aarch64-linux-gnu/libGLdispatch.so.0 (0x0000007f967a0000) liborc-0.4.so.0 => /lib/aarch64-linux-gnu/liborc-0.4.so.0 (0x0000007f966d0000) libgmodule-2.0.so.0 => /lib/aarch64-linux-gnu/libgmodule-2.0.so.0 (0x0000007f966a0000) libffi.so.8 => /lib/aarch64-linux-gnu/libffi.so.8 (0x0000007f96670000) libatomic.so.1 => /lib/aarch64-linux-gnu/libatomic.so.1 (0x0000007f96640000) libpcre2-8.so.0 => /lib/aarch64-linux-gnu/libpcre2-8.so.0 (0x0000007f96580000) libgudev-1.0.so.0 => /lib/aarch64-linux-gnu/libgudev-1.0.so.0 (0x0000007f96550000) $

philseeley avatar Nov 20 '25 14:11 philseeley

@philseeley Hey, can you try building with these parameters:

cmake ... -DBUILD_GSTREAMER_AUDIO_PLAYER_PLUGIN=ON -DTRY_BUILD_GSTREAMER_AUDIO_PLAYER_PLUGIN=OFF

The off on the second one is important, otherwise it'll happily continue building flutter-pi without the plugin, if required libraries were not found :)

ardera avatar Nov 20 '25 15:11 ardera

Hi @ardera,

Thanks for the quick reply.

Just to confirm all the steps on the target Raspberry Pi4:

$ sudo apt install cmake libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev ttf-mscorefonts-installer fontconfig libsystemd-dev libinput-dev libudev-dev  libxkbcommon-dev
$ sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-alsa
$ sudo fc-cache
$ git clone --recursive https://github.com/ardera/flutter-pi
$ cd flutter-pi
$ mkdir build && cd build
$ cmake -DBUILD_GSTREAMER_AUDIO_PLAYER_PLUGIN=ON -DTRY_BUILD_GSTREAMER_AUDIO_PLAYER_PLUGIN=OFF ..
$ make -j`nproc`
$ ./flutter-pi --release ~/pi4-64/

Same result:

MissingPluginException(No implementation found for method listen on channel xyz.luan/audioplayers.global/events)
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:365)

#1      EventChannel.receiveBroadcastStream. (package:flutter/src/services/platform_channel.dart:712)

The flutterpi_tool is run on my Fedora42 dev laptop with:

$ flutterpi_tool build --arch=arm64 --cpu=pi4 --release

and the pi4-64 directory is copied to the target Raspberry Pi4:

$ scp -r build/flutter-pi/pi4-64 bi:

Note: the instructions say to scp the flutter_assets directory, but I think this has changed as this doesn't work:

$ ./flutter-pi --release ~/flutter_assets/
filesystem_layout.c: icudtl file not found!

Any other debug that would help?

Cheers Phil

philseeley avatar Nov 21 '25 10:11 philseeley

Bit more info...

Well it turns out the audio does come out of the speaker jack, but it logs lots of errors:

$ ./flutter-pi --release ~/pi4-64/
MissingPluginException(No implementation found for method listen on channel xyz.luan/audioplayers.global/events)
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:365)

#1      EventChannel.receiveBroadcastStream. (package:flutter/src/services/platform_channel.dart:712)

plugins/audioplayers/player.c: Could not query current position.
AudioPlayers Exception: AudioPlayerException(
	AssetSource(path: warning.mp3, mimeType: null), 
	UnimplementedError: Event Method does not exist audio.onCurrentPosition
#0      EventChannelAudioplayersPlatform.createEventStream. (package:audioplayers_platform_interface/src/audioplayers_platform.dart:273)
#1      _MapStream._handleData (dart:async/stream_pipe.dart:247)
#2      _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:184)
#3      _RootZone.runUnaryGuarded (dart:async/zone.dart:1778)
#4      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:381)
#5      _DelayedData.perform (dart:async/stream_impl.dart:573)
#6      _PendingEvents.handleNext (dart:async/stream_impl.dart:678)
#7      _PendingEvents.schedule. (dart:async/stream_impl.dart:649)
#8      _microtaskLoop (dart:async/schedule_microtask.dart:40)
#9      _startMicrotaskLoop (dart:async/schedule_microtask.dart:49)

plugins/audioplayers/player.c: Could not query current duration.
AudioPlayers Exception: AudioPlayerException(
	AssetSource(path: warning.mp3, mimeType: null), 
	UnimplementedError: Event Method does not exist audio.onCurrentPosition
#0      EventChannelAudioplayersPlatform.createEventStream. (package:audioplayers_platform_interface/src/audioplayers_platform.dart:273)
#1      _MapStream._handleData (dart:async/stream_pipe.dart:247)
#2      _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:184)
#3      _RootZone.runUnaryGuarded (dart:async/zone.dart:1778)
#4      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:381)
#5      _DelayedData.perform (dart:async/stream_impl.dart:573)
#6      _PendingEvents.handleNext (dart:async/stream_impl.dart:678)
#7      _PendingEvents.schedule. (dart:async/stream_impl.dart:649)
#8      _microtaskLoop (dart:async/schedule_microtask.dart:40)
#9      _startMicrotaskLoop (dart:async/schedule_microtask.dart:49)

plugins/audioplayers/player.c: Could not query current duration.
AudioPlayers Exception: AudioPlayerException(
	AssetSource(path: warning.mp3, mimeType: null), 
	UnimplementedError: Event Method does not exist audio.onCurrentPosition
#0      EventChannelAudioplayersPlatform.createEventStream. (package:audioplayers_platform_interface/src/audioplayers_platform.dart:273)
#1      _MapStream._handleData (dart:async/stream_pipe.dart:247)
#2      _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:184)
#3      _RootZone.runUnaryGuarded (dart:async/zone.dart:1778)
#4      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:381)
#5      _DelayedData.perform (dart:async/stream_impl.dart:573)
#6      _PendingEvents.handleNext (dart:async/stream_impl.dart:678)
#7      _PendingEvents.schedule. (dart:async/stream_impl.dart:649)
#8      _microtaskLoop (dart:async/schedule_microtask.dart:40)
#9      _startMicrotaskLoop (dart:async/schedule_microtask.dart:49)

Another thing I tried was "ssh -X" into the Pi4 and ran the app without flutter-pi, getting the display remotely on my laptop and this runs without logging any errors.

philseeley avatar Nov 21 '25 10:11 philseeley

Look like this is related to:

  • https://github.com/bluefireteam/audioplayers/issues/1154
  • https://github.com/ardera/flutter-pi/issues/408
  • https://github.com/ardera/flutter-pi/issues/120 - looks like it previously assumed Linux and worked

Using a test app I can see that the when running under flutter-pi the, possibly updated, way of accessing platform plugins now throws a MissingPluginException.

Steps to recreate test app. Note: all steps run on Pi4 after sshing in with "-X":

$ flutter create --template plugin --platforms linux test
$ cd test/example/
$ flutter build linux

Running the test app on the Pi4 with X forwarding to my laptop:

$ build/linux/arm64/release/bundle/test_example

Gives:

Image

Running under flutter-pi:

$ flutterpi_tool build --arch=arm64 --cpu=pi4 --release 
$ ~/flutter-pi/build/flutter-pi --release build/flutter-pi/pi4-64/
[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: MissingPluginException(No implementation found for method getPlatformVersion on channel test)
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:365)

#1      MethodChannelTest.getPlatformVersion (package:test/test_method_channel.dart:14)

#2      _MyAppState.initPlatformState (package:test_example/main.dart:35)

Hope that helps.

philseeley avatar Nov 22 '25 10:11 philseeley