chrome上镀铬而不发送消息

时间:2015-01-03 09:58:10

标签: google-chrome chromecast

if (!chrome.cast || !chrome.cast.isAvailable) {
  setTimeout(initializeCastApi, 1000);
}

function initializeCastApi() {
  var sessionRequest = new chrome.cast.SessionRequest(applicationID);
  var apiConfig = new chrome.cast.ApiConfig(sessionRequest,
    sessionListener,
    receiverListener);
  chrome.cast.initialize(apiConfig, onInitSuccess, onError);
};

function sessionListener(e) {
  //this function doenot runs firsttime
  appendMessage('New session ID:' + e.sessionId);
  session = e;
  session.addUpdateListener(sessionUpdateListener); 
  session.addMessageListener(namespace, receiverMessage);
  console.log(receiverMessage);
}
第一次没有调用

sessionListener()函数。当会话更新时,它会被调用。为什么会这样?

0 个答案:

没有答案