Hello @chunsiong.tan
I did the next steps to create the renderer-object (ZoomSDKRenderer) and to subscribe it to the video stream of one user.
I donwnloaded the ZoomSDKSample project from here: Download | Meeting SDK | macOS
Then I modified the file ZMSDKMeetingStatusMgr.m.
I used the callback called onLocalRecordingPrivilegeRequestStatus to trigger the raw-recording.
If the user that wants to record needs to ask for permission to the host, then to start the local-recording he will need to click 2 times the record button.
The first time to get the permission and the 2nd to start the local-recording.
However, I’m using the 1st click to trigger the raw-recording after he gets the privilege to record. See code below:
//Fired up when privileges are granted/denied to do local-recording or raw-recording
- (void) onLocalRecordingPrivilegeRequestStatus:(ZoomSDKRequestLocalRecordingStatus)status{
//If I am authorized to local recoding then I will trigger raw data recording
if(status == ZoomSDKRequestLocalRecordingStatus_Granted){
//1. Start recording with recordController
// Get ZoomSDKMeetingService object from the the ZoomSDK singleton object
ZoomSDKMeetingService *meetingService = [[ZoomSDK sharedSDK] getMeetingService];
// Get the ZoomSDKMeetingRecordController object from meetingService object
ZoomSDKMeetingRecordController *recordController = [meetingService getRecordController];
//Start raw recording
ZoomSDKError rawRecordingError = [recordController startRawRecording];
After the raw-recording has started I’m creating the renderer-object, then getting the userID from any user, and subscribing the renderer to the video stream of that user. See code below:
if(rawRecordingError == ZoomSDKError_Success){
//2. Subscribe to user stream with renderer
//Creating the renderer getting a raw-controller from the sharedSDK singleton
//and calling creatRender and passing pointer to renderer
ZoomSDKRenderer *renderer = nil;
ZoomSDKError rendererError = [[[ZoomSDK sharedSDK] getRawDataController] creatRender:&renderer];
//Assigning the property delegate to be the same object so we can have the ZoomSDKRendererDelegate
//callbacks in the same class
renderer.delegate = self;
//Remove duplictaes from UserIds
userIdsNoDuplicates = [userIds valueForKeyPath:@"@distinctUnionOfObjects.self"];
//Subscribing renderer to the active user
int userID = [[userIdsNoDuplicates objectAtIndex:1] integerValue];
ZoomSDKError subscribeError = [renderer subscribe:userID rawDataType:ZoomSDKRawDataType_Video];
if(subscribeError == ZoomSDKError_Success){
NSLog(@">>renderer subscribed!!");
//We will trigger onRawDataReceived
}
}
}
}
To implement the callbacks used during the raw-recording I added the protocol ZoomSDKRendererDelegate to the header file ZMSDKMeetingStatusMgr.h. See code below:
@interface ZMSDKMeetingStatusMgr : NSObject <ZoomSDKMeetingServiceDelegate,ZoomSDKMeetingActionControllerDelegate,ZoomSDKWebinarControllerDelegate,ZoomSDKMeetingRecordDelegate,ZoomSDKRendererDelegate>
{
ZMSDKMainWindowController* _mainWindowController;
ZoomSDKMeetingService* _meetingService;
//To store user ids for raw-recording
NSMutableArray *userIds;
NSMutableArray *userIdsNoDuplicates;
}
- (id)initWithWindowController:(ZMSDKMainWindowController*)mainWindowController;
@end
Finally, I implemented a callback (onRawDataReceived) that is called after the raw-recording hast started in the file: ZMSDKMeetingStatusMgr.m
#pragma mark -- ZoomSDKRendererDelegate
//3. Create ZoomSDKRendererDelegate to manage raw recording events
// Fired after the renderer is subscribed to the stream of an user
- (void)onRawDataReceived:(ZoomSDKYUVRawDataI420*)data {
NSLog(@">>Hola from ZMSDKMeetingStatusMgr.m - onRawDataReceived!!");
}
To get the user-ids I’m using the callback onVideoStatusChange from ZoomSDKMeetingActionControllerDelegate. See code below:
- (void)onVideoStatusChange:(ZoomSDKVideoStatus)videoStatus UserID:(unsigned int)userID {
if([ZMSDKCommonHelper sharedInstance].isUseCutomizeUI)
[[ZMSDKConfUIMgr sharedConfUIMgr].userHelper onVideoStatusChange:videoStatus UserID:userID];
//Fired when any user hide/show video
NSLog(@">>Hola from ZMSDKMeetingStatusMgr.m - onVideoStatusChange!!");
NSLog(@"userID: %d\n", userID );
//Save userID
[userIds addObject: [NSNumber numberWithUnsignedInteger: userID]];
}
Thanks for your help!
