App Group
, SeeTRTC Official Website Documentation > Step 1: Create an App Group。Broadcast Upload Extension
,SeeTRTC Official Website Documentation > Step 2: Create a Broadcast Upload Extension。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
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 audiobreak;case RPSampleBufferTypeAudioMic:// Handle audio sample buffer for mic audiobreak;default:break;}}@end
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"];
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.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: 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.Background Modes
need to be added.
Was this page helpful?