Show subtitles on the Styled Media Receiver Google Cast with communication messages

Koen Van Looveren

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:

William Verhaeghe

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";

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Set supported media commands for Google Cast Styled Media Receiver

Styled media receiver source (Chromecast)

Playing M3U8 on Styled Media Receiver Chromecast

Chromecast receiver, how to load media without explicit cast sender request?

CAF Receiver: Positioning of subtitles

How to properly connect to Google Cast device and cast an url with an custom receiver?

Can I change album art on a chromecast styled media receiver without using RemoteMediaPlayer.load?

Google Cast iOS Cannot load media

Google cast receiver throwing "Uncaught NotSupportedError: Failed to execute 'addSourceBuffer' on 'MediaSource'

Chromecast styled receiver app ID

Show cast menu while casting media (without CastCompanionLibrary)

VideoJS does not show subtitles

Read subtitles from mkv/media

Android: Getting Google Cast MediaRouter Icon to Show

Google tests don't show report messages

Google Cast Media Player Library - for streaming from Local Device

Where to set Google Cast's custom receiver app ID [Connect SDK]

Chromecast custom receiver without media

Show dialog in broadcast receiver

Play *.srt subtitles in Windows Media Player?

Use Media Player Classic to resynchronize subtitles?

Finding and Saving Media Player Classic downloaded subtitles?

DDD and messages for Aggregates communication

Images doesn't show in media print with Google Chrome

show subtitles list, get id and name of each subtitles track

iOS Sdk Google Chromecast Subtitles

Java SerialPort communication, wrong input bytes on receiver

Render styled google map

Can a Rectangle be styled to show a border?