# Share directly to a Zoom Room

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

> 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.

```kotlin
val directShareService = ZoomSDK.getInstance().preMeetingService.directShareService
if (directShareService.canStartDirectShare()) {
    directShareService.startDirectShare()
}
```

```java
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.

```kotlin
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)
```

```java
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.

```kotlin
if (directShareService.isDirectShareInProgress) {
    directShareService.stopDirectShare()
}
```

```java
if (directShareService.isDirectShareInProgress()) {
    directShareService.stopDirectShare();
}
```

---
