How do I get data Uri .mp3 file time?


How can I set the status as Playing?
It still says that the Player must be in playing status.
I thought that by adding the TaifunPlayer.Start would work but it didn't.

try to get the Duration a few milliseconds later after the Player has been started
you can use a Clock component for that...

Tiafun

Hmmm, I don't understand.
Can you show me an example?
Thank you.

Ok, it is now working.
But it seems that the time displayed are milliseconds instead of seconds and I'm pretty sure I got to divide or something to get the seconds.
So, how can I convert the milliseconds into minutes?
I tried dividing the Duration by 60000 I don't know if it did worked or not it gives numbers that aren't similar to minutes.

yes, this is correct

It would really help if you provided a screenshot of your relevant blocks including Do it result of your Duration, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools
Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Let's say you have 1000ms this is 1s. If you divide it by 60000, you get the result 0.0166666667. It is 0.016 minutes, which is correct. If you want human readable minutes, use this block.

Instead of a box that says 60000, put your song duration there in millisecond format.

Thanks but how do I join that with the TaifunPlayer.CurrentPosition?
And sorry for not replying fast.

So the only way to do that is using Kodular?
Thanks for replying.

No, it's easier with Kodular, but it's also possible with AI2.

I see that some blocks are kind of the same as Taifun's Player extension.
So can you tell me what's the replacement?

It's late here, maybe more tomorrow ...
As I said it is possible. Show your blocks (and post the aia or a test aia).

Ok, no problem.

On my app there's a bug in the music notification for the two skip song buttons so, please don't press them if you do, refresh the companion.
I'm trying to fix that bug!
Headphones (1).aia (773.8 KB)
I know that the name doesn't match the app, it's just that I was doing something else before the music player app.

And I'll delete the aia tomorrow or the day after tomorrow because I don't want my game to be a victim of plagiarism.

Another bug that's on the app is that when you choose a song from the list view, the seconds doesn't appear.
Of course I'm trying to fix those bugs!

I think instead of starting with building an app, you should start with tutorials to learn coding basics in appinventor ...

I made a few fixes:
Headphones (2).aia (736.9 KB)

  • removed built-in Player component, works with Taifun Player.
  • I made the progress bar from the Canvas component, with a little imagination you can customize it as you want...clicking on the bar also works,
  • the list only contains file names, not whole pathes, it looks better.
  • I corrected the time display
1 Like

@TTG_Studioz
Note: The MediaStyleNotification (.PlayMusicNotification) does no longer work on Android 11 devices.

grafik

See also here:

Thanks for the fixes!

So the music notification doesn't work for android 11?

Well, I'm the type of guy that likes to learn while programming.

And also, this is an app that I've created that's is working a 100%

You can give me feedback on the play store if you want! :smiley:

1 Like

What could be misleading about this statement :question:

1 Like