How do I get the correct path and file name for audio file?

I want to add song into playlist using file picker component from MIT.
But I got error when to play the song that I got from file picker component via TaifunPlayer extension because the source file is incorrect (not found).

I got the fact that the correct file name for the song that retrieved from TaifunFile extension was not same as the file name that I got from file picker component from MIT.

How to solve this problem?

Regards,
Asri

The FilePicker returns a contenturi, not a filepath. You will need to convert the contenturi to a filepath. A block in Taifun's File extension is provided to do this.

image

I got this error when try your suggestion.

Is there something missed/mistake from me to follow your suggestion?

Regards,
Asri

1 Like
  1. If using the TaifunPlayer use FileTools from @vknow360
  2. The Player component can also play sound from contentURI.

Thanks.
I will try to get that extension to try it.

Hi Anke,

The file name of mp3 file be more readable using filetools extension but sill cannot be played using taifunplayer extension.
The following are result of my testing:

Is there something I missed to do for the coding?

Regards,
Asri

Try a full path starting with file:///storage/3061-6330/Krebs .. and replace spaces in the fikename by %20

Taifun

Thanks.
Will try it first.

I am sorry I am not clear for the solution.
How to change the path /sdcard/3061-6330/Krebs...... to be file:///storage/3061-6330/Krebs.... ?
Is the algorithm if I found "/sdcard" on the path then I need to change first to be "file:///storage" and replace the spaces to be "%20" ?
How if the path on the internal memory of phone, what I need to change first as the sdcard case?

Regards,
Asri


PS: By the way, I've been wondering for a long time why the TaifunPlayer doesn't play contentURI. The Player component and other Player extensions do this

Thanks Anke.
But please showing me the expanding of the below block code.
image

As you can see in my screenshot, there are a lot of spaces in this path & fileName
file:///storage/9C33-6BBD/SD-Karte/JO/Musik/Right Said Fred/Right Said Fred - Too Se*y.mp3
but it's no problem at all to play these songs.



:upside_down_face: :upside_down_face: :upside_down_face:

Se*y is not allowed, but using the Olympic Games as a stage to desecrate and mock Jesus and Christianity is allowed. What else has to happen until the world FINALLY wakes up from this madness and insanity.

ok. thanks Anke.
I will try again to solve this problem by follow your guidance.

Hi Anke,

Something strange happened which I cannot play mp3 files that located beyond Music folder as the following screenshot.
How to resolve this issue?

The failed play mp3 file located beyond Music folder

The detail folder name :

The succeed play mp3 file under folder Music :

The block code :

Regards,
Asri


Here is the aia for testing:
pickAudio.aia (54.8 KB)

Hi Anke,

Thanks for your sample app which I already tried it and working well on Companion.
But when I build to apk and run the app, I got this error after pick-up mp3 file.
Please advice.

Can you provide some Do it results same as @Anke provided earlier while using the companion app?
Also which device and Android version are you using for your tests?

Taifun

Taifun and Anke, I already implemented the code from Anke's sample app on my mp3 app and working well both on companion and apk.
So I think the little issue on the previous sample not matter as long as the sample code working well on my mp3 app.

Thanks for your support.