全部产品
云市场

macOS UISDK集成手册

更新时间:2020-04-27 21:08:33

1 概述

云视频会议Mac UI-SDK提供了一套用于入视频会议的接口集合,开发者可以通过调用Alimeeting UI SDK(下面统一简称SDK),可以在自己的Mac软件中快速集成带UI的云视频会议。

SDK主要功能点包括:

1.加入音视频会议

2.会议UI界面定制

3.会议信息&&SLS定制

4.会议状态回调

5.人员入离会状态回调

本文面向有一定Cocoa以及objectiveC基础的开发者,旨在引导读者快速接入SDK。

2 SDK文件结构

SDK&&SDK-Sample附件下载地址:

macos-uisdk.zip

首先,下载解压SDK文件压缩包,可以看到以下文件:

AliMeetingUISDK.framework:UI-SDK库

SDKSample:使用AliMeetingUISDK.framework的Demo代码

3 快速入门教程

3.1 开发环境准备

在接入SDK前需要以下环境:

名称 要求
macOS版本 macOS 10.11及以上
Xcode版本 Xcode 10.3及以上

3.2 创建项目

3.2.1 创建流程

1. 创建Cocoa App

创建1创建2

2. 创建好的工程结构如下

创建好的工程

3. 添加SDK库和第三方依赖库

添加SDK库和第三方库

4. 配置plist工程属性,添加音视频会议所需要的权限

配置plist

5. 关闭应用的沙盒模式

关闭沙盒模式

6. 关闭应用Hardened Runtime模式

关闭HR模式

注:如果确实需要Hardened Runtime模式,可以进行如下设置设置HR模式

3.3 业务代码集成

3.3.1入会参数配置

1. 构建入会信息

构建入会信息,添加各项入会参数,详细信息请参考3.5.1会议配置枚举或SDK中的头文件AMUISDKMeetingConfig.h

  1. NSDictionary *meetingConfig = @{
  2. AMUISDKMeetingConfigClientAppId:clientAppId,
  3. AMUISDKMeetingConfigSlsInfo:slsInfo,
  4. AMUISDKMeetingConfigMeetingUUID:meetingUUID,
  5. AMUISDKMeetingConfigMemberUUID:memberUUID,
  6. AMUISDKMeetingConfigMeetingToken:meetingToken,
  7. AMUISDKMeetingConfigMeetingDomain:meetingDomain,
  8. AMUISDKMeetingConfigUserId:userId
  9. };

注:meetingConfig以下参数需要从ISV服务端获取:

