有奖捉虫:办公协同&微信生态&物联网文档专题 HOT

ActiveX SDK 的接口

创建实例

CLASSID
描述
CLSID:99DD15EF-B353-4E47-9BE7-7DB4BC13613C
通过给 HTML 中的 OBJECT 对象设置 CLASSID 属性来加载 ActiveX 控件

房间相关接口函数

API
描述
enterRoom([in] INT sdkappid, [in] BSTR usersig, [in] BSTR room_id, [in] BSTR user_id, [in] enum AxTRTCRoleType role, [in] enum AxTRTCAppScene scene, [in] BSTR extend_info)
进入房间,其扩展参数 extend_info 参见主调接口的 JSON 格式?
exitRoom()
离开房间

视频相关接口函数

API
描述
startLocalPreview()
开启本地视频的预览画面
stopLocalPreview()
停止本地视频采集及预览
muteLocalVideo([in] enum AxTRTCVideoStreamType stream_type, [in] BOOL mute)
暂停/恢复推送本地的视频数据
setVideoMuteBlackFrame()
当调用了 muteLocalVideo(true) 暂停本地画面时,可以通过调用本接口推送黑帧数据到对方
startRemoteView([in] BSTR user_id, [in] enum AxTRTCVideoStreamType stream_type)
开始拉取并显示指定用户的远端画面
stopRemoteView([in] BSTR user_id, [in] enum AxTRTCVideoStreamType stream_type)
停止显示远端视频画面,同时不再拉取远端用户的视频数据流
muteRemoteVideoStream([in] BSTR user_id, [in] enum AxTRTCVideoStreamType stream_type, [in] BOOL mute)
暂停/恢复接收指定的远端视频流
setLocalRenderParams([in] enum AxTRTCVideoRotation rotation, [in] enum AxTRTCVideoFillMode fill_mode, [in] enum AxTRTCVideoMirrorType mirror_type)
设置本地图像(主流)的渲染参数
setRemoteRenderParams([in] BSTR user_id, [in] enum AxTRTCVideoStreamType stream_type, [in] enum AxTRTCVideoRotation rotation, [in] enum AxTRTCVideoFillMode fill_mode, [in] enum AxTRTCVideoMirrorType mirror_type)
设置远端图像的渲染模式
setVideoEncoderRotation([in] enum AxTRTCVideoRotation rotation)
设置视频编码输出的画面方向,即设置远端用户观看到的和服务器录制的画面方向
setVideoEncoderMirror([in] BOOL mirror)
设置编码器输出的画面镜像模式
setVideoEncoderParam([in] enum AxTRTCVideoResolution video_resolution, [in] enum AxTRTCVideoResolutionMode resolution_mode, [in, defaultvalue(15)] UINT video_fps, [in, defaultvalue(550)] UINT video_bitrate, [in, defaultvalue(0)] UINT min_video_bitrate)
设置视频编码器的编码参数,该设置能够决定远端用户看到的画面质量(第1、2个参数为必填项,分别代表分辨率和视频宽高比模式,第3、4、5个参数为选填项,分别代表帧率、目前码率和最小码率,默认值分别为15fps,550kbps,0kbps)
setVideoMuteImage([in] INT width, [in] INT height, [in] BSTR rgba_buffer, [in] INT length)
设置本地画面被暂停期间的替代图片
snapshotVideo([in] BSTR user_id, [in] enum AxTRTCVideoStreamType stream_type)
视频画面截图

音频相关接口函数

API
描述
startLocalAudio([in] enum AxTRTCAudioQuality quality)
开启本地音频的采集和上行
stopLocalAudio()
关闭本地音频的采集和上行
muteLocalAudio([in] BOOL mute)
静音/取消静音本地的音频
muteRemoteAudio([in] BSTR user_id, [in] BOOL mute)
静音/取消静音指定的远端用户的声音
setAudioCaptureVolume([in] INT volume)
设置 SDK 采集音量
getAudioCaptureVolume([out, retval] INT* volume)
获取 SDK 采集音量,通过 volume 参数返回
setAudioPlayoutVolume([in] INT volume)
设置 SDK 播放音量
getAudioPlayoutVolume([out, retval] INT* volume)
获取 SDK 播放音量,通过 volume 参数返回
enableAudioVolumeEvaluation([in] INT interval)
启用或关闭音量大小提示
setRemoteAudioVolume([in] BSTR user_id, [in] INT volume)
设定某一个远端用户的声音播放音量

设备相关接口函数

