Taifun Player Runtime Error play MP3

Hi,

I test the Taifun Player Extention.
i want to play a MP3 on storage/emulated/0/music
but when i clic on my button i have this message
"Runtime error
attempt to invoke virtual method "void android.media.mediaplayer.setaudiostreamtype(int) on a null object reference"

Why do you stop and start with same click..? May be you need to give some interval of time between this two events

Sorry,
i changed it but i have the same error


BTW, what is your android version?

If it is 10+ then you must move the file into ASD

hi,

i have android 12.

sorry but, wath's ASD ?

sorry, ASD it's for SDcard ?

already multiple discussions are there regaring how to access storage in android 10+ by @Taifun @Anke etc etc pls gothrough the forum,

eg

Post the full path (Player.Souce).

Android 12:

Btw, remove one slash /

grafik

hi,
i removed one "/" :slight_smile:
My full path is : file:///storage/emulated/0/Music/Star Wars/Punk Covers - Star Wars.mp3

but, i have same error :frowning:

Are you absolutely sure this path exists?
If so, does the audio file play, when you try to play it on your device?

Replace the spaces by %20
See also the Jukebox example here App Inventor Extensions: File | Pura Vida Apps

Taifun

file:///storage/emulated/0/Music/Star%20Wars/Punk%20Covers%20-%20Star%20Wars.mp3

image

i tried with no space in path : file:///storage/emulated/0/Music/StarWars/PunkCovers-StarWars.mp3

i have the firts message "Runtime Error" :sob:

use File component to test if the MP3 file exists.
And ask read External Storage permission.

1 Like

As test rename the file to something simple...
starwars.mp3
Taifun

This path works on all Android versions if the file exists.
Take a screenshot from your device that shows this path.

Note: If you test with the APK, you must request READ permission.

1 Like

i had the ReadExternalStorage

image

and my code is working :grinning:

image

sorry, my bad, rookie mistake

thanks at all
-- issue solved --

what about the spaces in the filename?
Taifun