Send custom metadata on a custom Chromecast receiver

I am using a custom Chromecast receiver and casting functionality. I want to pass custom metadata to the receiver.
In documentation i found that PlayerAPI | Bitmovin Player API 8.126.0.

// Send custom messages to CAF receiver
var payload = { foo: ‘bar’ };
player.addMetadata(‘CAST’, payload);

Its returning TRUE where i can console metadata at recivers end
Please assist. Thanks in advance.

this.playerConfig = {
          key: '5143b67b-df9b-XXXX-XXXX-d9441b6c36f1',
          ui: true,
          playback: {  
            autoplay: true,
            muted: true  
        } ,
        remotecontrol: {
            type: 'googlecast',
            receiverApplicationId: 'D3XXXX89', 
            receiverVersion: 'v3',
            messageNamespace: 'urn:x-cast:com.bitmovin.player.caf',
          },
          advertising: {
            adBreaks:_self.advertising.schedule.adBreaks,

        },
        cast: {
            enable: true
          }
        };```

Hi @madhuy1729 , thanks for sharing your question here.

Custom data can be passed to CAF receiver at time of starting casting. This can be done by adding metadata to the source being loaded.

The source.metadata property is present in all 3 platforms SDKs(Web, iOS and Android). The type of metadata property is mentioned in documentation for each SDK.

Web : SourceConfig.metadata . Any <String, String> key value pairs can be set as custom metadata. Example below.

Please let me know if this helps of if there are any followup questions.

`var source = { 
    dash: '',
    metadata: {
        "contentId": "test_id",
        "userId": "test_user"
    },
}`

Android : SourceConfig.metadata. Type is Map < String , String >

iOS : SourceConfig.metadata. Type is
NSMutableDictionary. But entries of dictionary should be <String, String> key value pairs.

Then on CAF receiver side, this will be available in cast.framework.messages.MessageType.LOAD message which can be intercepted as demonstrated in Bitmovin reference CAF receiver implementation. You will need to customize the implementation and get the metadata passed in from Cast sender in LoadRequestData.media.customData.metadatafield.

Thank you @lucky.goyal This worked for me and i am able to send custom metadata to chrome cast receiver.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.