如何从HDMI中连接的Chromecast退出

时间:2018-06-28 10:29:02

标签: javascript smart-tv

我正在为智能电视LG进行编程,现在我已将我的应用程序与ChromeCast HDMI连接,但是我遇到的问题是,当我单击退出按钮时,我无法离开chromeCast并再次启动我的应用程序

JavaScript代码:

// click sur un element (LG remote control)[lancer input(HDMI) après click sur bouton2]
function clickOnElement() {

  var keyInput = parseInt(focusedElementKeyboard.split("btn")[1]);

  // check if the button 2 that has the focus
  if (keyInput == 2) {
    //connect to  HDMI1
    hcap.externalinput.setCurrentExternalInput({
      "type": hcap.externalinput.ExternalInputType.HDMI,
      "index": 0,
      "onSuccess": function() {
          alert("onSuccess");
          hcap.mode.setHcapMode({
        "mode" : hcap.mode.HCAP_MODE_0,
        "onSuccess" : function() {
	         alert("onSuccess HCAP Mode 1");						
         }, 
		"onFailure" : function(f) {
			alert("onFailure : errorMessage = " + f.errorMessage);
		}
 });	
      },
      "onFailure": function(f) {
        alert("onFailure : errorMessage = " + f.errorMessage);
      }
    });

    return;
  }

}

我需要知道如何从HDMI中连接的chromeCast中退出,当我将mod1更改为mod0时,我只是使用hcap.mode.setHcapMode方法连接到HDMI,但是我无法使用按钮PORTAL mod0并使后者具有1

//manipulate keydown event (LG remote control)

function manageLauncherKeyDown(keyCode) {

  //alert(" SWITCH key Down event");
  switch (keyCode) {
    case hcap.key.Code.ENTER:
      clickOnElement();
      break;
    case hcap.key.Code.UP:
      goTo();
      break;
    case hcap.key.Code.DOWN:
      goTo();
      break;
    case hcap.key.Code.RIGHT:
      goTo();
      break;
    case hcap.key.Code.LEFT:
      goTo();
    case hcap.key.Code.PORTAL:
      exit(); //i have just change mod1 to mod0 but i can't use this key         
      break;
  }
}

0 个答案:

没有答案