You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
148 lines
3.8 KiB
148 lines
3.8 KiB
// |
|
// MoonChatPlatform.h |
|
// FWorkSDK |
|
// |
|
// Created by muen on 2021/2/27. |
|
// |
|
|
|
#import <Foundation/Foundation.h> |
|
#import <AVFoundation/AVFoundation.h> |
|
|
|
NS_ASSUME_NONNULL_BEGIN |
|
|
|
|
|
typedef enum : NSUInteger { |
|
MoonChatVoice = 0, |
|
MoonChatVideo = 1, |
|
} MoonChatType; |
|
|
|
typedef enum : NSUInteger { |
|
MoonChatViewTypeSendAudio = 1, |
|
MoonChatViewTypeSendVideo, |
|
MoonChatViewTypeReceiveAudio, |
|
MoonChatViewTypeReceiveVideo, |
|
} MoonChatViewType; |
|
|
|
typedef enum : NSUInteger { |
|
CallStatusSuccess = 0, |
|
CallStatusError = 1, |
|
CallStatusBusy = 7, |
|
CallStatusOffline = 8, |
|
} CallStatus; |
|
|
|
/// 联网类型 |
|
typedef NS_ENUM(NSInteger, LBVACurrentType) { |
|
LBVACurrentTypeNormal = 1, |
|
LBVACurrentTypeReceiced,//收到 |
|
LBVACurrentTypeInviting,//邀请中 |
|
LBVACurrentTypeWaiting, |
|
LBVACurrentTypeCalling,//通话中 |
|
}; |
|
|
|
typedef void (^ _Nullable ITCallBlock)(CallStatus); |
|
typedef void (^ _Nullable UserOnlineBlock)(BOOL); |
|
|
|
//音视频跳转 |
|
@protocol chatAVCallDelegate <NSObject> |
|
- (void)chatAVCallEventCallBack:(MoonChatViewType)avType; |
|
@end |
|
|
|
@protocol chatingEventDelegate <NSObject> |
|
//挂断事件 |
|
- (void)chatAVCloseEventCallBack:(int)type; |
|
//拨打时,初始化预览自己的摄像头信息 |
|
- (void)chatVideoPreviewInit:(AVCaptureSession *)session; |
|
//接通了,初始化视频相关的信息 |
|
- (void)chatVideoSessionInit:(AVCaptureSession *)session; |
|
//接通了,初始化音频相关信息 |
|
- (void)chatAudioInit:(BOOL)isCalling; |
|
//图像数据开始收到了 |
|
- (void)chatVideoDataReceived; |
|
@end |
|
@protocol chatNetWorkStateDelegate <NSObject> |
|
//yes 登录成功,no登录失败 |
|
- (void) chatNetWorkConnect:(BOOL)isConnect; |
|
@end |
|
|
|
|
|
|
|
@interface MoonChatPlatform : NSObject |
|
|
|
@property(nullable, nonatomic, assign) id<chatAVCallDelegate> avCallDelegate; |
|
@property(nullable, nonatomic, assign) id<chatingEventDelegate> avChatingDelegate; |
|
@property(nullable, nonatomic, assign) id<chatNetWorkStateDelegate> chatNetDelegate; |
|
//返回当前SDK是否有用户登录 |
|
@property(nonatomic, assign, readonly) BOOL isConnected; |
|
|
|
//当前通话的对方id |
|
@property(nullable, nonatomic, copy) NSString *partnerUid; |
|
//当前通话状态 |
|
@property(nonatomic, assign) LBVACurrentType curType; |
|
//判断是否传入自己的预览视图 |
|
@property(nonatomic, assign) BOOL isMySurfaceOK; |
|
|
|
// 获取单例对象 |
|
+ (MoonChatPlatform *) getInstance; |
|
// 初始化系统 |
|
+ (int) initSDK:(int)mode; |
|
+ (int) initSDKWithAppid:(NSString *)appid appsecret:(NSString *)appsecret; |
|
|
|
// 连接服务器 |
|
+ (void)connectServer __deprecated_msg("废弃,不需要手动调用连接。"); |
|
+ (int) connectServerAddress:(NSString*)address port:(int)port __deprecated_msg("废弃,不需要手动调用连接。"); |
|
// 登录系统 |
|
+ (int) loginUserName:(NSString*)uName psssword:(nullable NSString*)password; |
|
|
|
// 1 video 0 voice |
|
+ (void)startCalling:(NSString *)partUid phoneType:(MoonChatType)type callBlock:(ITCallBlock)block; |
|
+ (void)startCalling:(NSString *)partUid myNick:(NSString *)nick phoneType:(MoonChatType)type callBlock:(ITCallBlock)block; |
|
|
|
+ (void)setVideoSurface:(NSObject *)surface isMine:(BOOL)ismine; |
|
|
|
//挂断 |
|
+ (void)closeChat; |
|
|
|
//接听 |
|
+ (void)answerChat; |
|
//取消 |
|
+ (void)cancelChat; |
|
//拒绝 |
|
+ (void)refuseChat; |
|
//切换语音通话 |
|
+ (void)changetoVoice; |
|
//切换语音通话并接听 |
|
+ (void)changetoVoicePickUp; |
|
//切换摄像头 |
|
+ (void)switchCamera; |
|
/** |
|
* 设置声音外放还是听筒播放 |
|
* |
|
* @param isloud YES : 外发,NO: 听筒 |
|
*/ |
|
+ (void)changeSoundType:(BOOL)isloud; |
|
|
|
/** |
|
* 设置静音,对方听不到本机声音 |
|
*/ |
|
+ (void)setMute:(BOOL)ismute; |
|
|
|
/** |
|
* 检查指定用户uid是否在线 |
|
* |
|
* @param uid 检查的用户名 |
|
* |
|
* @param blcok 在线状态回调 |
|
*/ |
|
+ (void)checkUserOnline:(NSString *)uid userOnlineBlock:(UserOnlineBlock)blcok; |
|
/** |
|
* 注销视频聊天账号 |
|
*/ |
|
+ (void) logoutChatSDK; |
|
/** |
|
* 释放视频服务资源 |
|
*/ |
|
+ (void) destroy; |
|
|
|
@end |
|
|
|
NS_ASSUME_NONNULL_END
|
|
|