API
描述
getDevicesList([in] enum AxTRTCMediaDeviceType device_type, [out, retval] BSTR* device_list)
获取设备列表,其 device_list 以JSON串格式返回,参见主调接口的 JSON 格式?
setCurrentDevice([in] enum AxTRTCMediaDeviceType device_type, [in] BSTR device_id)
设置当前使用的设备
getCurrentDevice([in] enum AxTRTCMediaDeviceType device_type, [out, retval] BSTR* device_info)
获取当前使用的设备,其 device_info 以 JSON 串格式返回,参见主调接口的 JSON 格式?
setCurrentDeviceVolume([in] enum AxTRTCMediaDeviceType device_type, [in] UINT volume)
设置当前麦克风或扬声器的音量
getCurrentDeviceVolume([in] enum AxTRTCMediaDeviceType device_type, [out, retval] UINT* volume)
获取当前麦克风或扬声器的音量,通过 volume 参数返回
startCameraDeviceTest()
开始测试摄像头
stopCameraDeviceTest()
停止测试摄像头
startMicDeviceTest([in] UINT interval)
开始测试麦克风
stopMicDeviceTest()
停止测试麦克风
startSpeakerDeviceTest([in] BSTR file_path)
开始测试扬声器
stopSpeakerDeviceTest()
停止测试扬声器

美颜特效和图像水印

API
描述
setBeautyStyle([in] enum AxTRTCBeautyStyle style, [in] UINT beauty_level, [in] UINT whiteness_level, [in] UINT ruddiness_level)
设置美颜、美白、红润效果级别

屏幕分享相关接口函数

API
描述
startScreenCapture([in] enum AxTRTCVideoStreamType stream_type, [in] enum AxTRTCVideoResolution video_resolution, [in] UINT video_fps, [in, defaultvalue(FALSE)] BOOL local_render)
启动屏幕分享
stopScreenCapture()
停止屏幕采集
getScreenCaptureSources([in] UINT thumbnail_width, [in] UINT thumbnail_height, [in] UINT icon_width, [in] UINT icon_height, [out, retval] BSTR* screen_source_list)
枚举可分享的屏幕和窗口,其 screen_source_list 以 JSON 串格式返回,参见主调接口的 JSON 格式?
selectScreenCaptureTarget([in] UINT source_id, [in] UINT capture_rect_left, [in] UINT capture_rect_top, [in] UINT capture_rect_width, [in] UINT capture_rect_height)
选取要分享的屏幕或窗口

其他相关接口函数

API
描述
getVersion([out, retval] BSTR* version)
获取 SDK 版本信息
callExperimentalAPI([in] BSTR json)
调用实验性接口

ActiveX 的回调监听

腾讯云 ActiveX SDK 视频通话功能的回调监听。

错误事件和警告事件

API
描述
onError([in] INT error_code,[in] BSTR error_message)
错误回调,SDK 不可恢复的错误,一定要监听,并分情况给用户适当的界面提示
onWarning([in] INT warning_code,[in] BSTR warning_message)
警告回调:用于告知您一些非严重性问题,例如出现了卡顿或者可恢复的解码失败

房间事件回调

API
描述
onEnterRoom([in] INT result)
已加入房间的回调
onExitRoom([in] INT reason)
离开房间的事件回调

成员事件回调

API
描述
onRemoteUserEnterRoom([in] BSTR user_id)
有用户加入当前房间
onRemoteUserLeaveRoom([in] BSTR user_id,[in] INT reason)
有用户离开当前房间
onUserVideoAvailable([in] BSTR user_id, BOOL available)
用户是否开启摄像头视频
onUserSubStreamAvailable([in] BSTR user_id, BOOL available)
用户是否开启屏幕分享
onUserAudioAvailable([in] BSTR user_id, BOOL available)
用户是否开启音频上行
onFirstVideoFrame([in] BSTR user_id, [in] INT stream_type, [in] INT width, [in] INT height)
开始渲染本地或远程用户的首帧画面

硬件设备事件回调

API
描述
onUserVoiceVolume([in] BSTR user_volumes, [in] INT user_volumes_count, [in] INT total_volume)
用于提示音量大小的回调,包括每个 userId 的音量和远端总音量, user_volumes 为 JSON 串格式,参见 回调监听接口返回的 JSON 格式?
onTestMicVolume([in] INT volume)
麦克风测试音量回调
onTestSpeakerVolume([in] INT volume)
扬声器测试音量回调
onAudioDeviceCaptureVolumeChanged([in] INT volume, BOOL muted)
当前音频采集设备音量变化通知
onAudioDevicePlayoutVolumeChanged([in] INT volume, BOOL muted)
当前音频播放设备音量变化通知

