Chromecast Receiver App – 意外命令,播放器处于IDLE状态
我正在使用演员参考播放器示例代码来开发接收器应用程序。 我正在使用强制转换消息总线发送一个JSON字符串来启动我的媒体。
所以在我的player.html
,我初始化了转换cast message bus
。 当我receive JSON
我想播放的媒体的receive JSON
时,我从player.html
初始化player.js
, player.html
所示:
//receive message to play -> pass media through var player = document.getElementById('player'); new sampleplayer.CastPlayer(player).start();
然后在我的player.js
:
sampleplayer.CastPlayer.prototype.start = function() { var self = this; var message = //JSON string this.load(JSON.parse(message)); var millisecondsToWait = 8000; setTimeout(function() { //Pause Works self.mediaElement_.pause(); }, millisecondsToWait); var millisecondsToWait = 10000; setTimeout(function() { //Play Works self.mediaElement_.play(); }, millisecondsToWait); };
我可以启动媒体,我可以使用上面的代码播放/暂停媒体。
当我尝试使用遥控器上的播放/暂停按钮时,出现以下错误: [cast.receiver.MediaManager] Unexpected command, player is in IDLE state so the media session ID is not valid yet
。
我也没有获得我之前获得的任何PlayState
更新。
我相信我没有正确地做一些事情,但我不确定是什么。 有谁知道我的好起点? 谢谢