List of usage examples for android.media MediaMetadata METADATA_KEY_DISPLAY_TITLE
String METADATA_KEY_DISPLAY_TITLE
To view the source code for android.media MediaMetadata METADATA_KEY_DISPLAY_TITLE.
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 av a 2s . co m*/ 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 . ja v a 2 s . co 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: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 om*/ 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/* w w w . jav a 2s . c o m*/ public void onResourceReady(Bitmap bitmap, GlideAnimation anim) { metadataBuilder.putBitmap(MediaMetadata.METADATA_KEY_ART, bitmap); mSession.setMetadata(metadataBuilder.build()); } }); }