提交工单
咨询集成、功能及报价等问题
本文将介绍 Express SDK 版本升级至 3.0.0 及以上版本时的说明和注意事项。
废弃 ZegoScenario 场景枚举中的 General
、Communication
、Live
三种场景,请参考 场景化音视频配置 文档进行适配。
从 3.0.0 版本开始,Express iOS SDK 不再支持 bitcode,详情请参考 Xcode 14 Release Notes 中关于废弃 bitcode 的说明。
适配方式:打开 Xcode 工程的配置页面,在 App Target 的 "Build Settings" 页面中找到 "Enable Bitcode" 选项,将其设置为 "No"。
废弃了 ZegoEngineConfig > advancedConfig 的配置项 "audio_device_mode",请使用 setAudioDeviceMode 接口代替。
删除下列在先前版本已废弃的接口。
方法名 | 描述 |
---|---|
setDebugVerbose | 设置调试详细信息开关以及语言。此函数在 2.3.0 版本废弃,请使用 enableDebugAssistant 来实现原来的功能。 |
loginMultiRoom | 登录多房间。此方法在版本 2.9.0 以后已废弃,若需实现多房间功能,请先在引擎初始化之前调用 setRoomMode 函数设置多房间模式,再使用 loginRoom 登录多房间,如果调用 loginRoom 函数登录多房间,请确保传入相同的用户信息。 |
setPlayStreamVideoLayer | 设置选取拉流视频图层。此函数在 2.3.0 版本以后已废弃, 请使用 setPlayStreamVideoType 代替。 |
enableAudioDataCallback | 开启额外接收音频数据的回调。此函数在 2.7.0 版本以后已废弃,请使用 startAudioDataObserver 和 stopAudioDataObserver 代替。 |
setReverbParam | 设置混响的具体参数。此函数在 1.18.0 版本以后已废弃,请使用 setReverbPreset 或者 setReverbAdvancedParam 代替。 |
setBuiltInSpeakerOn | 是否使用内置扬声器播放声音。此函数在 2.3.0 版本以后已废弃,请使用 setAudioRouteToSpeaker 代替。 |
onRoomStreamUpdate | 相同房间内其他用户推的流增加或减少的通知。此回调函数自 1.18.0 起已废弃,请使用带 [extendedData] 参数的 onRoomStreamUpdate 函数。 |
onDeviceError | 设备异常通知。此函数在 2.15.0 版本及以上已废弃,请使用 onLocalDeviceExceptionOccurred 代替。 |
onNetworkQuality | 回报房间中流的网络质量。此回调函数在 2.10.0 版本及以上已废弃,请使用带 ZegoStreamQualityLevel 枚举参数的 onNetworkQuality 函数。 |
onProcessCapturedAudioData | 自定义音频处理本地采集 PCM 音频帧回调。此回调函数在 2.13.0 版本及以上已废弃,请使用带 [timestamp] 参数的 onProcessCapturedAudioData 函数。 |
onProcessRemoteAudioData | 自定义音频处理远端拉流 PCM 音频帧回调。此回调函数在 2.13.0 版本及以上已废弃,请使用带 [timestamp] 参数的 onProcessRemoteAudioData 函数。 |
onProcessPlaybackAudioData | 自定义音频处理 SDK 播放音频的 PCM 音频帧回调。此回调函数在 2.13.0 版本及以上已废弃,请使用带 [timestamp] 参数的 onProcessPlaybackAudioData 函数。 |
您可以参考以下示例代码进行接口变更。
ZegoEngineConfig engineConfig = new ZegoEngineConfig();
HashMap<String, String> advanceConfig = new HashMap<>();
advanceConfig.put("audio_device_mode", "2");
engineConfig.advancedConfig = advanceConfig;
ZegoExpressEngine.setEngineConfig(engineConfig);
ZegoEngineConfig *config = [[ZegoEngineConfig alloc] init];
config.advancedConfig = @{@"audio_device_mode": @"2"};
[ZegoExpressEngine setEngineConfig:config];
ZegoEngineConfig config;
config.advancedConfig["audio_device_mode"] = "2";
ZegoExpressSDK::setEngineConfig(config);
let engineConfig = ZegoEngineConfig()
engineConfig.advancedConfig = ["audio_device_mode": "2"];
ZegoExpressEngine.setEngineConfig(engineConfig)
ZegoExpressEngine.getEngine().setAudioDeviceMode(ZegoAudioDeviceMode.GENERAL);
[[ZegoExpressEngine sharedEngine] setAudioDeviceMode:ZegoAudioDeviceModeGeneral];
ZegoExpressSDK::getEngine()->setAudioDeviceMode(ZEGO_AUDIO_DEVICE_MODE_GENERAL);
ZegoExpressEngine.shared().setAudioDeviceMode(.general)
ZegoExpressEngine.getEngine().setDebugVerbose(true, ZegoLanguage.ENGLISH);
[[ZegoExpressEngine sharedEngine] setDebugVerbose:YES language:ZegoLanguageEnglish];
ZegoExpressSDK::getEngine()->setDebugVerbose(true, ZEGO_LANGUAGE_ENGLISH);
ZegoExpressEngine.shared().setDebugVerbose(true, language: .english)
// 注意,请勿在线上版本开启此功能!仅在开发阶段使用!
// Note, do not enable this feature in the online version! Use only during development phase!"
ZegoExpressEngine.getEngine().enableDebugAssistant(true);
// 注意,请勿在线上版本开启此功能!仅在开发阶段使用!
// Note, do not enable this feature in the online version! Use only during development phase!"
[[ZegoExpressEngine sharedEngine] enableDebugAssistant:YES];
// 注意,请勿在线上版本开启此功能!仅在开发阶段使用!
// Note, do not enable this feature in the online version! Use only during development phase!"
ZegoExpressSDK::getEngine()->enableDebugAssistant(true);
// 注意,请勿在线上版本开启此功能!仅在开发阶段使用!
// Note, do not enable this feature in the online version! Use only during development phase!"
ZegoExpressEngine.shared().enableDebugAssistant(true);
ZegoExpressEngine.createEngine(profile, null);
ZegoUser user = new ZegoUser("user1");
ZegoExpressEngine.getEngine().loginRoom("first_room", user);
ZegoExpressEngine.getEngine().loginMultiRoom("second_room", null);
[ZegoExpressEngine createEngineWithProfile:profile eventHandler:nil];
ZegoUser *user = [ZegoUser userWithUserID:@"user1"];
[[ZegoExpressEngine sharedEngine] loginRoom:@"first_room" user:user];
[[ZegoExpressEngine sharedEngine] loginMultiRoom:@"second_room" config:nil];
ZegoExpressSDK::createEngine(profile, nullptr);
auto user = ZegoUser("user1", "user1");
ZegoExpressSDK::getEngine()->loginRoom("first_room", user);
ZegoExpressSDK::getEngine()->loginMultiRoom("second_room");
ZegoExpressEngine.createEngine(with: profile, eventHandler: nil)
let user = ZegoUser(userID: "user1")
ZegoExpressEngine.shared().loginRoom("first_room", user: user)
ZegoExpressEngine.shared().loginMultiRoom("second_room", config: nil)
相关接口使用可参考 实时音视频 - 登录多房间 或 实时语音 - 登录多房间文档。
// 必须在调用 [createEngine] 之前设置才生效,否则会失败。
// Must be set before calling [createEngine] to take effect, otherwise it will fail.
ZegoExpressEngine.setRoomMode(ZegoRoomMode.MULTI_ROOM);
ZegoExpressEngine.createEngine(profile, null);
ZegoUser user = new ZegoUser("user1");
ZegoExpressEngine.getEngine().loginRoom("first_room", user);
ZegoExpressEngine.getEngine().loginRoom("second_room", user);
// 必须在调用 [createEngine] 之前设置才生效,否则会失败。
// Must be set before calling [createEngine] to take effect, otherwise it will fail.
[ZegoExpressEngine setRoomMode:ZegoRoomModeMultiRoom];
[ZegoExpressEngine createEngineWithProfile:profile eventHandler:nil];
ZegoUser *user = [ZegoUser userWithUserID:@"user1"];
[[ZegoExpressEngine sharedEngine] loginRoom:@"first_room" user:user];
[[ZegoExpressEngine sharedEngine] loginRoom:@"second_room" user:user];
// 必须在调用 [createEngine] 之前设置才生效,否则会失败。
// Must be set before calling [createEngine] to take effect, otherwise it will fail.
ZegoExpressSDK::setRoomMode(ZEGO_ROOM_MODE_MULTI_ROOM);
ZegoExpressSDK::createEngine(profile, nullptr);
auto user = ZegoUser("user1", "user1");
ZegoExpressSDK::getEngine()->loginRoom("first_room", user);
ZegoExpressSDK::getEngine()->loginRoom("second_room", user);
// 必须在调用 [createEngine] 之前设置才生效,否则会失败。
// Must be set before calling [createEngine] to take effect, otherwise it will fail.
ZegoExpressEngine.setRoomMode(.multiRoom)
ZegoExpressEngine.createEngine(with: profile, eventHandler: nil)
let user = ZegoUser(userID: "user1")
ZegoExpressEngine.shared().loginRoom("first_room", user: user)
ZegoExpressEngine.shared().loginRoom("second_room", user: user)
ZegoExpressEngine.getEngine().setPlayStreamVideoLayer("stream1", ZegoPlayerVideoLayer.AUTO);
[[ZegoExpressEngine sharedEngine] setPlayStreamVideoLayer:ZegoPlayerVideoLayerAuto streamID:@"stream1"];
ZegoExpressSDK::getEngine()->setPlayStreamVideoLayer("stream1", ZEGO_PLAYER_VIDEO_LAYER_AUTO);
ZegoExpressEngine.shared().setPlayStreamVideoLayer(.auto, streamID: "stream1")
相关接口使用可参考 设置视频编码方式 文档。
ZegoExpressEngine.getEngine().setPlayStreamVideoType("stream1", ZegoVideoStreamType.DEFAULT);
[[ZegoExpressEngine sharedEngine] setPlayStreamVideoType:ZegoVideoStreamTypeDefault streamID:@"stream1"];
ZegoExpressSDK::getEngine()->setPlayStreamVideoType("stream1", ZEGO_VIDEO_STREAM_TYPE_DEFAULT);
ZegoExpressEngine.shared().setPlayStreamVideoType(.default, streamID: "stream1")
int bitmask = ZegoAudioDataCallbackBitMask.CAPTURED.value() | ZegoAudioDataCallbackBitMask.PLAYER.value();
ZegoAudioFrameParam param = new ZegoAudioFrameParam();
param.sampleRate = ZegoAudioSampleRate.ZEGO_AUDIO_SAMPLE_RATE_48K;
param.channel = ZegoAudioChannel.MONO;
// Start
ZegoExpressEngine.getEngine().setAudioDataHandler(handler);
ZegoExpressEngine.getEngine().enableAudioDataCallback(true, bitmask, param);
// Stop
ZegoExpressEngine.getEngine().setAudioDataHandler(null);
ZegoExpressEngine.getEngine().enableAudioDataCallback(false, bitmask, param);
int bitmask = ZegoAudioDataCallbackBitMaskCaptured | ZegoAudioDataCallbackBitMaskPlayer;
ZegoAudioFrameParam *param = [[ZegoAudioFrameParam alloc] init];
param.sampleRate = ZegoAudioSampleRate48K;
param.channel = ZegoAudioChannelMono;
// Start
[[ZegoExpressEngine sharedEngine] setAudioDataHandler:self];
[[ZegoExpressEngine sharedEngine] enableAudioDataCallback:YES callbackBitMask:bitmask param:param];
// Stop
[[ZegoExpressEngine sharedEngine] setAudioDataHandler:nil];
[[ZegoExpressEngine sharedEngine] enableAudioDataCallback:NO callbackBitMask:bitmask param:param];
auto bitmask = ZEGO_AUDIO_DATA_CALLBACK_BIT_MASK_CAPTURED | ZEGO_AUDIO_DATA_CALLBACK_BIT_MASK_PLAYER;
auto param = ZegoAudioFrameParam();
param.sampleRate = ZEGO_AUDIO_SAMPLE_RATE_48K;
param.channel = ZEGO_AUDIO_CHANNEL_MONO;
// Start
ZegoExpressSDK::getEngine()->setAudioDataHandler(handler);
ZegoExpressSDK::getEngine()->enableAudioDataCallback(true, bitmask, param);
// Stop
ZegoExpressSDK::getEngine()->setAudioDataHandler(nullptr);
ZegoExpressSDK::getEngine()->enableAudioDataCallback(false, bitmask, param);
let param = ZegoAudioFrameParam()
param.sampleRate = .rate48K
param.channel = .mono
// Start
ZegoExpressEngine.shared().setAudioDataHandler(self)
ZegoExpressEngine.shared().enableAudioDataCallback(true, callbackBitMask: [.captured, .player], param: param)
// Stop
ZegoExpressEngine.shared().setAudioDataHandler(nil)
ZegoExpressEngine.shared().enableAudioDataCallback(false, callbackBitMask: [.captured, .player], param: param)
int bitmask = ZegoAudioDataCallbackBitMask.CAPTURED.value() | ZegoAudioDataCallbackBitMask.PLAYER.value();
ZegoAudioFrameParam param = new ZegoAudioFrameParam();
param.sampleRate = ZegoAudioSampleRate.ZEGO_AUDIO_SAMPLE_RATE_48K;
param.channel = ZegoAudioChannel.MONO;
// Start
ZegoExpressEngine.getEngine().setAudioDataHandler(handler);
ZegoExpressEngine.getEngine().startAudioDataObserver(bitmask, param);
// Stop
ZegoExpressEngine.getEngine().setAudioDataHandler(null);
ZegoExpressEngine.getEngine().stopAudioDataObserver();
int bitmask = ZegoAudioDataCallbackBitMaskCaptured | ZegoAudioDataCallbackBitMaskPlayer;
ZegoAudioFrameParam *param = [[ZegoAudioFrameParam alloc] init];
param.sampleRate = ZegoAudioSampleRate48K;
param.channel = ZegoAudioChannelMono;
// Start
[[ZegoExpressEngine sharedEngine] setAudioDataHandler:self];
[[ZegoExpressEngine sharedEngine] startAudioDataObserver:bitmask param:param];
// Stop
[[ZegoExpressEngine sharedEngine] setAudioDataHandler:nil];
[[ZegoExpressEngine sharedEngine] stopAudioDataObserver];
auto bitmask = ZEGO_AUDIO_DATA_CALLBACK_BIT_MASK_CAPTURED | ZEGO_AUDIO_DATA_CALLBACK_BIT_MASK_PLAYER;
auto param = ZegoAudioFrameParam();
param.sampleRate = ZEGO_AUDIO_SAMPLE_RATE_48K;
param.channel = ZEGO_AUDIO_CHANNEL_MONO;
// Start
ZegoExpressSDK::getEngine()->setAudioDataHandler(handler);
ZegoExpressSDK::getEngine()->startAudioDataObserver(bitmask, param);
// Stop
ZegoExpressSDK::getEngine()->setAudioDataHandler(nullptr);
ZegoExpressSDK::getEngine()->stopAudioDataObserver();
let param = ZegoAudioFrameParam()
param.sampleRate = .rate48K
param.channel = .mono
// Start
ZegoExpressEngine.shared().setAudioDataHandler(self)
ZegoExpressEngine.shared().startAudioDataObserver([.captured, .player], param: param)
// Stop
ZegoExpressEngine.shared().setAudioDataHandler(nil)
ZegoExpressEngine.shared().stopAudioDataObserver()
ZegoReverbParam param = new ZegoReverbParam(ZegoReverbPreset.BASEMENT);
ZegoExpressEngine.getEngine().setReverbParam(param);
ZegoReverbParam *param = [ZegoReverbParam paramWithPreset:ZegoReverbPresetBasement];
[[ZegoExpressEngine sharedEngine] setReverbParam:param];
auto param = ZegoReverbParam(ZEGO_REVERB_PRESET_BASEMENT);
ZegoExpressSDK::getEngine()->setReverbParam(param);
let param = ZegoReverbParam(preset: .basement)
ZegoExpressEngine.shared().setReverbParam(param)
ZegoExpressEngine.getEngine().setReverbPreset(ZegoReverbPreset.BASEMENT);
ZegoReverbAdvancedParam param = new ZegoReverbAdvancedParam();
ZegoExpressEngine.getEngine().setReverbAdvancedParam(param);
[[ZegoExpressEngine sharedEngine] setReverbPreset:ZegoReverbPresetBasement];
ZegoReverbAdvancedParam *param = [[ZegoReverbAdvancedParam alloc] init];
[[ZegoExpressEngine sharedEngine] setReverbAdvancedParam:param];
ZegoExpressSDK::getEngine()->setReverbPreset(ZEGO_REVERB_PRESET_BASEMENT);
auto param = ZegoReverbAdvancedParam();
ZegoExpressSDK::getEngine()->setReverbAdvancedParam(param);
ZegoExpressEngine.shared().setReverbPreset(.basement)
let param = ZegoReverbAdvancedParam()
ZegoExpressEngine.shared().setReverbAdvancedParam(param)
ZegoExpressEngine.getEngine().setBuiltInSpeakerOn(true);
[[ZegoExpressEngine sharedEngine] setBuiltInSpeakerOn:YES];
ZegoExpressSDK::getEngine()->setBuiltInSpeakerOn(true);
ZegoExpressEngine.shared().setBuiltInSpeakerOn(true)
ZegoExpressEngine.getEngine().setAudioRouteToSpeaker(true);
[[ZegoExpressEngine sharedEngine] setAudioRouteToSpeaker:YES];
ZegoExpressSDK::getEngine()->setAudioRouteToSpeaker(true);
ZegoExpressEngine.shared().setAudioRouteToSpeaker(true)
@Override
public void onRoomStreamUpdate(String roomID, ZegoUpdateType updateType, ArrayList<ZegoStream> streamList) {
super.onRoomStreamUpdate(roomID, updateType, streamList);
// Handle room streams
// 处理房间内的流变更
}
- (void)onRoomStreamUpdate:(ZegoUpdateType)updateType streamList:(NSArray<ZegoStream *> *)streamList roomID:(NSString *)roomID {
// Handle room streams
// 处理房间内的流变更
}
// Handle room streams
// 处理房间内的流变更
void onRoomStreamUpdate(const std::string& roomID, ZegoUpdateType updateType, const std::vector<ZegoStream>& streamList) override;
func onRoomStreamUpdate(_ updateType: ZegoUpdateType, streamList: [ZegoStream], roomID: String) {
// Handle room streams
// 处理房间内的流变更
}
@Override
public void onRoomStreamUpdate(String roomID, ZegoUpdateType updateType, ArrayList<ZegoStream> streamList, JSONObject extendedData) {
super.onRoomStreamUpdate(roomID, updateType, streamList, extendedData);
// Handle room streams
// 处理房间内的流变更
}
- (void)onRoomStreamUpdate:(ZegoUpdateType)updateType streamList:(NSArray<ZegoStream *> *)streamList extendedData:(NSDictionary *)extendedData roomID:(NSString *)roomID {
// Handle room streams
// 处理房间内的流变更
}
// Handle room streams
// 处理房间内的流变更
void onRoomStreamUpdate(const std::string& roomID, ZegoUpdateType updateType, const std::vector<ZegoStream>& streamList, const std::string& extendData) override;
func onRoomStreamUpdate(_ updateType: ZegoUpdateType, streamList: [ZegoStream], extendedData: [AnyHashable : Any]?, roomID: String) {
// Handle room streams
// 处理房间内的流变更
}
@Override
public void onDeviceError(int errorCode, String deviceName) {
super.onDeviceError(errorCode, deviceName);
// Handle device error
// 处理设备错误
}
- (void)onDeviceError:(int)errorCode deviceName:(NSString *)deviceName {
// Handle device error
// 处理设备错误
}
// Handle device error
// 处理设备错误
void onDeviceError(int errorCode, const std::string& deviceName) override;
func onDeviceError(_ errorCode: Int32, deviceName: String) {
// Handle device error
// 处理设备错误
}
@Override
public void onLocalDeviceExceptionOccurred(ZegoDeviceExceptionType exceptionType, ZegoDeviceType deviceType, String deviceID) {
super.onLocalDeviceExceptionOccurred(exceptionType, deviceType, deviceID);
// Handle device error
// 处理设备错误
}
- (void)onLocalDeviceExceptionOccurred:(ZegoDeviceExceptionType)exceptionType deviceType:(ZegoDeviceType)deviceType deviceID:(NSString *)deviceID {
// Handle device error
// 处理设备错误
}
// Handle device error
// 处理设备错误
void onLocalDeviceExceptionOccurred(ZegoDeviceExceptionType exceptionType, ZegoDeviceType deviceType, const std::string &deviceID) override;
func onLocalDeviceExceptionOccurred(_ exceptionType: ZegoDeviceExceptionType, deviceType: ZegoDeviceType, deviceID: String) {
// Handle device error
// 处理设备错误
}
@Override
public void onNetworkQuality(String streamID, int txQuality, int rxQuality) {
super.onNetworkQuality(streamID, txQuality, rxQuality);
// Handle network quality
// 处理网络质量
}
- (void)onNetworkQuality:(NSString *)streamID txQuality:(int)txQuality rxQuality:(int)rxQuality {
// Handle network quality
// 处理网络质量
}
// Handle network quality
// 处理网络质量
void onNetworkQuality(const char *streamID, int txQuality, int rxQuality) override;
func onNetworkQuality(_ streamID: String, txQuality: Int32, rxQuality: Int32) {
// Handle network quality
// 处理网络质量
}
@Override
public void onNetworkQuality(String userID, ZegoStreamQualityLevel upstreamQuality, ZegoStreamQualityLevel downstreamQuality) {
super.onNetworkQuality(userID, upstreamQuality, downstreamQuality);
// Handle network quality
// 处理网络质量
}
- (void)onNetworkQuality:(NSString *)userID upstreamQuality:(ZegoStreamQualityLevel)upstreamQuality downstreamQuality:(ZegoStreamQualityLevel)downstreamQuality {
// Handle network quality
// 处理网络质量
}
// Handle network quality
// 处理网络质量
void onNetworkQuality(const std::string &userID, ZegoStreamQualityLevel upstreamQuality, ZegoStreamQualityLevel downstreamQuality) override;
func onNetworkQuality(_ userID: String, upstreamQuality: ZegoStreamQualityLevel, downstreamQuality: ZegoStreamQualityLevel) {
// Handle network quality
// 处理网络质量
}
ZegoExpressEngine.getEngine().setCustomAudioProcessHandler(new IZegoCustomAudioProcessHandler() {
@Override
public void onProcessCapturedAudioData(ByteBuffer data, int dataLength, ZegoAudioFrameParam param) {
super.onProcessCapturedAudioData(data, dataLength, param);
// Handle captured audio data
// 处理本地采集音频数据
}
@Override
public void onProcessRemoteAudioData(ByteBuffer data, int dataLength, ZegoAudioFrameParam param, String streamID) {
super.onProcessRemoteAudioData(data, dataLength, param, streamID);
// Handle remote audio data
// 处理远端拉流音频数据
}
@Override
public void onProcessPlaybackAudioData(ByteBuffer data, int dataLength, ZegoAudioFrameParam param) {
super.onProcessPlaybackAudioData(data, dataLength, param);
// Handle playback audio data
// 处理播放音频数据
}
});
- (void)onProcessCapturedAudioData:(unsigned char *)data dataLength:(unsigned int)dataLength param:(ZegoAudioFrameParam *)param {
// Handle captured audio data
// 处理本地采集音频数据
}
- (void)onProcessRemoteAudioData:(unsigned char *)data dataLength:(unsigned int)dataLength param:(ZegoAudioFrameParam *)param streamID:(NSString *)streamID {
// Handle remote audio data
// 处理远端拉流音频数据
}
- (void)onProcessPlaybackAudioData:(unsigned char *)data dataLength:(unsigned int)dataLength param:(ZegoAudioFrameParam *)param {
// Handle playback audio data
// 处理播放音频数据
}
// Handle captured audio data
// 处理本地采集音频数据
void onProcessCapturedAudioData(unsigned char *data, unsigned int dataLength, ZegoAudioFrameParam *param) override;
// Handle remote audio data
// 处理远端拉流音频数据
void onProcessRemoteAudioData(unsigned char *data, unsigned int dataLength, ZegoAudioFrameParam *param, const std::string &streamID) override;
// Handle playback audio data
// 处理播放音频数据
void onProcessPlaybackAudioData(unsigned char *data, unsigned int dataLength, ZegoAudioFrameParam *param) override;
func onProcessCapturedAudioData(_ data: UnsafeMutablePointer<UInt8>, dataLength: UInt32, param: ZegoAudioFrameParam) {
// Handle captured audio data
// 处理本地采集音频数据
}
func onProcessRemoteAudioData(_ data: UnsafeMutablePointer<UInt8>, dataLength: UInt32, param: ZegoAudioFrameParam, streamID: String) {
// Handle remote audio data
// 处理远端拉流音频数据
}
func onProcessPlaybackAudioData(_ data: UnsafeMutablePointer<UInt8>, dataLength: UInt32, param: ZegoAudioFrameParam) {
// Handle playback audio data
// 处理播放音频数据
}
ZegoExpressEngine.getEngine().setCustomAudioProcessHandler(new IZegoCustomAudioProcessHandler() {
@Override
public void onProcessCapturedAudioData(ByteBuffer data, int dataLength, ZegoAudioFrameParam param, double timestamp) {
super.onProcessCapturedAudioData(data, dataLength, param, timestamp);
// Handle captured audio data
// 处理本地采集音频数据
}
@Override
public void onProcessRemoteAudioData(ByteBuffer data, int dataLength, ZegoAudioFrameParam param, String streamID, double timestamp) {
super.onProcessRemoteAudioData(data, dataLength, param, streamID, timestamp);
// Handle remote audio data
// 处理远端拉流音频数据
}
@Override
public void onProcessPlaybackAudioData(ByteBuffer data, int dataLength, ZegoAudioFrameParam param, double timestamp) {
super.onProcessPlaybackAudioData(data, dataLength, param, timestamp);
// Handle playback audio data
// 处理播放音频数据
}
});
- (void)onProcessCapturedAudioData:(unsigned char *)data dataLength:(unsigned int)dataLength param:(ZegoAudioFrameParam *)param timestamp:(double)timestamp {
// Handle captured audio data
// 处理本地采集音频数据
}
- (void)onProcessRemoteAudioData:(unsigned char *)data dataLength:(unsigned int)dataLength param:(ZegoAudioFrameParam *)param streamID:(NSString *)streamID timestamp:(double)timestamp {
// Handle remote audio data
// 处理远端拉流音频数据
}
- (void)onProcessPlaybackAudioData:(unsigned char *)data dataLength:(unsigned int)dataLength param:(ZegoAudioFrameParam *)param timestamp:(double)timestamp {
// Handle playback audio data
// 处理播放音频数据
}
// Handle captured audio data
// 处理本地采集音频数据
void onProcessCapturedAudioData(unsigned char *data, unsigned int dataLength, ZegoAudioFrameParam *param, double timestamp) override;
// Handle remote audio data
// 处理远端拉流音频数据
void onProcessRemoteAudioData(unsigned char *data, unsigned int dataLength, ZegoAudioFrameParam *param, const std::string &streamID, double timestamp) override;
// Handle playback audio data
// 处理播放音频数据
void onProcessPlaybackAudioData(unsigned char *data, unsigned int dataLength, ZegoAudioFrameParam *param, double timestamp) override;
func onProcessCapturedAudioData(_ data: UnsafeMutablePointer<UInt8>, dataLength: UInt32, param: ZegoAudioFrameParam, timestamp: Double) {
// Handle captured audio data
// 处理本地采集音频数据
}
func onProcessRemoteAudioData(_ data: UnsafeMutablePointer<UInt8>, dataLength: UInt32, param: ZegoAudioFrameParam, streamID: String, timestamp: Double) {
// Handle remote audio data
// 处理远端拉流音频数据
}
func onProcessRemoteAudioData(_ data: UnsafeMutablePointer<UInt8>, dataLength: UInt32, param: ZegoAudioFrameParam, streamID: String, timestamp: Double) {
// Handle playback audio data
// 处理播放音频数据
}
联系我们
文档反馈