I am trying to start an mp4 stream on a Chromecast that also shows the subtitles (vtt files)
I saw that it was added in the native libraries. But I could not find the payload messages that are used to send this to the receiver app. I am not using the native libraries for android & iOS but the a Flutter version that uses the payload messages instead of the native libraries. -> https://github.com/jonathantribouharet/flutter_cast
This is what I already tried.
{
'type': 'LOAD',
'autoPlay': true,
'currentTime': currentTime,
'media': {
'contentId': url,
'contentType': 'video/mp4',
'streamType': 'BUFFERED',
'metadata': {
'type': 0,
'metadataType': 0,
'title': title,
'images': [
{
'url': posterUrl,
}
],
},
},
'customData': {
'cc': {
'tracks': [
{'src': 'https://gist.githubusercontent.com/samdutton/ca37f3adaf4e23679957b8083e061177/raw/e19399fbccbc069a2af4266e5120ae6bad62699a/sample.vtt'},
],
'active': 0
},
},
}
And this is my full app: https://github.com/vanlooverenkoen/flutter_cast_ui/tree/feature/cast-ui
But the custom data is not doing anything.
All the StackOverflow issues I find are from 2014. Since then it should be possible with ClosedCaptions or subtitles via 3 file formats: WebVTT, TTML and CEA-608.
This documentation is used for the play/pause/stop implementation:
Stackoveflow issues I've already seen:
I don't have experience with this, but you could check out this repo. It uses cpp to do a similar thing and provides a way to build a payload including text/vtt with a link for the subtitles. So you could expand the tracks object with more data
msg["media"]["tracks"][0]["language"] = "en-US";
msg["media"]["tracks"][0]["name"] = "English";
msg["media"]["tracks"][0]["type"] = "TEXT";
msg["media"]["tracks"][0]["subtype"] = "SUBTITLES";
msg["media"]["tracks"][0]["trackId"] = 1;
msg["media"]["tracks"][0]["trackContentId"] = yourSubtitleUrl;
msg["media"]["tracks"][0]["trackContentType"] = "text/vtt";