launching m3u playlist with intent

by Seb » Sun, 16 Aug 2009 21:11:31 GMT


Sponsored Links
 Hi,

Is there a way to launch a playlist whith intent?

I can retrieve the path of the m3u playlist with:
Cursor cursor = context.getContentResolver().query
(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI, null, null, null,
null);
cursor.getString(cursor.getColumnIndex
(MediaStore.Audio.Playlists.DATA));

But, I can't launch this m3u file neither with Intent nor with
MediaPlayer.

Is there a way to do this?

Thanks in advance


--~--~---------~--~----~------------~-------~--~----~



launching m3u playlist with intent

by Marco Nelissen » Mon, 17 Aug 2009 03:23:56 GMT


 


No.


--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


launching m3u playlist with intent

by Marco Nelissen » Mon, 17 Aug 2009 03:30:16 GMT


 Well, OK, that's not entirely true. While you can't play an arbitrary
m3u file, you can play playlists that are in the database (which may
have come from m3u files originally, in which case there path is in
the _data column).
To see how, you can look at what happens when you put a shortcut to a
playlist on the home screen and then launch it.







--~--~---------~--~----~------------~-------~--~----~



launching m3u playlist with intent

by Seb » Mon, 17 Aug 2009 21:36:13 GMT


 Hi Marco,

Thank you very much for the response. You give me the key to find the
solution.

I had to study the code of PlaylistBrowserActivity to find the
solution.

I give it here if someone else search the solution:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setComponent(new ComponentName
("com.android.music","com.android.music.PlaylistBrowserActivity"));
intent.setType(MediaStore.Audio.Playlists.CONTENT_TYPE);
intent.setFlags(0x10000000);
intent.putExtra("oneshot", false);
intent.putExtra("playlist", playlistid);
startActivity(intent);

and to retrieve the playlistid:
Cursor cursor = getContentResolver().query
(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI, null, null, null,
null);
if (cursor != null) {
 if (cursor.moveToFirst()) {
  do {
     playlistid = cursor.getString(cursor.getColumnIndex
(MediaStore.Audio.Playlists._ID));
     playList.add(playlist);
     } while (cursor.moveToNext());
     cursor.close();
 }
}







--~--~---------~--~----~------------~-------~--~----~



launching m3u playlist with intent

by hav...@gmail.com » Fri, 11 Sep 2009 16:12:32 GMT


 Awesome. I love you! :)
This was just what I was looking for.







--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Map recycling and use problems

I have one map activity in my application which uses a map view
inflated from XML. Registered for an API key, and all works well,
etc... However, the map activity is registered in my manifest to be
started with two intents, VIEW and PICK. Most use cases of the
application start the activity with the VIEW intent, and rarely the
PICK intent.

On the occasion when I attempt to display the Map activity through the
PICK intent using startActivityForResult() however (after having
previously viewed it successfully through VIEW), the map displays a
blank screen of X's. Thereafter, any use of the map activity, whether
through VIEW or PICK results in the same, even after restarting the
application process. The only solution is to completely uninstall the
application and reinstall. Then it works again until the map is
started through PICK again. I suspect this is somehow related to the
map api key since it persists across sessions until uninstalled.

Log:

INFO/ActivityManager(64): Starting activity: Intent
{ action=android.intent.action.VIEW comp={...Map} }
INFO/MapActivity(11594): Handling network change
notification:CONNECTED
ERROR/MapActivity(11594): Couldn't get connection factory client
INFO/ActivityManager(64): Displayed activity ...Map: 808 ms

(map displays properly... then...)

INFO/ActivityManager(64): Starting activity: Intent
{ action=android.intent.action.PICK comp={...Map} (has extras) }
WARN/MapActivity(11594): Recycling dispatcher
com.google.common.datarequestdispatc...@4309f7e0
VERBOSE/MapActivity(11594): Recycling map object.
INFO/MapActivity(11594): Handling network change
notification:CONNECTED
ERROR/MapActivity(11594): Couldn't get connection factory client
INFO/ActivityManager(64): Displayed activity ...Map: 304 ms

(map will not display until a full uninstall/reinstall)

--~--~---------~--~----~------------~-------~--~----~

2. Suggestions Needed: can not play sound files under "assets" folder

Hi All,
I have been struggling with playing a WAV file "music.wav" under
"assets" folder of my APK file. The WAV file has been proven good by
using Android SDK's media sample code.

I tried the following methods, all of them generates
"java.io.IOException: Prepare failed.: status=0xFFFFFFFC".

Method 1 - mediaplayer.setDataSource("file:///android_asset/
music.wav");

Method 2 - mediaplayer.setDataSource(myActivity.getAssets().openFd
("music.wav").getFileDescriptor());

Method3 - First, write a temporary wav file under "data/data/myAppName/
files/" by opening an InputStream / OutputStream with AssetManager,
then use mediaplayer.setDataSource("data/data/myAppName/files/
music.wav");  From Adroid file explorer I can even see that the
temporary wav file is created successfully, but prepare() still
generates IOException.

The only way I can play this wav file is I manually push this wav file
onto the emulator, say "data/data/myApp", then I use a hard-coded
string to call setDataSource(), but sadly we can not use a hard-coded
string to play sound effect.

Can anyone help me out to play sound files (wav, mp3) under APK
"assets" folder? Or is there a way to set the data source by an
InputStream directly?

Many thanks for any suggestions!
Hongkun
www.omnigsoft.com





--~--~---------~--~----~------------~-------~--~----~

3. Font size for Context menu

4. Regarding Opencore Codec Integration

5. Activity goes to background but secondary thread needs to end its work

6. Custom Views and Touch Events

7. Display a screen for 2 0r 3 seconds