96 lines
2.3 KiB
Objective-C
96 lines
2.3 KiB
Objective-C
//
|
||
// 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 {
|
||
RtcEngineType_Agora = 1001, // 声网
|
||
RtcEngineType_Zego, // 即构
|
||
RtcEngineType_WJ, // 无界
|
||
RtcEngineType_AgoraFast, // 声网急速
|
||
RtcEngineType_TRTC, // 腾讯TRTC
|
||
} RtcEngineType;
|
||
|
||
/** 音频服务管理单例,对所有音频服务 SDK 的封装。
|
||
|
||
**Note:**
|
||
|
||
- ✅ 外部调用者只需要调用 RtcManager 。
|
||
- ✅ RtcManager 对房间业务逻辑有封装。
|
||
- ❌ 业务逻辑不要侵入 RctImpl 。
|
||
*/
|
||
@interface RtcManager : NSObject
|
||
|
||
/**
|
||
* 是否静音(静别人)
|
||
* YES:🔇虽然你们麦位上在说话,但是我就是不听。🙉
|
||
* NO:🔊我听,我听。🐵
|
||
*/
|
||
@property(nonatomic,getter=isRemoteMuted) BOOL remoteMuted;
|
||
|
||
/**
|
||
* 是否闭麦(闭自己)
|
||
* YES:🤐虽然我在麦位上,但是我就是不说话。🙊
|
||
* NO:😲我说,我说。🐵
|
||
*/
|
||
@property(nonatomic,getter=isLocalMuted) BOOL localMuted;
|
||
|
||
/** 初始化/重新初始化 RtcManager 实例,设置音频服务类型和 RtcDelegate。
|
||
|
||
**Note:**
|
||
|
||
- 切换音频服务或者更换 delegate 必须先调用该方法。
|
||
- RtcManager 是单例,[RtcManager instance] 也可以获取到 RtcManager 实例。
|
||
|
||
@param type 使用的音频服务 RtcEngineType。
|
||
@param delegate RtcDelegate。
|
||
|
||
@return - RtcManager instance
|
||
*/
|
||
+ (instancetype _Nonnull)initEngineWithType:(RtcEngineType)type
|
||
delegate:(id<RtcDelegate> _Nullable)delegate;
|
||
|
||
/** 获取 RtcManager instance。
|
||
|
||
**Note:**
|
||
|
||
- 务必先 [RtcManager initEngineWithType:delegate:] 设置 RtcEngineType 和 RtcDelegate,否则默认使用声网服务。
|
||
|
||
@return - RtcManager instance
|
||
*/
|
||
+ (instancetype _Nonnull)instance;
|
||
- (instancetype)init NS_UNAVAILABLE;
|
||
+ (instancetype)new NS_UNAVAILABLE;
|
||
- (id)copy NS_UNAVAILABLE;
|
||
- (id)mutableCopy NS_UNAVAILABLE;
|
||
|
||
/**
|
||
* 加入频道(房间)
|
||
*/
|
||
- (BOOL)enterRoom:(NSString *)roomUid;
|
||
|
||
/**
|
||
* 加入频道(房间),TRTC 进房需要动态签名。
|
||
*/
|
||
- (BOOL)enterRoom:(NSString *)roomUid trtcSign:(NSString *)sign;
|
||
|
||
/**
|
||
* 上下麦(说话)
|
||
*/
|
||
- (void)broadcast:(BOOL)on;
|
||
|
||
/**
|
||
* 退出频道
|
||
*/
|
||
- (void)exitRoom;
|
||
|
||
@end
|
||
|
||
NS_ASSUME_NONNULL_END
|