2021-10-19 18:06:19 +08:00
|
|
|
|
//
|
|
|
|
|
// RTCManager.h
|
|
|
|
|
// xplan-ios
|
|
|
|
|
//
|
|
|
|
|
// Created by zu on 2021/10/19.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
|
#import "RtcDelegate.h"
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
|
|
typedef enum : NSUInteger {
|
2021-12-02 16:58:18 +08:00
|
|
|
|
RtcEngineType_Agora = 1001, // 声网
|
2021-12-06 20:43:58 +08:00
|
|
|
|
RtcEngineType_Zego, // 即构
|
2021-12-02 16:58:18 +08:00
|
|
|
|
RtcEngineType_WJ, // 无界
|
|
|
|
|
RtcEngineType_AgoraFast, // 声网急速
|
2021-12-06 20:43:58 +08:00
|
|
|
|
RtcEngineType_TRTC, // 腾讯TRTC
|
2021-10-19 18:06:19 +08:00
|
|
|
|
} RtcEngineType;
|
|
|
|
|
|
2021-10-21 00:50:48 +08:00
|
|
|
|
/** 音频服务管理单例,对所有音频服务 SDK 的封装。
|
|
|
|
|
|
|
|
|
|
**Note:**
|
|
|
|
|
|
2021-11-01 18:25:13 +08:00
|
|
|
|
- ✅ 外部调用者只需要调用 RtcManager 。
|
|
|
|
|
- ✅ RtcManager 对房间业务逻辑有封装。
|
|
|
|
|
- ❌ 业务逻辑不要侵入 RctImpl 。
|
2021-10-21 00:50:48 +08:00
|
|
|
|
*/
|
2021-10-20 14:21:57 +08:00
|
|
|
|
@interface RtcManager : NSObject
|
2021-10-20 17:06:31 +08:00
|
|
|
|
|
2021-11-01 18:39:10 +08:00
|
|
|
|
/**
|
|
|
|
|
* 是否静音(静别人)
|
|
|
|
|
* YES:🔇虽然你们麦位上在说话,但是我就是不听。🙉
|
|
|
|
|
* NO:🔊我听,我听。🐵
|
|
|
|
|
*/
|
|
|
|
|
@property(nonatomic,getter=isRemoteMuted) BOOL remoteMuted;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 是否闭麦(闭自己)
|
|
|
|
|
* YES:🤐虽然我在麦位上,但是我就是不说话。🙊
|
|
|
|
|
* NO:😲我说,我说。🐵
|
|
|
|
|
*/
|
|
|
|
|
@property(nonatomic,getter=isLocalMuted) BOOL localMuted;
|
|
|
|
|
|
2021-10-20 17:06:31 +08:00
|
|
|
|
/** 初始化/重新初始化 RtcManager 实例,设置音频服务类型和 RtcDelegate。
|
|
|
|
|
|
|
|
|
|
**Note:**
|
|
|
|
|
|
|
|
|
|
- 切换音频服务或者更换 delegate 必须先调用该方法。
|
|
|
|
|
- RtcManager 是单例,[RtcManager instance] 也可以获取到 RtcManager 实例。
|
|
|
|
|
|
|
|
|
|
@param type 使用的音频服务 RtcEngineType。
|
|
|
|
|
@param delegate RtcDelegate。
|
|
|
|
|
|
|
|
|
|
@return - RtcManager instance
|
2021-10-19 19:29:25 +08:00
|
|
|
|
*/
|
2021-10-20 17:06:31 +08:00
|
|
|
|
+ (instancetype _Nonnull)initEngineWithType:(RtcEngineType)type
|
|
|
|
|
delegate:(id<RtcDelegate> _Nullable)delegate;
|
|
|
|
|
|
|
|
|
|
/** 获取 RtcManager instance。
|
|
|
|
|
|
|
|
|
|
**Note:**
|
|
|
|
|
|
|
|
|
|
- 务必先 [RtcManager initEngineWithType:delegate:] 设置 RtcEngineType 和 RtcDelegate,否则默认使用声网服务。
|
|
|
|
|
|
|
|
|
|
@return - RtcManager instance
|
2021-10-19 19:29:25 +08:00
|
|
|
|
*/
|
2021-10-20 14:21:57 +08:00
|
|
|
|
+ (instancetype _Nonnull)instance;
|
2021-10-19 18:06:19 +08:00
|
|
|
|
- (instancetype)init NS_UNAVAILABLE;
|
|
|
|
|
+ (instancetype)new NS_UNAVAILABLE;
|
|
|
|
|
- (id)copy NS_UNAVAILABLE;
|
|
|
|
|
- (id)mutableCopy NS_UNAVAILABLE;
|
|
|
|
|
|
2021-11-01 18:25:13 +08:00
|
|
|
|
/**
|
|
|
|
|
* 加入频道(房间)
|
|
|
|
|
*/
|
2021-10-21 00:50:48 +08:00
|
|
|
|
- (BOOL)enterRoom:(NSString *)roomUid;
|
2021-10-20 17:06:31 +08:00
|
|
|
|
|
2021-12-06 20:43:58 +08:00
|
|
|
|
/**
|
|
|
|
|
* 加入频道(房间),TRTC 进房需要动态签名。
|
|
|
|
|
*/
|
|
|
|
|
- (BOOL)enterRoom:(NSString *)roomUid trtcSign:(NSString *)sign;
|
|
|
|
|
|
2021-11-01 18:25:13 +08:00
|
|
|
|
/**
|
|
|
|
|
* 上下麦(说话)
|
|
|
|
|
*/
|
2021-10-20 17:06:31 +08:00
|
|
|
|
- (void)broadcast:(BOOL)on;
|
|
|
|
|
|
2021-11-01 18:25:13 +08:00
|
|
|
|
/**
|
|
|
|
|
* 退出频道
|
|
|
|
|
*/
|
2021-10-21 00:50:48 +08:00
|
|
|
|
- (void)exitRoom;
|
2021-10-20 17:06:31 +08:00
|
|
|
|
|
2021-10-19 18:06:19 +08:00
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|