屏幕分享回调

API
描述
onScreenCaptureStarted()
当屏幕分享开始时,SDK 会通过此回调通知
onScreenCaptureStoped([in] INT reason)
当屏幕分享停止时,SDK 会通过此回调通知

相关枚举值

AxTRTCVideoResolution 的枚举值

AxTRTCVideoResolution 的枚举值
描述
AxTRTCVideoResolution_120_120 = 1
宽高比 1:1;分辨率 120x120;建议码率(VideoCall)80kbps; 建议码率(LIVE)120kbps
AxTRTCVideoResolution_160_160 = 3
宽高比 1:1 分辨率 160x160;建议码率(VideoCall)100kbps; 建议码率(LIVE)150kbps
AxTRTCVideoResolution_270_270 = 5
宽高比 1:1;分辨率 270x270;建议码率(VideoCall)200kbps; 建议码率(LIVE)300kbps
AxTRTCVideoResolution_480_480 = 7
宽高比 1:1;分辨率 480x480;建议码率(VideoCall)350kbps; 建议码率(LIVE)500kbps
AxTRTCVideoResolution_160_120 = 50
宽高比4:3;分辨率 160x120;建议码率(VideoCall)100kbps; 建议码率(LIVE)150kbps
AxTRTCVideoResolution_240_180 = 52
宽高比 4:3;分辨率 240x180;建议码率(VideoCall)150kbps; 建议码率(LIVE)250kbps
AxTRTCVideoResolution_280_210 = 54
宽高比 4:3;分辨率 280x210;建议码率(VideoCall)200kbps; 建议码率(LIVE)300kbps
AxTRTCVideoResolution_320_240 = 56
宽高比 4:3;分辨率 320x240;建议码率(VideoCall)250kbps; 建议码率(LIVE)375kbps
AxTRTCVideoResolution_400_300 = 58
宽高比 4:3;分辨率 400x300;建议码率(VideoCall)300kbps; 建议码率(LIVE)450kbps
AxTRTCVideoResolution_480_360 = 60
宽高比 4:3;分辨率 480x360;建议码率(VideoCall)400kbps; 建议码率(LIVE)600kbps
AxTRTCVideoResolution_640_480 = 62
宽高比 4:3;分辨率 640x480;建议码率(VideoCall)600kbps; 建议码率(LIVE)900kbps
AxTRTCVideoResolution_960_720 = 64
宽高比 4:3;分辨率 960x720;建议码率(VideoCall)1000kbps; 建议码率(LIVE)1500kbps
AxTRTCVideoResolution_160_90 = 100
宽高比 16:9;分辨率 160x90;建议码率(VideoCall)150kbps; 建议码率(LIVE)250kbps
AxTRTCVideoResolution_256_144 = 102
宽高比 16:9;分辨率 256x144;建议码率(VideoCall)200kbps; 建议码率(LIVE)300kbps
AxTRTCVideoResolution_320_180 = 104
宽高比 16:9;分辨率 320x180;建议码率(VideoCall)250kbps; 建议码率(LIVE)400kbps
AxTRTCVideoResolution_480_270 = 106
宽高比 16:9;分辨率 480x270;建议码率(VideoCall)350kbps; 建议码率(LIVE)550kbps
AxTRTCVideoResolution_640_360 = 108
宽高比 16:9;分辨率 640x360;建议码率(VideoCall)500kbps; 建议码率(LIVE)900kbps
AxTRTCVideoResolution_960_540 = 110
宽高比 16:9;分辨率 960x540;建议码率(VideoCall)850kbps; 建议码率(LIVE)1300kbps
AxTRTCVideoResolution_1280_720 = 112
宽高比 16:9;分辨率 1280x720;建议码率(VideoCall)1200kbps; 建议码率(LIVE)1800kbps
AxTRTCVideoResolution_1920_1080 = 114
宽高比 16:9;分辨率 1920x1080;建议码率(VideoCall)2000kbps; 建议码率(LIVE)3000kbps

AxTRTCVideoStreamType 的枚举值

枚举值
描述
AxTRTCVideoStreamTypeBig = 0
高清大画面,一般用来传输摄像头的视频数据
AxTRTCVideoStreamTypeSmall = 1
低清小画面:小画面和大画面的内容相互,但是分辨率和码率都比大画面低,因此清晰度也更低
AxTRTCVideoStreamTypeSub = 2
辅流画面:一般用于屏幕分享,同一时间在同一个房间中只允许一个用户发布辅流视频,其他用户必须要等该用户关闭之后才能发布自己的辅流

AxTRTCVideoFillMode 的枚举值

枚举值
描述
AxTRTCVideoFillMode_Fill = 0
填充模式:即将画面内容居中等比缩放以充满整个显示区域,超出显示区域的部分将会被裁剪掉,此模式下画面可能不完整
AxTRTCVideoFillMode_Fit = 1
适应模式:即按画面长边进行缩放以适应显示区域,短边部分会被填充为黑色,此模式下图像完整但可能留有黑边

AxTRTCVideoMirrorType 的枚举值

枚举值
描述
AxTRTCVideoMirrorType_Enable = 1
强制开启镜像
AxTRTCVideoMirrorType_Disable = 2
强制关闭镜像

AxTRTCVideoRotation 的枚举值

枚举值
描述
AxTRTCVideoRotation0 = 0
不旋转
AxTRTCVideoRotation90 = 1
顺时针旋转90度
AxTRTCVideoRotation180 = 2
顺时针旋转180度
AxTRTCVideoRotation270 = 3
顺时针旋转270度

AxTRTCBeautyStyle 的枚举值

枚举值
描述
AxTRTCBeautyStyleSmooth = 0
光滑,算法比较激进,磨皮效果比较明显,适用于秀场直播
AxTRTCBeautyStyleNature = 1
自然,算法更多地保留了面部细节,磨皮效果更加自然,适用于绝大多数直播场景

AxTRTCAppScene 的枚举值

枚举值
描述
AxTRTCAppSceneVideoCall = 0
视频通话场景,支持720P、1080P高清画质,单个房间最多支持300人同时在线,最高支持50人同时发言。适用于1对1视频通话300人视频会议在线问诊教育小班课远程面试等业务场景
AxTRTCAppSceneLIVE = 1
视频互动直播,支持平滑上下麦,切换过程无需等待,主播延时小于300ms;支持十万级别观众同时播放,播放延时低至1000ms。 适用于低延时互动直播大班课主播 PK视频相亲在线互动课堂远程培训超大型会议等业务场景。此场景下,您必须通过 TRTCParams 中的 role 字段指定当前用户的角色
AxTRTCAppSceneAudioCall = 2
语音通话场景,默认采用 SPEECH 音质,单个房间最多支持300人同时在线,最高支持50人同时发言。 适用于1对1语音通话300人语音会议语音聊天语音会议在线狼人杀等业务场景
AxTRTCAppSceneVoiceChatRoom = 3
语音互动直播,支持平滑上下麦,切换过程无需等待,主播延时小于300ms;支持十万级别观众同时播放,播放延时低至1000ms。适用于语音俱乐部在线 K 歌房音乐直播间FM 电台等业务场景。此场景下,您必须通过 TRTCParams 中的 role 字段指定当前用户的角色

AxTRTCRoleType 的枚举值

枚举值
描述
AxTRTCRoleAnchor = 20
主播:可以随时发布自己的音视频流,但人数有限制,同一个房间中最多只允许 50 个主播同时发布自己的音视频流
AxTRTCRoleAudience = 21
观众:只能观看其他用户的音视频流,要发布音视频流,需要先通过AxTRTCRoleAnchor角色进房,同一个房间中最多能容纳10万观众

AxTRTCVideoQosPreference 的枚举值

AxTRTCVideoQosPreference 的枚举值
描述
AxTRTCVideoQosPreferenceSmooth = 1
流畅优先:即当前网络不足以传输既清晰又流畅的画面时,优先保证画面的流畅性,代价就是画面会比较模糊且伴随有较多的马赛克
AxTRTCVideoQosPreferenceClear = 2
清晰优先(默认值):即当前网络不足以传输既清晰又流畅的画面时,优先保证画面的清晰度,代价就是画面会比较卡顿

AxTRTCQuality 的枚举值

AxTRTCQuality 的枚举值
描述
AxTRTCQuality_Unknown = 0
未定义
AxTRTCQuality_Excellent = 1
当前网络非常好
AxTRTCQuality_Good = 2
当前网络比较好
AxTRTCQuality_Poor = 3
当前网络一般
AxTRTCQuality_Bad = 4
当前网络较差
AxTRTCQuality_Vbad = 5
当前网络很差
AxTRTCQuality_Down = 6
当前网络不满足 TRTC 的最低要求

AxTRTCAudioQuality 的枚举值

枚举值
描述
AxTRTCAudioQualitySpeech = 1
人声模式,具备几个模式中最强的网络抗性,适合语音通话为主的场景,比如在线会议,语音通话等
采样率:16k
单声道
编码码率:16kbps
AxTRTCAudioQualityDefault = 2
默认模式,介于 Speech 和 Music 之间的档位,SDK 默认档位,推荐选择
采样率:48k
单声道
编码码率:50kbps
AxTRTCAudioQualityMusic = 3
音乐模式,适合需要高保真传输音乐的场景,比如在线 K 歌、音乐直播等
采样率:48k
全频带立体声
编码码率:128kbps

AxTRTCScreenCaptureSourceType 的枚举值

枚举值
描述
AxTRTCScreenCaptureSourceTypeUnknown = -1
未定义
AxTRTCScreenCaptureSourceTypeWindow = 0
该分享目标是某一个应用的窗口
AxTRTCScreenCaptureSourceTypeScreen = 1
该分享目标是某一台显示器的屏幕
AxTRTCScreenCaptureSourceTypeCustom = 2
该分享目标是用户自定义的数据源

AxTRTCMediaDeviceType 的枚举值

枚举值
描述
AxTRTCMediaDeviceTypeUnknown = -1
未定义的设备类型
AxTRTCMediaDeviceTypeMic = 0
麦克风类型设备
AxTRTCMediaDeviceTypeSpeaker = 1
扬声器类型设备
AxTRTCMediaDeviceTypeCamera = 2
摄像头类型设

AxTRTCVideoResolutionMode 的枚举值

枚举值
描述
AxTRTCVideoResolutionModeLandscape = 0
横屏分辨率,例如:AxTRTCVideoResolution_640_360 + AxTRTCVideoResolutionModeLandscape = 640 × 360
AxTRTCVideoResolutionModePortrait = 1
竖屏分辨率,例如:AxTRTCVideoResolution_640_360 + AxTRTCVideoResolutionModePortrait = 360 × 640

主调接口的 JSON 格式

enterRoom 接口的入参

进房接口 enterRoom([in] INT sdkappid, [in] BSTR usersig, [in] BSTR room_id, [in] BSTR user_id, [in] enum AxTRTCRoleType role, [in] enum AxTRTCAppScene scene, [in] BSTR extend_info) 的入参 extend_info 参数以 JSON 形式传入,如下:
{
"stream_id":"",
"user_define_record_id":"",
"private_map_key":"",
"business_info":""
}

getScreenCaptureSources 接口的出参

枚举可分享的屏幕窗口接口 getScreenCaptureSources([in] UINT thumbnail_width, [in] UINT thumbnail_height, [in] UINT icon_width, [in] UINT icon_height, [out, retval] BSTR* screen_source_list) 的出参 screen_source_list 以 JSON 形式返回给用户,其格式如下:
[
{
"sourceId":1,
"sourceName":"Screen1",
"iconBGRA":{
"buffer":"",
"height":0,
"length":0,
"width":0
},
"thumbBGRA":{
"buffer":"iVBORw0KGgoAAAANSU...base64",
"height":0,
"length":0,
"width":0
}
},
...
]

getDevicesList 接口的出参

设备列表的获取接口 getDevicesList([in] enum AxTRTCMediaDeviceType device_type, [out, retval] BSTR* device_list) 的出参 device_list 以 JSON 形式返回给用户,其格式如下:
[
{
"name":"Integrated Camera",
"device_id":"\\\\\\\\?\\\\usb#vid_04f2&pid_b67c&mi_00#6&325e987&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\\\\global"
},
...
]

getCurrentDevice 接口的出参

获取当前设备信息接口 getCurrentDevice([in] enum AxTRTCMediaDeviceType device_type, [out, retval] BSTR* device_info) 的出参 device_info 以 JSON 形式返回给用户,其格式如下:
{
"name":"Integrated Camera",
"device_id":"\\\\\\\\?\\\\usb#vid_04f2&pid_b67c&mi_00#6&325e987&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\\\\global"
}

回调监听接口返回的 JSON 格式??

onUserVoiceVolume 回调监听

用户音量回调 onUserVoiceVolume([in] BSTR user_volumes, [in] INT user_volumes_count, [in] INT total_volume) 中的 user_volumes 以 JSON 数组的形式返回给用户,其格式如下:
[
{
"userId":"", //说话者的 userId, 如果 userId 为空则代表是当前用户自己。
"volume": 0 //说话者的音量大小, 取值范围[0 - 100]。
},
...
]
?


http://www.vxiaotou.com