gapu / google-cast-sdk

Automatically exported from code.google.com/p/google-cast-sdk
0 stars 0 forks source link

Android Sender MediaMetadata: Any application-defined fields NOT passed to the receiver #582

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Clone https://github.com/googlecast/CastVideos-android
2.Add a custom key, in 
/src/com/google/sample/cast/refplayer/browser/VideoProvider.java:
MediaMetadata movieMetadata = new 
MediaMetadata(MediaMetadata.MEDIA_TYPE_GENERIC);
movieMetadata.putString(MediaMetadata.KEY_SUBTITLE, subTitle);
movieMetadata.putString(MediaMetadata.KEY_TITLE, title);
movieMetadata.putString(MediaMetadata.KEY_STUDIO, studio);
movieMetadata.addImage(new WebImage(Uri.parse(imgUrl)));
movieMetadata.addImage(new WebImage(Uri.parse(bigImageUrl)));
movieMetadata.putString("generickey", value");
3. Build/Install

What is the expected output? What do you see instead?
GENERICKEY should be passed in the custom receiver. The other fields are 
present.

What version of the product are you using? On what operating system?

I used https://github.com/googlecast/Cast-Player-Sample as a custom receiver.

It seems to work for an html sender like 
https://github.com/googlecast/CastVideos-chrome. To pass the custom field, I 
write the following code in the html sender:

  mediaInfo.metadata = new chrome.cast.media.GenericMediaMetadata();
  mediaInfo.metadata.metadataType = chrome.cast.media.MetadataType.GENERIC;
  mediaInfo.contentType = 'video/mp4';
  mediaInfo.metadata.title = this.mediaContents[mediaIndex]['title'];
  mediaInfo.metadata.images = [{'url': MEDIA_SOURCE_ROOT + this.mediaContents[mediaIndex]['thumb']}];
  mediaInfo.metadata.generickey= "value";

Original issue reported on code.google.com by laurence...@gmail.com on 21 May 2015 at 7:22

GoogleCodeExporter commented 9 years ago
I figured out why the application-defined field are not passed to the custom 
receiver for the android sender.

Filters are applied on 'MediaMetada' object in the project 
https://github.com/googlecast/CastCompanionLibrary-android. In order to pass 
custom application-defined fields, you have to override two methods: 
mediaInfoToBundle and bundleToMediaInfo 
(./src/com/google/android/libraries/cast/companionlibrary/utils/Utils.java)

Original comment by laurence...@radio-canada.ca on 21 May 2015 at 9:46

GoogleCodeExporter commented 9 years ago

Original comment by jonathan...@google.com on 21 May 2015 at 10:19