主頁 > 服務(wù)與支持 > 開發(fā)平臺 > 客戶端SDK參考 > iOS UI SDK > 業(yè)務(wù)開發(fā) 會議中屏幕共享
更新時間:2019-11-20
iOS端屏幕共享需要進行iOS Extension的開發(fā)進行實現(xiàn),以下步驟用于說明如何集成SDK進行屏幕共享Extension的開發(fā),另外由于相關(guān)特性對系統(tǒng)能力的依賴,因此需要iOS12及以上版本才能支持屏幕共享功能。
ReplayKit.framework:系統(tǒng)庫
CloudLinkMeetingScreenShare.framework:SDK提供的庫
#import "SampleHandler.h" #import <CLoudLinkMeetingScreenShare/ScreenShareManager.h> @interface SampleHandler()<ScreenShareManagerDelegate> @property (strong, nonatomic) ScreenShareManager *screenShareManager; @end @implementation SampleHandler - (instancetype)init { if (self = [super init]) { self.screenShareManager = [[ScreenShareManager alloc] initWithAppGroupIdentifier:自己申請的appGroupIdentifier]; self.screenShareManager.delegate = self; } return self; } - (void)broadcastStartedWithSetupInfo:(NSDictionary<NSString *,NSObject *> *)setupInfo { // User has requested to start the broadcast. Setup info from the UI extension can be supplied but optional. [self.screenShareManager broadcastStartedWithSetupInfo:setupInfo]; } - (void)dealloc { self.screenShareManager = nil; } - (void)broadcastPaused { // User has requested to pause the broadcast. Samples will stop being delivered. [self.screenShareManager broadcastPaused]; } - (void)broadcastResumed { // User has requested to resume the broadcast. Samples delivery will resume. [self.screenShareManager broadcastResumed]; } - (void)broadcastFinished { // User has requested to finish the broadcast. [self.screenShareManager broadcastFinished]; } - (void)processSampleBuffer:(CMSampleBufferRef)sampleBuffer withType:(RPSampleBufferType)sampleBufferType { switch (sampleBufferType) { case RPSampleBufferTypeVideo: // Handle video sample buffer [self.screenShareManager processSampleBuffer:sampleBuffer withType:RPSampleBufferTypeVideo]; break; case RPSampleBufferTypeAudioApp: // Handle audio sample buffer for app audio break; case RPSampleBufferTypeAudioMic: // Handle audio sample buffer for mic audio break; default: break; } } - (void)screenShareManagerFinishBroadcastWithError:(NSError *)error { [self finishBroadcastWithError: error]; } @end
CloudLinkMeeting *clm = [CloudLinkMeeting sharedInstance]; clm.screenShareGroupId = 跟extension中相同的groupId; //開始ClooudLinkMeeting的其他接口調(diào)用