NERtc Windows SDK
|
#include <nertc_engine_ex.h>
Public Member Functions | |
virtual NERtcConnectionStateType | getConnectionState ()=0 |
virtual int | muteLocalAudioStream (bool mute)=0 |
virtual int | setAudioProfile (NERtcAudioProfileType profile, NERtcAudioScenarioType scenario)=0 |
virtual int | setLocalVoiceEqualizationPreset (NERtcVoiceEqualizationType type)=0 |
virtual int | setLocalVoiceEqualizations (float *band_gain)=0 |
virtual int | setLocalVoiceReverbPreset (NERtcVoiceReverbType type)=0 |
virtual int | setLocalVoiceChangerPreset (NERtcVoiceChangerType type)=0 |
virtual int | subscribeRemoteAudioStream (uid_t uid, bool subscribe)=0 |
virtual int | setVideoConfig (const NERtcVideoConfig &config)=0 |
virtual int | enableDualStreamMode (bool enable)=0 |
virtual int | setupLocalSubStreamVideoCanvas (NERtcVideoCanvas *canvas)=0 |
virtual int | setLocalRenderMode (NERtcVideoScalingMode scaling_mode)=0 |
virtual int | setLocalSubStreamRenderMode (NERtcVideoScalingMode scaling_mode)=0 |
virtual int | setLocalVideoMirrorMode (NERtcVideoMirrorMode mirror_mode)=0 |
virtual int | setRemoteRenderMode (uid_t uid, NERtcVideoScalingMode scaling_mode)=0 |
virtual int | setupRemoteSubStreamVideoCanvas (uid_t uid, NERtcVideoCanvas *canvas)=0 |
virtual int | subscribeRemoteVideoSubStream (uid_t uid, bool subscribe)=0 |
virtual int | setRemoteSubSteamRenderMode (uid_t uid, NERtcVideoScalingMode scaling_mode)=0 |
virtual int | startVideoPreview ()=0 |
virtual int | stopVideoPreview ()=0 |
virtual int | muteLocalVideoStream (bool mute)=0 |
virtual int | setParameters (const char *parameters)=0 |
virtual int | setRecordingAudioFrameParameters (NERtcAudioFrameRequestFormat *format)=0 |
virtual int | setPlaybackAudioFrameParameters (NERtcAudioFrameRequestFormat *format)=0 |
virtual int | setMixedAudioFrameParameters (int sample_rate)=0 |
virtual int | setAudioFrameObserver (INERtcAudioFrameObserver *observer)=0 |
virtual int | startAudioDump ()=0 |
virtual int | stopAudioDump ()=0 |
virtual int | startAudioMixing (NERtcCreateAudioMixingOption *option)=0 |
virtual int | stopAudioMixing ()=0 |
virtual int | pauseAudioMixing ()=0 |
virtual int | resumeAudioMixing ()=0 |
virtual int | setAudioMixingSendVolume (uint32_t volume)=0 |
virtual int | getAudioMixingSendVolume (uint32_t *volume)=0 |
virtual int | setAudioMixingPlaybackVolume (uint32_t volume)=0 |
virtual int | getAudioMixingPlaybackVolume (uint32_t *volume)=0 |
virtual int | getAudioMixingDuration (uint64_t *duration)=0 |
virtual int | getAudioMixingCurrentPosition (uint64_t *position)=0 |
virtual int | setAudioMixingPosition (uint64_t seek_position)=0 |
virtual int | playEffect (uint32_t effect_id, NERtcCreateAudioEffectOption *option)=0 |
virtual int | stopEffect (uint32_t effect_id)=0 |
virtual int | stopAllEffects ()=0 |
virtual int | pauseEffect (uint32_t effect_id)=0 |
virtual int | resumeEffect (uint32_t effect_id)=0 |
virtual int | pauseAllEffects ()=0 |
virtual int | resumeAllEffects ()=0 |
virtual int | setEffectSendVolume (uint32_t effect_id, uint32_t volume)=0 |
virtual int | getEffectSendVolume (uint32_t effect_id, uint32_t *volume)=0 |
virtual int | setEffectPlaybackVolume (uint32_t effect_id, uint32_t volume)=0 |
virtual int | getEffectPlaybackVolume (uint32_t effect_id, uint32_t *volume)=0 |
virtual int | startSystemAudioLoopbackCapture ()=0 |
virtual int | stopSystemAudioLoopbackCapture ()=0 |
virtual int | setSystemAudioLoopbackCaptureVolume (uint32_t volume)=0 |
virtual int | enableEarback (bool enabled, uint32_t volume)=0 |
virtual int | setEarbackVolume (uint32_t volume)=0 |
virtual int | setStatsObserver (IRtcMediaStatsObserver *observer)=0 |
virtual int | enableAudioVolumeIndication (bool enable, uint64_t interval)=0 |
virtual int | startScreenCaptureByScreenRect (const NERtcRectangle &screen_rect, const NERtcRectangle ®ion_rect, const NERtcScreenCaptureParameters &capture_params)=0 |
virtual int | startScreenCaptureByDisplayId (unsigned int display_id, const NERtcRectangle ®ion_rect, const NERtcScreenCaptureParameters &capture_params)=0 |
virtual int | startScreenCaptureByWindowId (void *window_id, const NERtcRectangle ®ion_rect, const NERtcScreenCaptureParameters &capture_params)=0 |
virtual int | updateScreenCaptureRegion (const NERtcRectangle ®ion_rect)=0 |
virtual int | stopScreenCapture ()=0 |
virtual int | pauseScreenCapture ()=0 |
virtual int | resumeScreenCapture ()=0 |
virtual int | setExternalVideoSource (bool enabled)=0 |
virtual int | pushExternalVideoFrame (NERtcVideoFrame *frame)=0 |
virtual int | setExternalAudioSource (bool enabled, int sample_rate, int channels)=0 |
virtual int | pushExternalAudioFrame (NERtcAudioFrame *frame)=0 |
virtual int | setExternalAudioRender (bool enabled, int sample_rate, int channels)=0 |
virtual int | pullExternalAudioFrame (void *data, int len)=0 |
virtual const char * | getVersion (int *build)=0 |
virtual const char * | getErrorDescription (int error_code)=0 |
virtual void | uploadSdkInfo ()=0 |
virtual int | addLiveStreamTask (const NERtcLiveStreamTaskInfo &info)=0 |
virtual int | updateLiveStreamTask (const NERtcLiveStreamTaskInfo &info)=0 |
virtual int | removeLiveStreamTask (const char *task_id)=0 |
virtual int | sendSEIMsg (const char *data, int length, NERtcStreamChannelType type)=0 |
virtual int | sendSEIMsg (const char *data, int length)=0 |
![]() | |
virtual int | initialize (const NERtcEngineContext &context)=0 |
virtual void | release (bool sync=false)=0 |
virtual int | setClientRole (NERtcClientRole role)=0 |
virtual int | setChannelProfile (NERtcChannelProfileType profile)=0 |
virtual int | joinChannel (const char *token, const char *channel_name, uid_t uid)=0 |
virtual int | leaveChannel ()=0 |
virtual int | queryInterface (NERtcInterfaceIdType iid, void **inter)=0 |
virtual int | enableLocalAudio (bool enabled)=0 |
virtual int | setupLocalVideoCanvas (NERtcVideoCanvas *canvas)=0 |
virtual int | setupRemoteVideoCanvas (uid_t uid, NERtcVideoCanvas *canvas)=0 |
virtual int | enableLocalVideo (bool enabled)=0 |
virtual int | subscribeRemoteVideoStream (uid_t uid, NERtcRemoteVideoStreamType type, bool subscribe)=0 |
RtcEngine 类提供了供 App 调用的主要接口方法。
IRtcEngineEx 是 NERTC SDK 的扩展接口类。创建一个 IRtcEngine 对象并调用这个对象的方法可以激活 NERTC SDK 的通信功能。
|
pure virtual |
添加房间推流任务,成功添加后当前用户可以收到该直播流的状态通知。通话中有效。
[in] | info | 直播任务信息。 |
|
pure virtual |
启用说话者音量提示。该方法允许 SDK 定期向 App 反馈当前谁在说话以及说话者的音量。
启用该方法后,无论频道内是否有人说话,都会在 onRemoteAudioVolumeIndication 回调中按设置的间隔时间返回音量提示。
enable | 是否启用说话者音量提示。 |
interval | 指定音量提示的时间间隔,单位为毫秒。必须设置为 100 毫秒的整数倍值。 |
|
pure virtual |
设置视频双流发送。
[in] | enable |
|
|
pure virtual |
开启或关闭耳返。
请在频道内调用该方法。
[in] | enabled | 开启或关闭。 |
[in] | volume | 耳返音量。 |
|
pure virtual |
获取音乐文件的播放进度。
该方法获取当前伴奏播放进度,单位为毫秒。请在频道内调用该方法。
[out] | position | 伴奏播放进度,单位为毫秒。 |
|
pure virtual |
获取伴奏时长。
该方法获取伴奏时长,单位为毫秒。请在频道内调用该方法。
[out] | duration | 伴奏时长,单位为毫秒。 |
|
pure virtual |
获取伴奏播放音量。
该方法获取混音里伴奏的播放音量大小。请在频道内调用该方法。
[out] | volume | 伴奏播放音量。 |
|
pure virtual |
获取伴奏发送音量。
该方法获取混音里伴奏的发送音量大小。请在频道内调用该方法。
[out] | volume | 伴奏发送音量。 |
|
pure virtual |
Gets the connection state of the SDK.
|
pure virtual |
获取音效播放音量。
该方法获取音效的播放音量大小。请在频道内调用该方法。
[in] | effect_id | 指定音效的 ID。每个音效均有唯一的 ID。 |
[out] | volume | 音效播放音量。 |
|
pure virtual |
获取音效发送音量。
该方法获取音效的发送音量大小。请在频道内调用该方法。
[in] | effect_id | 指定音效的 ID。每个音效均有唯一的 ID。 |
[out] | volume | 音效发送音量。 |
|
pure virtual |
|
pure virtual |
查询 SDK 版本号。
[out] | build | 编译号。 |
|
pure virtual |
开关本地音频发送。该方法用于允许/禁止往网络发送本地音频流。
[in] | mute | 静音/取消静音:
|
|
pure virtual |
开关本地视频发送。
[in] | mute |
|
|
pure virtual |
暂停所有音效文件播放。
请在频道内调用该方法。
|
pure virtual |
暂停播放伴奏。
该方法暂停播放伴奏。请在频道内调用该方法。
|
pure virtual |
暂停音效文件播放。
请在频道内调用该方法。
[in] | effect_id | 指定音效的 ID。每个音效均有唯一的 ID。 |
|
pure virtual |
暂停屏幕共享。
|
pure virtual |
播放指定音效文件。
你可以多次调用该方法,通过传入不同的音效文件的 effect_id 和 option ,同时播放多个音效文件,实现音效叠加。为获得最佳用户体验,我们建议同时播放的音效文件不要超过 3 个。成功调用该方法后,如果播放结束,本地会触发 onAudioEffectFinished 回调。
[in] | effect_id | 指定音效的 ID。每个音效均有唯一的 ID。 |
[in] | option | 创建音效任务配置的选项,包括混音任务类型、混音文件全路径或URL等。支持的音频格式包括: AAC、MP3 和 WAVE。 |
|
pure virtual |
获取外部音频渲染数据
该方法将从内部引擎拉取音频数据。 通过 setExternalAudioRender 启用外部音频数据渲染功能成功后,可以使用 pullExternalAudioFrame 接口获取音频 PCM 数据。
[out] | data | 数据指针,SDK内部会将数据拷贝到data中。 |
[in] | len | 需要的数据长度,数据长度不能超过7680。 |
|
pure virtual |
推送外部音频数据输入
将外部音频数据帧推送给内部引擎。 通过 setExternalAudioSource 启用外部音频数据输入功能成功后,可以使用 pushExternalAudioFrame 接口发送音频 PCM 数据。
[in] | frame | 桢数据,数据长度不能超过7680:
|
|
pure virtual |
推送外部视频源数据输入
该方法将数据帧设置给内部引擎。
[in] | frame | 视频桢数据: |
|
pure virtual |
删除房间推流任务。通话中有效。
[in] | task_id | 直播任务id |
|
pure virtual |
恢复播放所有音效文件。
请在频道内调用该方法。
|
pure virtual |
恢复播放伴奏。
该方法恢复混音,继续播放伴奏。请在频道内调用该方法。
|
pure virtual |
恢复播放指定音效文件。
请在频道内调用该方法。
[in] | effect_id | 指定音效的 ID。每个音效均有唯一的 ID。 |
|
pure virtual |
恢复屏幕共享。
|
pure virtual |
将小数据量的自定义数据嵌入视频帧中
data | 自定义数据 |
length | 自定义数据长度,最大值 4k |
type | sei使用的流通道类型 |
|
pure virtual |
将小数据量的自定义数据嵌入视频帧中
data | 自定义数据 |
length | 自定义数据长度,最大值 4k |
|
pure virtual |
注册语音观测器对象。joinChannel 前/后都允许更改设置。
该方法用于注册语音观测器对象,即注册回调。当需要引擎给出 onAudioFrameDidRecord 或 onAudioFrameWillPlayback 回调时,需要使用该方法注册回调。
observer | 接口对象实例。如果传入 NULL,则取消注册,同时会清理NERtcAudioFrameRequestFormat相关设置。 |
|
pure virtual |
调节伴奏播放音量。
该方法调节混音里伴奏的播放音量大小。请在频道内调用该方法。
[in] | volume | 伴奏音量范围为 0~100。默认 100 为原始文件音量。 |
|
pure virtual |
设置音乐文件的播放位置。
该方法可以设置音频文件的播放位置,这样你可以根据实际情况播放文件,而非从头到尾播放整个文件。
[in] | seek_position | 进度条位置,单位为毫秒。 |
|
pure virtual |
调节伴奏发送音量。
该方法调节混音里伴奏的发送音量大小。请在频道内调用该方法。
[in] | volume | 伴奏音量范围为 0~100。默认 100 为原始文件音量。 |
|
pure virtual |
设置音频编码属性。
[in] | profile | 设置采样率,码率,编码模式和声道数: NERtcAudioProfileType. |
[in] | scenario | 设置音频应用场景: NERtcAudioScenarioType. |
|
pure virtual |
设置耳返音量。
请在频道内调用该方法。
[in] | volume | 耳返音量。 |
|
pure virtual |
调节音效播放音量。
该方法调节音效的播放音量大小。请在频道内调用该方法。
[in] | effect_id | 指定音效的 ID。每个音效均有唯一的 ID。 |
[in] | volume | 音效音量范围为 0~100。默认 100 为原始文件音量。 |
|
pure virtual |
调节音效发送音量。
该方法调节音效的发送音量大小。请在频道内调用该方法。
[in] | effect_id | 指定音效的 ID。每个音效均有唯一的 ID。 |
[in] | volume | 音效音量范围为 0~100。默认 100 为原始文件音量。 |
|
pure virtual |
开启或关闭外部音频数据渲染
启用外部音频数据渲染功能,并设计采集参数。默认不启用该功能。 加入通话前调用该接口,当该方法调用成功后,音频播放设备选择和异常重启失效。 调用成功后可以使用 pullExternalAudioFrame 接口获取音频 PCM 数据。
[in] | enabled | 是否外部数据输出:
|
[in] | sample_rate | 数据采样率,后续数据按该格式返回。 注意:调用接口关闭功能时可传入任意合法值,此时设置不会生效。 |
[in] | channels | 数据声道数,后续数据按该格式返回。 注意:调用接口关闭功能时可传入任意合法值,此时设置不会生效。 可设置为:
|
|
pure virtual |
开启或关闭外部音频源数据输入
启用外部音频数据输入功能,并设计采集参数。默认不启用该功能。 加入通话前调用该接口,当该方法调用成功后,音频输入设备选择和异常重启失效。 调用成功后可以使用 pushExternalAudioFrame 接口发送音频 PCM 数据。
[in] | enabled | 是否外部数据输入:
|
[in] | sample_rate | 数据采样率,后续数据传入需要按该格式传入。 注意:调用接口关闭功能时可传入任意合法值,此时设置不会生效。 |
[in] | channels | 数据声道数,后续数据传入需要按该格式传入。 注意:调用接口关闭功能时可传入任意合法值,此时设置不会生效。 可设置为:
|
|
pure virtual |
开启或关闭外部视频源数据输入
该方法启用外部视频数据输入功能。并且需要通过IVideoDeviceManager::setDevice 设置kNERtcExternalVideoDeviceID为外部视频输入源ID
[in] | enabled | 是否外部视频源数据输入:
|
|
pure virtual |
设置本地视图显示模式。
该方法设置本地视图显示模式。 App 可以多次调用此方法更改显示模式。
[in] | scaling_mode | 视频显示模式: NERtcVideoScalingMode |
|
pure virtual |
设置本地辅流视图显示模式。
该方法设置本地视图显示模式。 App 可以多次调用此方法更改显示模式。
[in] | scaling_mode | 视频显示模式: NERtcVideoScalingMode |
|
pure virtual |
设置本地视频镜像模式。
该方法设置本地视频镜像模式。 App 可以多次调用此方法更改镜像模式。
[in] | mirror_mode | 视频镜像模式: NERtcVideoMirrorMode |
|
pure virtual |
设置预设的变声模式
[in] | type | 预设置的变声模式值 |
|
pure virtual |
设置预设的EQ模式
[in] | type | 预设置的EQ模式值 |
|
pure virtual |
设置自定义的EQ
[in] | band_gain | float[10] |
|
pure virtual |
设置预设的混响模式
[in] | type | 预设置的混响模式值 |
|
pure virtual |
设置采集和播放后的混合后的采样频率。该方法设置 onMixedAudioFrame 回调的声音格式。
sample_rate | 指定 onMixedAudioFrame 中返回数据的采样率。仅支持 8000, 16000, 32000, 44100或48000。 |
|
pure virtual |
通过 JSON 配置 SDK 提供技术预览或特别定制功能。以标准化方式公开 JSON 选项。
[in] | parameters | JSON 字符串形式的参数 |
|
pure virtual |
设置播放的声音格式。该方法设置 onAudioFrameWillPlayback 回调的播放声音格式。
format | 指定 onAudioFrameWillPlayback 中返回数据的采样率和数据的通道数。允许传入 NULL,默认为 NULL。 |
|
pure virtual |
设置录制的声音格式。该方法设置 onAudioFrameDidRecord 回调的录制声音格式。
format | 指定 onAudioFrameDidRecord 中返回数据的采样率和数据的通道数。允许传入 NULL,默认为 NULL。 |
|
pure virtual |
设置远端视图显示模式。
该方法设置远端视图显示模式。App 可以多次调用此方法更改显示模式。
[in] | uid | 远端用户 ID。 |
[in] | scaling_mode | 视频显示模式: NERtcVideoScalingMode |
|
pure virtual |
设置远端辅流视图显示模式。
该方法设置远端辅流视图显示模式。App 可以多次调用此方法更改显示模式。
[in] | uid | 远端用户 ID。 |
[in] | scaling_mode | 视频显示模式: NERtcVideoScalingMode |
|
pure virtual |
注册统计信息观测器。
[in] | observer | 统计信息观测器 |
|
pure virtual |
设置声音共享音量。只支持windows
请在频道内调用该方法。
[in] | volume | 音效音量范围为 0~100。默认 100 为原始音量。 |
|
pure virtual |
设置本地辅流视图。
该方法设置本地辅流视频显示信息。App 通过调用此接口绑定本地辅流的显示视窗(view)。 在 App 开发中,通常在初始化后调用该方法进行本地视频设置,然后再加入频道。
[in] | canvas | 视频画布信息 |
|
pure virtual |
设置远端用户辅流视图。
该方法绑定远端用户和辅流显示视图,即设定 uid 指定的用户用哪个视图显示。调用该接口时需要指定远端视频的 uid,一般可以在用户加入后设置好。
[in] | uid | 远端用户 ID。 |
[in] | canvas | 视频画布信息 |
|
pure virtual |
设置视频配置。
该方法设置视频配置。每个属性对应一套视频参数,如分辨率等,会在摄像头重启后生效。 所有设置的参数均为理想情况下的最大值。当视频引擎因网络环境等原因无法达到设置的分辨率的最大值时,会取最接近最大值的那个值。
[in] | config | 视频配置: NERtcVideoConfig |
|
pure virtual |
开启音频dump。
|
pure virtual |
开始播放伴奏。
指定本地或在线音频文件来和录音设备采集的音频流进行混音。成功调用该方法后,如果播放状态改变,本地会触发 onAudioMixingStateChanged 回调。
[in] | option | 创建混音任务配置的选项,包括混音任务类型、混音文件全路径或URL等。支持的音频格式包括: AAC、MP3 和 WAVE。 |
|
pure virtual |
通过屏幕 ID 共享屏幕。共享一个屏幕或该屏幕的部分区域。用户需要在该方法中指定想要共享的屏幕 ID。
display_id | 指定待共享的屏幕 ID。开发者需要通过该参数指定你要共享的那个屏幕。 |
region_rect | (可选)指定待共享的区域相对于整个窗口的位置。如果设置的共享区域超出了窗口的边界,则只共享窗口内的内容;如果宽或高为 0,则共享整个窗口。 |
capture_params | 屏幕共享的编码参数配置。 |
|
pure virtual |
通过指定区域共享屏幕。共享一个屏幕或该屏幕的部分区域。用户需要在该方法中指定想要共享的屏幕区域。
screen_rect | 指定待共享的屏幕相对于虚拟屏的位置。 |
region_rect | (可选) 指定待共享区域相对于整个屏幕屏幕的位置。如果设置的共享区域超出了屏幕的边界,则只共享屏幕内的内容;如果将 width 或 height 设为 0, 则共享整个屏幕。 |
capture_params | 屏幕共享的编码参数配置。 |
|
pure virtual |
通过窗口 ID 共享窗口。共享一个窗口或该窗口的部分区域。用户需要在该方法中指定想要共享的窗口 ID。
window_id | 指定待共享的窗口 ID。 |
region_rect | (可选)指定待共享的区域相对于整个窗口的位置。如果设置的共享区域超出了窗口的边界,则只共享窗口内的内容;如果宽或高为 0,则共享整个窗口。 |
capture_params | 屏幕共享的编码参数配置。 |
|
pure virtual |
开启声音共享。只支持windows
请在频道内调用该方法,该方法会捕获系统声音发送,开启本地语音后工作;
|
pure virtual |
开启视频预览。
该方法用于在进入频道前启动本地视频预览。调用该 API 前,必须:
|
pure virtual |
停止播放所有音效文件。
|
pure virtual |
结束音频dump。
|
pure virtual |
停止播放伴奏。
该方法停止播放伴奏。请在频道内调用该方法。
|
pure virtual |
停止播放指定音效文件。
请在频道内调用该方法。
[in] | effect_id | 指定音效的 ID。每个音效均有唯一的 ID。 |
|
pure virtual |
停止屏幕共享。
|
pure virtual |
关闭声音共享。只支持windows
请在频道内调用该方法,通话结束后自动关闭
|
pure virtual |
停止视频预览。
|
pure virtual |
订阅/取消订阅指定音频流。
[in] | uid | 指定用户的 ID |
[in] | subscribe |
|
|
pure virtual |
订阅 / 取消订阅指定远端用户的视频辅流。对方打开视频后需要主动订阅
[in] | uid | 指定用户的用户 ID。 |
[in] | subscribe |
|
|
pure virtual |
更新修改房间推流任务。通话中有效。
[in] | info | 直播任务信息。 |
|
pure virtual |
在共享屏幕或窗口时,更新共享的区域。
region_rect | (可选)指定待共享的区域相对于整个窗口的位置。如果设置的共享区域超出了窗口的边界,则只共享窗口内的内容;如果宽或高为 0,则共享整个窗口。 |
|
pure virtual |
上传SDK 信息(如log文件和Audio dump文件)。