Updated on 2023-10-12 GMT+08:00

openCamera (Turning on the Camera)

Interface Description

This interface is invoked to turn on the local camera.

Notes

The WebSocket connection with the OpenEye is set up.

Method Definition

OpenEyeCall.prototype.openCamera = function(callId, callbacks)

Parameter Description

Table 1 Parameter description

Parameter

Type

Mandatory/Optional

Description

callId

Number

Mandatory

Call ID of the current call. If no ongoing call is available, this parameter must be set to –1.

callbacks

Callback

Optional

Callback method.

Table 2 Callback

Parameter

Type

Mandatory/Optional

Description

response

function

Mandatory

For details about the input parameters of the callback method, see Table 3.

Table 3 Input parameters of the callback method

Parameter

Type

Description

description

String

Description of the current request.

result

Number

Configuration result. The value 0 indicates success and other values indicate failure.

rsp

Number

Internal message ID.

The following is an example of input parameters of the callback method:

{
   "description" : "tsdk_control_camera",
   "result" : 0,
   "rsp" : 67759
}

Examples

function switchCameraMode() {
 var ischecked = document.getElementById("camera-control-toggle-button").checked;
 if (tupCurrentCallId == "") {
  tupCurrentCallId = -1;
 }
 if (ischecked) {
  console.info("switchCameraMode ischecked true.CallId is:"+tupCurrentCallId);
  this.global_openEye_SDK.openEyeCall.openCamera(tupCurrentCallId, {
   response: cameraModeResponse});
 } else {
  console.info("switchCameraMode ischecked false.CallId is:"+tupCurrentCallId);
  this.global_openEye_SDK.openEyeCall.closeCamera(tupCurrentCallId, {
   response: cameraModeResponse});
 }
}

function cameraModeResponse(data) {
    console.info(data);
    if (data.result == 0) {
        console.info("controlVideo Success.");
    } else {
        console.error("controlVideo failed.");
    }
}