getMediaDevices(获取设备列表)
接口描述
获取本地设备列表,如麦克风和扬声器。
注意事项
需要账号注册成功后才能调用该接口。
方法定义
OpenEyeCall.prototype.getMediaDevices = function(type, callbacks)
参数描述
|
参数名 |
类型 |
可选/必选 |
描述 |
|---|---|---|---|
|
type |
Number |
必选 |
设备类型。0表示麦克风,1表示扬声器。 |
|
callbacks |
可选 |
回调方法。 |
|
参数名 |
类型 |
描述 |
|---|---|---|
|
description |
String |
当前请求描述。 |
|
result |
Number |
查询结果。0表示成功,其他表示失败。 |
|
rsp |
Number |
内部消息编号。 |
|
param |
设备信息。 |
{
"description" : "tsdk_get_devices",
"param" : {
"deviceInfo" : [
{
"cameraOrient":0,
"deviceId":0,
"deviceName":
"default: 扬声器 (Huawei HDP Audio Driver)",
"index":0
},
{
"cameraOrient":0,
"deviceId":0,
"deviceName":"扬声器 (Huawei HDP Audio Driver)",
"index":1
}
],
"deviceType":1,
"num" : 2
},
"result" : 0,
"rsp" : 67550
}
使用示例
function getMediaDevices() {
global_openEye_SDK.openEyeCall.getMediaDevices(1, {
response: getMediaDevicesResponse
});
}
function getMediaDevicesResponse(data) {
console.info(data);
if (data.result == 0) {
console.info("GetMediaDevices success");
} else {
console.error("GetMediaDevices failed");
}
}