New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Asset sound only plays the first time #584
Labels
bug
Something isn't working
Comments
I've also tried playing the sound manually when load finishes with the same result: player = AssetsAudioPlayer.newPlayer();
player
.open(
Audio("assets/mp3/disconnect.mp3"),
autoStart: false,
showNotification: false,
volume: 0.3,
)
.then((value) => player.play())
.catchError((e) => print("ERROR playing the disconnecting sound")); |
Playing it natively worked great 😯 MethodChannel(flutterEngine.dartExecutor.binaryMessenger, SOUND_CHANNEL).setMethodCallHandler { call, result ->
val method = call.method
if (method == "disconnect") {
val mp: MediaPlayer = MediaPlayer.create(this, R.raw.disconnect)
mp.start()
mp.setOnCompletionListener {
mp.release()
}
}
} |
Can you try Audio.file instead of using only Audio. and open method is future use await for initializing correctly. Here is the edited your code.
|
I'll try! :·) |
and ? |
Never did 😅 I ran it natively and my iOS colleague did it too. Sorry for the broken expectations! 🙏 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Flutter Version
Flutter 2.2.1 • channel stable
Lib Version
^3.0.3+3
Platform (Android / iOS / web) + version
Android
Describe the bug
If you play an asset sound, it works. But if you play it again, it doesn't sound anymore. It only plays the first time you opened it. Maybe something is leaking the audio file? By the way, I'm disposing the AudioPlayer when needed.
Small code to reproduce
The text was updated successfully, but these errors were encountered: