Reading the song length of MP3 files in app inventor?

836 views
Skip to first unread message

Piezor

unread,
Oct 5, 2014, 4:01:03 AM10/5/14
to mitappinv...@googlegroups.com
Hey guys,

I planned to build an app which involved, playing an mp3 file, and then playing the next MP3 when the song is finished, but...
There seems to be no real way that I can read information about the song length, so app inventor can know when to play the next song, after the first is finished.

I thought I could rename each song with the song length on the end of it, but still there seems to be no way that I know of to read the file name.

Does anyone know how to read the file names, or just read the length of an MP3 in app inventor?

Cheers!

Gareth Haylings

unread,
Oct 5, 2014, 7:37:09 AM10/5/14
to mitappinv...@googlegroups.com
The easiest solution is if you use a player component. Use the player1.completed event block to detect when the current mp3 is finshed playing. In this event block you can then change to the next mp3 and start it playing like this

 

Piezor

unread,
Oct 5, 2014, 3:14:03 PM10/5/14
to
Ahh yes, but the player component prevents the use of using the phones SD card music, and I have to upload every song individually?(don't i)? Where some of the songs are over 10MB.
That's why i've been using activity starter. I'm just thinking, if there's a component that is able to browse and at least read the names of MP3 files on my SD card somehow, I will be able to do it.

Taifun

unread,
Oct 5, 2014, 3:21:58 PM10/5/14
to mitappinv...@googlegroups.com
you don't have to upload the files, but you need the names and the path to the files in the app to be able to play them
Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         

Piezor

unread,
Oct 5, 2014, 4:08:04 PM10/5/14
to
Hmmm, ok How would I go about accessing the files on a Nexus 5, I've tried using  "file:///sdcard" to access them but nothing.
I used "
file:///storage/emulated/0/Music/App inventor music/glitchmob/1.mp3" to access them via Activity starter, but doesn't work for player component.
Thanks so far!

Taifun

unread,
Oct 5, 2014, 4:20:58 PM10/5/14
to mitappinv...@googlegroups.com
set Player.Source to "file:///mnt/sdcard/Music/App inventor music/glitchmob/1.mp3"
Player.Start
Taifun

Piezor

unread,
Oct 5, 2014, 4:46:03 PM10/5/14
to
Hmm, Just seems like error 701 all round.
Tried:
file:///mnt/Internal storage/Music/App inventor music/glitchmob/1.mp3
file:///mnt/sdcard/Music/App inventor music/glitchmob/1.mp3
file:///Nexus 5/internal storage/Music/App inventor music/glitchmob/1.mp3
file:///storage/emulated/0/Music/App inventor music/glitchmob/1.mp3

Is there anyway I can effectively figure out what works other than just trying random things?

Cheers,
Piezor

Piezor

unread,
Oct 5, 2014, 5:08:56 PM10/5/14
to mitappinv...@googlegroups.com
Wow, ok

Got it working with:
"/sdcard/Music/App inventor music/glitchmob/1.mp3"

Thanks for everyone's help!
Reply all
Reply to author
Forward
0 new messages