nimeet 文档中心
English

Cocos2d-x(C++ 绑定) API 参考

构建时从公开 SDK 接口定义生成:接口、方法重载、属性、事件、枚举与错误码。

由公开 SDK 接口定义生成

版本 v1.1.0 · 更新于 2026-10-26 · 修订 1

接口概览

本页列出 Cocos2d-x(C++ 绑定) 端公开 API 的类、方法、重载、属性、事件与错误码,接口定义与 SDK 包版本一致。

核对项数量
接口 / 类2
方法43
方法重载48
属性0
枚举0
错误码常量0

可用性

该端 SDK:正式可用。接口定义与 SDK 包版本一致;运行时的能力边界以实际发布的 SDK 包为准。

加入频道核心链路

按 join / leave / publish / subscribe 的典型调用顺序整理;参数表在“最小可运行链路”一节展开。

步骤接口方法重载数
开启视频与预览NimeetCocos2dxRtcEngineenableVideo1
创建 / 初始化NimeetCocos2dxRtcEngineinitialize1
加入频道NimeetCocos2dxRtcEnginejoinChannel2
离开频道NimeetCocos2dxRtcEngineleaveChannel2
订阅远端媒体NimeetCocos2dxRtcEnginemuteRemoteAudioStream1
续期 TokenNimeetCocos2dxRtcEnginerenewToken1
频道场景NimeetCocos2dxRtcEnginesetChannelProfile1
角色切换NimeetCocos2dxRtcEnginesetClientRole2
本地画面NimeetCocos2dxRtcEnginesetupLocalVideo1

最小可运行链路的参数

参数类型可选可变参数
contextconst RtcEngineContext&否否
tokenconst char*否否
channelIdconst char*否否
infoconst char*否否
uiduid_t否否
tokenconst char*否否
channelIdconst char*否否
uiduid_t否否
optionsconst ChannelMediaOptions&否否
optionsconst LeaveChannelOptions&否否
uiduid_t否否
mutebool否否
tokenconst char*否否
profileCHANNEL_PROFILE_TYPE否否
roleCLIENT_ROLE_TYPE否否
roleCLIENT_ROLE_TYPE否否
optionsconst ClientRoleOptions&否否
canvasconst VideoCanvas&否否

接口索引

接口方法属性事件
IRtcEngineEventHandler1400
NimeetCocos2dxRtcEngine2900

全部接口

IRtcEngineEventHandler 14 方法 / 0 属性
typescript
onAudioVolumeIndication(speakers: const AudioVolumeInfo*, speakerNumber: unsigned int, totalVolume: int): void
onConnectionStateChanged(state: CONNECTION_STATE_TYPE, reason: CONNECTION_CHANGED_REASON_TYPE): void
onError(err: int, msg: const char*): void
onJoinChannelSuccess(channel: const char*, uid: uid_t, elapsed: int): void
onLeaveChannel(stats: const RtcStats&): void
onLocalAudioStateChanged(state: LOCAL_AUDIO_STREAM_STATE, reason: LOCAL_AUDIO_STREAM_REASON): void
onLocalVideoStateChanged(source: VIDEO_SOURCE_TYPE, state: LOCAL_VIDEO_STREAM_STATE, reason: LOCAL_VIDEO_STREAM_REASON): void
onRejoinChannelSuccess(channel: const char*, uid: uid_t, elapsed: int): void
onRemoteAudioStateChanged(uid: uid_t, state: REMOTE_AUDIO_STATE, reason: REMOTE_AUDIO_STATE_REASON, elapsed: int): void
onRemoteVideoStateChanged(uid: uid_t, state: REMOTE_VIDEO_STATE, reason: REMOTE_VIDEO_STATE_REASON, elapsed: int): void
onRequestToken(): void
onRtcStats(stats: const RtcStats&): void
onUserJoined(uid: uid_t, elapsed: int): void
onUserOffline(uid: uid_t, reason: USER_OFFLINE_REASON_TYPE): void

方法明细:14 / 14(参数、返回值、错误码)

方法参数返回值错误
onAudioVolumeIndicationspeakers: const AudioVolumeInfo*, speakerNumber: unsigned int, totalVolume: intvoid错误码索引
onConnectionStateChangedstate: CONNECTION_STATE_TYPE, reason: CONNECTION_CHANGED_REASON_TYPEvoid错误码索引
onErrorerr: int, msg: const char*void错误码索引
onJoinChannelSuccesschannel: const char*, uid: uid_t, elapsed: intvoid错误码索引
onLeaveChannelstats: const RtcStats&void错误码索引
onLocalAudioStateChangedstate: LOCAL_AUDIO_STREAM_STATE, reason: LOCAL_AUDIO_STREAM_REASONvoid错误码索引
onLocalVideoStateChangedsource: VIDEO_SOURCE_TYPE, state: LOCAL_VIDEO_STREAM_STATE, reason: LOCAL_VIDEO_STREAM_REASONvoid错误码索引
onRejoinChannelSuccesschannel: const char*, uid: uid_t, elapsed: intvoid错误码索引
onRemoteAudioStateChangeduid: uid_t, state: REMOTE_AUDIO_STATE, reason: REMOTE_AUDIO_STATE_REASON, elapsed: intvoid错误码索引
onRemoteVideoStateChangeduid: uid_t, state: REMOTE_VIDEO_STATE, reason: REMOTE_VIDEO_STATE_REASON, elapsed: intvoid错误码索引
onRequestToken—void错误码索引
onRtcStatsstats: const RtcStats&void错误码索引
onUserJoineduid: uid_t, elapsed: intvoid错误码索引
onUserOfflineuid: uid_t, reason: USER_OFFLINE_REASON_TYPEvoid错误码索引
NimeetCocos2dxRtcEngine 29 方法 / 0 属性
typescript
adjustPlaybackSignalVolume(volume: int): int
adjustRecordingSignalVolume(volume: int): int
disableAudio(): int
disableVideo(): int
enableAudio(): int
enableAudioVolumeIndication(interval: int, smooth: int, reportVad: bool): int
enableLocalAudio(enabled: bool): int
enableLocalVideo(enabled: bool): int
enableVideo(): int
initialize(context: const RtcEngineContext&): int
joinChannel(token: const char*, channelId: const char*, info: const char*, uid: uid_t): int
joinChannel(token: const char*, channelId: const char*, uid: uid_t, options: const ChannelMediaOptions&): int
leaveChannel(): int
leaveChannel(options: const LeaveChannelOptions&): int
muteAllRemoteAudioStreams(mute: bool): int
muteAllRemoteVideoStreams(mute: bool): int
muteLocalAudioStream(mute: bool): int
muteLocalVideoStream(mute: bool): int
muteRemoteAudioStream(uid: uid_t, mute: bool): int
muteRemoteVideoStream(uid: uid_t, mute: bool): int
renewToken(token: const char*): int
setChannelProfile(profile: CHANNEL_PROFILE_TYPE): int
setClientRole(role: CLIENT_ROLE_TYPE): int
setClientRole(role: CLIENT_ROLE_TYPE, options: const ClientRoleOptions&): int
setLogFilter(filter: unsigned int): int
setParameters(parameters: const char*): int
setVideoEncoderConfiguration(config: const VideoEncoderConfiguration&): int
setupLocalVideo(canvas: const VideoCanvas&): int
setupRemoteVideo(canvas: const VideoCanvas&): int
startPreview(): int
startPreview(sourceType: VIDEO_SOURCE_TYPE): int
stopPreview(): int
stopPreview(sourceType: VIDEO_SOURCE_TYPE): int
switchCamera(): int

方法明细:29 / 29(参数、返回值、错误码)

方法参数返回值错误
adjustPlaybackSignalVolumevolume: intint错误码索引
adjustRecordingSignalVolumevolume: intint错误码索引
disableAudio—int错误码索引
disableVideo—int错误码索引
enableAudio—int错误码索引
enableAudioVolumeIndicationinterval: int, smooth: int, reportVad: boolint错误码索引
enableLocalAudioenabled: boolint错误码索引
enableLocalVideoenabled: boolint错误码索引
enableVideo—int错误码索引
initializecontext: const RtcEngineContext&int错误码索引
joinChanneltoken: const char*, channelId: const char*, info: const char*, uid: uid_tint错误码索引
leaveChannel—int错误码索引
muteAllRemoteAudioStreamsmute: boolint错误码索引
muteAllRemoteVideoStreamsmute: boolint错误码索引
muteLocalAudioStreammute: boolint错误码索引
muteLocalVideoStreammute: boolint错误码索引
muteRemoteAudioStreamuid: uid_t, mute: boolint错误码索引
muteRemoteVideoStreamuid: uid_t, mute: boolint错误码索引
renewTokentoken: const char*int错误码索引
setChannelProfileprofile: CHANNEL_PROFILE_TYPEint错误码索引
setClientRolerole: CLIENT_ROLE_TYPEint错误码索引
setLogFilterfilter: unsigned intint错误码索引
setParametersparameters: const char*int错误码索引
setVideoEncoderConfigurationconfig: const VideoEncoderConfiguration&int错误码索引
setupLocalVideocanvas: const VideoCanvas&int错误码索引
setupRemoteVideocanvas: const VideoCanvas&int错误码索引
startPreview—int错误码索引
stopPreview—int错误码索引
switchCamera—int错误码索引

枚举

该端 SDK 没有独立枚举(Web SDK 用字符串联合类型表达)。

错误码常量

该端 SDK 未提供错误码常量(见“已知限制”)。平台 REST 错误码见 错误码全表,跨端 SDK 错误标识见 各端 SDK 错误标识。

本页由文档构建流水线生成 · 2026-10-31 01:24:02 UTC · 文档中心 v1.1.0.

内容依据公开 API 定义.

ni-meet 是自建 RTC PaaS,媒体面基于 LiveKit(Apache-2.0),并与声网 API 兼容。