Note: The Cast receiver and sender SDKs don’t currently
have native support for ads metadata inside the media status updates.
This will be supported in a future update.

Either the sender or the receiver can provide the ads metadata.

If your receiver app is responsible for providing the ads metadata to your
sender app, it must send the metadata as custom data in the media
status updates. Your sender app needs to parse the ads metadata and then
configure the media status object with the ads data. The Cast framework widgets
use the ads data to update their UI’s to the user when ads are playing.

Android: Set up sender app for ads

Your sender app needs to implement and set a
ParseAdsInfoCallback
to the
RemoteMediaClient. The callback will be invoked before
RemoteMediaClient propagates the MediaStatus
to its listeners. The implementation should parse the MediaStatus
and custom JSON data to return ads metadata:

iOS: Set up sender app for ads

The GCKRemoteMediaClient instance allows your sender app to modify the
GCKMediaStatus object by implementing a
GCKRemoteMediaClientAdInfoParserDelegate.
Note that if custom data is present, it will be made available to the client
as part of the GCKMediaStatuscustomData property. In this step, your
sender app’s delegate is responsible for parsing the custom data, and
if necessary set the GCKMediaStatus and
GCKMediaInformation in this way: