Share directly to a Zoom Room
The code on this page only works with the custom UI.
The SDK lets you share directly to a Zoom Room device through a few method calls.
if let directShareHelper = ZoomSDK.shared().getPremeetingService()?.getDirectShareHelper() {
if directShareHelper.canDirectShare() == ZoomSDKError_Success {
directShareHelper.startDirectShare()
}
}
ZoomSDKDirectShareHelper *directShareHelper = [[[ZoomSDK sharedSDK] getPremeetingService] getDirectShareHelper];
if (directShareHelper && [directShareHelper canDirectShare] == ZoomSDKError_Success) {
[directShareHelper startDirectShare];
}
Set the ZoomSDKDirectShareHelperDelegate to receive the direct share status updates.
directShareHelper.delegate = self
extension ViewController: ZoomSDKDirectShareHelperDelegate {
func onDirectShareStatusReceived(_ status: DirectShareStatus, directShareReceived handler: ZoomSDKDirectShareHandler?) {
if (status == DirectShareStatus_NeedMeetingIDOrSharingKey) {
handler?.inputMeetingNumber("Meeting_Number") // Join using meeting_number, or
handler?.inputSharingKey("Sharing_Key") // Join using sharing_key
}
}
func onDirectShareSpecifyContent(_ handler: ZoomSDKDirectShareSpecifyContentHandler) {
}
}
// In your .h file, conform to the ZoomSDKDirectShareHelperDelegate
@interface ZMSDKWindow : NSWindowController <ZoomSDKDirectShareHelperDelegate> {
}
// In your .m file, add the required delegate and the 2 callbacks available
directShareHelper.delegate = self;
- (void)onDirectShareStatusReceived:(DirectShareStatus)status DirectShareReceived:(ZoomSDKDirectShareHandler *)handler {
if (status == DirectShareStatus_NeedMeetingIDOrSharingKey) {
[handler inputMeetingNumber:@"Meeting_Number"]; // Join using meeting_number, or
[handler inputSharingKey:@"Sharing_Key"]; // Join using sharing_key
}
}
// The onDirectShareSpecifyContent callback is only for custom UI
- (void)onDirectShareSpecifyContent:(ZoomSDKDirectShareSpecifyContentHandler *)handler {
}
Before stopping a direct share session, confirm that a share is already in progress.
if status == DirectShareStatus_InProgress {
directShareHelper.stopDirectShare()
}
if (status == DirectShareStatus_InProgress) {
[directShareHelper stopDirectShare];
}