List of usage examples for android.media MediaMetadata METADATA_KEY_DISPLAY_ICON_URI
String METADATA_KEY_DISPLAY_ICON_URI
To view the source code for android.media MediaMetadata METADATA_KEY_DISPLAY_ICON_URI.
Click Source Link
From source file:hkapps.playmxtv.Activities.PlaybackOverlayActivity.java
private void updateMetadata(final Ficha movie) { final MediaMetadata.Builder metadataBuilder = new MediaMetadata.Builder(); String title = movie.getTitle().replace("_", " -"); metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_TITLE, title); metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_SUBTITLE, movie.getSinopsis()); metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_ICON_URI, movie.getPoster()); // And at minimum the title and artist for legacy support metadataBuilder.putString(MediaMetadata.METADATA_KEY_TITLE, title); //metadataBuilder.putString(MediaMetadata.METADATA_KEY_ARTIST, movie.); Glide.with(this).load(Uri.parse(movie.getPoster())).asBitmap().into(new SimpleTarget<Bitmap>(500, 500) { @Override/*from w w w . j a va 2s .com*/ public void onResourceReady(Bitmap bitmap, GlideAnimation anim) { metadataBuilder.putBitmap(MediaMetadata.METADATA_KEY_ART, bitmap); mSession.setMetadata(metadataBuilder.build()); } }); }
From source file:org.opensilk.video.playback.PlaybackService.java
void updateMetadata() { assertCreated();/* ww w .j a va 2 s. c o m*/ final Media media = mMediaPlayer.getMedia(); final MediaBrowser.MediaItem mediaItem = mDbClient.getMedia(media.getUri()); final MediaMetadata.Builder b = new MediaMetadata.Builder(); CharSequence title; Uri artworkUri = null; long duration; if (mediaItem != null) { MediaDescription description = mediaItem.getDescription(); title = description.getTitle(); b.putText(MediaMetadata.METADATA_KEY_DISPLAY_TITLE, title); b.putText(MediaMetadata.METADATA_KEY_DISPLAY_SUBTITLE, description.getSubtitle()); if (description.getIconUri() != null) { b.putText(MediaMetadata.METADATA_KEY_DISPLAY_ICON_URI, description.getIconUri().toString()); artworkUri = description.getIconUri(); } MediaMetaExtras metaExtras = MediaMetaExtras.from(description); b.putText(MediaMetadata.METADATA_KEY_TITLE, metaExtras.getMediaTitle()); duration = metaExtras.getDuration(); } else { title = media.getMeta(Media.Meta.Title); b.putText(MediaMetadata.METADATA_KEY_DISPLAY_TITLE, title); String artworkUrl = media.getMeta(Media.Meta.ArtworkURL); if (!StringUtils.isEmpty(artworkUrl)) { b.putText(MediaMetadata.METADATA_KEY_DISPLAY_ICON_URI, artworkUrl); artworkUri = Uri.parse(artworkUrl); } duration = mMediaPlayer.getLength(); } b.putLong(MediaMetadata.METADATA_KEY_DURATION, duration); if (artworkUri != null) { RequestOptions options = new RequestOptions().fitCenter(mContext); FutureTarget<Bitmap> futureTarget = Glide.with(mContext).asBitmap().apply(options).load(artworkUri) .submit(); try { Bitmap bitmap = futureTarget.get(5000, TimeUnit.MILLISECONDS); b.putBitmap(MediaMetadata.METADATA_KEY_DISPLAY_ICON, bitmap); } catch (InterruptedException | ExecutionException | TimeoutException e) { //pass } } mMediaSession.setMetadata(b.build()); mMediaSession.setSessionActivity(makeActivityIntent(mediaItem)); }
From source file:com.chinaftw.music.model.MusicProvider.java
private MediaMetadata buildFromJSON(JSONObject json) throws JSONException { String id = String.valueOf(json.getInt(JSON_SONG_ID)); String title = json.getString(JSON_TITLE); String album = json.getJSONObject(JSON_ALBUM).getString(JSON_ALBUM_NAME); String albumId = json.getJSONObject(JSON_ALBUM).getString(JSON_ALBUM_ID); String artist = json.getJSONArray(JSON_ARTIST).getJSONObject(0).getString(JSON_ARTIST_NAME); String artistId = json.getJSONObject(JSON_ALBUM).getString(JSON_ARTIST_ID); String imageId = json.getJSONObject(JSON_ALBUM).getString(JSON_ALBUM_IMAGE_ID); int duration = json.getInt(JSON_DURATION); // ms LogHelper.d(TAG, "Found music track: ", json); String source = MusicAPI.getSongUrl(id); String imageUri = MusicAPI.getPictureUrl(imageId); // Since we don't have a unique ID in the server, we fake one using the hashcode of // the music source. In a real world app, this could come from the server. // Adding the music source to the MediaMetadata (and consequently using it in the // mediaSession.setMetadata) is not a good idea for a real world music app, because // the session metadata can be accessed by notification listeners. This is done in this // sample for convenience only. return new MediaMetadata.Builder().putString(MediaMetadata.METADATA_KEY_MEDIA_ID, id) .putString(CUSTOM_METADATA_TRACK_SOURCE, source).putString(MediaMetadata.METADATA_KEY_ALBUM, album) .putString(MediaMetadata.METADATA_KEY_ARTIST, artist) .putLong(MediaMetadata.METADATA_KEY_DURATION, duration) .putString(MediaMetadata.METADATA_KEY_GENRE, "BILLBOARD") //TODO .putString(MediaMetadata.METADATA_KEY_TITLE, title) .putString(MediaMetadata.METADATA_KEY_ART_URI, imageUri) .putString(MediaMetadata.METADATA_KEY_ALBUM_ART_URI, imageUri) .putString(MediaMetadata.METADATA_KEY_DISPLAY_ICON_URI, imageUri).build(); }
From source file:de.kraenksoft.c3tv.ui.PlaybackOverlayFragment.java
private void updateMetadata(final Video video) { final MediaMetadata.Builder metadataBuilder = new MediaMetadata.Builder(); metadataBuilder.putString(MediaMetadata.METADATA_KEY_MEDIA_ID, video.id + ""); metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_TITLE, video.title); metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_SUBTITLE, video.studio); metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_DESCRIPTION, video.description); metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_ICON_URI, video.cardImageUrl); metadataBuilder.putLong(MediaMetadata.METADATA_KEY_DURATION, mDuration); // And at minimum the title and artist for legacy support metadataBuilder.putString(MediaMetadata.METADATA_KEY_TITLE, video.title); metadataBuilder.putString(MediaMetadata.METADATA_KEY_ARTIST, video.studio); Glide.with(this).load(Uri.parse(video.cardImageUrl)).asBitmap().into(new SimpleTarget<Bitmap>(500, 500) { @Override//from ww w . j av a 2 s. c o m public void onResourceReady(Bitmap bitmap, GlideAnimation anim) { metadataBuilder.putBitmap(MediaMetadata.METADATA_KEY_ART, bitmap); mSession.setMetadata(metadataBuilder.build()); } }); }
From source file:org.mythtv.android.presentation.view.fragment.TvPlaybackOverlayFragment.java
private void updateMetadata(final VideoModel videoModel) { final MediaMetadata.Builder metadataBuilder = new MediaMetadata.Builder(); metadataBuilder.putString(MediaMetadata.METADATA_KEY_MEDIA_ID, videoModel.id + ""); metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_TITLE, videoModel.title); metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_SUBTITLE, videoModel.studio); metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_DESCRIPTION, videoModel.description); metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_ICON_URI, videoModel.cardImageUrl); metadataBuilder.putLong(MediaMetadata.METADATA_KEY_DURATION, mDuration); // And at minimum the title and artist for legacy support metadataBuilder.putString(MediaMetadata.METADATA_KEY_TITLE, videoModel.title); metadataBuilder.putString(MediaMetadata.METADATA_KEY_ARTIST, videoModel.studio); Glide.with(this).load(Uri.parse(videoModel.cardImageUrl)).asBitmap() .into(new SimpleTarget<Bitmap>(500, 500) { @Override/*from ww w . ja v a 2 s . com*/ public void onResourceReady(Bitmap bitmap, GlideAnimation anim) { metadataBuilder.putBitmap(MediaMetadata.METADATA_KEY_ART, bitmap); mSession.setMetadata(metadataBuilder.build()); } }); }