import { NativeModules, Platform } from 'react-native'; import type { Errors } from '../native/ZoomVideoSdk'; const { RNZoomVideoSdkShareHelper } = NativeModules; /** * Share control interface. */ export type ZoomVideoSdkShareHelperType = { /** * Start sharing the screen. */ shareScreen: () => void; /** * Stop view or screen share. */ stopShare: () => Promise; /** * Lock sharing the view or screen. Only the host can call this method. */ lockShare: (lock: boolean) => Promise; /** * Determine whether other user is sharing. */ isOtherSharing: () => Promise; /** * Determine whether the current user is sharing the screen. */ isScreenSharingOut: () => Promise; /** * Determine whether sharing the view or screen is locked. */ isShareLocked: () => Promise; /** * Determine whether the current user is sharing. */ isSharingOut: () => Promise; /** * Determine whether annotation feature is supported. */ isAnnotationFeatureSupport:() => Promise; /** * Disable viewer annotation. */ disableViewerAnnotation:(disable: boolean) => Promise; /** * Determine whether viewer annotation is disabled. */ isViewerAnnotationDisabled: () => Promise; /** * Enble share audio when screen sharing. */ enableShareDeviceAudio: (enable: boolean) => Promise; /** * Pause screen share. */ pauseShare: () => Promise; /** * Resume screen share. */ resumeShare: () => Promise; /** * iOS only: Share the select camera. Query the select camera using {@link ZoomVideoSdkVideoHelper#getCameraList()}. * The presenter can use {@link #pauseShare()} to enable viewer annotation. * If the camera is paused, the presenter can use {@link #resumeShare()} to resume. * Notice: The user should start video before starting to share a camera, * otherwise the SDK returns error {@link ZoomVideoSDKErrors#Errors_Session_Share_Camera_Video_Not_Start}. * To share camera view on Android, add CameraView component directly in the screen. */ startShareCamera: () => Promise; }; export class ZoomVideoSdkShareHelper implements ZoomVideoSdkShareHelperType { async shareScreen() { return await RNZoomVideoSdkShareHelper.shareScreen(); } async stopShare() { return await RNZoomVideoSdkShareHelper.stopShare(); } async lockShare(lock: boolean) { return await RNZoomVideoSdkShareHelper.lockShare(lock); } async isOtherSharing() { return await RNZoomVideoSdkShareHelper.isOtherSharing(); } async isScreenSharingOut() { return await RNZoomVideoSdkShareHelper.isScreenSharingOut(); } async isShareLocked() { return await RNZoomVideoSdkShareHelper.isShareLocked(); } async isSharingOut() { return await RNZoomVideoSdkShareHelper.isSharingOut(); } async isAnnotationFeatureSupport() { return await RNZoomVideoSdkShareHelper.isAnnotationFeatureSupport(); } async disableViewerAnnotation(disable: boolean) { return await RNZoomVideoSdkShareHelper.disableViewerAnnotation(disable); } async isViewerAnnotationDisabled() { return await RNZoomVideoSdkShareHelper.isViewerAnnotationDisabled(); } async enableShareDeviceAudio(enable: boolean) { return await RNZoomVideoSdkShareHelper.enableShareDeviceAudio(enable); } async pauseShare() { return await RNZoomVideoSdkShareHelper.pauseShare(); } async resumeShare() { return await RNZoomVideoSdkShareHelper.resumeShare(); } async startShareCamera() { if (Platform.OS === 'ios') { return await RNZoomVideoSdkShareHelper.startShareCamera(); } } }