Creating an audio progress bar

Hi,

I can see there are solutions to this problem for the Classic platform, but not for the cross-platform version.

I am creating a simple audio player, and would like to display a progress bar that fills up dependent upon how much of the audio file has been played.

I would expect to see some options on the sound file to say “send max time to the slider element” or something similar, but cannot find anything! Does anyone know how to set this functionality in the cross-platform version? I’m not looking for it to have a seek-bar functionality, just a progress bar.

Thanks!

If you can read audio length and current position in e.g. seconds, then it’s easy. If track_length = 100%, then progressbar_position = (current_position/track_length)*100

Example:
track_length: 3 min (180 sec) - 100%
current_position: 35 sec
progressbar_position: (35/180) * 100 = 0.1944444 * 100 = 19.4 (19%)

1 Like

Yep that’s what I would have thought too, but I can’t find the options on Thunkable X. Do you know if that is included (and I’m just being dumb not being able to find it!)? Whenever I look in the blocks for “Sound1” it only gives options like play, pause, stop and “on load” etc.

Thanks!

Hey @greg_m1993, are your audio files coming from random playlists, or will you know in advance the source (and duration?) of the songs?

Hey, they’ll be fairly random to be honest. My users will be uploading audio files that have varying duration which will be stored in my AWS database, and then this app will be using an API to get the URL to play them (so will all be different lengths).

Sounds good :+1:. Are you writing this API yourself or is it third-party? Is there any way obtain track length through this??

Writing it myself - at the moment it is not stored by default but I may be able to change that. Is this the only way to do it in the X platform?

Alternatively, would you suggest using the classic platform to build?

Thanks!

Well, the track length is in the track metadata anyway, so if there’s some way to include or expose this via your API then that seems like the best way to proceed.

I don’t think Classic would be a good choice in this particular case, the projects are limited to just 10MB in size, there’s no support for iOS and, most importantly, there’s no trackDuration in the sound or player component either.

1 Like

Hi Thunkers, I have a list of songs on the firebase storage. Im a newbie to programming. How can I link a button to play 1 of the songs on the data base.

Please help.

1 Like

Hi Donavan,

I am also trying to do this. Did you have any success with it?