Previously, I would set the metadata like this:
val movieMetadata = MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE)
movieMetadata.putString(MediaMetadata.KEY_TITLE, title)
movieMetadata.putString(MediaMetadata.KEY_SUBTITLE, subtitle)
movieMetadata.addImage(WebImage(Uri.parse(posterImage)))
val mediaInfoBuilder = MediaInfo.Builder(media.mediaUrl)
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
.setMetadata(movieMetadata)
player.loadItem(MediaQueueItem.Builder(mediaInfoBuilder.build()).build(), TimeUnit.SECONDS.toMillis(position))
Where MediaMetadata in the above example is com.google.android.gms.cast.MediaMetadata. Now that CastPlayer.loadItem() is deprecated, I want to replace it with Player.setMediaItem() but I can't find how to pass the same metadata to a MediaItem. I know that it accepts com.google.android.exoplayer2.MediaMetadata but this currently only has a title property.
So my question is how can I set the title, subtitle, and image to be displayed in the cast receiver app using a MediaItem?
Previously, I would set the metadata like this:
Where
MediaMetadatain the above example iscom.google.android.gms.cast.MediaMetadata. Now thatCastPlayer.loadItem()is deprecated, I want to replace it withPlayer.setMediaItem()but I can't find how to pass the same metadata to aMediaItem. I know that it acceptscom.google.android.exoplayer2.MediaMetadatabut this currently only has atitleproperty.So my question is how can I set the title, subtitle, and image to be displayed in the cast receiver app using a
MediaItem?