Domanda

When I cast Video from android phone to Chromecast device, I want to add additional fields for my own application. But when I get this field from the API (VideoCastManager.getRemoteMediaInformation()). It always return null for String, zero for int.
Here I use another field is MediaMetadata.KEY_ARTIST:

MediaMetadata movieMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
movieMetadata.putString(MediaMetadata.KEY_TITLE, video.getFullName());
movieMetadata.putString(MediaMetadata.KEY_ARTIST, String.valueOf(video.getId()));// video ID
movieMetadata.addImage(new WebImage(Uri.parse(video.getThumbnail())));

mSelectedMedia = new MediaInfo.Builder(link)
                .setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
                .setContentType("video/mp4")
                .setMetadata(movieMetadata)
                .build();
mCastManager.loadMedia(mSelectedMedia, true, position);

But when I get this field, it always return null

MediaInfo mediaInfo = mCastManager.getRemoteMediaInformation();
MediaMetadata md = mediaInfo.getMetadata();
String title = md.getString(MediaMetadata.KEY_TITLE));
String videoID = md.getString(MediaMetadata.KEY_ARTIST);// always return null;

It just works with these field: KEY_TITLE, KEY_STUDIO, KEY_SUBTITLE. Can anyone explain this for me? Thanks.

P/S: For me, I guess MovieMetaDta( MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE) ) class just has 3 above fields.

È stato utile?

Soluzione

The easiest for you would be to use the customData field on the MediaInfo object.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top