【问题标题】:Show subtitles on the Styled Media Receiver Google Cast with communication messages在 Styled Media Receiver Google Cast 上显示带有通信消息的字幕
【发布时间】:2021-10-01 19:32:45
【问题描述】:

我正在尝试在 Chromecast 上启动一个 mp4 流,该流还显示字幕(vtt 文件)

我看到它被添加到本机库中。但是我找不到用于将其发送到接收器应用程序的有效负载消息。我没有使用 Android 和 iOS 的原生库,而是使用有效负载消息而不是原生库的 Flutter 版本。 -> https://github.com/jonathantribouharet/flutter_cast

这是我已经尝试过的。

{
      '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
        },
      },
    }

这是我的完整应用程序: https://github.com/vanlooverenkoen/flutter_cast_ui/tree/feature/cast-ui

但是自定义数据没有做任何事情。

我发现的所有 StackOverflow 问题都来自 2014 年。从那时起,ClosedCaptions 或字幕应该可以通过 3 种文件格式实现:WebVTT、TTML 和 CEA-608。

本文档用于播放/暂停/停止实现:

我已经看到的 Stackoveflow 问题:

【问题讨论】:

    标签: android ios flutter chromecast google-cast


    【解决方案1】:

    我没有这方面的经验,但您可以查看this repo。它使用 cpp 来做类似的事情,并提供了一种构建有效负载的方法,包括带有字幕链接的 text/vtt。 因此,您可以使用更多数据扩展轨道对象

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

    【讨论】:

      猜你喜欢
      • 2021-01-31
      • 2014-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-08
      • 2018-02-16
      • 2020-01-18
      相关资源
      最近更新 更多