|
| 1 | +/* |
| 2 | + * Module: TXReplayKitExt @ TXLiteAVSDK |
| 3 | + * |
| 4 | + * Function: The main interface class of Tencent Cloud ReplayKit screen recording function in Extension |
| 5 | + * |
| 6 | + * Version: <:Version:> |
| 7 | + */ |
| 8 | + |
| 9 | +// Author: * |
| 10 | + |
| 11 | +/// @defgroup TXReplayKitExt_ios TXReplayKitExt |
| 12 | +/// The main interface class of Tencent Cloud ReplayKit screen recording function in Extension |
| 13 | +/// @{ |
| 14 | + |
| 15 | +#import <CoreMedia/CoreMedia.h> |
| 16 | +#import <Foundation/Foundation.h> |
| 17 | +#import <ReplayKit/ReplayKit.h> |
| 18 | + |
| 19 | +NS_ASSUME_NONNULL_BEGIN |
| 20 | + |
| 21 | +typedef NS_ENUM(NSUInteger, TXReplayKitExtReason) { |
| 22 | + /// Main process request ends |
| 23 | + TXReplayKitExtReasonRequestedByMain, |
| 24 | + /// The link is broken and the main process exits |
| 25 | + TXReplayKitExtReasonDisconnected, |
| 26 | + /// The version does not match the main process SDK |
| 27 | + TXReplayKitExtReasonVersionMismatch |
| 28 | +}; |
| 29 | + |
| 30 | +@protocol TXReplayKitExtDelegate; |
| 31 | + |
| 32 | +/// Screen sharing main entrance class |
| 33 | +API_AVAILABLE(ios(11.0)) |
| 34 | +__attribute__((visibility("default"))) @interface TXReplayKitExt : NSObject |
| 35 | + |
| 36 | +/// Get singleton |
| 37 | ++ (instancetype)sharedInstance; |
| 38 | + |
| 39 | +/// Initialization method |
| 40 | +/// |
| 41 | +/// Needs to be called in the broadcastStartedWithSetupInfo method in the implementation class of RPBroadcastSampleHandler |
| 42 | +/// @param appGroup App group ID |
| 43 | +/// @param delegate Callback object |
| 44 | +- (void)setupWithAppGroup:(NSString *)appGroup delegate:(id<TXReplayKitExtDelegate>)delegate; |
| 45 | + |
| 46 | +/// Method of screen recording paused |
| 47 | +/// |
| 48 | +/// When stopping screen recording through the system control center, RPBroadcastSampleHandler.broadcastPaused |
| 49 | +/// will be called back, which is called in the broadcastPaused method. |
| 50 | +- (void)broadcastPaused; |
| 51 | + |
| 52 | +/// Method of screen recording resumed |
| 53 | +/// |
| 54 | +/// When stopping screen recording through the system control center, RPBroadcastSampleHandler.broadcastPaused |
| 55 | +/// will be called back, which is called in the broadcastPaused method. |
| 56 | +- (void)broadcastResumed; |
| 57 | + |
| 58 | +/// Method of screen recording finished |
| 59 | +/// |
| 60 | +/// When stopping screen recording through the system control center, RPBroadcastSampleHandler.broadcastPaused |
| 61 | +/// will be called back, which is called in the broadcastPaused method. |
| 62 | +- (void)broadcastFinished; |
| 63 | + |
| 64 | +/// Media data (audio and video) sending method |
| 65 | +/// |
| 66 | +/// Need to be called in the processSampleBuffer: method in the implementation class of RPBroadcastSampleHandler |
| 67 | +/// |
| 68 | +/// @param sampleBuffer Video or audio frame for system callback |
| 69 | +/// @param sampleBufferType media input type |
| 70 | +/// @note |
| 71 | +/// - sampleBufferType currently supports data frame processing of RPSampleBufferTypeVideo and RPSampleBufferTypeAudioApp types. |
| 72 | +/// - RPSampleBufferTypeAudioMic is not supported. Please process the microphone collection data in the main app. |
| 73 | +- (void)sendSampleBuffer:(CMSampleBufferRef)sampleBuffer |
| 74 | + withType:(RPSampleBufferType)sampleBufferType; |
| 75 | + |
| 76 | +/// Video sending method |
| 77 | +/// Deprecated, please use - (void)sendSampleBuffer:(CMSampleBufferRef)sampleBuffer |
| 78 | +/// withType:(RPSampleBufferType)sampleBufferType; instead,Need to be called in the |
| 79 | +/// processSampleBuffer: method in the implementation class of RPBroadcastSampleHandler. |
| 80 | +/// |
| 81 | +/// @param sampleBuffer System callback video frame |
| 82 | +- (void)sendVideoSampleBuffer:(CMSampleBufferRef)sampleBuffer |
| 83 | + __attribute__((deprecated("use sendSampleBuffer:withType instead"))); |
| 84 | + |
| 85 | +@end |
| 86 | + |
| 87 | +API_AVAILABLE(ios(11.0)) |
| 88 | +@protocol TXReplayKitExtDelegate <NSObject> |
| 89 | + |
| 90 | +/// Screen recording completion callback |
| 91 | +/// |
| 92 | +/// @param broadcast The instance that issues the callback |
| 93 | +/// @param reason End reason code, see TXReplayKitExtReason |
| 94 | +- (void)broadcastFinished:(TXReplayKitExt *)broadcast reason:(TXReplayKitExtReason)reason; |
| 95 | + |
| 96 | +@end |
| 97 | + |
| 98 | +NS_ASSUME_NONNULL_END |
| 99 | +/// @} |
0 commit comments