前言
快对讲2.0,全新升级,新增多人音视频会议模块,让沟通更高效!会议模块包含会控、成员管理、聊天、屏幕共享、音视频相关、AI降噪等实用功能,支持iOS、Android 和 Web等多终端接入,让远程协作更加轻松自如。
功能体验
会议场景功能
基础会议
效果预览
部分代码实现
NS_ASSUME_NONNULL_BEGIN
@class ARUIRoomKit;
@protocol ARUIRoomKitDelegate <NSObject>
@optional
/// 加入会议事件回调
/// - Parameter code: 错误码
- (void)onEnterRoom:(ARUIConferenceErrCode)code;
/// 退出会议事件回调
/// - Parameter code: 错误码
- (void)onExitRoom:(ARUIConferenceErrCode)code;
@end
@interface ARUIRoomKit : NSObject
/// 会议事件回调
/// - Parameter delegate: 回调
+ (void)setDelegate:(id<ARUIRoomKitDelegate> _Nullable)delegate;
/// 创建会议房间
/// - Parameter info: 房间信息
+ (void)createRoom:(ARUIRoomInfo *_Nonnull)info;
/// 加入会议房间
/// - Parameter info: 房间信息
+ (void)enterRoom:(ARUIRoomInfo *_Nonnull)info;
/// 结束会议
+ (void)exitRoom;
@end
@interface ARTCMeeting : NSObject
+ (ARTCMeeting *)shareInstance;
/// 开始会议
/// - Parameter roomInfo: 会议信息
- (void)startMeeing:(ARUIRoomInfo *)roomInfo
NS_SWIFT_NAME(startMeeing(roomInfo:));
/// 离开会议
- (void)leaveRoom
NS_SWIFT_NAME(leaveRoom());
/// 设置ARTCMeetingDelegate回调
/// @param delegate 回调实例
- (void)addDelegate:(id<ARTCMeetingDelegate>)delegate
NS_SWIFT_NAME(addDelegate(delegate:));
/// 开启远程用户视频渲染
/// @param userId 远程用户 ID
/// @param view 渲染视图
- (void)startRemoteView:(NSString *)userId view:(UIView *)view
NS_SWIFT_NAME(startRemoteView(userId:view:));
/// 关闭远程用户视频渲染
/// @param userId 远程用户 ID
- (void)stopRemoteView:(NSString *)userId
NS_SWIFT_NAME(stopRemoteView(userId:));
/// 打开摄像头
- (void)openCamera:(BOOL)frontCamera view:(UIView *)view
NS_SWIFT_NAME(openCamera(frontCamera:view:));
/// 切换摄像头
- (void)switchCamera
NS_SWIFT_NAME(switchCamera());
/// 开关本地视频流
/// - Parameter mute: YES 禁止,NO 恢复
- (void)muteLocalVideo:(BOOL)mute
NS_SWIFT_NAME(muteLocalVideo(mute:));
/// 开关本地音频流
/// - Parameter mute: YES 禁止,NO 恢复
- (void)muteLocalAudio:(BOOL)mute
NS_SWIFT_NAME(muteLocalAudio(mute:));
/// 免提
- (void)setHandsFree:(BOOL)isHandsFree
NS_SWIFT_NAME(setHandsFree(isHandsFree:));
/// 停止/恢复接收指定视频流
/// - Parameters:
/// - userID: 用户ID
/// - mute: YES 停止,NO 恢复
- (void)muteRemoteVideoStream:(NSString *)userID mute:(BOOL)mute
NS_SWIFT_NAME(muteRemoteVideoStream(userID:mute:));
/// 停止/恢复接收指定音频流
/// - Parameters:
/// - userID: 用户ID
/// - mute: YES 停止,NO 恢复
- (void)muteRemoteAudioStream:(NSString *)userID mute:(BOOL)mute;
/// 本地镜像
/// - Parameter mirror: YES 镜像打开,NO 镜像关闭
- (void)setLocalRenderMirrorMode:(BOOL)mirror
NS_SWIFT_NAME(setLocalRenderMirrorMode(mirror:));
/// 说话提示音
/// - Parameter enable: YES 打开,NO 关闭
- (void)enableAudioVolumeIndication:(BOOL)enable
NS_SWIFT_NAME(enableAudioVolumeIndication(enable:));
/// 调节录音音量
/// - Parameter volume: 录音音量 [0, 400]
- (void)adjustRecordingSignalVolume:(NSInteger)volume
NS_SWIFT_NAME(adjustRecordingSignalVolume(volume:));
/// 调节本地播放的所有远端用户音量
/// - Parameter volume: 播放音量 [0, 400]
- (void)adjustPlaybackSignalVolume:(NSInteger)volume
NS_SWIFT_NAME(adjustPlaybackSignalVolume(volume:));
/// 设置视频编码配置
- (void)updateVideoEncoderParam
NS_SWIFT_NAME(updateVideoEncoderParam());
/// AI 降噪
/// - Parameter state: 1打开,0 关闭
- (void)setAudioAiNoise:(BOOL)isOpen
NS_SWIFT_NAME(setAudioAiNoise(isOpen:));
/// 收到主持人禁画信令
/// - Parameter mute: YES 禁画,NO 禁画
/// - Parameter isAll: YES 全体,NO 个人
- (void)receiveMuteVideo:(BOOL)mute all:(BOOL)isAll
NS_SWIFT_NAME(receiveMuteVideo(mute:all:));
/// 同步用户禁画状态变化
/// - Parameters:
/// - uid: 用户ID
/// - mute: YES 禁止,NO 恢复
- (void)syncVidState:(NSString *)uid mute:(BOOL)mute
NS_SWIFT_NAME(syncVidState(uid:mute:));
/// 同步禁言状态变化
/// - Parameter mute: YES 禁止,NO 恢复
- (void)syncChatState:(BOOL)mute
NS_SWIFT_NAME(syncChatState(mute:));
@end
会控逻辑
效果预览
部分代码实现
@implementation ARTCMeeting
+ (ARTCMeeting *)shareInstance {
static dispatch_once_t onceToken;
static ARTCMeeting * g_sharedInstance = nil;
dispatch_once(&onceToken, ^{
g_sharedInstance = [[ARTCMeeting alloc] init];
});
return g_sharedInstance;
}
- (ARtcEngineKit *)rtcEngine {
if (!_rtcEngine) {
_rtcEngine = [ARtcEngineKit sharedEngineWithAppId:[ARUILogin getSdkAppID] delegate:self];
[_rtcEngine setEnableSpeakerphone: YES];
[_rtcEngine enableDualStreamMode:YES];
}
return _rtcEngine;
}
- (void)addObserver {
/// 监听前后台状态
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(enterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil];
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(becomeActive:) name:UIApplicationWillEnterForegroundNotification object:nil];
}
- (void)removeObserver {
/// 移除监听
[NSNotificationCenter.defaultCenter removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:nil];
[NSNotificationCenter.defaultCenter removeObserver:self name:UIApplicationWillEnterForegroundNotification object:nil];
}
- (void)enterBackground:(NSNotificat