• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Uris from the filepicker

dwf2008

Newbie
May 18, 2023
11
0
Hi all, Newbie here. I am working on an app that involves picking a mp3 file , saving its Uri to a database, and then later selecting the file from the database and playing it with the mediaPlayer. This is all similar to creating a playlist from the music stored on the device. In this regard I have several questions.

I can only get the mediaPlayer to play the mp3 if the Uri is an audio based Uri. The filePicker seems to want to return a document based Uri. So, Is there a way to get the mediaPlayer to play the file based on the content/document based Uri?

Is there a simple way to convert the document Uri into an audio based Uri?

Is there a way to get the filePicker to return an audio based Uri?

Would all this be easier if I used the exoPlayer instead of the builtin mediaPlayer?

Thanks for any advice and/or code samples.
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones