# Namespace hcap.externalinput

hcap.externalinput

- Defined in: hcap-1.24.6.5901.js

Namespace Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| hcap.externalinput

## Method Summary

## Namespace Detail

hcap.externalinput

## Method Detail

- <static> hcap.externalinput.getCurrentExternalInput(param)
  Gets the current Audio/Video source type and index. Types and indexes of input sources depend on the H/W Spec. Following table specifies Audio & Video source type.

  Source Type | Value
  --- | ---
  TV | hcap.externalinput.ExternalInputType.TV
  Composite | hcap.externalinput.ExternalInputType.COMPOSITE
  S-Video | hcap.externalinput.ExternalInputType.SVIDEO
  Component | hcap.externalinput.ExternalInputType.COMPONENT
  RGB | hcap.externalinput.ExternalInputType.RGB
  HDMI | hcap.externalinput.ExternalInputType.HDMI
  SCART | hcap.externalinput.ExternalInputType.SCART
  OTHERS | hcap.externalinput.ExternalInputType.OTHERS
  External Input Type List List

  Following table shows the multiple index for the same type of Audio & Video source.

  Device Input | External Input Type List | Source Index
  --- | --- | ---
  1st HDMI | hcap.externalinput.ExternalInputType.HDMI | 0
  2nd HDMI | hcap.externalinput.ExternalInputType.HDMI | 1
  1st S-Video | hcap.externalinput.ExternalInputType.SVIDEO | 0
  Example of Multiple Index

      hcap.externalinput.getCurrentExternalInput({
           "onSuccess" : function(s) {
               console.log("onSuccess :" +
                   "\n type = " + s.type +
                   "\n index = " + s.index);
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {Function} param.onSuccess [Optional] - success callback function.

            param.onSuccess = function (param) {
                // {Number} param.type - external Input Type List.
                // {Number} param.index - index of source. Index value starts with 0.
                //     Max value of source index depends on the H/W Spec
            }

    - {Function} param.onFailure [Optional] - failure callback function.

            param.onFailure = function (param) {
                // {String} param.errorMessage - in case of failure, this message provides the details.
            }

  Since:
    1.3.1
  See:
    {Event} external_input_changed
    hcap.externalinput.setCurrentExternalInput()
    hcap.externalinput.isExternalInputConnected()
    hcap.externalinput.getExternalInputList()
    hcap.externalinput.ExternalInputType.TV
    hcap.externalinput.ExternalInputType.COMPOSITE
    hcap.externalinput.ExternalInputType.SVIDEO
    hcap.externalinput.ExternalInputType.COMPONENT
    hcap.externalinput.ExternalInputType.RGB
    hcap.externalinput.ExternalInputType.HDMI
    hcap.externalinput.ExternalInputType.SCART
    hcap.externalinput.ExternalInputType.OTHERS
- <static> hcap.externalinput.getExternalInputList(param)
  Gets the physically supported external input list.

      hcap.externalinput.getExternalInputList({
           "onSuccess" : function(s) {
               console.log("onSuccess : list length = " + s.list.length);
               for (var i = 0; i < s.list.length; i++) {
                   console.log("(" + s.list[i].type + "," + s.list[i].index + "," + s.list[i].name + ")");
               }
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {Function} param.onSuccess [Optional] - success callback function.

            param.onSuccess = function (param) {
                // {Array} param.list - external input list supported by TV
                //         {Number} param.list[].type - external input type (refer to external input type)
                //         {Number} param.list[].index - external input index in the external input type
                //         {String} param.list[].name - OsdName of external input type (HDMI-CEC Only)
            }

    - {Function} param.onFailure [Optional] - failure callback function.

            param.onFailure = function (param) {
                // {String} param.errorMessage - in case of failure, this message provides the details.
            }

  Since:
    1.20
  See:
    {Event} external_input_changed
    hcap.externalinput.getCurrentExternalInput()
    hcap.externalinput.setCurrentExternalInput()
    hcap.externalinput.ExternalInputType.TV
    hcap.externalinput.ExternalInputType.COMPOSITE
    hcap.externalinput.ExternalInputType.SVIDEO
    hcap.externalinput.ExternalInputType.COMPONENT
    hcap.externalinput.ExternalInputType.RGB
    hcap.externalinput.ExternalInputType.HDMI
    hcap.externalinput.ExternalInputType.SCART
    hcap.externalinput.ExternalInputType.OTHERS
- <static> hcap.externalinput.isExternalInputConnected(param)
  Checks if the Audio/Video input signal is connected to RGB or HDMI, or if the cable is connected to other input sources.
  Types and indexes of input sources depend on the H/W Spec.
  For the external input type list, refer to { external input type list }.

      // this examples shows how to check that the 1st RGB input is connected.
      hcap.externalinput.isExternalInputConnected({
           "type" : hcap.externalinput.ExternalInputType.RGB,
           "index" : 0,
           "onSuccess" : function(s) {
               console.log("onSuccess : isConnected = " + s.isConnected);
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {Number} param.type [Required] - external input type.
    - {Number} param.index [Required] - index of source type. Index value starts with 0.
    - {Function} param.onSuccess [Optional] - success callback function.

            param.onSuccess = function (param) {
                // {Boolean} param.isConnected -  true if the signal of RGB or HDMI was connected,
                //     or the cable of other input sources was connected; otherwise false.
            }

    - {Function} param.onFailure [Optional] - failure callback function.

            param.onFailure = function (param) {
                // {String} param.errorMessage - in case of failure, this message provides the details.
            }

  Since:
    1.3.1
  See:
    {Event} external_input_changed
    hcap.externalinput.getCurrentExternalInput()
    hcap.externalinput.setCurrentExternalInput()
    hcap.externalinput.getExternalInputList()
    hcap.externalinput.ExternalInputType.TV
    hcap.externalinput.ExternalInputType.COMPOSITE
    hcap.externalinput.ExternalInputType.SVIDEO
    hcap.externalinput.ExternalInputType.COMPONENT
    hcap.externalinput.ExternalInputType.RGB
    hcap.externalinput.ExternalInputType.HDMI
    hcap.externalinput.ExternalInputType.SCART
    hcap.externalinput.ExternalInputType.OTHERS
- <static> hcap.externalinput.setCurrentExternalInput(param)
  Changes the current Audio & Video source type and index.
  For the external input type list, refer to { external input type list }.

      hcap.externalinput.setCurrentExternalInput({
           "type" : hcap.externalinput.ExternalInputType.HDMI,
           "index" : 1,
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {Number} param.type [Required] - audio/Video source type.
    - {Number} param.index [Required] - index of source type. Index value starts with 0.
    - {Function} param.onSuccess [Optional] - success callback function.

            param.onSuccess = function() {
                // No parameter.
            }

    - {Function} param.onFailure [Optional] - failure callback function.
      Setting to same audio/video source type and index will invoke this callback function.

            param.onFailure = function (param) {
                // {String} param.errorMessage - in case of failure, this message provides the details.
            }

  Since:
    1.3.1
  See:
    {Event} external_input_changed
    hcap.externalinput.getCurrentExternalInput()
    hcap.externalinput.isExternalInputConnected()
    hcap.externalinput.getExternalInputList()
    hcap.externalinput.ExternalInputType.TV
    hcap.externalinput.ExternalInputType.COMPOSITE
    hcap.externalinput.ExternalInputType.SVIDEO
    hcap.externalinput.ExternalInputType.COMPONENT
    hcap.externalinput.ExternalInputType.RGB
    hcap.externalinput.ExternalInputType.HDMI
    hcap.externalinput.ExternalInputType.SCART
    hcap.externalinput.ExternalInputType.OTHERS