Playing audio files already on the device

Hi,

Is it possible to select and play .mp3 files already on the device? Like a music player? I want to make a an app where the user can select their own backgound music.

There is a plugin for iOS (Pro and Enterprise subscribers) that let’s you access your iTunes library.  I don’t know of a way to do this on Android.

Rob

There are a plethora of audio players for Android so I’m sure there is a way, but guess it’s a cross platform thing…

Ok, I could solve it if I could play the sound of youtube videos (or the video in a small window). Is this possible? I’ve tried something like this, but nothing seems to happen…

media.playVideo( "https://www.youtube.com/watch?v=nNrBAE39MS0", media.remoteSource)

First, trying to play a YouTube video that way is trying to invoke their player.  It doesn’t really download a file for media.playVideo() to play, so that’s not going to work.  The only way I’ve seen Corona SDK play YouTube videos is with a native.newWebView().

Some of the media.* API calls take a URL, which means you can construct a path to a file and potentially (and I say again, potentially) could play a track if you knew it’s file system path.  It’s rumored (and unsupported) that LFS can work outside of the app’s sandbox on Android (def. won’t work on iOS) so you might be able to read a folder and get a list of files.  Again: unsupported and untested.

Rob

Ok, so basically it’s not possible to create an (Android) app that plays user selected audio files (outside the app)  with Corona?

There is a plugin for iOS (Pro and Enterprise subscribers) that let’s you access your iTunes library.  I don’t know of a way to do this on Android.

Rob

There are a plethora of audio players for Android so I’m sure there is a way, but guess it’s a cross platform thing…

Ok, I could solve it if I could play the sound of youtube videos (or the video in a small window). Is this possible? I’ve tried something like this, but nothing seems to happen…

media.playVideo( "https://www.youtube.com/watch?v=nNrBAE39MS0", media.remoteSource)

First, trying to play a YouTube video that way is trying to invoke their player.  It doesn’t really download a file for media.playVideo() to play, so that’s not going to work.  The only way I’ve seen Corona SDK play YouTube videos is with a native.newWebView().

Some of the media.* API calls take a URL, which means you can construct a path to a file and potentially (and I say again, potentially) could play a track if you knew it’s file system path.  It’s rumored (and unsupported) that LFS can work outside of the app’s sandbox on Android (def. won’t work on iOS) so you might be able to read a folder and get a list of files.  Again: unsupported and untested.

Rob

Ok, so basically it’s not possible to create an (Android) app that plays user selected audio files (outside the app)  with Corona?