audioplayers icon indicating copy to clipboard operation
audioplayers copied to clipboard

Can not get duration before audio play

Open VCasecnikovs opened this issue 1 year ago • 2 comments

After setting the source I am trying to get the duration of the audio file. Unfortunately, the answer is zero.

The code:

    await player.setSource(event.source);
    var duration = await player.getDuration();

Platforms OS: Windows & Android

VCasecnikovs avatar Jul 14 '22 08:07 VCasecnikovs

This cannot be guaranteed in all cases. The problem is e.g. for mp3 the duration is estimated which only will precisely work if playing the audio. But I didn't experience that on Android/Windows yet...

Gustl22 avatar Jul 21 '22 20:07 Gustl22

I have the same issue here, just_audio offer get duration before we play audio, but there is already to much code I implement using audio_player

tffajari avatar Jul 27 '22 02:07 tffajari

Closing in favor of #1033

Gustl22 avatar Sep 27 '22 16:09 Gustl22