List of usage examples for android.media MediaMetadata getDescription
public @NonNull MediaDescription getDescription()
From source file:com.orangesoft.jook.CastPlayback.java
/** * Helper method to convert a {@link android.media.MediaMetadata} to a * {@link com.google.android.gms.cast.MediaInfo} used for sending media to the receiver app. * * @param track {@link com.google.android.gms.cast.MediaMetadata} * @param customData custom data specifies the local mediaId used by the player. * @return mediaInfo {@link com.google.android.gms.cast.MediaInfo} *///ww w . j a v a 2 s . c o m private static MediaInfo toCastMediaMetadata(MediaMetadata track, JSONObject customData) { com.google.android.gms.cast.MediaMetadata metadata = new com.google.android.gms.cast.MediaMetadata( com.google.android.gms.cast.MediaMetadata.MEDIA_TYPE_MUSIC_TRACK); metadata.putString(com.google.android.gms.cast.MediaMetadata.KEY_TITLE, track.getDescription().getTitle() == null ? "" : track.getDescription().getTitle().toString()); metadata.putString(com.google.android.gms.cast.MediaMetadata.KEY_SUBTITLE, track.getDescription().getSubtitle() == null ? "" : track.getDescription().getSubtitle().toString()); metadata.putString(com.google.android.gms.cast.MediaMetadata.KEY_ALBUM_ARTIST, track.getString(MediaMetadata.METADATA_KEY_ALBUM_ARTIST)); metadata.putString(com.google.android.gms.cast.MediaMetadata.KEY_ALBUM_TITLE, track.getString(MediaMetadata.METADATA_KEY_ALBUM)); WebImage image = new WebImage( new Uri.Builder().encodedPath(track.getString(MediaMetadata.METADATA_KEY_ALBUM_ART_URI)).build()); // First image is used by the receiver for showing the audio album art. metadata.addImage(image); // Second image is used by Cast Companion Library on the full screen activity that is shown // when the cast dialog is clicked. metadata.addImage(image); return new MediaInfo.Builder(track.getString(MusicProvider.CUSTOM_METADATA_TRACK_SOURCE)) .setContentType(MIME_TYPE_AUDIO_MPEG).setStreamType(MediaInfo.STREAM_TYPE_BUFFERED) .setMetadata(metadata).setCustomData(customData).build(); }
From source file:de.kraenksoft.c3tv.ui.PlaybackOverlayFragment.java
private void updateMovieView(MediaMetadata metadata) { Video v = new Video.VideoBuilder().buildFromMediaDesc(metadata.getDescription()); long dur = metadata.getLong(MediaMetadata.METADATA_KEY_DURATION); // PlaybackControlsRow doesn't allow you to set the item, so we must create a new one // because our Video class is now immutable. // TODO(ryanseys): Implement Playback Glue support so this can be mitigated. mPlaybackControlsRow = new PlaybackControlsRow(v); mPlaybackControlsRow.setTotalTime((int) dur); // Show the video card image if there is enough room in the UI for it. // If you have many primary actions, you may not have enough room. updateVideoImage(v.cardImageUrl);//from w w w . j av a2 s . co m mRowsAdapter.clear(); mRowsAdapter.add(mPlaybackControlsRow); updatePlaybackRow(); mPlaybackControlsRow.setPrimaryActionsAdapter(mPrimaryActionsAdapter); mPlaybackControlsRow.setSecondaryActionsAdapter(mSecondaryActionsAdapter); addOtherRows(); }
From source file:org.mythtv.android.presentation.view.fragment.TvPlaybackOverlayFragment.java
private void updateMovieView(MediaMetadata metadata) { VideoModel v = new VideoModel.VideoModelBuilder().buildFromMediaDesc(metadata.getDescription()); long dur = metadata.getLong(MediaMetadata.METADATA_KEY_DURATION); // PlaybackControlsRow doesn't allow you to set the item, so we must create a new one // because our Video class is now immutable. // TODO(ryanseys): Implement Playback Glue support so this can be mitigated. mPlaybackControlsRow = new PlaybackControlsRow(v); mPlaybackControlsRow.setTotalTime((int) dur); // Show the video card image if there is enough room in the UI for it. // If you have many primary actions, you may not have enough room. updateVideoImage(v.cardImageUrl);/*from w ww. j av a 2s .c om*/ mRowsAdapter.clear(); mRowsAdapter.add(mPlaybackControlsRow); updatePlaybackRow(); mPlaybackControlsRow.setPrimaryActionsAdapter(mPrimaryActionsAdapter); mPlaybackControlsRow.setSecondaryActionsAdapter(mSecondaryActionsAdapter); addOtherRows(); }