73 lines
1.7 KiB
Objective-C
73 lines
1.7 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_Zego,//即构
|
||
RtcEngineType_Agora,//声网
|
||
RtcEngineType_WJ,//无界
|
||
RtcEngineType_AgoraFast,//声网急速
|
||
} RtcEngineType;
|
||
|
||
/** 音频服务管理单例,对所有音频服务 SDK 的封装。
|
||
|
||
**Note:**
|
||
|
||
- 外部调用者只需要调用 RtcManager 。
|
||
- 不要侵入 RctImpl 内的逻辑。
|
||
*/
|
||
|
||
@interface RtcManager : NSObject
|
||
|
||
/** 初始化/重新初始化 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;
|
||
|
||
/** 上下麦(说话)*/
|
||
- (void)broadcast:(BOOL)on;
|
||
|
||
/** 退出频道 */
|
||
- (void)exitRoom;
|
||
|
||
/** 销毁引擎(理论上不需要调用) */
|
||
- (void)destory;
|
||
|
||
@end
|
||
|
||
NS_ASSUME_NONNULL_END
|