在Chromecast上切换Audiotrack [英] Switching Audiotrack on Chromecast
问题描述
我实在无法相信我无法找到答案,因为在我看来它应该是一个常见的问题 - 我使用的是错误的术语吗?
I actually cannot believe I couldn't find an answer to this as it appears to me as if it should be a common problem - am I using the wrong terminology?
但是,我正在寻找一种方法来切换正在发送的视频的录像带,以便在chromecast上播放。更确切地说,我正在谈论嵌入两条音频线(mkv格式)的多轨视频文件。
However, I am looking for a way to switch the audiotrack of the video that is being sent to be played on chromecast. More precisely I'm talking about a multitrack video File embedding two audio lines (mkv-format).
我没有发现使用(Android)这样做的可能性)SDK,也不能在Receiver App本身上使用JavaScript来更改它。 (这至少使我能够使用自定义接收器实现该功能。)
I've not found any possibility to do this using the (Android) SDK, nor could I change it using JavaScript on the Receiver App itself. (This would at least enable me to implement the ability using a custom receiver).
从我的研究中我发现,视频元素应该是一个audioTracks和videoTracks属性,但相应它尚未由任何浏览器实现,因此显然在chromecast上不可用。 ( http://www.w3schools.com/tags/av_prop_audiotracks.asp )
From my research I found, that the video element is supposed to get a audioTracks and videoTracks attribute but accordingly it is not yet implemented by any browser and thus obviously not available on chromecast. (http://www.w3schools.com/tags/av_prop_audiotracks.asp)
有什么建议吗?
推荐答案
查看媒体播放器库文档中的循环通过音频流: https://developers.google.com/cast/docs/player
Look at the media player library documentation for cycling through audio streams: https://developers.google.com/cast/docs/player
window.changeLanguage = function() {
var currentLanguage = null;
var streamCount = this.protocol_.getStreamCount();
var streamInfo;
for (var i = 0; i < streamCount; i++) {
if (protocol.isStreamEnabled(i)) {
streamInfo = protocol.getStreamInfo(i);
if (streamInfo.mimeType.indexOf('audio') === 0) {
if (streamInfo.language) {
currentLanguage = i;
break;
}
}
}
}
if (currentLanguage === null) {
currentLanguage = 0;
}
i = currentLanguage + 1;
while (i !== currentLanguage) {
if (i === streamCount) {
i = 0;
}
streamInfo = protocol.getStreamInfo(i);
if (streamInfo.mimeType.indexOf('audio') === 0) {
protocol.enableStream(i, true);
protocol.enableStream(currentLanguage, false);
break;
}
i++;
}
if (i !== currentLanguage) {
this.player_.reload();
}
};
这篇关于在Chromecast上切换Audiotrack的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!