Skip to content Skip to sidebar Skip to footer

Display An Image In Default Media Player Of Android

Here is my code. First I recorded an audio file and started playing it. For playing the audio file /** * * play the recorded audio * */ public void playAudio() { try

Solution 1:

The default media player is using the following code to retrieve the album art of a song.

UrisArtworkUri= Uri.parse("content://media/external/audio/albumart");
Uriuri= ContentUris.withAppendedId(sArtworkUri, album_id);
ContentResolverres= context.getContentResolver();
InputStreamin= res.openInputStream(uri);
Bitmapartwork= BitmapFactory.decodeStream(in);

where album_id is the albumd id of the song. So in order to show an album art the default player should know the album id and check if there is album art associated with this id. So if you want to show artwork you have to insert your file in android's database and then play it from there.

Post a Comment for "Display An Image In Default Media Player Of Android"