Chromecast字幕默认接收器应用程序 [英] Chromecast subtitles on default receiver applications

查看:191
本文介绍了Chromecast字幕默认接收器应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我正在构建的Chromecast应用中添加字幕。


  1. 我使用默认的接收器应用程序。

  2. 我正在使用chrome sender api的v1编写一个chrome发件人应用程序。

根据 Chromecast Sender Api文档,我应该将一个轨道对象数组传递给chrome.cast.media.MediaInfo对象。我的问题是,无论何时调用 chrome.cast.media.Track(trackId,trackType),它都会返回undefined。当我通过控制台查看 chrome.cast.media 中的公共方法时,我没有看到与Track相关的任何内容。链接到文档此处

下面是我的loadMedia方法,其中我试图包含一系列跟踪对象以及我的 LoadRequest 演员api。注释掉的代码是我看到在一个Github类库中处理了隐藏字幕,但不幸的是我相信你必须在你自己的自定义接收器应用程序中处理这个customData。



字幕是否可以通过Chrome发送者SDK?还是必须构建自己的接收器应用程序,并专门通过传入customData来处理文本跟踪?我可能使用错误的发件人API?



 函数loadMedia(){
mediaUrl = decodeURIComponent(_player.sources。 MP4);
var mediaInfo = new chrome.cast.media.MediaInfo(mediaUrl);
mediaInfo.contentType ='video / mp4';

var track1 = new chrome.cast.media.Track(1,chrome.cast.media.TrackType.TEXT);
track1.trackContentId =https://dl.dropboxusercontent.com/u/35106650/test.vtt;

mediaInfo.tracks = [track1];
var request = new chrome.cast.media.LoadRequest(mediaInfo);

// var json = {
// cc:{
// tracks:[{
// src:https://dl.dropboxusercontent。 com / u / 35106650 / test.vtt
//}],
// active:0
//}
//};

// request.customData = json;
session.loadMedia(request,onMediaDiscovered.bind(this,'loadMedia'),onMediaError);
}


解决方案

Styled Receivers支持隐藏式字幕;你需要创建你自己的。我们在我们的GitHub仓库中有一个示例 ,可用于完成此操作。



更新:Styled和Default接收器现在支持曲目,请参阅我们的文档 a>。


I am trying to include subtitles on a Chromecast application I'm building.

  1. I am using the default receiver application.
  2. I am writing a chrome sender application using v1 of the chrome sender api.

According to the Chromecast Sender Api documentation, I should be passing in an array of track objects into the chrome.cast.media.MediaInfo object. My issue is, whenever I call chrome.cast.media.Track(trackId, trackType), it returns undefined. When I look through the public methods in chrome.cast.media, through console, I don't see anything related to Track. Link to documentation here.

Below is my loadMedia method where I try to include an array of track objects along with my LoadRequest as specified by the cast api. The commented out code is how I've seen closed-captioning handled in one of the cast Github repositories, but unfortunately I believe you have to handle that customData in your own custom receiver application.

Are subtitles through the chrome sender SDK possible yet, or does one have to build their own receiver application and specifically handle text tracking through passed in customData? Am I potentially using the wrong sender api?

function loadMedia() {
  mediaUrl = decodeURIComponent(_player.sources.mp4);
  var mediaInfo = new chrome.cast.media.MediaInfo(mediaUrl);
  mediaInfo.contentType = 'video/mp4';

  var track1 = new chrome.cast.media.Track(1, chrome.cast.media.TrackType.TEXT);
  track1.trackContentId = "https://dl.dropboxusercontent.com/u/35106650/test.vtt";

  mediaInfo.tracks = [track1];
  var request = new chrome.cast.media.LoadRequest(mediaInfo);

  // var json = {
  //   cc: {
  //     tracks: [{
  //       src: "https://dl.dropboxusercontent.com/u/35106650/test.vtt"
  //     }],
  //     active: 0
  //   }
  // };

  // request.customData = json;
  session.loadMedia(request, onMediaDiscovered.bind(this, 'loadMedia'), onMediaError);
}

解决方案

Currently, neither the Default nor the Styled Receivers support Closed Caption; you need to create your own. We have a sample in our GitHub repo that can be used for doing exactly that.

Update: Styled and Default receivers now support Tracks, see our documentations.

这篇关于Chromecast字幕默认接收器应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