# Send custom metadata on a custom Chromecast receiver

**URL:** <https://community.bitmovin.com/t/send-custom-metadata-on-a-custom-chromecast-receiver/2172>\
**Category:** Support\
**Tags:** bitmovin-player, bitmovin-analytics, bitmovin, web, chromecast\
**Created:** [July 27, 2023, 7:52am UTC](https://community.bitmovin.com/t/send-custom-metadata-on-a-custom-chromecast-receiver/2172 "2023-07-27T07:52:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![madhuy1729](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@madhuy1729](https://community.bitmovin.com/u/madhuy1729)\
**Post date:** [July 27, 2023, 7:52am UTC](https://community.bitmovin.com/t/send-custom-metadata-on-a-custom-chromecast-receiver/2172/1 "2023-07-27T07:52:45Z")

</div>

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](https://cdn.bitmovin.com/player/web/8/docs/interfaces/core.playerapi.html#addmetadata).

// 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.

````auto
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
          }
        };```
````

---

<div class="post-metadata">

**Author:** ![lucky.goyal](https://sea1.discourse-cdn.com/flex015/user_avatar/community.bitmovin.com/lucky.goyal/32/506_2.png) [@lucky.goyal](https://community.bitmovin.com/u/lucky.goyal)\
**Post date:** [August 1, 2023, 9:02am UTC](https://community.bitmovin.com/t/send-custom-metadata-on-a-custom-chromecast-receiver/2172/2 "2023-08-01T09:02:58Z")

</div>

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](https://bitmovin.com/docs/player/api-reference/web/web-sdk-api-reference-v8#/player/web/8/docs/interfaces/core_config.sourceconfig.html#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.

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

```

**Android** : [SourceConfig.metadata](https://cdn.bitmovin.com/player/android/3/docs/-player%20-module/com.bitmovin.player.api.source/-source-config/metadata.html). Type is `Map` `<` `String` `, ` `String` `>`

**iOS** : [SourceConfig.metadata](https://cdn.bitmovin.com/player/ios/3/docs/Classes/BMPSourceConfig.html#/c:objc(cs)BMPSourceConfig(py)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](https://github.com/bitmovin/bitmovin-player-caf-receiver/blob/main/src/index.ts#L25-L40) implementation. You will need to customize the implementation and get the metadata passed in from Cast sender in `LoadRequestData.media.customData.metadata`field.

---

<div class="post-metadata">

**Author:** ![madhuy1729](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@madhuy1729](https://community.bitmovin.com/u/madhuy1729)\
**Post date:** [August 3, 2023, 9:03am UTC](https://community.bitmovin.com/t/send-custom-metadata-on-a-custom-chromecast-receiver/2172/3 "2023-08-03T09:03:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/bitmovin/original/1X/1ab86334145095b0af9c5b924fa3ae6d920b6482.png) [@system](https://community.bitmovin.com/u/system)\
**Post date:** [August 3, 2023, 3:31pm UTC](https://community.bitmovin.com/t/send-custom-metadata-on-a-custom-chromecast-receiver/2172/4 "2023-08-03T15:31:03Z")

</div>

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