Skip to content
This repository has been archived by the owner on Jan 20, 2023. It is now read-only.

MissingPluginException(No implementation found for method play on channel bz.rxla.flutter/audio) #2

Closed
TheDumbfounds opened this issue May 25, 2017 · 23 comments

Comments

@TheDumbfounds
Copy link

I ran the init method from the example provided, and as soon as I play the sound, I get the error. The play method is taken from the exaple as well. The only thing I replaced was the url to the sound.

@rxlabz
Copy link
Owner

rxlabz commented May 25, 2017

on an Android or iOS device ?

@TheDumbfounds
Copy link
Author

on Android

@rxlabz
Copy link
Owner

rxlabz commented May 25, 2017

did you runflutter build apk from the example folder ? ( cf. https://flutter.io/platform-plugins/#android-platform-code-javakt )

@TheDumbfounds
Copy link
Author

Yes, I did.

@rxlabz
Copy link
Owner

rxlabz commented May 25, 2017

just to be clear, the default example works, but your code based on it doesn't ?

@TheDumbfounds
Copy link
Author

Sorry, I put that wrong. I ran it on my code with the functions of the example project. I will try it out on the example project later, have to go now. I will let you know as soon as I do.

@TheDumbfounds
Copy link
Author

Okay, If I use the example as it is, it works fine. But as soon as I delete the main method, and instead instantiate the view at another point, it gives me the errors. Is it necessary that the sound view is the first one to load?

@rxlabz
Copy link
Owner

rxlabz commented May 25, 2017

Maybe you can try to apply the same "lifecycle" than the example : init the plugin on the initState of the widget which needs to use it ?

@rxlabz
Copy link
Owner

rxlabz commented May 27, 2017

This issue seems not related to the library code, so I close it for now. Let me know if you can make your own example work.

@rxlabz rxlabz closed this as completed May 27, 2017
@TheDumbfounds
Copy link
Author

Still can't seem to figure it out... Could you maybe have a look at it? I copied the example's main.dart into soundManager.dart, added a route and navigated to it in the grid.dart file. I still get the same errors.
https://github.com/Rechunk/Soundy

@rxlabz
Copy link
Owner

rxlabz commented May 29, 2017

your java MainActivity seems to be outdated, the Flutter plugin api changed a lot during last month or so. You should start with a new fresh project, or, update your flutter sdk, remove your android and iOS folders and flutter create .

@TheDumbfounds
Copy link
Author

Yes, you were right, it was outdated. Starting a fresh project solved the issue. Thank you a lot :)

@TheDumbfounds
Copy link
Author

I have one more question. How can I call a sound that is in the same folder as my script calling it (e.g. calling lib\sound.mp3 from lib\main.dart), instead of using an internet url?

@rxlabz
Copy link
Owner

rxlabz commented Jun 1, 2017

🤔 hmm... I have no tried this. Maybe you should look at the assets managements docs.
Not related : if this plugin is useful to you, please consider to ⭐️ it ;)

@TheDumbfounds
Copy link
Author

TheDumbfounds commented Jun 1, 2017

I'll for sure give it a star!
I saw that the README.md says you should use the isLocal parameter to play a local file.

I have tried an absolute path:
final result = await audioPlayer.play("C:/Users/User/Desktop/soundy/lib/TestSong.mp3", isLocal: true);

as well as a relative one:
final result = await audioPlayer.play("lib/TestSong.mp3", isLocal: true);

Unfortunately, either an error or no sound :/

@rxlabz
Copy link
Owner

rxlabz commented Jun 1, 2017

on mobile, each app has its own directory. Even the simulators work like this. In the example, I download the file in the dedicated app storage directory, and then can play it. But you AFAIK, you can only access to this "programmatically".
(thanks for the star :))

@TheDumbfounds
Copy link
Author

Okay, thank you :) No problem 👍

@cnqiuxue
Copy link

[ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception:
E/flutter (15713): MissingPluginException(No implementation found for method play on channel bz.rxla.flutter/audio)
E/flutter (15713): #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:291:7)
E/flutter (15713):
E/flutter (15713): #1 AudioPlayer.play (package:audioplayer/audioplayer.dart:47:22)
E/flutter (15713):
E/flutter (15713): #2 _MyHomePageState.play (package:flutter_face/main.dart:113:23)
E/flutter (15713):
E/flutter (15713): #3 _MyHomePageState._eventBack. (package:flutter_face/main.dart:123:7)
E/flutter (15713): #4 State.setState (package:flutter/src/widgets/framework.dart:1130:30)
E/flutter (15713): #5 _MyHomePageState._eventBack (package:flutter_face/main.dart:120:10)
E/flutter (15713): #6 _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
E/flutter (15713): #7 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
E/flutter (15713): #8 _DelayedData.perform (dart:async/stream_impl.dart:591:14)
E/flutter (15713): #9 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:707:11)
E/flutter (15713): #10 _PendingEvents.schedule. (dart:async/stream_impl.dart:667:7)
E/flutter (15713): #11 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter (15713): #12 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)

@shuiRong
Copy link

shuiRong commented May 24, 2019

Make a supplement: the location of the play method is important, for example:

play() async {
    int result = await audioPlayer.play('........mp3');
    if (result == 1) {
      // success
      print(1);
    }
  }


build(){
    ...
    // int result = await audioPlayer.play();  // will thorwn a `MissingPluginException` exception.
    return RaisedButton(
         onPressed: play // correct.
     )
}

@sarang06
Copy link

sarang06 commented Apr 8, 2020

make a new project and replicate your current app this resolved my issue!

@andzejsw
Copy link

The exception is thrown when you're doing hot reload or hot restart. I solved the problem by simply restarting the app

@dharmesh304
Copy link

dharmesh304 commented May 11, 2020

I have tried your latest plugin version 0.8.0 and later but it's give me exception MissingPluginException(No implementation found for method play on channel bz.rxla.flutter/audio)

When i tried with your version 0.7.0 then it's works fine.
can you help me resolve this issue in version 0.8.1 ?

@pdivita
Copy link

pdivita commented May 15, 2020

I have tried your latest plugin version 0.8.0 and later but it's give me exception MissingPluginException(No implementation found for method play on channel bz.rxla.flutter/audio)

When i tried with your version 0.7.0 then it's works fine.
can you help me resolve this issue in version 0.8.1 ?

Worked for me downgrading to 0.7.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants