Class: ChuangLiveEngine

ChuangLiveEngine()

new ChuangLiveEngine()

ChuangLiveEngine
Source:
Example
let ChuangLiveEngine = new ChuangLiveEngine(); 

Methods

(static) on(eventtype, callback)

注册SDK回调事件
Parameters:
Name Type Description
eventtype eventtype 事件
callback function 回调:不同事件回调时的参数不同
Source:

enableAEC(enable)

开/关回声消除
Parameters:
Name Type Description
enable bool
Source:
Returns:
void

enableAGC(enable)

开/关自动增益
Parameters:
Name Type Description
enable bool
Source:
Returns:
void

enableANS(enable)

开/关噪声抑制
Parameters:
Name Type Description
enable bool
Source:
Returns:
void

enableAudioMixing(enable, channel)

开启音频混音
Parameters:
Name Type Description
enable bool
channel ChuangPublishChannel 流通道
Source:
Returns:
int 函数调用结果返回

enableCustomAudioCapture(enable, config, channel:)

音频自定义采集开关及参数设置
Parameters:
Name Type Description
enable bool
config ChuangCustomAudioCaptureConfig 音频参数
channel: ChuangPublishChannel 流通道
Source:
Returns:
int 函数调用结果返回

enableCustomAudioRender(bool, config)

开/关外部音频渲染
Parameters:
Name Type Description
bool enable
config ChuangCustomAudioRenderConfig 音频配置
Source:
Returns:
int 函数调用结果返回

enableCustomLocalVideoRender(bool)

开启本地流外部渲染
Parameters:
Name Type Description
bool
Source:
Returns:
void

enableCustomRemoteVideoRender(bool, ChuangPublishChannel)

开/关远端流外部视频渲染
Parameters:
Name Type Description
bool enable
ChuangPublishChannel channel 流通道
Source:
Returns:
int 函数调用结果返回

enableCustomVideoCapture(true, type, channel:)

视频自定义采集开关及参数设置
Parameters:
Name Type Description
true bool or false
type ChuangVideoBufferType 视频自采集格式
channel: ChuangPublishChannel 流通道
Source:
Returns:
int 函数调用结果返回

fetchCustomAudioRenderPCMData(data, dataLength)

从sdk获取一部分音频数据
Parameters:
Name Type Description
data uint8Array 音频数据存放
dataLength int 数据长度
Source:
Returns:
int 函数调用结果返回

getAudioDeviceName()

获取麦克风列表
Source:
Returns:
Array

getRoomConnectState()

获取当前房间连接状态
Source:
Returns:
ChuangRoomState 当前房间连接状态

getSDKVersion()

获取版本号
Source:
Returns:
string

getVideoConfig(ChuangPublishChannel)

获取视频配置
Parameters:
Name Type Description
ChuangPublishChannel channel: 流通道
Source:
Returns:
ChuangVideoConfig

getVideoDeviceName()

获取摄像头列表
Source:
Returns:
Array

initEngine(appId, appKey)

初始化Engine
Parameters:
Name Type Description
appId string
appKey string
Source:
Returns:
ChuangLiveEngine 实例

loginRoom(roomId:, userId:, ChuangUserRole:)

登录房间
Parameters:
Name Type Description
roomId: string 登录房间名
userId: string 登录用户名
ChuangUserRole: 登录角色
Source:
Returns:
int 函数调用结果

logoutRoom()

退出房间
Source:
Returns:
void

muteLocalAudio(streamId, mute)

本地流静音音频
Parameters:
Name Type Description
streamId string 流ID
mute bool 是否静音
Source:
Returns:
int 函数调用结果返回

muteLocalVideo(streamId, bool)

本地流静音视频
Parameters:
Name Type Description
streamId string 流ID
bool mute 是否静音
Source:
Returns:
int

muteRemoteAudio(streamId, bool)

远端流静音音频
Parameters:
Name Type Description
streamId string 流ID
bool mute 是否静音
Source:
Returns:
int

muteRemoteVideo(streamId, bool)

远端流静音视频
Parameters:
Name Type Description
streamId string 流ID
bool mute 是否静音
Source:
Returns:
int

sendCustomAudioCapturePCMData(data, length, channel:)

向sdk发送音频数据
Parameters:
Name Type Description
data uint8Array 音频数据
length int 长度
channel: ChuangPublishChannel 流通道
Source:
Returns:
int 函数调用结果返回

sendCustomVideoCaptureEncodedData(data, param, referenceTimeMillisecond, channel:)

向sdk发送h264数据
Parameters:
Name Type Description
data uint8Array h264数据
param ChuangVideoEncodedFrameParam 视频参数
referenceTimeMillisecond long 时间戳
channel: ChuangPublishChannel 流通道
Source:
Returns:
int 函数调用结果返回

sendCustomVideoCaptureRawData(data, param, long, ChuangPublishChannel)

向sdk发送视频帧数据
Parameters:
Name Type Description
data uint8Array 视频数据
param ChuangVideoFrameParam 视频帧参数
long referenceTimeMillisecond 时间戳
ChuangPublishChannel channel: 流通道
Source:
Returns:
int 函数调用结果

sendStreamAttachedMessage(streamId, msg)

发送推流消息
Parameters:
Name Type Description
streamId string 流ID
msg string 消息内容
Source:
Returns:
int 函数调用结果返回

setAudioConfig(ChuangAudioConfig, ChuangPublishChannel)

设置音频配置
Parameters:
Name Type Description
ChuangAudioConfig config: 音频配置
ChuangPublishChannel channel: 流通道
Source:
Returns:
int 函数调用结果返回

setAudioMixingHandler()

设置音频混音回调
Source:
Returns:
int 函数调用结果返回

setCustomVideoCaptureHandler()

设置视频自定义采集接口回调
Source:
Returns:
int 函数调用结果返回

setEventHandler()

设置回调事件
Source:
Returns:
void

setLogFilePath(filePath)

设置日志路径
Parameters:
Name Type Description
filePath string
Source:
Returns:
void

setLogFileSize(fileSizeInKB)

设置日志文件分块大小, 单位KB, 取值范围为 [0, 10240], 当设置值为0时,sdk会关闭日志记录功能, 默认为1024KB
Parameters:
Name Type Description
fileSizeInKB int
Source:
Returns:
void

setLogLevel(ChuangLogLevel)

设置日志记录级别 sdk会记录所有日志级别大于设置级别的日志
Parameters:
Name Type Description
ChuangLogLevel string
Source:
Returns:
void

setSoundLevelMonitorInterval(intervalMs)

设置回调间隔,单位毫秒
Parameters:
Name Type Description
intervalMs int 时间间隔 默认200
Source:
Returns:
int 函数调用结果返回

setVideoConfig(ChuangVideoConfig, ChuangPublishChannel)

设置视频配置
Parameters:
Name Type Description
ChuangVideoConfig config: 视频配置
ChuangPublishChannel channel: 流通道
Source:
Returns:
int 函数调用结果返回

startMixStream(config)

开启混流
Parameters:
Name Type Description
config ChuangMixStreamConfig 混流配置
Source:
Returns:
int 函数调用结果返回

startNetworkSpeedTest(config)

开始网络测速
Parameters:
Name Type Description
config ChuangNetworkSpeedTestConfig 网络测速配置
Source:
Returns:
int 函数调用结果返回

startPlayStream(}, }, videoCanvas)

开始拉流
Parameters:
Name Type Description
} string roomId 房间号
} string streamId 流ID
videoCanvas ChuangVideoCanvas 绘制窗口信息
Source:
Returns:
void

startPublishStream(ChuangStreamConfig, HTMLElement, ChuangPublishChannel)

开始推流
Parameters:
Name Type Description
ChuangStreamConfig config: 推流配置
HTMLElement canvas: 渲染的view
ChuangPublishChannel channel: 流通道
Source:
Returns:
int 函数调用结果返回

startSoundLevelMonitor()

开启流音量大小回调
Source:
Returns:
void

stopMixStream()

停止混流
Source:
Returns:
void

stopNetworkSpeedTest()

停止网络测速
Source:
Returns:
void

stopPlayStream(streamId)

停止拉流
Parameters:
Name Type Description
streamId string 流ID
Source:
Returns:
void

stopPublishStream(ChuangPublishChannel)

停止推流
Parameters:
Name Type Description
ChuangPublishChannel channel: 流通道
Source:
Returns:
void

stopSoundLevelMonitor()

关闭流音量大小回调
Source:
Returns:
void

switchCamera(cameraName, channel)

切换摄像头
Parameters:
Name Type Description
cameraName string 摄像头名称
channel ChuangPublishChannel 流通道
Source:
Returns:
bool

uninitEngine()

释放Engine
Source:
Returns:
void