# Namespace hcap.webrtc

hcap.webrtc

- Defined in: hcap-1.24.6.5901.js

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

## Method Summary

## Namespace Detail

hcap.webrtc

## Method Detail

- <static> hcap.webrtc.acceptMessage(param)
  Sends a message to webrtc service. Predefined types of message can be passed to webrtc service.

      hcap.webrtc.acceptMessage({
           "remoteId" : 2,
           "rtcMsg" : "{"type":"answer","sdp":"v=0\r\no=- 4474142502554476113 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio video..."}",
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {Number} param.remoteId [Required] - peer ID
    - {String} param.rtcMsg [Required] - message which be sent to webrtc service, such as SDP, ICE configuration, and so on.
    - {Function} param.onSuccess [Optional] - success callback function.

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

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

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

  Deprecated:
  since 1.24
  See:
    {Event} webrtc_message_received
    {Event} webrtc_event_received
    hcap.webrtc.startPreviewVideo()
    hcap.webrtc.stopPreviewVideo()
    hcap.webrtc.incomingCall()
    hcap.webrtc.outgoingCall()
    hcap.webrtc.endCall()
    hcap.webrtc.startCheckAudio()
    hcap.webrtc.stopCheckAudio()
    hcap.webrtc.setConfiguration()
    hcap.webrtc.getConfiguration()
    hcap.webrtc.showDiagnostics()
- <static> hcap.webrtc.endCall(param)
  Ends a call.

      hcap.webrtc.endCall({
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

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

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

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

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

  Deprecated:
  since 1.24
  See:
    {Event} webrtc_message_received
    {Event} webrtc_event_received
    hcap.webrtc.startPreviewVideo()
    hcap.webrtc.stopPreviewVideo()
    hcap.webrtc.incomingCall()
    hcap.webrtc.outgoingCall()
    hcap.webrtc.acceptMessage()
    hcap.webrtc.startCheckAudio()
    hcap.webrtc.stopCheckAudio()
    hcap.webrtc.setConfiguration()
    hcap.webrtc.getConfiguration()
    hcap.webrtc.showDiagnostics()
- <static> hcap.webrtc.getConfiguration(param)
  Gets WebRTC configurations. This return the list of configrations.

      hcap.webrtc.getConfiguration({
           "onSuccess" : function(s) {
               console.log("onSuccess : configurations = " + s.configurations);
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

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

            param.onSuccess = function (param) {
                // {String} param.configurations - configurations string.
            }

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

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

  Deprecated:
  since 1.24
  See:
    {Event} webrtc_message_received
    {Event} webrtc_event_received
    hcap.webrtc.startPreviewVideo()
    hcap.webrtc.stopPreviewVideo()
    hcap.webrtc.incomingCall()
    hcap.webrtc.outgoingCall()
    hcap.webrtc.endCall()
    hcap.webrtc.acceptMessage()
    hcap.webrtc.startCheckAudio()
    hcap.webrtc.stopCheckAudio()
    hcap.webrtc.setConfiguration()
    hcap.webrtc.showDiagnostics()
- <static> hcap.webrtc.incomingCall(param)
  Receives an incoming call. This API should be included the information of peer's SDP(Session Description Protocol).

      hcap.webrtc.incomingCall({
           "localId" : 1,
           "remoteId" : 2,
           "remoteSDP" : "{"sdp" : "v=0\r\no=- 3454157150814283647 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio video\r\..."}",
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {Number} param.localId [Required] - local(my) ID
    - {Number} param.remoteId [Required] - peer(who makes a call to me) ID
    - {String} param.remoteSDP[Required] - peer SDP
    - {Function} param.onSuccess [Optional] - success callback function.

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

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

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

  Deprecated:
  since 1.24
  See:
    {Event} webrtc_message_received
    {Event} webrtc_event_received
    hcap.webrtc.startPreviewVideo()
    hcap.webrtc.stopPreviewVideo()
    hcap.webrtc.outgoingCall()
    hcap.webrtc.endCall()
    hcap.webrtc.acceptMessage()
    hcap.webrtc.startCheckAudio()
    hcap.webrtc.stopCheckAudio()
    hcap.webrtc.setConfiguration()
    hcap.webrtc.getConfiguration()
    hcap.webrtc.showDiagnostics()
- <static> hcap.webrtc.outgoingCall(param)
  Makes an outgoing call. This API lead to create WebRTC object and local SDP. The local SDP will be passed to HCAP by an event {Event} webrtc_message_received.

      hcap.webrtc.outgoingCall({
           "localId" : 1,
           "remoteId" : 2,
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {Number} param.localId [Required] - local(my) ID
    - {Number} param.remoteId [Required] - peer(who I want to call) ID
    - {Function} param.onSuccess [Optional] - success callback function.

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

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

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

  Deprecated:
  since 1.24
  See:
    {Event} webrtc_message_received
    {Event} webrtc_event_received
    hcap.webrtc.startPreviewVideo()
    hcap.webrtc.stopPreviewVideo()
    hcap.webrtc.incomingCall()
    hcap.webrtc.endCall()
    hcap.webrtc.acceptMessage()
    hcap.webrtc.startCheckAudio()
    hcap.webrtc.stopCheckAudio()
    hcap.webrtc.setConfiguration()
    hcap.webrtc.getConfiguration()
    hcap.webrtc.showDiagnostics()
- <static> hcap.webrtc.setConfiguration(param)
  Sets WebRTC configuration.

      hcap.webrtc.setConfiguration({
           "key" : "max_height",
           "value" : "480",
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {String} param.key [Required] - configuration key to be set.
    - {String} param.value [Required] - configuration value to be set.

      Key | Description | Read/Write | Value Format | Value example (default value for the predefined value set)
      --- | --- | --- | --- | ---
      ice_cfg | STUN/TURN server infomation | Read/Write | [version string] ';' '|' ':' | stun:stun.l.google.com:19302;turn:89.108.113.194:3478|webrtc|webrtc
      peer_server_name | IP address of peer connection server | Read/Write | [version string] ip address | 192.168.0.2
      peer_server_port | Port number of peer connection server | Read/Write | [version string] integer | 8888
      user_name | User name to log-in | Read/Write | [version string] free format string | Andy

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

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

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

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

  Deprecated:
  since 1.24
  See:
    {Event} webrtc_message_received
    {Event} webrtc_event_received
    hcap.webrtc.startPreviewVideo()
    hcap.webrtc.stopPreviewVideo()
    hcap.webrtc.incomingCall()
    hcap.webrtc.outgoingCall()
    hcap.webrtc.endCall()
    hcap.webrtc.acceptMessage()
    hcap.webrtc.startCheckAudio()
    hcap.webrtc.stopCheckAudio()
    hcap.webrtc.getConfiguration()
    hcap.webrtc.showDiagnostics()
- <static> hcap.webrtc.showDiagnostics(param)
  Shows diagnostics.

      hcap.webrtc.showDiagnostics({
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

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

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

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

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

  Deprecated:
  since 1.24
  See:
    {Event} webrtc_message_received
    {Event} webrtc_event_received
    hcap.webrtc.startPreviewVideo()
    hcap.webrtc.stopPreviewVideo()
    hcap.webrtc.incomingCall()
    hcap.webrtc.outgoingCall()
    hcap.webrtc.endCall()
    hcap.webrtc.acceptMessage()
    hcap.webrtc.startCheckAudio()
    hcap.webrtc.stopCheckAudio()
    hcap.webrtc.setConfiguration()
    hcap.webrtc.getConfiguration()
- <static> hcap.webrtc.startCheckAudio(param)
  Checks local audio. This API can test the local sound by 2-step.
  step1: Set the param.type as a 'microphone' to test input works well or not. It record the sound only from microphone. step2: Set the param.type as a 'speaker' to test the output works well or not. It plays the recorded sound from 'microphone' test. Each step will be done by hcap.webrtc.stopCheckAudio().

      hcap.webrtc.startCheckAudio({
           "type" : "microphone",
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {String} param.type [Required] - microphone | speaker
    - {Function} param.onSuccess [Optional] - success callback function.

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

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

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

  Deprecated:
  since 1.24
  See:
    {Event} webrtc_message_received
    {Event} webrtc_event_received
    hcap.webrtc.startPreviewVideo()
    hcap.webrtc.stopPreviewVideo()
    hcap.webrtc.incomingCall()
    hcap.webrtc.outgoingCall()
    hcap.webrtc.endCall()
    hcap.webrtc.acceptMessage()
    hcap.webrtc.stopCheckAudio()
    hcap.webrtc.setConfiguration()
    hcap.webrtc.getConfiguration()
    hcap.webrtc.showDiagnostics()
- <static> hcap.webrtc.startPreviewVideo(param)
  Plays the video stream from local video. This is for checking local video works well or not.

      hcap.webrtc.startPreviewVideo({
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

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

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

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

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

  Deprecated:
  since 1.24
  See:
    {Event} webrtc_message_received
    {Event} webrtc_event_received
    hcap.webrtc.stopPreviewVideo()
    hcap.webrtc.incomingCall()
    hcap.webrtc.outgoingCall()
    hcap.webrtc.endCall()
    hcap.webrtc.acceptMessage()
    hcap.webrtc.startCheckAudio()
    hcap.webrtc.stopCheckAudio()
    hcap.webrtc.setConfiguration()
    hcap.webrtc.getConfiguration()
    hcap.webrtc.showDiagnostics()
- <static> hcap.webrtc.stopCheckAudio(param)
  Stops hcap.webrtc.startCheckAudio().

      hcap.webrtc.stopCheckAudio({
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

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

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

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

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

  Deprecated:
  since 1.24
  See:
    {Event} webrtc_message_received
    {Event} webrtc_event_received
    hcap.webrtc.startPreviewVideo()
    hcap.webrtc.stopPreviewVideo()
    hcap.webrtc.incomingCall()
    hcap.webrtc.outgoingCall()
    hcap.webrtc.endCall()
    hcap.webrtc.acceptMessage()
    hcap.webrtc.startCheckAudio()
    hcap.webrtc.setConfiguration()
    hcap.webrtc.getConfiguration()
    hcap.webrtc.showDiagnostics()
- <static> hcap.webrtc.stopPreviewVideo(param)
  Stops playing local video.

      hcap.webrtc.stopPreviewVideo({
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

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

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

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

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

  Deprecated:
  since 1.24
  See:
    {Event} webrtc_message_received
    {Event} webrtc_event_received
    hcap.webrtc.startPreviewVideo()
    hcap.webrtc.incomingCall()
    hcap.webrtc.outgoingCall()
    hcap.webrtc.endCall()
    hcap.webrtc.acceptMessage()
    hcap.webrtc.startCheckAudio()
    hcap.webrtc.stopCheckAudio()
    hcap.webrtc.setConfiguration()
    hcap.webrtc.getConfiguration()
    hcap.webrtc.showDiagnostics()