flutter_sound icon indicating copy to clipboard operation
flutter_sound copied to clipboard

[HELP]: About when to display the audio file duration in SoundPlayerUI

Open uchidacode opened this issue 4 years ago • 12 comments

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,
                  ),

uchidacode avatar Jun 19 '21 08:06 uchidacode

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.

Faaatman avatar Jul 14 '21 15:07 Faaatman

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);

Larpoux avatar Jul 14 '21 15:07 Larpoux

Thanks!! fine working

uchidacode avatar Jul 21 '21 05:07 uchidacode

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?

patelnirav48 avatar Jan 24 '22 12:01 patelnirav48

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()

Larpoux avatar Jan 24 '22 18:01 Larpoux

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

Alvarocda avatar Jan 24 '22 19:01 Alvarocda

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

Larpoux avatar Jan 24 '22 19:01 Larpoux

Thank you for your reply. It will be great help if we have this change. Thank you

patelnirav48 avatar Jan 25 '22 07:01 patelnirav48

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

Larpoux avatar Jan 31 '22 09:01 Larpoux

@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 avatar Jan 31 '22 10:01 Larpoux

@Larpoux Thank you very much, that will really a great help.

patelnirav48 avatar Jan 31 '22 10:01 patelnirav48

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

Larpoux avatar Jan 31 '22 13:01 Larpoux

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.

github-actions[bot] avatar Dec 15 '23 01:12 github-actions[bot]