I’m using just_audio
to play a sound from asset as shown below:
playSound() async{
await audioPlayer.setAsset(assetName,preload:true);
await audioPlayer.play();
}
It works fine for the first time but it throws the following error on the second call.
I/flutter ( 9944): Audio is stopped I/ExoPlayerImpl( 9944): Init 713a895 [ExoPlayerLib/2.18.7] [kiev, motorola one 5G ace, motorola, 30] I/ExoPlayerImpl( 9944): Release 713a895 [ExoPlayerLib/2.18.7] [kiev, motorola one 5G ace, motorola, 30] [goog.exo.core, goog.exo.exoplayer, goog.exo.decoder, goog.exo.datasource, goog.exo.extractor] E/flutter ( 9944): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(abort, Loading interrupted, null, null) E/flutter ( 9944): #0 AudioPlayer._setPlatformActive.checkInterruption (package:just_audio/just_audio.dart:1300:7) E/flutter ( 9944): #1 AudioPlayer._setPlatformActive.setPlatform (package:just_audio/just_audio.dart:1438:17) E/flutter ( 9944): <asynchronous suspension> E/flutter ( 9944): E/flutter ( 9944): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(abort, Loading interrupted, null, null)
It seems that it doesn’t allow to set the path for the asset if it is already set. Appreciate any feedback.