Enable Group Live Streaming (iOS)

Last updated: 2021-08-18 10:15:29

    TUIKit 5.0.10 and later versions support group livestreaming and interconnection between the iOS and Android platforms. To implement group livestreaming, you need to integrate the TUIKitLive component as well.

    If the Tencent Real-Time Communication (TRTC) service is not activated, enable group livestreaming as follows:

    Step 1: Activate the TRTC Service

    1. Log in to the IM console and click the target app card to go to the basic configuration page of the app.
    2. Click Activate under Activate Tencent Real-Time Communication (TRTC).
    3. Click Confirm in the pop-up dialog box.
      Note:

      A TRTC app with the same SDKAppID as the IM app will be created in the TRTC console. You can use the same account and authentication information for IM and TRTC.

    Step 2: Integrate TUIKitLive

    1. Add the following content to the podfile file.

      pod 'TXIMSDK_TUIKit_live_iOS'                // By default, the audio and video library of the TXLiteAVSDK_TRTC version is integrated.
      // pod 'TXIMSDK_TUIKit_live_iOS_Professional' // By default, the audio and video library of the TXLiteAVSDK_Professional version is integrated.
      

      Do not integrate different Tencent Cloud audio and video libraries at the same time to avoid symbol conflicts. If you use a library not of the TRTC version, we recommend that you remove it and integrate the TXIMSDK_TUIKit_iOS_Professional version. The audio and video library of the LiteAV_Professional version contains all basic audio and video capabilities.

    2. Run the following command to download the third-party library to the current project:

      pod install
      

      If you cannot install the latest TUIKit version, run the following command to update the local CocoaPods repository list:

      pod repo update
      

    Step 3: Initialize TUIKit

    To initialize TUIKit, import the SDKAppID generated in Step 1. (If your project is integrated with TUIKit, skip this step.)

    [[TUIKit sharedInstance] setupWithAppId:SDKAppID];
    

    Step 4: Log In to TUIKit

    Call the login API provided by TUIKit to log in to IM. For more information on how to generate UserSig, see UserSig. (If your project is integrated with TUIKit, skip this step.)

    [[TUIKit sharedInstance] login:@"userID" userSig:@"userSig" succ:^{
       NSLog(@"-----> login succeeds");
    } fail:^(int code, NSString *msg) {
       NSLog(@"-----> login fails");
    }];
    

    Step 5: Enable/Disable Group Livestreaming

    In TUIKitLive, group livestreaming is enabled by default. If you do not need group livestreaming, use the enableGroupLiveEntry attribute in TUIKitLive.h to disable it. The code is as follows:

    // Values of `enableGroupLiveEntry`: YES (enable); NO (disable). Default value: YES
    [TUIKitLive shareInstance].enableGroupLiveEntry = YES;