tencent cloud

Feedback

Mobile Screen Sharing

Last updated: 2024-12-12 11:36:17

    iOS Side

    3. For newly created Target,Rely TCICSDK_ReplayKit,as follows,after re pod install can.
    target 'new target name' do
    # Comment the next line if you don't want to use dynamic frameworks
    # use_frameworks!
    pod 'TCICSDK_ReplayKit'
    end
    4. Add the following code and copy it to SampleHandler.m, and change APPGROUP to the App Group created in step 1.
    #import "SampleHandler.h"
    #import <TXLiteAVSDK_ReplayKitExt/TXLiteAVSDK_ReplayKitExt.h>
    #import <TCICScreenKit/TCICScreenKit.h>
    // Note: APPGROUP here needs to be changed to the App Group Identifier created above.
    #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 {
        // User has requested to pause the broadcast. Samples will stop being delivered.
        [[TCICScreenKit sharedScreenKit] onScreenKitPaused];
    }
    - (void)broadcastResumed {
        // User has requested to resume the broadcast. Samples delivery will resume.
        [[TCICScreenKit sharedScreenKit] onScreenKitResumed];
    }
    - (void)broadcastFinished {
        [[TXReplayKitExt sharedInstance] finishBroadcast];
        // 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 = @"app disconnected";
                break;
            case TXReplayKitExtReasonVersionMismatch:
                tip = @"Integration error (SDK version numbers do not match)";
                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. Docking with the receiving logic of the main app: Currently, the main app uses TCICSDK, which already supports system screen sharing related logic. It only needs the business side to configure the App Group: before entering the classroom, set the AppGroup.
    
    TCICClassConfig *roomConfig = [[TCICClassConfig alloc] init];
    roomConfig.userId = "test";
    roomConfig.token = "test_token";
    roomConfig.classId = 123454;
    roomConfig.schoolId = xxxxx;
    
    // Setting AppGroup by KVC
    [roomConfig setValue:@"group.com.xx.xxxx" forKey:@"appGroup"];

    Precautions

    1. TCICSDK already supports the trigger button for screen sharing, for details, seeTRTC Official Documentation > Step 4: Adding a trigger button for screen sharing(optional),But this feature has limitations:
    1.1 The trigger button for screen sharing only supports iOS12 and above. At the same time, the project that needs to be created does not depend on the Scene life cycle. If the Scenedelegate is already supported in the code, please refer to Xcode 11 Delete Scenedelegate to remove it. Take Demo as an example, the pop-up effect is as follows, just click to start the live broadcast.
    1.2 For iOS11 models, the business side needs to guide the user to long-press the screen recording in the remote control to trigger, and select the Broadcast Upload Extension created by the business to trigger. The following figure uses the Tencent meeting as an example: 
    2. The Deployment target of the created Upload Extension is configured on iOS 11.0 (Replay Kit only starts to support iOS11), and the real device should be after iOS11 when debugging.
    3. If the main app supports system-level screen sharing, Background Modes need to be added.
    
    
    

    Android Side

    Note:
    Android screen sharing version requirements: Android 5.0 +
    Except for version requirements, there are no other configuration and special requirements.
    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