[HELP]: About when to display the audio file duration in SoundPlayerUI
Here is my question :
First of all, thank you for creating a nice plugin.
What I would like to do this time is to call the fromTrack method of SoundPlayerUI and display how long the audio file is when the track is loaded. Is there any way to do this?
In the current situation, the duration is updated after the play button is pressed, so I want to change it when the track is loaded.
SoundPlayerUI.fromTrack(
track,
enabled: true,
showTitle: false,
audioFocus: AudioFocus.requestFocusAndDuckOthers,
),
I have used the duration function but I don't think it works with tracks. If you have the audio file saved or the link to that file you can pass it to that function.
I want to change it when the track is loaded.
Actually there is no call back when Flutter Sound finished the loading of the file. Maybe you can load the file yourself and display the duration with :
Duration d = flutterSoundHelper.duration(myAudioFile);
Thanks!! fine working
We are playing audio in SoundPlayerUI with url.. initially its showing 00:00 / 00:00 .. how can we display audio actual time in SoundPlayerUI widget?
I am not sure that we can know the duration before starting the playback.
@Alvarocda : can you look to this issue ?
It seems that we really need to open the sound during the openPlayer().
If we do that, we will know the duration after openPlayer() and before startPlayer()
There is a way for us to know the duration of the audio before starting the playback, I already had to do that once. If I'm not mistaken, this only works with the FULL version.
In issue 743 there is an example of how to do this
Unfortunately there will not have FULL/LITE in 9.0.
We will not link to FFmpeg. The only way to know the duration is to open the sound.
I really think that we should open the sound in openPlayer and start the playback in startPlayer().
This way it would be possible to show the duration without starting the playback
Thank you for your reply. It will be great help if we have this change. Thank you
I agree with you. This change would be great. The API would be cleaner. I would like this very much . But this change is not trivial and we actually have several contributors missing.
Personally I would like to start a new project : Taudio and I don't think I can do that if I have important maintenance to do on Flutter Sound.
We really need other contributors
@patelnirav48,
I am going to look for this change this afternoon. I will tell you after if I decide to do this change now and delay the Taudio project
@Larpoux Thank you very much, that will really a great help.
I have just decided to delay Taudio during several weeks because I think that this change will be great for Flutter Sound. That's a shame because I really think that Taudio will be a great project. But I cannot leave Flutter Sound dying without maintenance. Very soon we will have 777 likes on pub.dev. This means that I am working for 777 people who like what I am doing. It makes me feel good. Very good.
This will be Flutter Sound 10.x : it will be major breaking changes in the API
This issue is stale because it has been open 90 days with no activity. Leave a comment or this will be closed in 7 days.