(关于云视频会议的开发流程请参考文档:https://help.aliyun.com/document_detail/145896.html

AMUISDKMeetingConfigClientAppId

AMUISDKMeetingConfigSlsInfo

AMUISDKMeetingConfigMeetingUUID

AMUISDKMeetingConfigMemberUUID

AMUISDKMeetingConfigMeetingToken

AMUISDKMeetingConfigMeetingDomain

2. 构建企业定制信息

构建界面定制信息,添加各项界面参数,详细信息请参考3.5.2UI配置枚举或参考SDK中的头文件AMUISDKGUIConfig.h

  1. NSDictionary *uiConfig = @{
  2. AMUISDKGuiConfigLogoBanner:logoBannerName,
  3. AMUISDKGuiConfigMeetingTopic:meetingTopic,
  4. AMUISDKGuiConfigMeetingCode:meetingCode,
  5. AMUISDKGuiConfigMeetingRateUrl:meetingRateUrl
  6. };

3.3.2 回调配置

1. 会议状态回调

详细信息请参考3.5.3回调状态码枚举或SDK中的头文件AMUISDKMeetingEventDelegate.h

  1. @interface MeetingCallBack : NSObject <AMUISDKMeetingEventDelegate>
  2. @end
  3. @implementation MeetingCallBack
  4. //已成功进入会议回调
  5. - (void) onMeetingJoined{
  6. NSLog(@"onMeetingJoined");
  7. //DO SOMETHING
  8. }
  9. // 会议正常结束回调
  10. - (void) onMeetingFinish:(AMUISDKMeetingFinishCode) code reason:(NSString*) reason{
  11. NSLog(@"onMeetingFinish");
  12. //DO SOMETHING
  13. }
  14. // 入会异常回调
  15. - (void) onError:(AMUISDKMeetingErrorCode) code reason:(NSString*) reason{
  16. NSLog(@"onError");
  17. //DO SOMETHING
  18. }
  19. // (可选)邀请成员回调
  20. - (void) onInviteClicked:(NSString*) reason{
  21. NSLog(@"onInviteClicked");
  22. //DO SOMETHING
  23. }
  24. // (可选)成员加入/离开消息回调
  25. - (void) onMeetingUserStatusChange:(AMSDKMeetingUser *)meetingUser event:(AMSDKUserStatusEvent)event{
  26. NSLog(@"onMeetingUserStatusChange");
  27. //DO SOMETHING
  28. }

2. 本地日志回调

  1. @interface demoLogger : NSObject <AMSDKLoggerProtocol>
  2. @end
  3. @implementation demoLogger
  4. + (void)action:(nonnull NSString *)module point:(nonnull NSString *)monitorPoint params:(NSDictionary * _Nullable)params {
  5. }
  6. + (void)debug:(nonnull NSString *)tag msg:(nonnull NSString *)msg {
  7. NSLog(@"%@ : %@", tag, msg);
  8. }
  9. + (void)error:(nonnull NSString *)tag msg:(nonnull NSString *)msg {
  10. NSLog(@"%@ : %@", tag, msg);
  11. }
  12. + (void)error:(nonnull NSString *)module point:(nonnull NSString *)monitorPoint params:(NSDictionary * _Nullable)params {
  13. }
  14. + (void)event:(nonnull NSString *)module point:(nonnull NSString *)monitorPoint params:(NSDictionary * _Nullable)params {
  15. }
  16. + (void)info:(nonnull NSString *)tag msg:(nonnull NSString *)msg {
  17. NSLog(@"%@ : %@", tag, msg);
  18. }
  19. + (void)warn:(nonnull NSString *)tag msg:(nonnull NSString *)msg {
  20. NSLog(@"%@ : %@", tag, msg);
  21. }
  22. @end

3.3.3 新建窗体,入会

  1. //新建主窗体,传入各项参数和回调
  2. _win = [[AMUISDKMeetingMainWindow alloc] initWithUIConfig:uiConfig meetingConfig:meetingConfig delegate:self];
  3. //设置日志回调
  4. [AMSDKLogger setLoggerPrinter:[demoLogger class]];
  5. //加入会议
  6. [_win joinMeeting];

3.4 编译、运行

运行

3.5 枚举回调定义

3.5.1 会议配置枚举

  1. //! 会议初始化配置项类型
  2. typedef NSString *AMUISDKMeetingConfigKey;
  3. //! 【Required】产品ID,类型NSString
  4. extern AMUISDKMeetingConfigKey const AMUISDKMeetingConfigClientAppId;
  5. //! 【Required】SLS信息,类型NSString
  6. extern AMUISDKMeetingConfigKey const AMUISDKMeetingConfigSlsInfo;
  7. //! 【Required】设置会议UUID,类型NSString
  8. extern AMUISDKMeetingConfigKey const AMUISDKMeetingConfigMeetingUUID;
  9. //! 【Required】设置会议 Publisher UUID,类型NSString
  10. extern AMUISDKMeetingConfigKey const AMUISDKMeetingConfigMemberUUID;
  11. //! 【Required】设置会议Token,类型NSString
  12. extern AMUISDKMeetingConfigKey const AMUISDKMeetingConfigMeetingToken;
  13. //! 【Required】设置会议域名,类型NSString
  14. extern AMUISDKMeetingConfigKey const AMUISDKMeetingConfigMeetingDomain;
  15. //! 【Required】设置人员UserId,类型NSString
  16. extern AMUISDKMeetingConfigKey const AMUISDKMeetingConfigUserId;
  17. //! 【Optional】入会时是否静音,类型BOOL,默认NO
  18. extern AMUISDKMeetingConfigKey const AMUISDKMeetingConfigMuteAudio;
  19. //! 【Optional】入会时是否开启扬声器,类型BOOL,默认YES
  20. extern AMUISDKMeetingConfigKey const AMUISDKMeetingConfigSpeakerEnabled;
  21. //! 【Optional】入会时是否默认关闭本地摄像头,类型BOOL,默认NO
  22. extern AMUISDKMeetingConfigKey const AMUISDKMeetingConfigMuteVideo;
  23. //! 【Optional】入会是不开视频,只需要音频,不需要视频
  24. AMUISDKMeetingConfigKey const AMUISDKMeetingConfigAudioOnly = @"audioOnly";
  25. //! 【Optional】入会时没有检测到麦克风是否允许入会,类型BOOL,默认 YES
  26. AMUISDKMeetingConfigKey const AMUISDKMeetingConfigAllowNoMic = @"allowNoMic";

3.5.2 UI配置枚举

  1. //! UI初始化配置项类型
  2. typedef NSString *AMUISDKGuiConfigKey;
  3. //! 【Optional】会议产品Logo文件地址,类型NSString
  4. extern AMUISDKGuiConfigKey const AMUISDKGuiConfigAppLogo;
  5. //! 【Optional】企业Logo文件地址,类型NSString
  6. extern AMUISDKGuiConfigKey const AMUISDKGuiConfigLogoBanner;
  7. //! 【Optional】本场会议名称,类型NSString
  8. extern AMUISDKGuiConfigKey const AMUISDKGuiConfigMeetingTopic;
  9. //! 【Optional】本场会议时间区间,类型NSString
  10. extern AMUISDKGuiConfigKey const AMUISDKGuiConfigMeetingTime;
  11. //! 【Optional】本场会议口令信息,类型NSString
  12. extern AMUISDKGuiConfigKey const AMUISDKGuiConfigMeetingCode;
  13. //! 【Optional】本场会议分享URL,类型NSString
  14. extern AMUISDKGuiConfigKey const AMUISDKGuiConfigMeetingUrl;
  15. //! 【Optional】 会议结束后的评价页开放URL,需要传入一个评价页的h5
  16. extern AMUISDKGuiConfigKey const AMUISDKGuiConfigMeetingRateUrl;
  17. //! 【Optional】入会时是否开启会议成员邀请回调,类型BOOL,默认NO
  18. extern AMUISDKGuiConfigKey const AMUISDKGuiConfigInviteMember;

3.5.3 回调状态码枚举

  1. typedef NS_ENUM(NSInteger, AMUISDKMeetingErrorCode)
  2. {
  3. //! 非法参数,接口调用参数不正确
  4. AMUISDKMeetingErrorCodeIllegalParameters = 0,
  5. //! 会议初始化失败,如无法获取会议信息,拉去配置
  6. AMUISDKMeetingErrorCodeInitializedFailed = 1,
  7. //! 设备无权限
  8. AMUISDKMeetingErrorCodeDevicePermissionNotGranted = 2,
  9. //! 无麦克风设备
  10. AMUISDKMeetingErrorCodeNoDevice = 3,
  11. //! 无法连接媒体服务
  12. AMUISDKMeetingErrorCodeMediaServerConnectFailed = 4,
  13. //! 会议并发满了
  14. AMUISDKMeetingErrorCodeRoomFull = 5,
  15. //! 入会超时
  16. AMUISDKMeetingErrorCodeJoinMeetingTimeout = 6,
  17. //!网络不可用
  18. AMUISDKMeetingErrorCodeNetworkUnAvailable = 7,
  19. //!媒体协商失败
  20. AMUISDKMeetingErrorCodeMediaNegotiationFailed = 8
  21. };
  22. typedef NS_ENUM(NSInteger, AMUISDKMeetingFinishCode)
  23. {
  24. //!主动退出会议
  25. AMUISDKMeetingFinishCodeLeaveBySelf = 0,
  26. //!被动退出会议
  27. AMUISDKMeetingFinishCodeLeaveByKick = 1,
  28. //!挂断所有人
  29. AMUISDKMeetingFinishCodeLeaveByHangupAll = 2,
  30. //!同一个UserID的用户进入了会议
  31. AMUISDKMeetingFinishCodeOtherClientJoined = 3,
  32. //!会议评价完成
  33. AMUISDKMeetingFinishCodeMeetingRateComplete = 4,
  34. //!系统挂起
  35. AMUISDKMeetingFinishCodeSystemWillSleep = 5
  36. };
  37. typedef NS_ENUM(NSInteger, AMSDKUserStatusEvent) {
  38. //! 成员上线
  39. AMSDKUserStatusEventOnline = 0,
  40. //! 成员离线
  41. AMSDKUserStatusEventOffline = 1,
  42. //!静音
  43. AMSDKUserStatusEventAudioMute = 2,
  44. //!取消静音
  45. AMSDKUserStatusEventAudioUnMute = 3,
  46. //!禁视频
  47. AMSDKUserStatusEventVideoMute = 4,
  48. //!打开视频
  49. AMSDKUserStatusEventVideoUnMute = 5,
  50. //!说话中
  51. AMSDKUserStatusEventStartTalking = 6,
  52. //!结束说话
  53. AMSDKUserStatusEventStopTalking = 7,
  54. //!主讲人切换
  55. AMSDKUserStatusEventMainSpeaker = 8,
  56. };

SDK ReleaseNote

1.0.0.1(2020-01-17)

sdk 初始化版本

1.0.0.2(2020-03-17)

增加成员加入、离开消息回调

增加可配置邀请成员回调

增加无麦克风可入会

关闭摄像头时关摄像头灯

1.0.0.3(2020-04-27)

修复了会议token无效的问题