# Class InputSource#initialize

InputSource

- Defined in: inputSource.js

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| InputSource#initialize(successCallback, errorCallback, options) Imports video tag to show the input source dynamically.

## Class Detail

InputSource#initialize(successCallback, errorCallback, options)
Imports video tag to show the input source dynamically. This is used to embed input source in an html page.

    // HTML code
     < body onload="onLoad()" >
        < div id = "videoDiv" style="width:640px; height:380px" >
        < /div >
     < /body >

    // Javascript code
    function init () {
    }

    function onLoad() {
      var options = {
         divId : "inputSource", // It should be matched to div tag name in an html page.
         videoId : "inputSourceVid",
         callback : init,
         src : "ext://hdmi:1"
      };

      function successCb() {
         // Do something
      }

      function failureCb(cbObject) {
         var errorCode = cbObject.errorCode;
         var errorText = cbObject.errorText;
         console.log ("Error Code [" + errorCode + "]: " + errorText);
      }

      var inputSource = new InputSource();
      inputSource.initialize(successCb, failureCb, options);
    }

Parameters:
{Function} successCallback
  success callback function.
{Function} errorCallback
  failure callback function.
{Object} options

  Property | Type | Description | Required
  --- | --- | --- | ---
  divId | String | Div tag ID with the video tag in it. | required
  videoId | String | The ID of the video tag to be dynamically created. | required
  callback | Function | An event handler (onloadedmetadata) that is called when the video tag is created. | required
  src | String | The src attribute of the video tag. ext://[externalInput]:[portNum]. (eg: "ext://hdmi:1") | required

Since:
  1.0, 1.1 options.isLastChannel removed
Returns:

  None.