AVDEngine

AVDEngine

new AVDEngine()

Description:
  • AVDEngine构造函数,实例化avdEngine 对象,用于获取摄像头列表、麦克风列表、检查浏览器兼容性、控制日志等级及日志保存等功能。
Source:
Example
var avdEngine = new AVDEngine();

Methods

addCallback(type, callback)

Description:
  • 引擎级别的回调
Source:
Example
avdEngine.addCallback(EngineCallback.device_microphone_change, onMicrophoneDeviceChangeHandle)
avdEngine.addCallback(EngineCallback.device_camera_change, onCameraDeviceChangeHandle)

//param {String} changeType -  设备变化类型,可以为"add"、"remove"
//param {Array} deviceIdList - 变动的麦克风设备ID列表
function onMicrophoneDeviceChangeHandle(changeType, deviceIdList) {}

//param {String} changeType -  设备变化类型,可以为"add"、"remove"
//param {Array} deviceIdList - 变动的摄像头设备ID列表
function onCameraDeviceChangeHandle(changeType, deviceIdList) {}
Parameters:
Name Type Description
type EngineCallback 回调枚举标识, 包括EngineCallback.device_microphone_changet 和 device_camera_change.
callback Object 回调方法名,可以自定义,建议保持默认值

addCallback(type, callback)

Description:
  • 引擎级别的回调
Source:
Example
avdEngine.addCallback(EngineCallback.device_microphone_change, onMicrophoneDeviceChangeHandle)
avdEngine.addCallback(EngineCallback.device_camera_change, onCameraDeviceChangeHandle)

//param {String} changeType -  设备变化类型,可以为"add"、"remove"
//param {Array} deviceIdList - 变动的麦克风设备ID列表
function onMicrophoneDeviceChangeHandle(changeType, deviceIdList) {}

//param {String} changeType -  设备变化类型,可以为"add"、"remove"
//param {Array} deviceIdList - 变动的摄像头设备ID列表
function onCameraDeviceChangeHandle(changeType, deviceIdList) {}
Parameters:
Name Type Description
type EngineCallback 回调枚举标识, 包括EngineCallback.device_microphone_changet 和 device_camera_change.
callback Object 回调方法名,可以自定义,建议保持默认值

checkAudioLevel(intervalMilis, showAudioLevel)

Description:
  • 设备检测,麦克风音量的检测回调
Source:
Example
avdEngine.checkAudioLevel(1000,showAudioLevel);
function showAudioLevelm(audioLevel) {}
Parameters:
Name Type Description
intervalMilis int 音量采购频率,单位为毫秒
showAudioLevel Object 音量值回调方法

checkAudioLevel(intervalMilis, showAudioLevel)

Description:
  • 设备检测,麦克风音量的检测回调
Source:
Example
avdEngine.checkAudioLevel(1000,showAudioLevel);
function showAudioLevelm(audioLevel) {}
Parameters:
Name Type Description
intervalMilis int 音量采购频率,单位为毫秒
showAudioLevel Object 音量值回调方法

checkBrowserPluginSupport() → {boolean}

Description:
  • 检测当前浏览器是否通过插件支持rtc能力
Source:
Example
var browserPluginSupport = avdEngine.checkBrowserPluginSupport();
Returns:
- 是否支持, false:不支持; true:支持
Type
boolean

checkBrowserPluginSupport() → {boolean}

Description:
  • 检测当前浏览器是否通过插件支持rtc能力
Source:
Example
var browserPluginSupport = avdEngine.checkBrowserPluginSupport();
Returns:
- 是否支持, false:不支持; true:支持
Type
boolean

checkBrowserSupport() → {boolean}

Description:
  • 检测当前浏览器是否支持rtc能力,目前仅支持Chrome内核的浏览器、firefox和safair.
Source:
Example
var browserSupport = avdEngine.checkBrowserSupport();
Returns:
- 是否支持, false:不支持; true:支持
Type
boolean

checkBrowserSupport() → {boolean}

Description:
  • 检测当前浏览器是否支持rtc能力,目前仅支持Chrome内核的浏览器、firefox和safair.
Source:
Example
var browserSupport = avdEngine.checkBrowserSupport();
Returns:
- 是否支持, false:不支持; true:支持
Type
boolean

checkCloseAudio()

Description:
  • 设备检测,关闭麦克风
Source:
Example
avdEngine.checkCloseAudio();

checkCloseAudio()

Description:
  • 设备检测,关闭麦克风
Source:
Example
avdEngine.checkCloseAudio();

checkCloseVideo()

Description:
  • 设备检测,关闭摄像头
Source:
Example
avdEngine.checkCloseVideo();

checkCloseVideo()

Description:
  • 设备检测,关闭摄像头
Source:
Example
avdEngine.checkCloseVideo();

(async) checkOpenAudio(microphoneId) → {Object}

Description:
  • 设备检测,打开麦克风
Source:
Example
avdEngine.checkOpenAudio().then(showAudio).otherwise(alertError);

function showAudio(stream) {
   checkAudio.srcObject = stream;
}
Parameters:
Name Type Description
microphoneId String 麦克风ID,空字符串时则默认选择打开一个麦克风
Returns:
- 音频流对象
Type
Object

(async) checkOpenAudio(microphoneId) → {Object}

Description:
  • 设备检测,打开麦克风
Source:
Example
avdEngine.checkOpenAudio().then(showAudio).otherwise(alertError);

function showAudio(stream) {
   checkAudio.srcObject = stream;
}
Parameters:
Name Type Description
microphoneId String 麦克风ID,空字符串时则默认选择打开一个麦克风
Returns:
- 音频流对象
Type
Object

(async) checkOpenVideo(cameraId, resolution, framerate) → {Object}

Description:
  • 设备检测,打开摄像头
Source:
Example
avdEngine.checkOpenVideo(cameraId, resolution, framerate).then(showVideo).otherwise(alertError);

function showVideo(stream) {
   checkVideo.srcObject = stream;
}
Parameters:
Name Type Description
cameraId String 摄像头ID,空字符串时则默认选择打开一个摄像头
resolution Int 视频分辨率
framerate Int 视频帧率
Returns:
- 视频流对象
Type
Object

(async) checkOpenVideo(cameraId, resolution, framerate) → {Object}

Description:
  • 设备检测,打开摄像头
Source:
Example
avdEngine.checkOpenVideo(cameraId, resolution, framerate).then(showVideo).otherwise(alertError);

function showVideo(stream) {
   checkVideo.srcObject = stream;
}
Parameters:
Name Type Description
cameraId String 摄像头ID,空字符串时则默认选择打开一个摄像头
resolution Int 视频分辨率
framerate Int 视频帧率
Returns:
- 视频流对象
Type
Object

(async) checkOpenVideoAndAudio(cameraId, microphoneId, resolution, framerate) → {Object}

Description:
  • 设备检测,打开摄像头和麦克风
Source:
Example
avdEngine.checkOpenVideoAndAudio().then(showVideoAndAudio).otherwise(alertError);

function showVideoAndAudio(stream) {
   checkVideo.srcObject = stream.videoStream;
   checkAudio.srcObject = stream.audioStream;
}
Parameters:
Name Type Description
cameraId String 摄像头ID,空字符串时则默认选择打开一个摄像头
microphoneId String 麦克风ID,空字符串时则默认选择打开一个麦克风
resolution Int 视频分辨率
framerate Int 视频帧率
Returns:
- 音视频流对象
Type
Object

(async) checkOpenVideoAndAudio(cameraId, microphoneId, resolution, framerate) → {Object}

Description:
  • 设备检测,打开摄像头和麦克风
Source:
Example
avdEngine.checkOpenVideoAndAudio().then(showVideoAndAudio).otherwise(alertError);

function showVideoAndAudio(stream) {
   checkVideo.srcObject = stream.videoStream;
   checkAudio.srcObject = stream.audioStream;
}
Parameters:
Name Type Description
cameraId String 摄像头ID,空字符串时则默认选择打开一个摄像头
microphoneId String 麦克风ID,空字符串时则默认选择打开一个麦克风
resolution Int 视频分辨率
framerate Int 视频帧率
Returns:
- 音视频流对象
Type
Object

(async) getAllDevices() → {Object}

Description:
  • 获取当前所有设备的原始对象,需要应用层自己去疏理摄像头,麦克风等。
Source:
Example
avdEngine.getAllDevices().then(onAllDevices).otherwise(showError);

