I use plugin Cast to broadcast Internet radio from a mobile device to Chromecast.
I use this plugin to broadcast Internet radio from a device to x.
it generally works. But there’s a issue – I can’t update the track info without restarting the stream. For example, one track ended – another one started. My application has this information, but I don’t know how to correctly transfer it to Chromecast.
The plugin I use supports messages.
I try the following scenario – get mediaSessionId – then pass the following message:
final message = {
'type': 'EDIT_TRACKS_INFO',
'mediaSessionId': _mediaSessionId,
'tracks': [
{
'trackId': 1,
'type': 'AUDIO',
'trackContentType': 'audio/mp3',
'name': 'New track',
'language': 'en',
'customData': {
'artist': 'New artist',
'albumName': 'New album',
'images': [
{
'url': _tmpImage,
},
],
},
},
],
};
_session!.sendMessage(CastSession.kNamespaceMedia, message);
But it doesn’t work. Looks like I still need to get trackId. I am trying to use the following message
final message = {
'type': 'QUEUE_GET_ITEM',
'itemId': itemId,
};
but it doesn’t work yet. also the logic is quite confusing – and I’m not sure I’m on the right way.
the plugin supports the following constants – but I can’t find in the documentation how to apply it correctly:
static const kNamespaceConnection = 'urn:x-cast:com.google.cast.tp.connection';
static const kNamespaceHeartbeat = 'urn:x-cast:com.google.cast.tp.heartbeat';
static const kNamespaceReceiver = 'urn:x-cast:com.google.cast.receiver';
static const kNamespaceDeviceauth = 'urn:x-cast:com.google.cast.tp.deviceauth';
static const kNamespaceMedia = 'urn:x-cast:com.google.cast.media';
any advice – I will be very grateful