I use plugin Cast to broadcast Internet radio from a mobile app(Flutter – Android/iOS) to Chromecast. I used custom receiver(on Google cast device). in general, everything works, but I can’t update the data about the current track on Chromecast device. I have this information in the mobile application, I send it to 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