tencent cloud

Feedback

Last updated: 2024-07-26 17:35:51

    Environment Requirements

    Xcode 14

    Prerequisites

    You have completed the procedures for Sign up for a Tencent Cloud account and Identity Verification.

    Step 1: Create New Application

    1. Log in to the Low-code Interative Classroom, and select Quick Start from the left navigation bar.
    2. By default, you enter the "Create application" interface, where you can select "Create new application" for the application type. Enter the application name, such as TestLCIC.
    If you have already created an application, you can click "Select an existing application" for the application type.
    Note:
    To Integrate the Mobile client, you need to purchase the Premium or Enterprise edition. If you need to create a commercial version, you can choose and purchase the corresponding version based on your business needs on the Purchase Page according to business needs.
    3. Add or edit tags based on actual business needs, and then click Create.
    
    
    
    
    Note:
    Application names may only contain underscores, digits, or letters.
    Tags are used to identify and organize your resources in Tencent Cloud. For instance, a corporation with several business units, each of which has one or more LCIC applications, can use tags to label departmental information on LCIC applications. Tags are optional, and you can add or edit them based on your actual business needs.

    Step 2: Enter SDKAppId and Key (SecretKey)

    1. Choose Application Management > Settings to obtain the SDKAppId.
    2. Enter Cloud Access Management to obtain the key. If there is no key, you need to create a new one in API Key Management. For details, refer to Key Management.
    
    
    

    Step 3: Import the SDK

    Pod Integration SDK
    The LCIC SDK has been released to the Cocoapods library. You can download and install it by configuring the podfile.
    pod 'TCICSDK_Pro', '1.8.3.3'

    Step 4: Configure app Permissions

    Configure app permissions in the main app's info.plist. The LCIC SDK requires the following permissions:
    <key>NSCameraUsageDescription</key>
    <key>NSMicrophoneUsageDescription</key>
    <key>NSPhotoLibraryAddUsageDescription</key>
    <key>NSPhotoLibraryUsageDescription</key>

    Step 5: Obtain Parameters Required to Enter the Classroom

    1. Choose Application Management > Settings through the Console to retrieve the SDKAppId, which serves as the identifier for the school (schoolId).
    2. By utilizing the Cloud API endpoint CreateRoom, you can create a classroom and obtain the classroom number (classid).
    3. Registering a user through the Cloud API endpoint RegisterUser allows for the acquisition of the corresponding user ID (userid).
    4. Logging in via the Cloud API endpoint LoginUser grants access to the user authentication token.
    5. Parameters such as scene, lng, camera, mic, and speaker are optional. Default values are employed if these parameters are not specified.
    Field
    Type
    Meaning
    Remarks
    Mandatory
    schoolId
    Int
    School Number
    Choose Application Management > Application Configuration through the console to obtain the SDKAppId.
    Yes
    classId
    Long
    Classroom Number
    By creating through the CreateRoom interface, you can obtain the returned RoomId.
    Yes
    userId
    string
    User account
    It is obtained through the RegisterUser interface.
    Yes
    token
    String
    Backend authentication parameters
    It is obtained through the LoginUser interface.
    Yes
    scene
    String
    Scene name
    It is used to distinguish different custom layouts. It is configured through the SetAppCustomContent interface.
    [roomConfig setValue:@"scene_name" forKey:@"scene"];
    No
    lng
    String
    Language parameters
    You can enter zh-Hans or en. The default value is Chinese (zh-Hans). You can set this parameter on this interface.
    [roomConfig setValue:@"en" forKey:@"language"];
    No
    camera
    Int
    Initialize and turn on the camera.
    1 indicates to turn on the camera, and 0 indicates to turn it off. You can set this parameter through roomConfig.jsParams.
    No
    mic
    Int
    Initialize and turn on the microphone.
    1 indicates to turn on the microphone, and 0 indicates to turn it off. You can set this parameter through roomConfig.jsParams.
    No
    speaker
    Int
    Initialize and turn on the speaker.
    1 indicates to turn on the speaker, and 0 indicates to turn it off. You can set this parameter through roomConfig.jsParams.
    No

    Step 6: Launch the Main Page of the Component

    Only 4 parameters are needed to launch the main page of the LCIC component, namely, School Number, Classroom Number, User account, and token.
    TCICClassConfig *roomConfig = [[TCICClassConfig alloc] init];
    roomConfig.schoolId = 123456;
    roomConfig.userId = "test";
    roomConfig.token = "test_token";
    roomConfig.classId = 654321;
    [roomConfig setValue:@"en" forKey:@"language"]; //Language settings, optional
    [roomConfig setValue:@"scene_name" forKey:@"scene"]; //Customized according to different scenes, optional
    [roomConfig setValue:@(0) forKey:@"preferPortrait"]; //Default landscape, optional (0 indicates landscape and 1 indicates portrait)
    
    TCICClassController *vc = [TCICClassController classRoomWithConfig:roomConfig];
    if (vc) {
    [(UINavigationController *)self.window.rootViewController pushViewController:vc animated:YES];
    }else {
    NSLog(@"Incorrect parameter");
    }
    If you need to receive notifications of leaving the classroom, you can register a local broadcast for TCICExitClassRoomCompleteNotify. See the following code for reference:
    [[NSNotificationCenter defaultCenter] addObserver:self
    selector:@selector(yourselector)
    name:@"TCICExitClassRoomCompleteNotify" object:nil];

    Step 7: SDK Authorization Application

    You need to send an email to apply for SDK permissions. Follow the template below and send an email to mediaservices@tencent.com. We will complete the processing within 1 working day, provided the information is correct.
    Note:
    The package name is used for LEB player signature authorization. Provide the App Name, Package Name, and Bundle ID information for the official application that needs authorization, and send an email.
    
    Recipient: mediaservices@tencent.com
    Topic
    LCIC iOS SDK Authorization Application
    Content
    Company Name: xxx Limited Company
    Individual Name:
    Contact Information:
    App Name:
    Package Name (Android):
    Bundle ID (iOS):

    Advanced Feature: Mobile Screen Sharing

    1. Create an App Group. Refer to TRTC Documentation.
    2. Create a Broadcast Upload Extension. Refer to TRTC Documentation.
    3. For the newly created Target, depend on TCICSDK_ReplayKit as follows, and then simply re-run pod install.
    target 'New target name' do
    # Comment the next line if you do not need to use dynamic frameworks.
    # use_frameworks!
    pod 'TCICSDK_Pro_ReplayKit'
    end
    4. Add the following code to SampleHandler.m, and replace APPGROUP with the App Group created in Step 1.
    #import "SampleHandler.h"
    #import <TXLiteAVSDK_ReplayKitExt/TXLiteAVSDK_ReplayKitExt.h>
    #import <TCICScreenKit/TCICScreenKit.h>
    // Note: Replace `APPGROUP` with the ID of the App Group created earlier.
    #define APPGROUP ""
    
    @interface SampleHandler() <TXReplayKitExtDelegate>
    @end
    @implementation SampleHandler
    
    - (void)broadcastStartedWithSetupInfo:(NSDictionary<NSString *,NSObject *> *)setupInfo {
    [[TXReplayKitExt sharedInstance] setupWithAppGroup:APPGROUP delegate:self];
    
    [[TCICScreenKit sharedScreenKit] onScreenKitStarted];
    }
    - (void)broadcastPaused {
    // The user has requested to pause the broadcast. Samples will stop being delivered.
    [[TCICScreenKit sharedScreenKit] onScreenKitPaused];
    }
    - (void)broadcastResumed {
    // The user has requested to resume the broadcast. Samples delivery will resume.
    [[TCICScreenKit sharedScreenKit] onScreenKitResumed];
    }
    - (void)broadcastFinished {
    [[TXReplayKitExt sharedInstance] finishBroadcast];
    // The user has requested to finish the broadcast.
    [[TCICScreenKit sharedScreenKit] onScreenKitFinished];
    }
    #pragma mark - TXReplayKitExtDelegate
    - (void)broadcastFinished:(TXReplayKitExt *)broadcast reason:(TXReplayKitExtReason)reason
    {
    NSString *tip = @"";
    switch (reason) {
    case TXReplayKitExtReasonRequestedByMain:
    tip = @"Screen sharing ended";
    break;
    case TXReplayKitExtReasonDisconnected:
    tip = @"Application disconnected";
    break;
    case TXReplayKitExtReasonVersionMismatch:
    tip = @"Integration error (SDK version mismatch)";
    break;
    }
    NSError *error = [NSError errorWithDomain:NSStringFromClass(self.class) code:0 userInfo:@{
    NSLocalizedFailureReasonErrorKey:tip
    }];
    [self finishBroadcastWithError:error];
    }
    - (void)processSampleBuffer:(CMSampleBufferRef)sampleBuffer withType: (RPSampleBufferType)sampleBufferType {
    switch (sampleBufferType) {
    case RPSampleBufferTypeVideo:
    [[TXReplayKitExt sharedInstance] sendVideoSampleBuffer:sampleBuffer];
    break;
    case RPSampleBufferTypeAudioApp:
    // Handle audio sample buffer for app audio
    break;
    case RPSampleBufferTypeAudioMic:
    // Handle audio sample buffer for mic audio
    break;
    
    default:
    break;
    }
    }
    @end
    5. For integrating with the main app's receiving logic: Currently, the main app incorporates TCICSDK, which already supports system screen sharing logic. You only need to configure the App Group. In addition, set the App Group before entering the class.
    
    TCICClassConfig *roomConfig = [[TCICClassConfig alloc] init];
    roomConfig.userId = "test";
    roomConfig.token = "test_token";
    roomConfig.classId = 123454;
    roomConfig.schoolId = xxxxx;
    
    // Set AppGroup using the KVC method.
    [roomConfig setValue:@"group.com.xx.xxxx" forKey:@"appGroup"];

    Notes

    1. Currently, TCICSDK supports a trigger button for screen sharing. For details, refer to TRTC Documentation (optional). However, this feature has limitations.
    1.1 The trigger button for screen sharing is only supported on iOS12 and above. In addition, the project created must not depend on the Scene Lifecycle. If the code already supports Scenedelegate, refer to Xcode 11 Remove Scenedelegate to remove it. For example, in the Demo, the pop-up effect is as follows. Click Start live streaming to begin.
    1.2 For iOS11 devices, it is necessary to guide users to trigger from the remote control by pressing and holding screen recording and selecting the business's own Broadcast Upload Extension to trigger, as exemplified below with Tencent Meeting:
    2. The Upload Extension created should have its Deployment target set to iOS 11.0 (since Replay Kit is only supported from iOS11), and ensure that the physical device used for debugging is also on iOS11 or later.
    3. To support system-level screen sharing in the main app, Background Modes needs to be added.
    

    Other Issues

    We suggest integrating Tencent Bugly when using LCICSDK, which helps to rapidly identify and resolve anomalies, keep track of product operations dynamics, and promptly follow up on user feedback. Refer to the Tencent Bugly official website for the integration guide.
    Refer to Develop a demo.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support