Share directly to a Zoom Room
The code on this page works with either the default UI or the custom UI.
Share to a Zoom Room device
The SDK lets you share directly to a Zoom Room device through a few method calls.
val directShareService = ZoomSDK.getInstance().preMeetingService.directShareService
if (directShareService.canStartDirectShare()) {
directShareService.startDirectShare()
}
IDirectShareServiceHelper directShareService = ZoomSDK.getInstance().getPreMeetingService().getDirectShareService();
if (directShareService.canStartDirectShare()) {
directShareService.startDirectShare();
}
Receive direct share status updates
Set the IDirectShareServiceHelperEvent to receive the direct share status updates.
val directShareEvent =
IDirectShareServiceHelperEvent { directShareStatus, iDirectShareViaMeetingIDOrPairingCodeHandler ->
if (directShareStatus == DirectShareStatus.DirectShare_Need_MeetingID_Or_PairingCode) {
if (directShareWithMeetingId) {
iDirectShareViaMeetingIDOrPairingCodeHandler.tryWithMeetingNumber(123456789)
} else {
iDirectShareViaMeetingIDOrPairingCodeHandler.tryWithPairingCode("123456")
}
}
}
directShareService.setEvent(directShareEvent)
IDirectShareServiceHelperEvent directShareEvent = new IDirectShareServiceHelperEvent() {
@Override
public void onDirectShareStatusUpdate(DirectShareStatus directShareStatus, IDirectShareViaMeetingIDOrPairingCodeHandler iDirectShareViaMeetingIDOrPairingCodeHandler) {
if (directShareStatus == DirectShareStatus.DirectShare_Need_MeetingID_Or_PairingCode) {
if (directShareWithMeetingId) {
iDirectShareViaMeetingIDOrPairingCodeHandler.tryWithMeetingNumber(123456789);
} else {
iDirectShareViaMeetingIDOrPairingCodeHandler.tryWithPairingCode("123456");
}
}
}
};
directShareService.setEvent(directShareEvent);
Stop sharing
Before stopping a direct share session, confirm that a share is already in progress.
if (directShareService.isDirectShareInProgress) {
directShareService.stopDirectShare()
}
if (directShareService.isDirectShareInProgress()) {
directShareService.stopDirectShare();
}