function onAllDevices(devices) {
   devices.forEach(function(device){
	     if (device.kind === 'videoinput' || device.kind === 'video') {
	           console.log("camera:",device);
      }else if(device.kind === 'audioinput' || device.kind === 'audio'){
	           console.log("microphone:",device);
      }else if(device.kind === 'audiooutput'){
	           console.log("speaker:",device);
      }
   }
}
Returns:
- devices - 所有设备的原始对象
Type
Object

(async) getAllDevices() → {Object}

Description:
  • 获取当前所有设备的原始对象,需要应用层自己去疏理摄像头,麦克风等。
Source:
Example
avdEngine.getAllDevices().then(onAllDevices).otherwise(showError);

function onAllDevices(devices) {
   devices.forEach(function(device){
	     if (device.kind === 'videoinput' || device.kind === 'video') {
	           console.log("camera:",device);
      }else if(device.kind === 'audioinput' || device.kind === 'audio'){
	           console.log("microphone:",device);
      }else if(device.kind === 'audiooutput'){
	           console.log("speaker:",device);
      }
   }
}
Returns:
- devices - 所有设备的原始对象
Type
Object

getAudioAutoSub()

Description:
  • 获取当前的音频的订阅方式,true为自动订阅,flase为手动订阅
Source:
Example
avdEngine.getAudioAutoSub();

getAudioAutoSub()

Description:
  • 获取当前的音频的订阅方式,true为自动订阅,flase为手动订阅
Source:
Example
avdEngine.getAudioAutoSub();

getAudioBatchEnabled()

Description:
  • 获取音频自动订阅时,对多路音频批量订阅处理的状态值
Source:

getAudioBatchEnabled()

Description:
  • 获取音频自动订阅时,对多路音频批量订阅处理的状态值
Source:

getAudioCoding()

Description:
  • 获取当前的音频编码格式
Source:
Example
avdEngine.getAudioCoding();

getAudioCoding()

Description:
  • 获取当前的音频编码格式
Source:
Example
avdEngine.getAudioCoding();

getBrowserDetect() → {Object}

Description:
  • 获取浏览器检测结果
Source:
Example
var detect = avdEngine.getBrowserDetect();

detect.browser.name:  浏览器内核名称
detect.browser.fullVersion: 内核版本
detect.browser.isCustomized: 是否是定制外壳
detect.browser.shellFullVersion:外壳版本
detect.osName: 操作系统名称
detect.getUserMediaSupport:是否支持webrtc的GetUserMedia
detect.RTCPeerConnectionSupport:是否支持webrtc的RTCPeerConnection
detect.dataChannelSupport: 是否支持webrtc的DataChannel
detect.WebSocketSupport: 是否支持WebSocket
detect.screenSharingSupport: 是否支持屏幕共享(chrome42以上及https访问)
detect.h264Support: 是否支持H264(chrome52及以上)
Returns:
- 浏览器检测结果对象
Type
Object

getBrowserDetect() → {Object}

Description:
  • 获取浏览器检测结果
Source:
Example
var detect = avdEngine.getBrowserDetect();

detect.browser.name:  浏览器内核名称
detect.browser.fullVersion: 内核版本
detect.browser.isCustomized: 是否是定制外壳
detect.browser.shellFullVersion:外壳版本
detect.osName: 操作系统名称
detect.getUserMediaSupport:是否支持webrtc的GetUserMedia
detect.RTCPeerConnectionSupport:是否支持webrtc的RTCPeerConnection
detect.dataChannelSupport: 是否支持webrtc的DataChannel
detect.WebSocketSupport: 是否支持WebSocket
detect.screenSharingSupport: 是否支持屏幕共享(chrome42以上及https访问)
detect.h264Support: 是否支持H264(chrome52及以上)
Returns:
- 浏览器检测结果对象
Type
Object

getCustomerTokenEnabled()

Description:
  • 获取当前是否开启客户自己的认证token状态值
Source:

getCustomerTokenEnabled()

Description:
  • 获取当前是否开启客户自己的认证token状态值
Source:

getDataCryptoType()

Description:
  • 获取当前的数据加密类型
Source:
Example
avdEngine.getDataCryptoType();

getDataCryptoType()

Description:
  • 获取当前的数据加密类型
Source:
Example
avdEngine.getDataCryptoType();

getElectronManager()

Description:
  • 获取ElectronManager对象
Source:
Example
var electronManager = avdEngine.getElectronManager();

getElectronManager()

Description:
  • 获取ElectronManager对象
Source:
Example
var electronManager = avdEngine.getElectronManager();

getMediaConnectType()

Description:
  • 获取媒体通道协议,0 表示udp优先; 1表示 tcp优先,默认为0
Source:
Example
avdEngine.getMediaConnectType();

getMediaConnectType()

Description:
  • 获取媒体通道协议,0 表示udp优先; 1表示 tcp优先,默认为0
Source:
Example
avdEngine.getMediaConnectType();

getResolutionEnum()

Description:
  • 获取摄像头分辨率枚举,该枚举值只是罗列了主流的分辨率,而非真实的当前摄像头支持的分辨率集。
Source:
Example
avdEngine.getResolutionEnum().then(fillResolutionElement);

function fillResolutionElement(resolutionEnum){
	    for(var key in resolutionEnum){
			 	var resolutionObject = resolutionEnum[key];
			 	var value = resolutionObject.width +" X " + resolutionObject.height;
	     }
}

getResolutionEnum()

Description:
  • 获取摄像头分辨率枚举,该枚举值只是罗列了主流的分辨率,而非真实的当前摄像头支持的分辨率集。
Source:
Example
avdEngine.getResolutionEnum().then(fillResolutionElement);

function fillResolutionElement(resolutionEnum){
	    for(var key in resolutionEnum){
			 	var resolutionObject = resolutionEnum[key];
			 	var value = resolutionObject.width +" X " + resolutionObject.height;
	     }
}

getRestfulRequestType()

Description:
  • 获取RESTful API 请求类型,0 表示GET; 1表示 POST,默认为0
Source:
Example
avdEngine.getRestfulRequestType();

getRestfulRequestType()

Description:
  • 获取RESTful API 请求类型,0 表示GET; 1表示 POST,默认为0
Source:
Example
avdEngine.getRestfulRequestType();

getRoom(roomId) → {Object}

Description:
  • 获取房间对象
Source:
Parameters:
Name Type Description
roomId String 房间ID
Returns:
room - 房间对象
Type
Object

getRoom(roomId) → {Object}

Description:
  • 获取房间对象
Source:
Parameters:
Name Type Description
roomId String 房间ID
Returns:
room - 房间对象
Type
Object

getSimulcastEnabled()

Description:
  • 获取视频是否开启多流的状态值
Source:

getSimulcastEnabled()

Description:
  • 获取视频是否开启多流的状态值
Source:

getTraceId() → {String}

Description:
  • 获取traceId
Source:
Returns:
traceId
Type
String

getTraceId() → {String}

Description:
  • 获取traceId
Source:
Returns:
traceId
Type
String

getVersion() → {String}

Description:
  • 获取当前rtc web SDK的版本号
Source:
Example
var Version = avdEngine.getVersion();
Returns:
- 版本号
Type
String

getVersion() → {String}

Description:
  • 获取当前rtc web SDK的版本号
Source:
Example
var Version = avdEngine.getVersion();
Returns:
- 版本号
Type
String

getVideoCoding()

Description:
  • 获取当前的视频编码格式
Source:
Example
avdEngine.getVideoCoding();

getVideoCoding()

Description:
  • 获取当前的视频编码格式
Source:
Example
avdEngine.getVideoCoding();

(async) init(serverURI, accessToken, isUseCascade)

Description:
  • 引擎初始化
Source:
Example
avdEngine.init('avd.nice2meet.cn:9610','ZDgyNGU1MGU0ZGY2MTJlZWY3NjkwMjQ5NDY0YWE3MDkxZGJjNmRiZg==').then(function(){}).otherwise(function(error){});
Parameters:
Name Type Description
serverURI String MCU服务器地址
accessToken String 访问令牌
isUseCascade boolean 是否级联加入会议,可以不传,默认为false

(async) init(serverURI, accessToken, isUseCascade)

Description:
  • 引擎初始化
Source:
Example
avdEngine.init('avd.nice2meet.cn:9610','ZDgyNGU1MGU0ZGY2MTJlZWY3NjkwMjQ5NDY0YWE3MDkxZGJjNmRiZg==').then(function(){}).otherwise(function(error){});
Parameters:
Name Type Description
serverURI String MCU服务器地址
accessToken String 访问令牌
isUseCascade boolean 是否级联加入会议,可以不传,默认为false

(async) initDevice() → {int}

Description:
  • 初始化摄像头、麦克风设备

    逻辑:摄像头设备会全部初始化到服务器,麦克风设备只会初始化默认的一个到服务器

Source:
Example
avdEngine.initDevice().then(function(result){
	   if(result == 1){
	      console.log('设备初始化完成');
    }
}).otherwise(function(error){});
Returns:
- 返回初始化完成状态。1:代表完成
Type
int

(async) initDevice() → {int}

Description:
  • 初始化摄像头、麦克风设备

    逻辑:摄像头设备会全部初始化到服务器,麦克风设备只会初始化默认的一个到服务器

Source:
Example
avdEngine.initDevice().then(function(result){
	   if(result == 1){
	      console.log('设备初始化完成');
    }
}).otherwise(function(error){});
Returns:
- 返回初始化完成状态。1:代表完成
Type
int

(async) initWithOEM(serverURI, oemName)

Description:
  • avdEngine OEM初始化
Source:
Parameters:
Name Type Description
serverURI String MCU服务器地址
oemName String oem名称

(async) initWithOEM(serverURI, oemName)

Description:
  • avdEngine OEM初始化
Source:
Parameters:
Name Type Description
serverURI String MCU服务器地址
oemName String oem名称

obtainRoom(roomId) → {Object}

Description:
  • 获取房间。如房间存在,直接返回,不存在时创建房间后返回
Source:
Example
var roomId = '13124323454';
room = avdEngine.obtainRoom(roomId);
Parameters:
Name Type Description
roomId String 房间ID
Returns:
room - 房间对象
Type
Object

obtainRoom(roomId) → {Object}

Description:
  • 获取房间。如房间存在,直接返回,不存在时创建房间后返回
Source:
Example
var roomId = '13124323454';
room = avdEngine.obtainRoom(roomId);
Parameters:
Name Type Description
roomId String 房间ID
Returns:
room - 房间对象
Type
Object

preloadBeautyModel() → {Promise}

Description:
  • 预加载美颜模型(人脸检测),可以在用户点击美颜按钮之前提前调用,显著减少首次启用美颜的等待时间
Source:
Example
avdEngine.preloadBeautyModel().then(function() { console.log('预加载完成'); }).catch(function(e) { console.error('预加载失败:', e); });
Returns:
- 预加载结果
Type
Promise

preloadBeautyModel() → {Promise}

Description:
  • 预加载美颜模型(人脸检测),可以在用户点击美颜按钮之前提前调用,显著减少首次启用美颜的等待时间
Source:
Example
avdEngine.preloadBeautyModel().then(function() { console.log('预加载完成'); }).catch(function(e) { console.error('预加载失败:', e); });
Returns:
- 预加载结果
Type
Promise

setApplyToElectron(islectron, protocolStr)

Description:
  • Electron开发应用时,设置应用的协议
Source:
Parameters:
Name Type Description
islectron Boolean islectron true为应用于Electron
protocolStr String protocolStr Electron应用时的协议,可不填,默认为http:

setApplyToElectron(islectron, protocolStr)

Description:
  • Electron开发应用时,设置应用的协议
Source:
Parameters:
Name Type Description
islectron Boolean islectron true为应用于Electron
protocolStr String protocolStr Electron应用时的协议,可不填,默认为http:

setAudioAutoSub(isAudioAutodSub)

Description:
  • 设置音频订阅方式是否为自动订阅,默认值为true
Source:
Example
avdEngine.setAudioAutoSub(false);
Parameters:
Name Type Description
isAudioAutodSub Boolean true为自动订阅,flase为手动订阅

setAudioAutoSub(isAudioAutodSub)

Description:
  • 设置音频订阅方式是否为自动订阅,默认值为true
Source:
Example
avdEngine.setAudioAutoSub(false);
Parameters:
Name Type Description
isAudioAutodSub Boolean true为自动订阅,flase为手动订阅

setAudioBatchEnabled(isAudioBatch)

Description:
  • 音频自动订阅时,设置对多路音频批量订阅处理,这样可以只进行一次SDP交互以提高性能,默认值为false,
Source:
Example
avdEngine.setAudioBatchEnabled(true);
Parameters:
Name Type Description
isAudioBatch Boolean isAudioBatch false为不开启,true为开启

setAudioBatchEnabled(isAudioBatch)

Description:
  • 音频自动订阅时,设置对多路音频批量订阅处理,这样可以只进行一次SDP交互以提高性能,默认值为false,
Source:
Example
avdEngine.setAudioBatchEnabled(true);
Parameters:
Name Type Description
isAudioBatch Boolean isAudioBatch false为不开启,true为开启

(async) setAudioCoding(audioCodingType)

Description:
  • 设置音频编码格式
Source:
Example
avdEngine.setAudioCoding(AudioCodingType.opus).then(function(){}).otherwise(function(error){});
Parameters:
Name Type Description
audioCodingType AudioCodingType 音频编码格式(枚举型),默认值为AudioCodingType.opus

(async) setAudioCoding(audioCodingType)

Description:
  • 设置音频编码格式
Source:
Example
avdEngine.setAudioCoding(AudioCodingType.opus).then(function(){}).otherwise(function(error){});
Parameters:
Name Type Description
audioCodingType AudioCodingType 音频编码格式(枚举型),默认值为AudioCodingType.opus

setAutoGainControl(enable)

Description:
  • 设置自动增益
Source:
Parameters:
Name Type Description
enable Boolean

setAutoGainControl(enable)

Description:
  • 设置自动增益
Source:
Parameters:
Name Type Description
enable Boolean

setBugout(logFilename)

Description:
  • 设置日志的可输出下载地址
Source:
Example
avdEngine.setBugout(avdlog.txt);
Parameters:
Name Type Description
logFilename String 输出下载地址

setBugout(logFilename)

Description:
  • 设置日志的可输出下载地址
Source:
Example
avdEngine.setBugout(avdlog.txt);
Parameters:
Name Type Description
logFilename String 输出下载地址

setCustomerTokenEnabled(customerTokenEnabled)

Description:
  • 设置是否开启客户自己的认证token,不调接口设置时,默认值为不开启
Source:
Example
avdEngine.setCustomerTokenEnabled(true);
Parameters:
Name Type Description
customerTokenEnabled Boolean customerTokenEnabled false为不开启,true为开启

setCustomerTokenEnabled(customerTokenEnabled)

Description:
  • 设置是否开启客户自己的认证token,不调接口设置时,默认值为不开启
Source:
Example
avdEngine.setCustomerTokenEnabled(true);
Parameters:
Name Type Description
customerTokenEnabled Boolean customerTokenEnabled false为不开启,true为开启

setDataCryptoType(dataCryptoType)

Description:
  • 设置数据加密类型
Source:
Example
avdEngine.setDataCryptoType(DataCryptoType.AES256);
Parameters:
Name Type Description
dataCryptoType DataCryptoType 数据加密类型(枚举型),默认值为DataCryptoType.AES128

setDataCryptoType(dataCryptoType)

Description:
  • 设置数据加密类型
Source:
Example
avdEngine.setDataCryptoType(DataCryptoType.AES256);
Parameters:
Name Type Description
dataCryptoType DataCryptoType 数据加密类型(枚举型),默认值为DataCryptoType.AES128

setDefaultMediaPublishKeepAliveTime(keepAliveTime)

Description:
  • 设置媒体流推送的保活时长(单位为毫秒),不设置默认为15000毫秒
Source:
Parameters:
Name Type Description
keepAliveTime int 保活时长

setDefaultMediaPublishKeepAliveTime(keepAliveTime)

Description:
  • 设置媒体流推送的保活时长(单位为毫秒),不设置默认为15000毫秒
Source:
Parameters:
Name Type Description
keepAliveTime int 保活时长

setDefaultScreenParams(maxWidth, maxHeight, minFrameRate, maxFrameRate)

Description:
  • 设置桌面共享相关的默认参数值
Source:
Example
avdEngine.setDefaultScreenParams(1080,720,5,10);
Parameters:
Name Type Description
maxWidth int 分辨率最大宽度,默认值为1920
maxHeight int 分辨率最大高度,默认值为1080
minFrameRate int 最小帧率, 默认值为5
maxFrameRate int 最大帧率, 默认值为10

setDefaultScreenParams(maxWidth, maxHeight, minFrameRate, maxFrameRate)

Description:
  • 设置桌面共享相关的默认参数值
Source:
Example
avdEngine.setDefaultScreenParams(1080,720,5,10);
Parameters:
Name Type Description
maxWidth int 分辨率最大宽度,默认值为1920
maxHeight int 分辨率最大高度,默认值为1080
minFrameRate int 最小帧率, 默认值为5
maxFrameRate int 最大帧率, 默认值为10

setDefaultVideoParams(width, height, resolutionSetType, frameRate)

Description:
  • 设置视频相关的默认参数值
Source:
Example
avdEngine.setDefaultVideoParams(1080,720,ResolutionSetType.ideal,25);
Parameters:
Name Type Description
width int 分辨率宽,默认值为640
height int 分辨率高,默认值为480
resolutionSetType Object 分辨率设置类型枚举,默认值为强制即ResolutionSetType.ideal
frameRate int 视频帧率,默认值为20

setDefaultVideoParams(width, height, resolutionSetType, frameRate)

Description:
  • 设置视频相关的默认参数值
Source:
Example
avdEngine.setDefaultVideoParams(1080,720,ResolutionSetType.ideal,25);
Parameters:
Name Type Description
width int 分辨率宽,默认值为640
height int 分辨率高,默认值为480
resolutionSetType Object 分辨率设置类型枚举,默认值为强制即ResolutionSetType.ideal
frameRate int 视频帧率,默认值为20

setEchoCancellation(enable)

Description:
  • 设置回声消除
Source:
Example
avdEngine.setEchoCancellation(false);
Parameters:
Name Type Description
enable Boolean 是否开启回声消除,默认为true

setEchoCancellation(enable)

Description:
  • 设置回声消除
Source:
Example
avdEngine.setEchoCancellation(false);
Parameters:
Name Type Description
enable Boolean 是否开启回声消除,默认为true

setEnableHardwareEncoding(isEnable)

Description:
  • 在加入会议之前设置是否启用硬件编码,默认为false,推荐有独立显卡的电脑设备开启,如性能足够,可实现高分辨率、高码率和高帧率
Source:
Parameters:
Name Type Description
isEnable Boolean 是否开启硬件编码

setEnableHardwareEncoding(isEnable)

Description:
  • 在加入会议之前设置是否启用硬件编码,默认为false,推荐有独立显卡的电脑设备开启,如性能足够,可实现高分辨率、高码率和高帧率
Source:
Parameters:
Name Type Description
isEnable Boolean 是否开启硬件编码

setIgnoreModifyResourceReq(isIgnore)

Description:
  • 是否忽略服务器下发的资源调整信令,true则不会响应服务器调整资源的通知,例如没有人订阅时发布的视频不会自动降低分辨率码率等
Source:
Parameters:
Name Type Description
isIgnore Boolean 是否忽略修改资源请求

setIgnoreModifyResourceReq(isIgnore)

Description:
  • 是否忽略服务器下发的资源调整信令,true则不会响应服务器调整资源的通知,例如没有人订阅时发布的视频不会自动降低分辨率码率等
Source:
Parameters:
Name Type Description
isIgnore Boolean 是否忽略修改资源请求

setLog(appenderModel, logLevel)

Description:
  • 设置日志显示方式和日志级别
Source:
Example
avdEngine.setLog(Appender.browserConsole, LogLevel.debug);
Parameters:
Name Type Description
appenderModel Appender 日志显示方式(枚举型), 默认值为Appender.browserConsole
logLevel LogLevel 日志级别(枚举型),默认值为LogLevel.info

setLog(appenderModel, logLevel)

Description:
  • 设置日志显示方式和日志级别
Source:
Example
avdEngine.setLog(Appender.browserConsole, LogLevel.debug);
Parameters:
Name Type Description
appenderModel Appender 日志显示方式(枚举型), 默认值为Appender.browserConsole
logLevel LogLevel 日志级别(枚举型),默认值为LogLevel.info

setMcuClusterRouteParams(mcuClusterRouteParams)

Description:
  • 在分布式集群部署中,设置加入房间时mcu服务器的路由参数分配
Source:
Parameters:
Name Type Description
mcuClusterRouteParams Object 参数值格式参考如:{ip_tag":"local","idc_code":"idc_code"} ip_tag:对应于 rtc_node_addr 中的tag标志,用于区分同一台服务器的多网卡地址,可以自定义,然后在参数中传入。 举例的话,比如 'local','internal','dianxin','liantong' idc_code:对应于 rtc_node 中的 idc_code标志,用于区分不同的服务器,唯一,可以自定义。 比如北京服务器设置为'beijing',杭州的设置为'hangzhou',然后在参数中传入,用于定位到服务器。

setMcuClusterRouteParams(mcuClusterRouteParams)

Description:
  • 在分布式集群部署中,设置加入房间时mcu服务器的路由参数分配
Source:
Parameters:
Name Type Description
mcuClusterRouteParams Object 参数值格式参考如:{ip_tag":"local","idc_code":"idc_code"} ip_tag:对应于 rtc_node_addr 中的tag标志,用于区分同一台服务器的多网卡地址,可以自定义,然后在参数中传入。 举例的话,比如 'local','internal','dianxin','liantong' idc_code:对应于 rtc_node 中的 idc_code标志,用于区分不同的服务器,唯一,可以自定义。 比如北京服务器设置为'beijing',杭州的设置为'hangzhou',然后在参数中传入,用于定位到服务器。

setMediaConnectType(mediaType,)

Description:
  • 设置媒体通道协议
Source:
Example
avdEngine.setMediaConnectType(1);
Parameters:
Name Type Description
mediaType, int 0 表示udp优先; 1表示 tcp优先,默认为0

setMediaConnectType(mediaType,)

Description:
  • 设置媒体通道协议
Source:
Example
avdEngine.setMediaConnectType(1);
Parameters:
Name Type Description
mediaType, int 0 表示udp优先; 1表示 tcp优先,默认为0

setNoiseSuppression(enable)

Description:
  • 设置降噪
Source:
Parameters:
Name Type Description
enable Boolean

setNoiseSuppression(enable)

Description:
  • 设置降噪
Source:
Parameters:
Name Type Description
enable Boolean

setRecordingMicrophone(microphoneId)

Description:
  • 设置成当前使用的麦克风
Source:
Parameters:
Name Type Description
microphoneId String 麦克风设备Id

setRecordingMicrophone(microphoneId)

Description:
  • 设置成当前使用的麦克风
Source:
Parameters:
Name Type Description
microphoneId String 麦克风设备Id

setReportLogger(appSign, appFunName)

Description:
  • 日志内容通过应用层提供的函数进行上报
Source:
Parameters:
Name Type Description
appSign string 应用层设置的标识,用于区别某用户某一次加入会议所产生的所有日志
appFunName Object 应用层设置的方法函数,SDK调用该函数上报日志内容

setReportLogger(appSign, appFunName)

Description:
  • 日志内容通过应用层提供的函数进行上报
Source:
Parameters:
Name Type Description
appSign string 应用层设置的标识,用于区别某用户某一次加入会议所产生的所有日志
appFunName Object 应用层设置的方法函数,SDK调用该函数上报日志内容

setRestFullProtocol(protocolStr)

Description:
  • 设置RestFull访问时应用的协议。 不设置默认取document.location.protocol
Source:
Parameters:
Name Type Description
protocolStr String protocolStr RestFull访问应用时的协议,可填写如https:

setRestFullProtocol(protocolStr)

Description:
  • 设置RestFull访问时应用的协议。 不设置默认取document.location.protocol
Source:
Parameters:
Name Type Description
protocolStr String protocolStr RestFull访问应用时的协议,可填写如https:

setRestfulRequestType(requestType,)

Description:
  • 设置RESTful API 请求类型
Source:
Example
avdEngine.setRestfulRequestType(1);
Parameters:
Name Type Description
requestType, int 0 表示GET; 1表示 POST,默认为0

setRestfulRequestType(requestType,)

Description:
  • 设置RESTful API 请求类型
Source:
Example
avdEngine.setRestfulRequestType(1);
Parameters:
Name Type Description
requestType, int 0 表示GET; 1表示 POST,默认为0

setSimulcastEnabled(isSimulcast)

Description:
  • 设置视频是否开启多流,默认值为false
Source:
Example
avdEngine.setSimulcastEnabled(true);
Parameters:
Name Type Description
isSimulcast Boolean isSimulcast false为不开启,true为开启

setSimulcastEnabled(isSimulcast)

Description:
  • 设置视频是否开启多流,默认值为false
Source:
Example
avdEngine.setSimulcastEnabled(true);
Parameters:
Name Type Description
isSimulcast Boolean isSimulcast false为不开启,true为开启

setTraceId(traceId)

Description:
  • 设置traceId,用于监控埋点实现
Source:
Parameters:
Name Type Description
traceId String

setTraceId(traceId)

Description:
  • 设置traceId,用于监控埋点实现
Source:
Parameters:
Name Type Description
traceId String

(async) setVideoCoding(videoCodingType)

Description:
  • 设置视频编码格式
Source:
Example
avdEngine.setVideoCoding(VideoCodingType.VP8).then(function(){}).otherwise(function(error){});
Parameters:
Name Type Description
videoCodingType VideoCodingType 视频编码格式(枚举型),默认值为videoCodingType.H264

(async) setVideoCoding(videoCodingType)

Description:
  • 设置视频编码格式
Source:
Example
avdEngine.setVideoCoding(VideoCodingType.VP8).then(function(){}).otherwise(function(error){});
Parameters:
Name Type Description
videoCodingType VideoCodingType 视频编码格式(枚举型),默认值为videoCodingType.H264

AVDEngine

new AVDEngine()

Description:
  • AVDEngine构造函数,实例化avdEngine 对象,用于获取摄像头列表、麦克风列表、检查浏览器兼容性、控制日志等级及日志保存等功能。
Source:
Example
var avdEngine = new AVDEngine();

Methods

addCallback(type, callback)

Description:
  • 引擎级别的回调
Source:
Example
avdEngine.addCallback(EngineCallback.device_microphone_change, onMicrophoneDeviceChangeHandle)
avdEngine.addCallback(EngineCallback.device_camera_change, onCameraDeviceChangeHandle)

//param {String} changeType -  设备变化类型,可以为"add"、"remove"
//param {Array} deviceIdList - 变动的麦克风设备ID列表
function onMicrophoneDeviceChangeHandle(changeType, deviceIdList) {}

//param {String} changeType -  设备变化类型,可以为"add"、"remove"
//param {Array} deviceIdList - 变动的摄像头设备ID列表
function onCameraDeviceChangeHandle(changeType, deviceIdList) {}
Parameters:
Name Type Description
type EngineCallback 回调枚举标识, 包括EngineCallback.device_microphone_changet 和 device_camera_change.
callback Object 回调方法名,可以自定义,建议保持默认值

addCallback(type, callback)

Description:
  • 引擎级别的回调
Source:
Example
avdEngine.addCallback(EngineCallback.device_microphone_change, onMicrophoneDeviceChangeHandle)
avdEngine.addCallback(EngineCallback.device_camera_change, onCameraDeviceChangeHandle)

//param {String} changeType -  设备变化类型,可以为"add"、"remove"
//param {Array} deviceIdList - 变动的麦克风设备ID列表
function onMicrophoneDeviceChangeHandle(changeType, deviceIdList) {}

//param {String} changeType -  设备变化类型,可以为"add"、"remove"
//param {Array} deviceIdList - 变动的摄像头设备ID列表
function onCameraDeviceChangeHandle(changeType, deviceIdList) {}
Parameters:
Name Type Description
type EngineCallback 回调枚举标识, 包括EngineCallback.device_microphone_changet 和 device_camera_change.
callback Object 回调方法名,可以自定义,建议保持默认值

checkAudioLevel(intervalMilis, showAudioLevel)

Description:
  • 设备检测,麦克风音量的检测回调
Source:
Example
avdEngine.checkAudioLevel(1000,showAudioLevel);
function showAudioLevelm(audioLevel) {}
Parameters:
Name Type Description
intervalMilis int 音量采购频率,单位为毫秒
showAudioLevel Object 音量值回调方法

checkAudioLevel(intervalMilis, showAudioLevel)

Description:
  • 设备检测,麦克风音量的检测回调
Source:
Example
avdEngine.checkAudioLevel(1000,showAudioLevel);
function showAudioLevelm(audioLevel) {}
Parameters:
Name Type Description
intervalMilis int 音量采购频率,单位为毫秒
showAudioLevel Object 音量值回调方法

checkBrowserPluginSupport() → {boolean}

Description:
  • 检测当前浏览器是否通过插件支持rtc能力
Source:
Example
var browserPluginSupport = avdEngine.checkBrowserPluginSupport();
Returns:
- 是否支持, false:不支持; true:支持
Type
boolean

checkBrowserPluginSupport() → {boolean}

Description:
  • 检测当前浏览器是否通过插件支持rtc能力
Source:
Example
var browserPluginSupport = avdEngine.checkBrowserPluginSupport();
Returns:
- 是否支持, false:不支持; true:支持
Type
boolean

checkBrowserSupport() → {boolean}

Description:
  • 检测当前浏览器是否支持rtc能力,目前仅支持Chrome内核的浏览器、firefox和safair.
Source:
Example
var browserSupport = avdEngine.checkBrowserSupport();
Returns:
- 是否支持, false:不支持; true:支持
Type
boolean

checkBrowserSupport() → {boolean}

Description:
  • 检测当前浏览器是否支持rtc能力,目前仅支持Chrome内核的浏览器、firefox和safair.
Source:
Example
var browserSupport = avdEngine.checkBrowserSupport();
Returns:
- 是否支持, false:不支持; true:支持
Type
boolean

checkCloseAudio()

Description:
  • 设备检测,关闭麦克风
Source:
Example
avdEngine.checkCloseAudio();

checkCloseAudio()

Description:
  • 设备检测,关闭麦克风
Source:
Example
avdEngine.checkCloseAudio();

checkCloseVideo()

Description:
  • 设备检测,关闭摄像头
Source:
Example
avdEngine.checkCloseVideo();

checkCloseVideo()

Description:
  • 设备检测,关闭摄像头
Source:
Example
avdEngine.checkCloseVideo();

(async) checkOpenAudio(microphoneId) → {Object}

Description:
  • 设备检测,打开麦克风
Source:
Example
avdEngine.checkOpenAudio().then(showAudio).otherwise(alertError);

function showAudio(stream) {
   checkAudio.srcObject = stream;
}
Parameters:
Name Type Description
microphoneId String 麦克风ID,空字符串时则默认选择打开一个麦克风
Returns:
- 音频流对象
Type
Object

(async) checkOpenAudio(microphoneId) → {Object}

Description:
  • 设备检测,打开麦克风
Source:
Example
avdEngine.checkOpenAudio().then(showAudio).otherwise(alertError);

function showAudio(stream) {
   checkAudio.srcObject = stream;
}
Parameters:
Name Type Description
microphoneId String 麦克风ID,空字符串时则默认选择打开一个麦克风
Returns:
- 音频流对象
Type
Object

(async) checkOpenVideo(cameraId, resolution, framerate) → {Object}

Description:
  • 设备检测,打开摄像头
Source:
Example
avdEngine.checkOpenVideo(cameraId, resolution, framerate).then(showVideo).otherwise(alertError);

function showVideo(stream) {
   checkVideo.srcObject = stream;
}
Parameters:
Name Type Description
cameraId String 摄像头ID,空字符串时则默认选择打开一个摄像头
resolution Int 视频分辨率
framerate Int 视频帧率
Returns:
- 视频流对象
Type
Object

(async) checkOpenVideo(cameraId, resolution, framerate) → {Object}

Description:
  • 设备检测,打开摄像头
Source:
Example
avdEngine.checkOpenVideo(cameraId, resolution, framerate).then(showVideo).otherwise(alertError);

function showVideo(stream) {
   checkVideo.srcObject = stream;
}
Parameters:
Name Type Description
cameraId String 摄像头ID,空字符串时则默认选择打开一个摄像头
resolution Int 视频分辨率
framerate Int 视频帧率
Returns:
- 视频流对象
Type
Object

(async) checkOpenVideoAndAudio(cameraId, microphoneId, resolution, framerate) → {Object}

Description:
  • 设备检测,打开摄像头和麦克风
Source:
Example
avdEngine.checkOpenVideoAndAudio().then(showVideoAndAudio).otherwise(alertError);

function showVideoAndAudio(stream) {
   checkVideo.srcObject = stream.videoStream;
   checkAudio.srcObject = stream.audioStream;
}
Parameters:
Name Type Description
cameraId String 摄像头ID,空字符串时则默认选择打开一个摄像头
microphoneId String 麦克风ID,空字符串时则默认选择打开一个麦克风
resolution Int 视频分辨率
framerate Int 视频帧率
Returns:
- 音视频流对象
Type
Object

(async) checkOpenVideoAndAudio(cameraId, microphoneId, resolution, framerate) → {Object}

Description:
  • 设备检测,打开摄像头和麦克风
Source:
Example
avdEngine.checkOpenVideoAndAudio().then(showVideoAndAudio).otherwise(alertError);

function showVideoAndAudio(stream) {
   checkVideo.srcObject = stream.videoStream;
   checkAudio.srcObject = stream.audioStream;
}
Parameters:
Name Type Description
cameraId String 摄像头ID,空字符串时则默认选择打开一个摄像头
microphoneId String 麦克风ID,空字符串时则默认选择打开一个麦克风
resolution Int 视频分辨率
framerate Int 视频帧率
Returns:
- 音视频流对象
Type
Object

(async) getAllDevices() → {Object}

Description:
  • 获取当前所有设备的原始对象,需要应用层自己去疏理摄像头,麦克风等。
Source:
Example
avdEngine.getAllDevices().then(onAllDevices).otherwise(showError);

function onAllDevices(devices) {
   devices.forEach(function(device){
	     if (device.kind === 'videoinput' || device.kind === 'video') {
	           console.log("camera:",device);
      }else if(device.kind === 'audioinput' || device.kind === 'audio'){
	           console.log("microphone:",device);
      }else if(device.kind === 'audiooutput'){
	           console.log("speaker:",device);
      }
   }
}
Returns:
- devices - 所有设备的原始对象
Type
Object

(async) getAllDevices() → {Object}

Description:
  • 获取当前所有设备的原始对象,需要应用层自己去疏理摄像头,麦克风等。
Source:
Example
avdEngine.getAllDevices().then(onAllDevices).otherwise(showError);

function onAllDevices(devices) {
   devices.forEach(function(device){
	     if (device.kind === 'videoinput' || device.kind === 'video') {
	           console.log("camera:",device);
      }else if(device.kind === 'audioinput' || device.kind === 'audio'){
	           console.log("microphone:",device);
      }else if(device.kind === 'audiooutput'){
	           console.log("speaker:",device);
      }
   }
}
Returns:
- devices - 所有设备的原始对象
Type
Object

getAudioAutoSub()

Description:
  • 获取当前的音频的订阅方式,true为自动订阅,flase为手动订阅
Source:
Example
avdEngine.getAudioAutoSub();

getAudioAutoSub()

Description:
  • 获取当前的音频的订阅方式,true为自动订阅,flase为手动订阅
Source:
Example
avdEngine.getAudioAutoSub();

getAudioBatchEnabled()

Description:
  • 获取音频自动订阅时,对多路音频批量订阅处理的状态值
Source:

getAudioBatchEnabled()

Description:
  • 获取音频自动订阅时,对多路音频批量订阅处理的状态值
Source:

getAudioCoding()

Description:
  • 获取当前的音频编码格式
Source:
Example
avdEngine.getAudioCoding();

getAudioCoding()

Description:
  • 获取当前的音频编码格式
Source:
Example
avdEngine.getAudioCoding();

getBrowserDetect() → {Object}

Description:
  • 获取浏览器检测结果
Source:
Example
var detect = avdEngine.getBrowserDetect();

detect.browser.name:  浏览器内核名称
detect.browser.fullVersion: 内核版本
detect.browser.isCustomized: 是否是定制外壳
detect.browser.shellFullVersion:外壳版本
detect.osName: 操作系统名称
detect.getUserMediaSupport:是否支持webrtc的GetUserMedia
detect.RTCPeerConnectionSupport:是否支持webrtc的RTCPeerConnection
detect.dataChannelSupport: 是否支持webrtc的DataChannel
detect.WebSocketSupport: 是否支持WebSocket
detect.screenSharingSupport: 是否支持屏幕共享(chrome42以上及https访问)
detect.h264Support: 是否支持H264(chrome52及以上)
Returns:
- 浏览器检测结果对象
Type
Object

getBrowserDetect() → {Object}

Description:
  • 获取浏览器检测结果
Source:
Example
var detect = avdEngine.getBrowserDetect();

detect.browser.name:  浏览器内核名称
detect.browser.fullVersion: 内核版本
detect.browser.isCustomized: 是否是定制外壳
detect.browser.shellFullVersion:外壳版本
detect.osName: 操作系统名称
detect.getUserMediaSupport:是否支持webrtc的GetUserMedia
detect.RTCPeerConnectionSupport:是否支持webrtc的RTCPeerConnection
detect.dataChannelSupport: 是否支持webrtc的DataChannel
detect.WebSocketSupport: 是否支持WebSocket
detect.screenSharingSupport: 是否支持屏幕共享(chrome42以上及https访问)
detect.h264Support: 是否支持H264(chrome52及以上)
Returns:
- 浏览器检测结果对象
Type
Object

getCustomerTokenEnabled()

Description:
  • 获取当前是否开启客户自己的认证token状态值
Source:

getCustomerTokenEnabled()

Description:
  • 获取当前是否开启客户自己的认证token状态值
Source:

getDataCryptoType()

Description:
  • 获取当前的数据加密类型
Source:
Example
avdEngine.getDataCryptoType();

getDataCryptoType()

Description:
  • 获取当前的数据加密类型
Source:
Example
avdEngine.getDataCryptoType();

getElectronManager()

Description:
  • 获取ElectronManager对象
Source:
Example
var electronManager = avdEngine.getElectronManager();

getElectronManager()

Description:
  • 获取ElectronManager对象
Source:
Example
var electronManager = avdEngine.getElectronManager();

getMediaConnectType()

Description:
  • 获取媒体通道协议,0 表示udp优先; 1表示 tcp优先,默认为0
Source:
Example
avdEngine.getMediaConnectType();

getMediaConnectType()

Description:
  • 获取媒体通道协议,0 表示udp优先; 1表示 tcp优先,默认为0
Source:
Example
avdEngine.getMediaConnectType();

getResolutionEnum()

Description:
  • 获取摄像头分辨率枚举,该枚举值只是罗列了主流的分辨率,而非真实的当前摄像头支持的分辨率集。
Source:
Example
avdEngine.getResolutionEnum().then(fillResolutionElement);

function fillResolutionElement(resolutionEnum){
	    for(var key in resolutionEnum){
			 	var resolutionObject = resolutionEnum[key];
			 	var value = resolutionObject.width +" X " + resolutionObject.height;
	     }
}

getResolutionEnum()

Description:
  • 获取摄像头分辨率枚举,该枚举值只是罗列了主流的分辨率,而非真实的当前摄像头支持的分辨率集。
Source:
Example
avdEngine.getResolutionEnum().then(fillResolutionElement);

function fillResolutionElement(resolutionEnum){
	    for(var key in resolutionEnum){
			 	var resolutionObject = resolutionEnum[key];
			 	var value = resolutionObject.width +" X " + resolutionObject.height;
	     }
}

getRestfulRequestType()

Description:
  • 获取RESTful API 请求类型,0 表示GET; 1表示 POST,默认为0
Source:
Example
avdEngine.getRestfulRequestType();

getRestfulRequestType()

Description:
  • 获取RESTful API 请求类型,0 表示GET; 1表示 POST,默认为0
Source:
Example
avdEngine.getRestfulRequestType();

getRoom(roomId) → {Object}

Description:
  • 获取房间对象
Source:
Parameters:
Name Type Description
roomId String 房间ID
Returns:
room - 房间对象
Type
Object

getRoom(roomId) → {Object}

Description:
  • 获取房间对象
Source:
Parameters:
Name Type Description
roomId String 房间ID
Returns:
room - 房间对象
Type
Object

getSimulcastEnabled()

Description:
  • 获取视频是否开启多流的状态值
Source:

getSimulcastEnabled()

Description:
  • 获取视频是否开启多流的状态值
Source:

getTraceId() → {String}

Description:
  • 获取traceId
Source:
Returns:
traceId
Type
String

getTraceId() → {String}

Description:
  • 获取traceId
Source:
Returns:
traceId
Type
String

getVersion() → {String}

Description:
  • 获取当前rtc web SDK的版本号
Source:
Example
var Version = avdEngine.getVersion();
Returns:
- 版本号
Type
String

getVersion() → {String}

Description:
  • 获取当前rtc web SDK的版本号
Source:
Example
var Version = avdEngine.getVersion();
Returns:
- 版本号
Type
String

getVideoCoding()

Description:
  • 获取当前的视频编码格式
Source:
Example
avdEngine.getVideoCoding();

getVideoCoding()

Description:
  • 获取当前的视频编码格式
Source:
Example
avdEngine.getVideoCoding();

(async) init(serverURI, accessToken, isUseCascade)

Description:
  • 引擎初始化
Source:
Example
avdEngine.init('avd.nice2meet.cn:9610','ZDgyNGU1MGU0ZGY2MTJlZWY3NjkwMjQ5NDY0YWE3MDkxZGJjNmRiZg==').then(function(){}).otherwise(function(error){});
Parameters:
Name Type Description
serverURI String MCU服务器地址
accessToken String 访问令牌
isUseCascade boolean 是否级联加入会议,可以不传,默认为false

(async) init(serverURI, accessToken, isUseCascade)

Description:
  • 引擎初始化
Source:
Example
avdEngine.init('avd.nice2meet.cn:9610','ZDgyNGU1MGU0ZGY2MTJlZWY3NjkwMjQ5NDY0YWE3MDkxZGJjNmRiZg==').then(function(){}).otherwise(function(error){});
Parameters:
Name Type Description
serverURI String MCU服务器地址
accessToken String 访问令牌
isUseCascade boolean 是否级联加入会议,可以不传,默认为false

(async) initDevice() → {int}

Description:
  • 初始化摄像头、麦克风设备

    逻辑:摄像头设备会全部初始化到服务器,麦克风设备只会初始化默认的一个到服务器

Source:
Example
avdEngine.initDevice().then(function(result){
	   if(result == 1){
	      console.log('设备初始化完成');
    }
}).otherwise(function(error){});
Returns:
- 返回初始化完成状态。1:代表完成
Type
int

(async) initDevice() → {int}

Description:
  • 初始化摄像头、麦克风设备

    逻辑:摄像头设备会全部初始化到服务器,麦克风设备只会初始化默认的一个到服务器

Source:
Example
avdEngine.initDevice().then(function(result){
	   if(result == 1){
	      console.log('设备初始化完成');
    }
}).otherwise(function(error){});
Returns:
- 返回初始化完成状态。1:代表完成
Type
int

(async) initWithOEM(serverURI, oemName)

Description:
  • avdEngine OEM初始化
Source:
Parameters:
Name Type Description
serverURI String MCU服务器地址
oemName String oem名称

(async) initWithOEM(serverURI, oemName)

Description:
  • avdEngine OEM初始化
Source:
Parameters:
Name Type Description
serverURI String MCU服务器地址
oemName String oem名称

obtainRoom(roomId) → {Object}

Description:
  • 获取房间。如房间存在,直接返回,不存在时创建房间后返回
Source:
Example
var roomId = '13124323454';
room = avdEngine.obtainRoom(roomId);
Parameters:
Name Type Description
roomId String 房间ID
Returns:
room - 房间对象
Type
Object

obtainRoom(roomId) → {Object}

Description:
  • 获取房间。如房间存在,直接返回,不存在时创建房间后返回
Source:
Example
var roomId = '13124323454';
room = avdEngine.obtainRoom(roomId);
Parameters:
Name Type Description
roomId String 房间ID
Returns:
room - 房间对象
Type
Object

preloadBeautyModel() → {Promise}

Description:
  • 预加载美颜模型(人脸检测),可以在用户点击美颜按钮之前提前调用,显著减少首次启用美颜的等待时间
Source:
Example
avdEngine.preloadBeautyModel().then(function() { console.log('预加载完成'); }).catch(function(e) { console.error('预加载失败:', e); });
Returns:
- 预加载结果
Type
Promise

preloadBeautyModel() → {Promise}

Description:
  • 预加载美颜模型(人脸检测),可以在用户点击美颜按钮之前提前调用,显著减少首次启用美颜的等待时间
Source:
Example
avdEngine.preloadBeautyModel().then(function() { console.log('预加载完成'); }).catch(function(e) { console.error('预加载失败:', e); });
Returns:
- 预加载结果
Type
Promise

setApplyToElectron(islectron, protocolStr)

Description:
  • Electron开发应用时,设置应用的协议
Source:
Parameters:
Name Type Description
islectron Boolean islectron true为应用于Electron
protocolStr String protocolStr Electron应用时的协议,可不填,默认为http:

setApplyToElectron(islectron, protocolStr)

Description:
  • Electron开发应用时,设置应用的协议
Source:
Parameters:
Name Type Description
islectron Boolean islectron true为应用于Electron
protocolStr String protocolStr Electron应用时的协议,可不填,默认为http:

setAudioAutoSub(isAudioAutodSub)

Description:
  • 设置音频订阅方式是否为自动订阅,默认值为true
Source:
Example
avdEngine.setAudioAutoSub(false);
Parameters:
Name Type Description
isAudioAutodSub Boolean true为自动订阅,flase为手动订阅

setAudioAutoSub(isAudioAutodSub)

Description:
  • 设置音频订阅方式是否为自动订阅,默认值为true
Source:
Example
avdEngine.setAudioAutoSub(false);
Parameters:
Name Type Description
isAudioAutodSub Boolean true为自动订阅,flase为手动订阅

setAudioBatchEnabled(isAudioBatch)

Description:
  • 音频自动订阅时,设置对多路音频批量订阅处理,这样可以只进行一次SDP交互以提高性能,默认值为false,
Source:
Example
avdEngine.setAudioBatchEnabled(true);
Parameters:
Name Type Description
isAudioBatch Boolean isAudioBatch false为不开启,true为开启

setAudioBatchEnabled(isAudioBatch)

Description:
  • 音频自动订阅时,设置对多路音频批量订阅处理,这样可以只进行一次SDP交互以提高性能,默认值为false,
Source:
Example
avdEngine.setAudioBatchEnabled(true);
Parameters:
Name Type Description
isAudioBatch Boolean isAudioBatch false为不开启,true为开启

(async) setAudioCoding(audioCodingType)

Description:
  • 设置音频编码格式
Source:
Example
avdEngine.setAudioCoding(AudioCodingType.opus).then(function(){}).otherwise(function(error){});
Parameters:
Name Type Description
audioCodingType AudioCodingType 音频编码格式(枚举型),默认值为AudioCodingType.opus

(async) setAudioCoding(audioCodingType)

Description:
  • 设置音频编码格式
Source:
Example
avdEngine.setAudioCoding(AudioCodingType.opus).then(function(){}).otherwise(function(error){});
Parameters:
Name Type Description
audioCodingType AudioCodingType 音频编码格式(枚举型),默认值为AudioCodingType.opus

setAutoGainControl(enable)

Description:
  • 设置自动增益
Source:
Parameters:
Name Type Description
enable Boolean

setAutoGainControl(enable)

Description:
  • 设置自动增益
Source:
Parameters:
Name Type Description
enable Boolean

setBugout(logFilename)

Description:
  • 设置日志的可输出下载地址
Source:
Example
avdEngine.setBugout(avdlog.txt);
Parameters:
Name Type Description
logFilename String 输出下载地址

setBugout(logFilename)

Description:
  • 设置日志的可输出下载地址
Source:
Example
avdEngine.setBugout(avdlog.txt);
Parameters:
Name Type Description
logFilename String 输出下载地址

setCustomerTokenEnabled(customerTokenEnabled)

Description:
  • 设置是否开启客户自己的认证token,不调接口设置时,默认值为不开启
Source:
Example
avdEngine.setCustomerTokenEnabled(true);
Parameters:
Name Type Description
customerTokenEnabled Boolean customerTokenEnabled false为不开启,true为开启

setCustomerTokenEnabled(customerTokenEnabled)

Description:
  • 设置是否开启客户自己的认证token,不调接口设置时,默认值为不开启
Source:
Example
avdEngine.setCustomerTokenEnabled(true);
Parameters:
Name Type Description
customerTokenEnabled Boolean customerTokenEnabled false为不开启,true为开启

setDataCryptoType(dataCryptoType)

Description:
  • 设置数据加密类型
Source:
Example
avdEngine.setDataCryptoType(DataCryptoType.AES256);
Parameters:
Name Type Description
dataCryptoType DataCryptoType 数据加密类型(枚举型),默认值为DataCryptoType.AES128

setDataCryptoType(dataCryptoType)

Description:
  • 设置数据加密类型
Source:
Example
avdEngine.setDataCryptoType(DataCryptoType.AES256);
Parameters:
Name Type Description
dataCryptoType DataCryptoType 数据加密类型(枚举型),默认值为DataCryptoType.AES128

setDefaultMediaPublishKeepAliveTime(keepAliveTime)

Description:
  • 设置媒体流推送的保活时长(单位为毫秒),不设置默认为15000毫秒
Source:
Parameters:
Name Type Description
keepAliveTime int 保活时长

setDefaultMediaPublishKeepAliveTime(keepAliveTime)

Description:
  • 设置媒体流推送的保活时长(单位为毫秒),不设置默认为15000毫秒
Source:
Parameters:
Name Type Description
keepAliveTime int 保活时长

setDefaultScreenParams(maxWidth, maxHeight, minFrameRate, maxFrameRate)

Description:
  • 设置桌面共享相关的默认参数值
Source:
Example
avdEngine.setDefaultScreenParams(1080,720,5,10);
Parameters:
Name Type Description
maxWidth int 分辨率最大宽度,默认值为1920
maxHeight int 分辨率最大高度,默认值为1080
minFrameRate int 最小帧率, 默认值为5
maxFrameRate int 最大帧率, 默认值为10

setDefaultScreenParams(maxWidth, maxHeight, minFrameRate, maxFrameRate)

Description:
  • 设置桌面共享相关的默认参数值
Source:
Example
avdEngine.setDefaultScreenParams(1080,720,5,10);
Parameters:
Name Type Description
maxWidth int 分辨率最大宽度,默认值为1920
maxHeight int 分辨率最大高度,默认值为1080
minFrameRate int 最小帧率, 默认值为5
maxFrameRate int 最大帧率, 默认值为10

setDefaultVideoParams(width, height, resolutionSetType, frameRate)

Description:
  • 设置视频相关的默认参数值
Source:
Example
avdEngine.setDefaultVideoParams(1080,720,ResolutionSetType.ideal,25);
Parameters:
Name Type Description
width int 分辨率宽,默认值为640
height int 分辨率高,默认值为480
resolutionSetType Object 分辨率设置类型枚举,默认值为强制即ResolutionSetType.ideal
frameRate int 视频帧率,默认值为20

setDefaultVideoParams(width, height, resolutionSetType, frameRate)

Description:
  • 设置视频相关的默认参数值
Source:
Example
avdEngine.setDefaultVideoParams(1080,720,ResolutionSetType.ideal,25);
Parameters:
Name Type Description
width int 分辨率宽,默认值为640
height int 分辨率高,默认值为480
resolutionSetType Object 分辨率设置类型枚举,默认值为强制即ResolutionSetType.ideal
frameRate int 视频帧率,默认值为20

setEchoCancellation(enable)

Description:
  • 设置回声消除
Source:
Example
avdEngine.setEchoCancellation(false);
Parameters:
Name Type Description
enable Boolean 是否开启回声消除,默认为true

setEchoCancellation(enable)

Description:
  • 设置回声消除
Source:
Example
avdEngine.setEchoCancellation(false);
Parameters:
Name Type Description
enable Boolean 是否开启回声消除,默认为true

setEnableHardwareEncoding(isEnable)

Description:
  • 在加入会议之前设置是否启用硬件编码,默认为false,推荐有独立显卡的电脑设备开启,如性能足够,可实现高分辨率、高码率和高帧率
Source:
Parameters:
Name Type Description
isEnable Boolean 是否开启硬件编码

setEnableHardwareEncoding(isEnable)

Description:
  • 在加入会议之前设置是否启用硬件编码,默认为false,推荐有独立显卡的电脑设备开启,如性能足够,可实现高分辨率、高码率和高帧率
Source:
Parameters:
Name Type Description
isEnable Boolean 是否开启硬件编码

setIgnoreModifyResourceReq(isIgnore)

Description:
  • 是否忽略服务器下发的资源调整信令,true则不会响应服务器调整资源的通知,例如没有人订阅时发布的视频不会自动降低分辨率码率等
Source:
Parameters:
Name Type Description
isIgnore Boolean 是否忽略修改资源请求

setIgnoreModifyResourceReq(isIgnore)

Description:
  • 是否忽略服务器下发的资源调整信令,true则不会响应服务器调整资源的通知,例如没有人订阅时发布的视频不会自动降低分辨率码率等
Source:
Parameters:
Name Type Description
isIgnore Boolean 是否忽略修改资源请求

setLog(appenderModel, logLevel)

Description:
  • 设置日志显示方式和日志级别
Source:
Example
avdEngine.setLog(Appender.browserConsole, LogLevel.debug);
Parameters:
Name Type Description
appenderModel Appender 日志显示方式(枚举型), 默认值为Appender.browserConsole
logLevel LogLevel 日志级别(枚举型),默认值为LogLevel.info

setLog(appenderModel, logLevel)

Description:
  • 设置日志显示方式和日志级别
Source:
Example
avdEngine.setLog(Appender.browserConsole, LogLevel.debug);
Parameters:
Name Type Description
appenderModel Appender 日志显示方式(枚举型), 默认值为Appender.browserConsole
logLevel LogLevel 日志级别(枚举型),默认值为LogLevel.info

setMcuClusterRouteParams(mcuClusterRouteParams)

Description:
  • 在分布式集群部署中,设置加入房间时mcu服务器的路由参数分配
Source:
Parameters:
Name Type Description
mcuClusterRouteParams Object 参数值格式参考如:{ip_tag":"local","idc_code":"idc_code"} ip_tag:对应于 rtc_node_addr 中的tag标志,用于区分同一台服务器的多网卡地址,可以自定义,然后在参数中传入。 举例的话,比如 'local','internal','dianxin','liantong' idc_code:对应于 rtc_node 中的 idc_code标志,用于区分不同的服务器,唯一,可以自定义。 比如北京服务器设置为'beijing',杭州的设置为'hangzhou',然后在参数中传入,用于定位到服务器。

setMcuClusterRouteParams(mcuClusterRouteParams)

Description:
  • 在分布式集群部署中,设置加入房间时mcu服务器的路由参数分配
Source:
Parameters:
Name Type Description
mcuClusterRouteParams Object 参数值格式参考如:{ip_tag":"local","idc_code":"idc_code"} ip_tag:对应于 rtc_node_addr 中的tag标志,用于区分同一台服务器的多网卡地址,可以自定义,然后在参数中传入。 举例的话,比如 'local','internal','dianxin','liantong' idc_code:对应于 rtc_node 中的 idc_code标志,用于区分不同的服务器,唯一,可以自定义。 比如北京服务器设置为'beijing',杭州的设置为'hangzhou',然后在参数中传入,用于定位到服务器。

setMediaConnectType(mediaType,)

Description:
  • 设置媒体通道协议
Source:
Example
avdEngine.setMediaConnectType(1);
Parameters:
Name Type Description
mediaType, int 0 表示udp优先; 1表示 tcp优先,默认为0

setMediaConnectType(mediaType,)

Description:
  • 设置媒体通道协议
Source:
Example
avdEngine.setMediaConnectType(1);
Parameters:
Name Type Description
mediaType, int 0 表示udp优先; 1表示 tcp优先,默认为0

setNoiseSuppression(enable)

Description:
  • 设置降噪
Source:
Parameters:
Name Type Description
enable Boolean

setNoiseSuppression(enable)

Description:
  • 设置降噪
Source:
Parameters:
Name Type Description
enable Boolean

setRecordingMicrophone(microphoneId)

Description:
  • 设置成当前使用的麦克风
Source:
Parameters:
Name Type Description
microphoneId String 麦克风设备Id

setRecordingMicrophone(microphoneId)

Description:
  • 设置成当前使用的麦克风
Source:
Parameters:
Name Type Description
microphoneId String 麦克风设备Id

setReportLogger(appSign, appFunName)

Description:
  • 日志内容通过应用层提供的函数进行上报
Source:
Parameters:
Name Type Description
appSign string 应用层设置的标识,用于区别某用户某一次加入会议所产生的所有日志
appFunName Object 应用层设置的方法函数,SDK调用该函数上报日志内容

setReportLogger(appSign, appFunName)

Description:
  • 日志内容通过应用层提供的函数进行上报
Source:
Parameters:
Name Type Description
appSign string 应用层设置的标识,用于区别某用户某一次加入会议所产生的所有日志
appFunName Object 应用层设置的方法函数,SDK调用该函数上报日志内容

setRestFullProtocol(protocolStr)

Description:
  • 设置RestFull访问时应用的协议。 不设置默认取document.location.protocol
Source:
Parameters:
Name Type Description
protocolStr String protocolStr RestFull访问应用时的协议,可填写如https:

setRestFullProtocol(protocolStr)

Description:
  • 设置RestFull访问时应用的协议。 不设置默认取document.location.protocol
Source:
Parameters:
Name Type Description
protocolStr String protocolStr RestFull访问应用时的协议,可填写如https:

setRestfulRequestType(requestType,)

Description:
  • 设置RESTful API 请求类型
Source:
Example
avdEngine.setRestfulRequestType(1);
Parameters:
Name Type Description
requestType, int 0 表示GET; 1表示 POST,默认为0

setRestfulRequestType(requestType,)

Description:
  • 设置RESTful API 请求类型
Source:
Example
avdEngine.setRestfulRequestType(1);
Parameters:
Name Type Description
requestType, int 0 表示GET; 1表示 POST,默认为0

setSimulcastEnabled(isSimulcast)

Description:
  • 设置视频是否开启多流,默认值为false
Source:
Example
avdEngine.setSimulcastEnabled(true);
Parameters:
Name Type Description
isSimulcast Boolean isSimulcast false为不开启,true为开启

setSimulcastEnabled(isSimulcast)

Description:
  • 设置视频是否开启多流,默认值为false
Source:
Example
avdEngine.setSimulcastEnabled(true);
Parameters:
Name Type Description
isSimulcast Boolean isSimulcast false为不开启,true为开启

setTraceId(traceId)

Description:
  • 设置traceId,用于监控埋点实现
Source:
Parameters:
Name Type Description
traceId String

setTraceId(traceId)

Description:
  • 设置traceId,用于监控埋点实现
Source:
Parameters:
Name Type Description
traceId String

(async) setVideoCoding(videoCodingType)

Description:
  • 设置视频编码格式
Source:
Example
avdEngine.setVideoCoding(VideoCodingType.VP8).then(function(){}).otherwise(function(error){});
Parameters:
Name Type Description
videoCodingType VideoCodingType 视频编码格式(枚举型),默认值为videoCodingType.H264

(async) setVideoCoding(videoCodingType)

Description:
  • 设置视频编码格式
Source:
Example
avdEngine.setVideoCoding(VideoCodingType.VP8).then(function(){}).otherwise(function(error){});
Parameters:
Name Type Description
videoCodingType VideoCodingType 视频编码格式(枚举型),默认值为videoCodingType.H264