HEXMEET APP SDK 开发者手册(iOS 版)
HEXMEET APP SDK 开发者手册(iOS 版)
Version 2.1,2018年12月
概述
HEXMEET APP SDK 是一款视频会议软终端开发套件,开发者可以利用本SDK开发出具有清晰流畅的音视频体验和高清内容协作的音视频会议终端APP。HEXMEET APP SDK 具备强大的网络适应性,和独特的音视频抗网络丢包算法,配合HEXMEET 平台使用,可以保证在30%网络丢包环境下视频依然清晰流畅,即使网络丢包高达50%,依然可以保证音频通畅。 HEXMEET APP SDK 提供了丰富,而且简单易用的API 接口。开发者不需要掌握丰富的音视频和信令相关知识,也可以使用本SDK 开发出专业的视频会议软终端APP。 本文档详细介绍了SDK 的各项功能,以及它们的使用方法。
快速开始
使用HEXMEET APP SDK iOS 版
推荐使用 Xcode 10.1 或以上版本
HEXMEET APP SDK iOS 版软件包包含如下文件:
文件 | 描述 | |
---|---|---|
HEXMEET APP SDK | HexmeetManager.h | HEXMEET SDK API头文件,该文件包含所有SDK API声明及宏定义, 用户需要将该文件加入到iOS 工程。 |
sample/hexmeet/ | lib | 库文件目录,所有SDK库文件(.a) 所在目录, 用户需要将该目录添加到工程链接目录列表中, 并将所有的.a文件添加到项目中。 |
示例工程sample/easyVideo/ | HexMeetPad.xcodeproj | 示例工程easyVideo是一个基于HEXMEET APP SDK 开发的完整的音视频会议软终端APP,展示 SDK 所提供的API 的使用方法。sample/easyVideo/ 目录包含了示例工程的全部源代码及其所需的其他文件,其中下面几个文件是需要特别说明的 SDK 使用中所需要的文件 |
easyVideo/Resource/rootca.pem | SIP TLS注册时SDK需要使用的自签名证书,需要将该文件添加到工程Resource目录,该文件为示例文件,用户可以根据需要自己生成,但是文件名必须为rootca.pem | |
easyVideo/Resource/hexmeet~ipad.conf | 【仅对于 iPad APP】SDK默认配置文件,SDK启动时,需要读取该配置文件中的配置内容,用户需要将该文件添加到工程resource目录并确保该文件不被改动 | |
easyVideo/Resource/hexmeet.conf | 【仅对于 iPhone APP】SDK默认配置文件,SDK启动时,需要读取该配置文件中的配置内容,用户需要将该文件添加到工程resource目录并确保该文件不被改动。示例工程中提供了 hexmeet~ipad.conf 文件,当为 iPhone 创建工程时,可将该文件改名为 hexmeet.conf 。 |
文件 | 描述 |
---|---|
easyVideo/Resource/sounds/ringtone.wav | 自定义铃声文件,用户可以替换该文件,但是文件名必须为ringtone.wav |
easyVideo/Resource/hexmeetsdk.lic | SDK激活文件, 用户需要将激活文件添加到工程资源目录,并调用相应的激活 API 激活HEXMEET APP SDK,之后才能正常使用SDK提供的功能 |
使用HEXMEET APP SDK时,需要在工程中做如下设置:
设置 | 描述 |
---|---|
添加SDK头文件HexmeetManager.h | 工程源代码目录 |
添加sdk库文件目录lib | 工程库文件搜索目录列表项 |
添加配置文件hexmeet~ipad.conf | 工程资源文件 |
添加来电铃声ringtone.wav | 工程资源文件 |
添加安全认证证书rootca.pem | 工程资源文件 |
添加SDK激活文件hexmeetsdk.lic | 工程资源文件 |
链接参数设置项-ObjC -lstdc -lresolv -liconv -v -IOS | 工程链接flag设置 |
添加系统库
Frameworks |
---|
SystemConfiguration.framework |
CoreTelephony.framework |
libresolv.tbd |
libz.tbd |
UserNotifications.framework |
PushKit.framework |
Accelerate.framework |
CoreImage.framework |
EventKitUI.framework |
EventKit.framework |
OpenAL.framework |
Security.framework |
MediaPlayer.framework |
AudioToolbox.framework |
CoreMedia.framework |
OpenGLES.framework |
CoreVideo.framework |
CoreFoundation.framework |
AVFoundation.framework |
ImageIO.framework |
UIKit.framework |
Foundation.framework |
CoreGraphics.framework |
libstdc++.6.0.9.dylib |
libicucore.dylib |
libxml2.dylib |
libsqlite3.dylib |
libz.1.2.5.dylib |
API 参考
宏定义
SDK 针对不同日志级别设置宏定义,为方便在代码中打印日志,用户可以直接使用宏定义来打印日志。APP 可以使用这些宏打印日志信息到SDK 的日志文件,这样可以在SDK 日志中体现APP 层的必要操作信息。
#define LOGV(level, ...) [HexmeetManager log:level file:__FILE__ line:__LINE__ format:__VA_ARGS__]
#define LOGD(...) LOGV(LOG_DEBUG, __VA_ARGS__)
#define LOGI(...) LOGV(LOG_MESSAGE, __VA_ARGS__)
#define LOGW(...) LOGV(LOG_WARNING, __VA_ARGS__)
#define LOGE(...) LOGV(LOG_ERROR, __VA_ARGS__)
#define LOGF(...) LOGV(LOG_FATAL, __VA_ARGS__)
类型定义
- FarendUserInfo 该类型表示通话远端信息, 包含呼叫别名和号码
@interface FarendUserInfo : NSObject
@property(nonatomic, strong) NSString* displayName;
@property(nonatomic, strong) NSString* callNumber;
@end
- MediaStaticEntity 该类型表示媒体流的统计信息, 包含所使用的编解码, 带宽,总数据包数, 未收到包数,丢弃的包数,超时包数, 坏包数,丢包率, 分辨率等
@interface MediaStaticEntity : NSObject
@property(nonatomic, strong) NSString* streamName;
//媒体流名字
@property(nonatomic, strong) NSString* codecName;
//编解码方式
@property(nonatomic, strong) NSString* rate;
//流所占带宽(kbps)
@property(nonatomic, strong) NSString* totalPackageNumber;
//总数据包
@property(nonatomic, strong) NSString* LostPackageNumber;
//未收到数据包
@property(nonatomic, strong) NSString* discardedPackageNumber;
//丢弃数据包
@property(nonatomic, strong) NSString* packageTimeoutNumber;
//超时数据包
@property(nonatomic, strong) NSString* badPackageNumber;
//坏数据包
@property(nonatomic, strong) NSString* packageLossRate;
//丢包率
@property(nonatomic, strong) NSString* resolution;
//分辨率
@end
- MediaStaticInfo 该类型表示一个通话中所有流的媒体统计,包括发送音频流, 接收音频流,发送视频流,接收视频流,接收双流视频流
@interface MediaStaticInfo : NSObject
@property(nonatomic, strong) MediaStaticEntity* localAudio;
//本地发送音频媒体统计
@property(nonatomic, strong) MediaStaticEntity* remoteAudio;
//远端接收音频媒体统计
@property(nonatomic, strong) MediaStaticEntity* localVideo;
//本地发送视频媒体统计
@property(nonatomic, strong) MediaStaticEntity* remoteVideo;
//远端接收媒体统计
@property(nonatomic, strong) MediaStaticEntity* remoteContent;
//远端接收双流媒体统计
@end
- HexmeetManager 该类型包含本文档中叙述的全部 API 方法,所有API 调用之前需要通过 instance 方法取得该类型的实例,该类型实例为全局单例,如果需要调用 startHexmeetSdk 函数,调用格式: [HexmeetManager.instance startHexmeetSdk]
枚举和常量定义
- SDK消息通知 SDK 通过系统通知机制(Notification Center)向APP 层汇报SDK 的状态,通话状态,注册状态,蓝牙设备状态等
extern NSString *const kSdkCallUpdate;
extern NSString *const kSdkRegistrationUpdate;
extern NSString *const kSdkBluetoothAvailabilityUpdate;
extern NSString *const kSdkGlobalStateUpdate;
- SDK 全局状态,通过 kSdkGlobalStateUpdate 消息通知SDK 全局状态
typedef enum HexmeetGlobalState{
HexmeetGlobalOff,
HexmeetGlobalStartup,
HexmeetGlobalOn,
HexmeetGlobalShutdown,
HexmeetGlobalConfiguring
} HexmeetGlobalState;
- 通话状态, 通过kSdkCallUpdate 消息通知通话过程中的状态变迁
typedef enum _HexmeetCallState{
HexmeetCallIdle, // Initial call state
HexmeetCallIncomingReceived, // This is a new incoming call
HexmeetCallOutgoingInit, // An outgoing call is started
HexmeetCallOutgoingProgress, // RESERVED
HexmeetCallOutgoingRinging,
// An outgoing call is ringing at remote end
HexmeetCallOutgoingEarlyMedia, // RESERVED
HexmeetCallConnected, // Connected, the call is answered
HexmeetCallStreamsRunning,
// The media streams are established and running
HexmeetCallPausing, // RESERVED
HexmeetCallPaused, // RESERVED
HexmeetCallResuming, // RESERVED
HexmeetCallRefered, // RESERVED
HexmeetCallError, // The call encountered an error
HexmeetCallEnd, // The call ended normally
HexmeetCallPausedByRemote, // RESERVED
HexmeetCallUpdatedByRemote, // RESERVED
HexmeetCallIncomingEarlyMedia,
// We are proposing early media to an incoming call
HexmeetCallUpdating,
// A call update has been initiated by us
HexmeetCallReleased,
// The call object is no more retained by the core
HexmeetCallEarlyUpdatedByRemote, // RESERVED
HexmeetCallEarlyUpdating // RESERVED
} HexmeetCallState;
- 通话失败原因
typedef enum _HexmeetReason{
HexmeetReasonNone,
HexmeetReasonNoResponse, // No response received from remote
HexmeetReasonForbidden, // Authentication failed due to bad
// credentials or resource forbidden
HexmeetReasonDeclined, // The call has been declined
HexmeetReasonNotFound,
// Destination of the call was not found.
HexmeetReasonNotAnswered,
// The call was not answered in time (request timeout)
HexmeetReasonBusy, // Phone line was busy
HexmeetReasonUnsupportedContent, // Unsupported content
HexmeetReasonIOError,
// Transport error: connection failures, disconnections etc...
HexmeetReasonDoNotDisturb, // Do not disturb reason
HexmeetReasonUnauthorized,
// Operation is unauthorized because missing credential
HexmeetReasonNotAcceptable,
// Operation like call update rejected by peer
HexmeetReasonNoMatch,
// Operation could not be executed by server or
// remote client because it didn't have any context
HexmeetReasonMovedPermanently, // Resource moved permanently
HexmeetReasonGone, // Resource no longer exists
HexmeetReasonTemporarilyUnavailable, // Temporarily unavailable
HexmeetReasonAddressIncomplete, // Address incomplete
HexmeetReasonNotImplemented, // Not implemented
HexmeetReasonBadGateway, // Bad gateway
HexmeetReasonServerTimeout, // Server timeout
HexmeetReasonUnknown // Unknown reason
} HexmeetReason;
- 注册状态:通过kSdkRegistrationUpdate 消息上报注册状态变迁
typedef enum _RegistrationState{
RegistrationNone, // Initial state for registrations
RegistrationProgress, // Registration is in progress
RegistrationOk, // Registration is successful
RegistrationCleared, // Unregistration succeeded
RegistrationFailed // Registration failed
} RegistrationState;
- 媒体流类型:
typedef enum _StreamType {
StreamTypeAudio, // audio stream
StreamTypeVideo, // video stream
StreamTypeBfcp, // RESERVED
StreamTypeContent, // content stream
StreamTypeFecc, // RESERVED
StreamTypeText, // RESERVED
StreamTypeUnknown // RESERVED
} StreamType;
- 媒体加密类型
/**
* Enum describing type of media encryption types.
**/
typedef enum _MediaEncryption {
MediaEncryptionNone, // No media encryption is used
MediaEncryptionSRTP, // Use SRTP media encryption
MediaEncryptionZRTP, // RESERVED
MediaEncryptionDTLS // RESERVED
} MediaEncryption;
- 播放声音类型
typedef enum _SoundType {
ringing,
ringback,
callclose,
all,
} SoundType;
- 摄像头操作类型定义
typedef enum _CameralOperationType {
switch2back,
switch2front,
alternate, //交替切换前后摄像头
} CameralOperationType;
- 日志级别定义
typedef enum {
LOG_DEBUG=1,
LOG_TRACE=1<<1,
LOG_MESSAGE=1<<2,
LOG_WARNING=1<<3,
LOG_ERROR=1<<4,
LOG_FATAL=1<<5,
LOG_LEV_END=1<<6
} LogLevel;
API 方法
所有API调用之前需要通过instance 类方法取得HexmeetManager 类型的实例,该类型实例为全局单例,例如需要调用startHexmeetSdk 函数时,调用格式为 [HexmeetManager.instance startHexmeetSdk]
API列表
方法 | 描述 |
---|---|
startHexmeetSdk | 初始化HEXMEET APP SDK,启动媒体、信令模块 |
destroyHexmeetSdk | 销毁 HEXMEET APP SDK |
appBecomeActive | iOS APP 从后台切换到前台时需要调用SDK 处理方法 |
appResignActive | iOS APP 从前台向后台切换时需要调用的方法 |
activeHexmeetSdkWithServerAddr | 使用HEXMEET APP SDK前,需要先调用该 API 激活 |
isHexmeetSdkEnabled | 获取HEXMEET APP SDK激活状态 |
setLocalVideoView | 设置本机视频视图 |
setRemoteVideoView | 设置远端视频视图 |
setContentVideoView | 设置双流视频试图 |
setDeviceRotation | 设置视频显示方向 |
zoomVideo | 放大/缩小视频 |
playSound | 播放声音 |
stopSound | 停放声音(指明声音类型) |
answerCall | 接受呼叫 |
placeCall | 呼出 |
hangupCall | 挂断 |
getFarendInfo | 获取呼叫远端信息 |
getCallFailureReason | 获取呼叫失败信息 |
isCurrentCallVideoEnabled | 当前呼叫视频是否打开 |
isActiveCallExisting | 当前是否有进行中的呼叫 |
isIncomingCallReceived | 是否有新的呼入 |
isReceivingContent | 是否接收到双流 |
getCurrentCallQuality | 获取当前呼叫质量等级 |
getMediaStatics | 获取当前呼叫媒体统计信息 |
unregister | 注销信令 |
registerSip | 注册信令 |
isSipRegisterOk | SIP 注册是否成功 |
getRegistrationState | 获取注册状态 |
switchCamera | 切换摄像头 |
muteMic | 关闭麦克风 |
muteLocalVideo | 关闭本地视频 |
isSpeakerEnabled | 扬声器是否打开 |
setSpeakerEnabled | 设置扬声器状态(打开、关闭) |
setCallRate | 设置呼叫速率 |
saveUserIcon2DocumentWithImage | 设置背景图 |
getLogFilePath | 获取日志文件路径 |
setLogFileName | 设置日志文件名 |
enableLogs | 打开收集日志功能 |
log | 写日志 |
API 详解
startHexmeetSdk
HexMeet SDK 初始化方法,该方法加载音频、视频、信令等核心模块,并加载硬件设备驱动等,为音视频呼叫做初始化工作。该方法需要在APP 启动阶段调用,确保之后的音视频成功使用
- 声明
-(void)startHexmeetSdk;
- 参数 无
- 返回值 无
activeHexmeetSdkWithServerAddr
iOS APP 应用在使用HEXMEET APP SDK时需要先通过该函数激活SDK,之后注册呼叫等 API 才能正常使用
- 声明
- (void)activeHexmeetSdkWithServerAddr
- 参数
传入 | serverAddr | license验证服务器地址 |
---|---|---|
response | SDK激活结果回调代码块 | |
传出 | 无 |
- 返回值 无
isHexmeetSdkEnabled
获取HEXMEET APP SDK激活状态
- 声明
- (BOOL)isHexmeetSdkEnabled;
- 参数 无
- 返回值
/**BOOL
返回SDK激活状态
TRUE 激活成功
FALSE 激活失败
*/
destroyHexmeetSdk
HexMeet SDK 销毁方法,该方法会释放音视频软硬件资源等,需要在APP 退出时调用,防止内存泄漏等问题
- 声明
- (void)destroyHexmeetSdk;
- 参数 无
- 返回值 无
setLogFileName
设置日志文件名
- 声明
- (void)setLogFileName:(NSString*)name;
- 参数
传入 | (NSString *)name | 日志文件名称 |
---|---|---|
传出 | 无 |
- 返回值 无
getLogFilePath
获取日志文件路径,方便下载或用邮件发送日志
- 声明
- (NSString*)getLogFilePath;
- 参数 无
- 返回值 无
enableLogs
设置日志收集级别
- 声明
+ (void)enableLogs:(LogLevel)level;
- 参数
传入 | (LogLevel)level | 收集日志级别 |
---|---|---|
传出 | 无 |
- 返回值 无
log
/**
打印日志方法定义,推荐用户不要直接使用这个方法,而使用如下宏定义打印日志。
LOGD 调试
LOGI 信息
LOGW 告警
LOGE 错误
LOGF 严重
*/
- 声明
+ (void)log:(LogLevel)severity file:(const char *)file line:(int)line format:(NSString *)format, ...;
- 参数
传入 | (LogLevel)severity | 日志级别 |
---|---|---|
传入 | (const char *)file | 文件名 |
传入 | (int)line | 行数 |
传入 | (NSString *) format | 日志输出格式 |
- 返回值 无
registerSip
注册到SIP 服务器,如果sdk没有激活,该函数调用会失败,并且会抛出异常
- 声明
- (void)registerSip:(NSString*)addr displayName:(NSString*)displayName userName:(NSString*)userName password:(NSString*)passwd protocol:(NSString*)protocol;
- 参数
传入 | (NSString *)addr | SIP 地址 |
---|---|---|
传入 | (NSString *)displayName | SIP 显示名称 |
传入 | (NSString *)userName | SIP 用户名称 |
传入 | (NSString *)passwd | SIP 用户密码 |
传入 | (NSString *)protocol | SIP 注册协议:TCP、UDP、TLS |
传出 | 无 |
- 返回值 无
isSipRegisterOk
是否SIP 注册成功
- 声明
- (BOOL)isSipRegisterOk;
- 参数 无
- 返回值
/**BOOL
返回SDK激活状态
TURE SIP 注册成功
FALSE SIP 注册失败
*/
getRegistrationState
获取SIP 注册状态
- 声明
- (RegistrationState)getRegistrationState;
- 参数 无
- 返回值
/**RegistrationState
SIP 注册状态返回,具体参考RegistrationState 枚举类型定义
*/
appResignActive
iOS APP 应用在由前台切换到后台之前,需要被iOS系统调用。该方法会关闭摄像头,并保持正在通话中的呼叫
- 声明
- (BOOL)appResignActive;
- 参数 无
- 返回值 无
setLocalVideoView
设置本地视频显示窗口,需要在HexMeet APP SDK 初始化完成后设置。应用层生成UIView 视图对象,传给SDK,SDK 将视频输出到该窗口上,需要显示视频时应用将视图设成可见状态,反之隐藏视图即可
- 声明
- (void)setLocalVideoView:(UIView*)view;
- 参数
传入 | (UIView *) view | 本地视频显示视图 |
---|---|---|
传出 | 无 |
- 返回值 无
setRemoteVideoView
设置远端视频显示视图,同本地视频显示视图类似,由UI 生成视图对象,传给SDK,需要显示时把视图设成可见状态,不需要显示时,隐藏视图
- 声明
- (void)setRemoteVideoView:(UIView*)view;
- 参数
传入 | UIView | 远端视频显示视图 |
---|---|---|
传出 | 无 |
- 返回值 无
setContentVideoView
设置双流视频显示视图,同本地视频显示视图类似,由UI 生成视图对象,传给SDK,需要显示时把视图设成可见状态,不需要显示时,隐藏视图
- 声明
- (void)setContentVideoView:(UIView*)view;
- 参数
传入 | (UIView *)view | 双流视频显示视图 |
---|---|---|
传出 | 无 |
- 返回值 无
setDeviceRotation
设置设备方向,取值 0, 90, 180, 270
- 声明
- (void)setDeviceRotation:(int)rotation;
- 参数
传入 | (int)rotation | 设备方向 |
---|---|---|
传出 | 无 |
- 返回值 无
zoomVideo
当在视频通话中时,如用户在视频窗口上使用手势功能,可以使用该方法对所显示的视频做相应的放大,缩小,移动
- 声明
- (void)zoomVideo:(float)factor withCX:(float*)cx withCY: (float*)cy forStreamType: (StreamType)type;
- 参数
传入 | (float)factor | 缩放比例 |
---|---|---|
传入/传出 | (float *)cx | 参考原点横轴坐标 |
传入 /传出 | (float *)cy | 参考原点纵轴坐标 |
传入 | (StreamType)type | 视频流类型:视频、双流 |
- 返回值 无
playSound
播放铃音方法
- 声明
- (void)playSound:(SoundType)type;
- 参数
传入 | (SoundType)type | 声音类型:振铃、回铃、挂呼叫 |
---|---|---|
传出 | 无 |
- 返回值 无
stopSound
停止播放铃音方法
- 声明
- (void)stopSound:(SoundType)type;
- 参数
传入 | (SoundType)type | 声音类型:振铃、回铃、挂呼叫 |
---|---|---|
传出 | 无 |
- 返回值 无
placeCall
主动呼出,输入参数enableVideo 值为TRUE时, 以视频通话方式呼出,为FALSE时,以音频方式呼出。如果sdk没有激活,该函数调用会失败,并且会抛出异常
- 声明
- (BOOL)placeCall:(NSString*)addr withVideoEnable:(BOOL)enableVideo;
- 参数
传入 | (NSString *)addr | 呼出地址 |
---|---|---|
传入 | (BOOL)enableVideo | 是否打开视频 |
传出 | 无 |
- 返回值
/**BOOL
TRUE 呼叫成功
FALSE 呼叫失败
*/
hangupCall
主动挂断通话
- 声明
- (void)hangupCall;
- 参数 无
- 返回值 无
getFarendInfo
主动挂断通话
- 声明
- (FarendUserInfo*)getFarendInfo;
- 参数 无
- 返回值
/**FarendUserInfo
返回SDK激活状态
displayName 显示名称
callNumber 呼叫号码
*/
getCallFailureReason
当呼叫发生失败时,获取当前呼叫失败的原因
- 声明
- (HexmeetReason)getCallFailureReason;
- 参数 无
- 返回值
/**BOOL
TRUE 有
FALSE 没有
*/
isIncomingCallReceived
当呼叫状态发生变化时,判断是否是收到了新的呼叫
- 声明
- (BOOL) isIncomingCallReceived;
- 参数 无
- 返回值
/**BOOL
TRUE 有
FALSE 没有
*/
answerCall
应答呼入的音视频通话,输入参数enableVideo 值为TRUE时,将以视频通话的方式接听,为FALSE时,将以音频通话的方式接听
- 声明
- (void)answerCall:(BOOL)enableVideo;
- 参数
传入 | (BOOL)enableVideo | 是否打开视频 |
---|---|---|
传出 | 无 |
- 返回值 无
isReceivingContent
当呼叫状态发生变化时,判断是否是收到了双流视频
- 声明
- (BOOL) isReceivingContent;
- 参数 无
- 返回值
/**BOOL
TRUE 有
FALSE 没有
*/
getCurrentCallQuality
**获取当前通话质量等级。该方法通过检查网络丢包情况等统计数据,给出当前通话的质量等级评价 **
- 声明
- (BOOL) getCurrentCallQuality;
- 参数 无
- 返回值
/**int
当前通话的质量等级,可能的值(0~4),对应于等级由低到高
*/
getMediaStatics
获取当前通话媒体统计信息
- 声明
- (MediaStaticInfo*)getMediaStatics;
- 参数 无
- 返回值
/**MediaStaticInfo
媒体统计信息对象指针,具体内容请参考统计信息结构体定义
*/
unregister
注销当前SIP 注册
- 声明
- (void)unregister;
- 参数 无
- 返回值 无
switchCamera
切换摄影镜头方法,指定摄影镜头:前镜头、后镜头、交替
- 声明
- (void)switchCamera:(CameralOperationType)type;
- 参数 无
- 返回值 无
muteMic
麦克风控制方法,可以打开、关闭麦克风
- 声明
- (void)muteMic:(BOOL)mute;
- 参数
传入 | (BOOL)mute | TRUE— 将麦克风关闭。FALSE — 将麦克风打开。 |
---|---|---|
传出 | 无 |
- 返回值 无
muteLocalVideo
摄影镜头控制方法,可以打开、关闭摄像头,通话中如果关闭摄像头,将向远端发送背景图
- 声明
- (void)muteLocalVideo:(BOOL)mute;
- 参数
传入 | (BOOL)mute | TRUE— 将本地视频关闭。FALSE — 将本地视频打开。 |
---|---|---|
传出 | 无 |
- 返回值 无
isSpeakerEnabled
查询扬声器是否打开
- 声明
- (Boolean)isSpeakerEnabled;
- 参数 无
- 返回值
/**BOOL
TRUE 扬声器打开
FALSE 扬声器关闭
*/
setSpeakerEnabled
设置打开、关闭扬声器的方法
- 声明
- (void)setSpeakerEnabled:(BOOL)enable;
- 参数
传入 | (BOOL)enable | TRUE — 打开扬声器。FALSE — 关闭扬声器。 |
---|---|---|
传出 | 无 |
- 返回值 无
setCallRate
设置呼叫速率的方法,呼叫速率决定通话中音视频质量,高速率下将获得高的视频分辨率、帧率,如果速率设定较低,则通话中的音视频质量将相应降低,最终结果也取决于与远端协商的结果
- 声明
- (void)setCallRate:(int)callRate;
- 参数
传入 | (int)callRate | 可能的值:384、 512、768、1024 |
---|---|---|
传出 | 无 |
- 返回值 无
saveUserIcon2DocumentWithImage
由iOS UIImage 对象设置本地背景图,在视频通话中关闭本地摄影镜头时发送给远端
- 声明
- (void)saveUserIcon2DocumentWithImage:(UIImage*)image withFileName:(NSString*)fileName;
- 参数
传入 | (UIImage *)image | 图片UIImage 对象。 |
---|---|---|
传入 | (NSString *)fileName | 文件名 |
传出 |
- 返回值 无
附录
HEXMEET APP SDK 头文件
/***********************************************************************
*
* Copyright (c) 2017 ZhongChuang, Inc.
* All rights reserved
*
* THIS IS UNPUBLISHED PROPRIETARY
* SOURCE CODE OF ZhongChuang, Inc.
* The copyright notice above does not
* evidence any actual or intended
* publication of such source code.
*
* HexmeetManager.h
* HEXMEET APP SDK API
* Version 2.0
* date 2017/02/20
*
**********************************************************************/
#define LOGV(level, ...) [HexmeetManager log:level file:__FILE__ line:__LINE__ format:__VA_ARGS__]
#define LOGD(...) LOGV(LOG_DEBUG, __VA_ARGS__)
#define LOGI(...) LOGV(LOG_MESSAGE, __VA_ARGS__)
#define LOGW(...) LOGV(LOG_WARNING, __VA_ARGS__)
#define LOGE(...) LOGV(LOG_ERROR, __VA_ARGS__)
#define LOGF(...) LOGV(LOG_FATAL, __VA_ARGS__)
extern NSString *const kSdkCallUpdate;
extern NSString *const kSdkRegistrationUpdate;
extern NSString *const kSdkBluetoothAvailabilityUpdate;
extern NSString *const kSdkGlobalStateUpdate;
typedef enum HexmeetGlobalState{
HexmeetGlobalOff,
HexmeetGlobalStartup,
HexmeetGlobalOn,
HexmeetGlobalShutdown,
HexmeetGlobalConfiguring
} HexmeetGlobalState;
typedef enum _HexmeetCallState{
HexmeetCallIdle, // Initial call state
HexmeetCallIncomingReceived, // This is a new incoming call
HexmeetCallOutgoingInit, // An outgoing call is started
HexmeetCallOutgoingProgress,
// An outgoing call is in progress
HexmeetCallOutgoingRinging,
// An outgoing call is ringing at remote end
HexmeetCallOutgoingEarlyMedia,
// An outgoing call is proposed early media
HexmeetCallConnected,
// Connected, the call is answered
HexmeetCallStreamsRunning,
// The media streams are established and running
HexmeetCallPausing,
// The call is pausing at the initiative of local end
HexmeetCallPaused,
// The call is paused, remote end has accepted the pause
HexmeetCallResuming,
// The call is being resumed by local end
HexmeetCallRefered,
// The call is being transfered to another party, resulting in // a new outgoing call
HexmeetCallError,
// The call encountered an error
HexmeetCallEnd,
// The call ended normally
HexmeetCallPausedByRemote,
// The call is paused by remote end
HexmeetCallUpdatedByRemote,
// The call's parameters change is requested by remote end,
// for example when video is added
HexmeetCallIncomingEarlyMedia,
// We are proposing early media to an incoming call
HexmeetCallUpdating,
// A call update has been initiated by us
HexmeetCallReleased,
// The call object is no more retained by the core
HexmeetCallEarlyUpdatedByRemote,
// The call is updated by remote while not yet answered
// (early dialog SIP UPDATE received).
HexmeetCallEarlyUpdating
// We are updating the call while not yet answered
// (early dialog SIP UPDATE sent)
} HexmeetCallState;
typedef enum _HexmeetReason{
HexmeetReasonNone,
HexmeetReasonNoResponse,
// No response received from remote
HexmeetReasonForbidden,
// Authentication failed due to bad credentials
// or resource forbidden
HexmeetReasonDeclined, // The call has been declined
HexmeetReasonNotFound,
// Destination of the call was not found.
HexmeetReasonNotAnswered,
// The call was not answered in time (request timeout)
HexmeetReasonBusy, // Phone line was busy
HexmeetReasonUnsupportedContent, // Unsupported content
HexmeetReasonIOError,
// Transport error: connection failures, disconnections etc...
HexmeetReasonDoNotDisturb, // Do not disturb reason
HexmeetReasonUnauthorized,
// Operation is unauthorized because missing credential
HexmeetReasonNotAcceptable,
// Operation like call update rejected by peer
HexmeetReasonNoMatch,
// Operation could not be executed by server or remote client
// because it didn't have any context
HexmeetReasonMovedPermanently, // Resource moved permanently
HexmeetReasonGone, // Resource no longer exists
HexmeetReasonTemporarilyUnavailable,// Temporarily unavailable
HexmeetReasonAddressIncomplete, // Address incomplete
HexmeetReasonNotImplemented, // Not implemented
HexmeetReasonBadGateway, // Bad gateway
HexmeetReasonServerTimeout, // Server timeout
HexmeetReasonUnknown // Unknown reason
} HexmeetReason;
typedef enum _RegistrationState{
RegistrationNone,
// Initial state for registrations
RegistrationProgress, // Registration is in progress
RegistrationOk, // Registration is successful
RegistrationCleared, // Unregistration succeeded
RegistrationFailed // Registration failed
} RegistrationState;
typedef enum _StreamType {
StreamTypeAudio,
StreamTypeVideo,
StreamTypeBfcp,
StreamTypeContent,
StreamTypeFecc,
StreamTypeText,
StreamTypeUnknown
} StreamType;
/**
* Enum describing type of media encryption types.
**/
typedef enum _MediaEncryption {
MediaEncryptionNone, // No media encryption is used
MediaEncryptionSRTP, // Use SRTP media encryption
MediaEncryptionZRTP, // Use ZRTP media encryption
MediaEncryptionDTLS // Use DTLS media encryption
} MediaEncryption;
typedef enum _SoundType {
ringing,
ringback,
callclose,
all,
} SoundType;
typedef enum _CameralOperationType {
switch2back,
switch2front,
alternate,
} CameralOperationType;
typedef enum {
LOG_DEBUG=1,
LOG_TRACE=1<<1,
LOG_MESSAGE=1<<2,
LOG_WARNING=1<<3,
LOG_ERROR=1<<4,
LOG_FATAL=1<<5,
LOG_LEV_END=1<<6
} LogLevel;
@interface FarendUserInfo : NSObject
@property(nonatomic, strong) NSString* displayName;
@property(nonatomic, strong) NSString* callNumber;
@end
@interface MediaStaticEntity : NSObject
@property(nonatomic, strong) NSString* streamName;
@property(nonatomic, strong) NSString* codecName;
@property(nonatomic, strong) NSString* rate; //kbps
@property(nonatomic, strong) NSString* totalPackageNumber;
@property(nonatomic, strong) NSString* LostPackageNumber;
@property(nonatomic, strong) NSString* discardedPackageNumber;
@property(nonatomic, strong) NSString* packageTimeoutNumber;
@property(nonatomic, strong) NSString* badPackageNumber;
@property(nonatomic, strong) NSString* packageLossRate;
@property(nonatomic, strong) NSString* resolution;
@end
@interface MediaStaticInfo : NSObject
@property(nonatomic, strong) MediaStaticEntity* localAudio;
@property(nonatomic, strong) MediaStaticEntity* remoteAudio;
@property(nonatomic, strong) MediaStaticEntity* localVideo;
@property(nonatomic, strong) MediaStaticEntity* remoteVideo;
@property(nonatomic, strong) MediaStaticEntity* remoteContent;
@end
@interface HexmeetManager : NSObject {
}
+ (HexmeetManager*)instance;
- (void)startHexmeetSdk;
- (void)destroyHexmeetSdk;
- (void)appBecomeActive;
- (BOOL)appResignActive;
(BOOL)isSdkStartup;
(void)activeHexmeetSdkWithServerAddr:(NSString*) serverAddr reponse:(void (^)(BOOL success, NSString* reason))response;
(BOOL)isHexmeetSdkEnabled
- (void)setLocalVideoView:(void*)view;
- (void)setRemoteVideoView:(void*)view;
- (void)setContentVideoView:(void*)view;
- (void)setDeviceRotation:(int)rotation; // 90, 180, 270
- (void)zoomVideo:(float)factor withCX:(float*)cx withCY: (float*)cy forStreamType: (StreamType)type;
- (void)playSound:(SoundType)type;
- (void)stopSound:(SoundType)type;
- (void)answerCall:(BOOL)enableVideo;
- (BOOL)placeCall:(NSString*)addr withVideoEnable:(BOOL)enableVideo;
- (void)hangupCall;
- (FarendUserInfo*)getFarendInfo;
- (HexmeetReason)getCallFailureReason;
- (BOOL)isCurrentCallVideoEnabled;
- (BOOL)isActiveCallExisting;
- (BOOL)isIncomingCallReceived;
- (BOOL)isReceivingContent;
- (int)getCurrentCallQuality; // 0~4
- (MediaStaticInfo*)getMediaStatics;
- (void)setCallRate:(int)callRate;
- (void)unregister;
- (void)registerSip:(NSString*)addr displayName:(NSString*)displayName userName:(NSString*)userName password:(NSString*)passwd protocol:(NSString*)protocol;
- (bool)isSipRegisterOk;
- (RegistrationState)getRegistrationState;
- (void)switchCamera:(CameralOperationType)type;
- (void)muteMic:(BOOL)mute;
- (void)muteLocalVideo:(BOOL)mute;
- (Boolean)isSpeakerEnabled;
- (void)setSpeakerEnabled:(BOOL)enable;
- (void)saveUserIcon2DocumentWithImage:(UIImage*)image withFileName:(NSString*)fileName;
- (NSString*)getLogFilePath;
- (void)setLogFileName:(NSString*)name;
+ (void)enableLogs:(LogLevel)level;
+ (void)log:(LogLevel)severity file:(const char *)file line:(int)line format:(NSString *)format, ...;
@end