I am trying to play audio file from asset on calling REST API using just_audio plugin. It can play the audio file only for the first time. I want to replay the audio every time I call API but I am unable to do that. The service is calling correctly but the sound file not playing neither it is giving any exception
Here is my code snippet:
socket.on('new_item', (data) async {
print(' RECEIVED: $data');
try {
await player.setAsset('assets/tone.mp3');
player.play();
} catch (eror) {
print('PLAY ERROR: $eror');
}
});
Can anyone help me with this issue. Thanks