0

I use the plugin Cast to broadcast Internet radio from a mobile app(Flutter - Android/iOS) to Chromecast. I used a custom receiver(on a Google cast device). in general, everything works, but I can't update the data about the current track on the Chromecast device. I have this information in the mobile application, I send it to a Chromecast device(sendMessage -> addCustomMessageListener->setMediaInformation). But nothing happens.

I used Chromecast V3 SDK for my Custom Receiver.

This is my code(Custom Receiver side):

const context = cast.framework.CastReceiverContext.getInstance();
const playerManager = context.getPlayerManager();

context.addCustomMessageListener(customNamespace, function(customEvent) => {
       const data = customEvent.data;
       console.log('Received custom event: ', data);
       const mediaInformation = new cast.framework.messages.MediaInformation();
       mediaInformation.streamType = cast.framework.messages.StreamType.BUFFERED;

       const metadata = new cast.framework.messages.MusicTrackMediaMetadata();
       metadata.title = data.title;
       metadata.artist = data.artist';
       metadata.albumName = data.album;
       mediaInformation.metadata = metadata;
       playerManager.setMediaInformation(mediaInformation, true);
});

If I'm wrong, please correct me. I need to update the information about the current track by sending a message from my mobile app.

if there is another way - - I will be very grateful

1
  • To update the current track information on a Chromecast device using a custom receiver, ensure the custom message is received correctly and the setMediaInformation method is properly called. Verify that the player manager updates the media information and the custom namespace matches exactly in both the sender i.e mobile app and the receiver.
    – Bob
    Commented Jun 27 at 9:46

0