idofilus / flutter_audio

Flutter Audio Plugin
MIT License
15 stars 14 forks source link

It falls when loading new audio #8

Closed mramirez11 closed 5 years ago

mramirez11 commented 5 years ago

I can load and reproduce the first audio, but when got out of the widget to load other element with a different audio, and I try reproduce a new audio, the app it falls.

The app says Exception has occurred. PlatformException (PlatformException(error, null, null))

The console print E/AndroidRuntime( 5103): java.lang.IllegalStateException E/AndroidRuntime( 5103): at android.media.MediaPlayer.isPlaying(Native Method) E/AndroidRuntime( 5103): at com.idofilus.audio.AudioPlayer$4.run(AudioPlayer.java:232) E/AndroidRuntime( 5103): at android.os.Handler.handleCallback(Handler.java:751) E/AndroidRuntime( 5103): at android.os.Handler.dispatchMessage(Handler.java:95) E/AndroidRuntime( 5103): at android.os.Looper.loop(Looper.java:154) E/AndroidRuntime( 5103): at android.app.ActivityThread.main(ActivityThread.java:6077) E/AndroidRuntime( 5103): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime( 5103): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) E/AndroidRuntime( 5103): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)

I think that maybe it could be the state of thw widgets, so I change it to stateful, but still continue failed.

Someone can help me?

mramirez11 commented 5 years ago

I could solve this problem, just change the single atributte of the Audio class to false. Audio audioPlayer = new Audio(single: false);