SDK integration

更新时间:
复制 MD 格式

The Cloud Conferencing software development kit (SDK) provides a set of interfaces for joining video conferences. You can call these interfaces to quickly integrate Cloud Conferencing features into your application. This topic describes how to integrate the Cloud Conferencing SDK.

Environment requirements

Category Description
System version iOS 9.0 or later.
CPU architecture Supported ARM architectures: armv7 and arm64.
Note armv7 and devices older than the iPhone 6 support only audio conferences, not video conferences.
Language Support for Objective-C and Swift.
Xcode version Xcode 10.0 or later.

Procedure

  1. Download and decompress the UI SDK. For the download link, see SDK download.
  2. Add the UI SDK.
    1. Copy the decompressed AliMeetingUISDK.framework folder to your project directory.
    2. Click the General tab. In the Frameworks, Libraries, and Embedded Content section, click + to add AliMeetingUISDK.framework.
    3. Click the Build Phases tab. In the Copy Files section, set Destination to Frameworks.
  3. Add the Meeting SDK, which is AliMeetingSDK.framework. For details, see Step 2.
  4. Enable VoIP mode.

    Click the Signing & Capabilities tab. In the Background Modes section, select Voice over IP.

  5. In info.plist, add permissions for the camera, microphone, and network access.
  6. Click the Build Settings tab. In the Build Options section, set Enable Bitcode to No.
  7. Integrate the business logic code.
    1. Build the meeting details and add the required parameters.
      AliMeetingDetail *detail = AliMeetingDetail.new;
      detail.subject = @"Test"; // Meeting subject
      detail.shareLink = @""; // Share link
      detail.shareMessage = @""; // Share message
      detail.beginDate = NSDate.date.timeIntervalSince1970 * 1000; // Start time
      detail.endDate = NSDate.date.timeIntervalSince1970 * 1000; // End time
      
      NSDictionary *meetingConfig = @{
              AliMeetingConfigKey.meetingCode: meetingCode, // Meeting code. Required. Obtain from the ISV server-side.
              AliMeetingConfigKey.meetingToken: meetingToken, // Meeting token. Required. Obtain from the ISV server-side.
              AliMeetingConfigKey.meetingUUID: meetingUUID, // Unique meeting ID. Required. Obtain from the ISV server-side.
              AliMeetingConfigKey.memberUUID: memberUUID, // Member ID for the enterprise. This ID must be unique within the enterprise. Required. Obtain from the ISV server-side.
              AliMeetingConfigKey.meetingDomain:meetingDomain, // Domain for the meeting link. Required. Obtain from the ISV server-side.
              AliMeetingConfigKey.clientAppID: clientAppID, // Client ID for joining the meeting. Required. Obtain from the ISV server-side.
              AliMeetingConfigKey.userID: userID, // User ID for joining the meeting. This ID must be unique. Required. Obtain from the ISV server-side.
              AliMeetingConfigKey.meetingPassword:password, // Meeting password
              AliMeetingConfigKey.openBeautifier:@(openBeautifer), // Retouching
              AliMeetingConfigKey.meetingDetail: detail // Meeting details
              };
    2. Customize invitation operations (implement as needed).
      /// Click the meeting title during a meeting to display meeting information. Returning YES redirects to your application's page.
      - (BOOL)showMeetingDetail:(UIViewController *)sourceVC {
          return NO;
      }
      
      /// Chat page callback. The 'chatPermissionGranted' parameter indicates whether chat permission is available for the current meeting. Returning YES redirects to your application's page.
      - (BOOL)showMeetingChat:(UIViewController *)sourceVC granted:(BOOL)chatPermissionGranted {
          return NO;
      }
      
      /// Invite operation during a meeting. Your application handles the invitation logic externally. Returning YES redirects to your application's page.
      - (BOOL)onInviteAction:(UIViewController *)sourceVC {
          return NO;
      }
      
      /// Load a member's profile picture. Returning YES indicates that your application handles the image loading logic.
      - (BOOL)loadAvatar:(AMSDKMeetingClient *)client imageView:(UIImageView *)imageView {
          [imageView sd_setImageWithURL:[NSURL URLWithString:@"https://gss0.baidu.com/7Po3dSag_xI4khGko9WTAnF6hhy/zhidao/pic/item/267f9e2f07082838685c484ab999a9014c08f11f.jpg"] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
              
          }];
          return YES;
      }
    3. Implement meeting callbacks (implement as needed).
      #pragma mark - AliMeetingCallback
      
      /// Called when the user successfully joins the meeting.
      - (void)onMeetingJoined {
      }
      
      /// Called when a user's status changes after successfully joining the meeting.
      - (void)onClientStatusChanged:(AMSDKMeetingClient *)client event:(AliMeetingClientStatusEvent)event {
      }
      
      /// Called when the meeting is interrupted after it has started.
      - (void)onMeetingFinished:(AMSDKFinishCode)code msg:(NSString *)msg {
      }
      
      /// Called when an error occurs while joining the meeting.
      - (void)onMeetingError:(AMSDKErrorCode)code msg:(NSString *)msg {
      }
      
      /// Called when the user leaves the meeting.
      - (void)onUserLeaveMeeting {
      }
      
      /// Called when the user ends the meeting.
      - (void)onUserFinishMeeting {
      }
    4. Minimize to a floating window (implement as needed).

      The UI SDK supports a minimized floating window. You can implement callbacks to change the window's size and position.

      /// Returns the parent view for the floating window. If nil is returned, the UI SDK adds the floatingView to the current window.
      - (UIView *)parentViewOfFloatingView;
      
      /// The margins of the floating window within its parent view.
      - (UIEdgeInsets)edgeInsetsOfFloatingView;
      
      /// The initial frame of the floating window. The default is [(screenWidth - 90, screenHeight - 160), (90,160)].
      - (CGRect)frameOfFloatingView;
      
      /// The ViewController object used to modally present MeetingVC when the floating window is enabled. If nil is returned, the UI SDK uses rootViewController to modally present MeetingVC.
      - (UIViewController *)viewControllerToPresentMeetingVC;
    5. Set the log level.
       /// Set the log level.
       AliMeetingUISDKManager.shared.logLevel = AMSDKLoggingLevelError;

      The following log levels are available:

      typedef NS_ENUM(NSUInteger, AMSDKLoggingLevel){
          //! Off
          AMSDKLoggingLevelOff       = 0,
          
          //! Outputs Error logs.
          AMSDKLoggingLevelError     = (AMSDKLoggingFlagError),
          
          //! Outputs Error and Warning logs.
          AMSDKLoggingLevelWarning   = (AMSDKLoggingLevelError   | AMSDKLoggingFlagWarning),
          
          //! Outputs Error, Warning, and Info logs.
          AMSDKLoggingLevelInfo      = (AMSDKLoggingLevelWarning | AMSDKLoggingFlagInfo),
          
          //! Outputs Error, Warning, Info, and Debug logs.
          AMSDKLoggingLevelDebug     = (AMSDKLoggingLevelInfo    | AMSDKLoggingFlagDebug),
          
          //! Outputs Error, Warning, Info, Debug, and Verbose logs.
          AMSDKLoggingLevelVerbose   = (AMSDKLoggingLevelDebug   | AMSDKLoggingFlagVerbose),
          
          //! Outputs all logs.
          AMSDKLoggingLevelAll       = NSUIntegerMax
      };
    6. Enable screen rotation.
      1. In info.plist, select the supported orientations.
      2. In AppDelegate, implement the following callback.
        - (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
            if (AliMeetingUISDKManager.shared.isInMeeting &&
                !AliMeetingUISDKManager.shared.isInFloating) {
                return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscape);
            }
            
            return UIInterfaceOrientationMaskPortrait;
        }
    7. Join a meeting.
       AliMeetingUISDKManager.shared.callback = meetingCallback; // Receive meeting callbacks
       AliMeetingUISDKManager.shared.UIController = uiController; // Customize some UI events
       [AliMeetingSDKManager.shared joinMeetingWithConfig:meetingConfig sourceVC:sourceVC];
  8. Compile and run the application.