Send custom metadata on a custom Chromecast receiver

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.