import { NativeModules } from 'react-native'; import { validateNonEmptyStringProp, validateBooleanProp, } from '../utils/validation'; const { RNZoomVideoSdk } = NativeModules; export enum RawDataMemoryMode { Stack = 'ZoomVideoSDKRawDataMemoryModeStack', Heap = 'ZoomVideoSDKRawDataMemoryModeHeap', } /** * The user share status. */ export enum ShareStatus { None = 'ZoomVideoSDKShareStatus_None', Stop = 'ZoomVideoSDKShareStatus_Stop', Pause = 'ZoomVideoSDKShareStatus_Pause', Start = 'ZoomVideoSDKShareStatus_Start', Resume = 'ZoomVideoSDKShareStatus_Resume', } /** * The user whiteboard status. */ export enum WhiteboardStatus { Started = 'WhiteboardStatus_Started', Stopped = 'WhiteboardStatus_Stopped', } export enum LiveStreamStatus { None = 'ZoomVideoSDKLiveStreamStatus_None', InProgress = 'ZoomVideoSDKLiveStreamStatus_InProgress', Connecting = 'ZoomVideoSDKLiveStreamStatus_Connecting', FailedTimeout = 'ZoomVideoSDKLiveStreamStatus_FailedTimeout', StartFailed = 'ZoomVideoSDKLiveStreamStatus_StartFailed', Ended = 'ZoomVideoSDKLiveStreamStatus_Ended', } /** * Broadcast streaming controller (host) status. */ export enum BroadcastControlStatus { None = 'ZoomVideoSDKBroadcastControlStatus_None', Starting = 'ZoomVideoSDKBroadcastControlStatus_Starting', Started = 'ZoomVideoSDKBroadcastControlStatus_Started', Stopping = 'ZoomVideoSDKBroadcastControlStatus_Stopping', Stopped = 'ZoomVideoSDKBroadcastControlStatus_Stopped', } /** * Broadcast streaming viewer (audience) join status. */ export enum StreamingJoinStatus { None = 'ZoomVideoSDKStreamingJoinStatus_None', Connecting = 'ZoomVideoSDKStreamingJoinStatus_Connecting', Joined = 'ZoomVideoSDKStreamingJoinStatus_Joined', Disconnecting = 'ZoomVideoSDKStreamingJoinStatus_Disconnecting', Reconnecting = 'ZoomVideoSDKStreamingJoinStatus_Reconnecting', Failed = 'ZoomVideoSDKStreamingJoinStatus_Failed', Left = 'ZoomVideoSDKStreamingJoinStatus_Left', } export enum RecordingStatus { None = 'ZoomVideoSDKRecordingStatus_None', Start = 'ZoomVideoSDKRecordingStatus_Start', Stop = 'ZoomVideoSDKRecordingStatus_Stop', DiskFull = 'ZoomVideoSDKRecordingStatus_DiskFull', Pause = 'ZoomVideoSDKRecordingStatus_Pause', } export enum NetworkStatus { None = 'ZoomVideoSDKNetwork_None', Good = 'ZoomVideoSDKNetwork_Good', Normal = 'ZoomVideoSDKNetwork_Normal', Bad = 'ZoomVideoSDKNetwork_Bad', } export enum SessionType { MainSession = 'MainSession', SubSession = 'SubSession' } /** * Get audio type: VOIP (Voice over IP), Telephony, or None. */ export enum AudioType { None = 'ZoomVideoSDKAudioType_None', VOIP = 'ZoomVideoSDKAudioType_VOIP', Telephony = 'ZoomVideoSDKAudioType_Telephony', Unknown = 'ZoomVideoSDKAudioType_Unknown', } export enum VideoAspect { Original = 'ZoomVideoSDKVideoAspect_Original', FullFilled = 'ZoomVideoSDKVideoAspect_Full_Filled', LetterBox = 'ZoomVideoSDKVideoAspect_LetterBox', PanAndScan = 'ZoomVideoSDKVideoAspect_PanAndScan', } export enum VideoResolution { Resolution90P = 'ZoomVideoSDKVideoResolution_90', Resolution180P = 'ZoomVideoSDKVideoResolution_180', Resolution360P = 'ZoomVideoSDKVideoResolution_360', Resolution720P = 'ZoomVideoSDKVideoResolution_720', Resolution1080P = 'ZoomVideoSDKVideoResolution_1080', ResolutionAuto = 'ZoomVideoSDKVideoResolution_Auto', } export enum PhoneStatus { None = 'ZoomVideoSDKPhoneStatus_None', Calling = 'ZoomVideoSDKPhoneStatus_Calling', Ringing = 'ZoomVideoSDKPhoneStatus_Ringing', Accepted = 'ZoomVideoSDKPhoneStatus_Accepted', Success = 'ZoomVideoSDKPhoneStatus_Success', Failed = 'ZoomVideoSDKPhoneStatus_Failed', Canceling = 'ZoomVideoSDKPhoneStatus_Canceling', Canceled = 'ZoomVideoSDKPhoneStatus_Canceled', CancelFailed = 'ZoomVideoSDKPhoneStatus_Cancel_Failed', Timeout = 'ZoomVideoSDKPhoneStatus_Timeout', } export enum PhoneFailedReason { None = 'ZoomVideoSDKPhoneFailedReason_None', Busy = 'ZoomVideoSDKPhoneFailedReason_Busy', NotAvailable = 'ZoomVideoSDKPhoneFailedReason_Not_Available', UserHangup = 'ZoomVideoSDKPhoneFailedReason_User_Hangup', OtherFail = 'ZoomVideoSDKPhoneFailedReason_Other_Fail', NoAnswer = 'ZoomVideoSDKPhoneFailedReason_No_Answer', BlockNoHost = 'ZoomVideoSDKPhoneFailedReason_Block_No_Host', BlockHighRate = 'ZoomVideoSDKPhoneFailedReason_Block_High_Rate', BlockTooFrequent = 'ZoomVideoSDKPhoneFailedReason_Block_Too_Frequent', } export enum ChatMessageDeleteType { None = 'ZoomVideoSDKChatMsgDeleteBy_NONE', Self = 'ZoomVideoSDKChatMsgDeleteBy_SELF', Host = 'ZoomVideoSDKChatMsgDeleteBy_HOST', Dlp = 'ZoomVideoSDKChatMsgDeleteBy_DLP', } export enum MultiCameraStreamStatus { Joined = 'ZoomVideoSDKMultiCameraStreamStatus_Joined', Left = 'ZoomVideoSDKMultiCameraStreamStatus_Left', } export enum LiveTranscriptionStatus { Stop = 'ZoomVideoSDKLiveTranscription_Status_Stop', Start = 'ZoomVideoSDKLiveTranscription_Status_Start', } export enum SystemPermissionType { Camera = 'ZoomVideoSDKSystemPermissionType_Camera', Microphone = 'ZoomVideoSDKSystemPermissionType_Microphone', } export enum LiveTranscriptionOperationType { None = 'ZoomVideoSDKLiveTranscription_OperationType_None', Update = 'ZoomVideoSDKLiveTranscription_OperationType_Update', Delete = 'ZoomVideoSDKLiveTranscription_OperationType_Delete', Complete = 'ZoomVideoSDKLiveTranscription_OperationType_Complete', Add = 'ZoomVideoSDKLiveTranscription_OperationType_Add', NotSupport = 'ZoomVideoSDKLiveTranscription_OperationType_NotSupported', } export enum ZoomVideoSDKVirtualBackgroundDataType { None = 'ZoomVideoSDKLiveTranscription_OperationType_None', Blur = 'ZoomVideoSDKLiveTranscription_OperationType_Update', Image = 'ZoomVideoSDKLiveTranscription_OperationType_Delete', } export enum ZoomVideoSDKDialInNumberType { None = 'ZoomVideoSDKDialInNumType_None', Toll = 'ZoomVideoSDKDialInNumType_Toll', TollFree = 'ZoomVideoSDKDialInNumType_TollFree', } export enum AnnotationClearType { All = 'ZoomVideoSDKAnnotationClearType_All', Others = 'ZoomVideoSDKAnnotationClearType_Others', My = 'ZoomVideoSDKAnnotationClearType_My', } export enum AnnotationToolType { None = 'ZoomVideoSDKAnnotationToolType_None', Pen = 'ZoomVideoSDKAnnotationToolType_Pen', HighLighter = 'ZoomVideoSDKAnnotationToolType_HighLighter', AutoLine = 'ZoomVideoSDKAnnotationToolType_AutoLine', AutoRectangle = 'ZoomVideoSDKAnnotationToolType_AutoRectangle', AutoEllipse = 'ZoomVideoSDKAnnotationToolType_AutoEllipse', AutoArrow = 'ZoomVideoSDKAnnotationToolType_AutoArrow', AutoRectangleFill = 'ZoomVideoSDKAnnotationToolType_AutoRectangleFill', AutoEllipseFill = 'ZoomVideoSDKAnnotationToolType_AutoEllipseFill', SpotLight = 'ZoomVideoSDKAnnotationToolType_SpotLight', Arrow = 'ZoomVideoSDKAnnotationToolType_Arrow', ERASER = 'ZoomVideoSDKAnnotationToolType_ERASER', Picker = 'ZoomVideoSDKAnnotationToolType_Picker', AutoRectangleSemiFill = 'ZoomVideoSDKAnnotationToolType_AutoRectangleSemiFill', AutoEllipseSemiFill = 'ZoomVideoSDKAnnotationToolType_AutoEllipseSemiFill', AutoDoubleArrow = 'ZoomVideoSDKAnnotationToolType_AutoDoubleArrow', AutoDiamond = 'ZoomVideoSDKAnnotationToolType_AutoDiamond', AutoStampArrow = 'ZoomVideoSDKAnnotationToolType_AutoStampArrow', AutoStampCheck = 'ZoomVideoSDKAnnotationToolType_AutoStampCheck', AutoStampX = 'ZoomVideoSDKAnnotationToolType_AutoStampX', AutoStampStar = 'ZoomVideoSDKAnnotationToolType_AutoStampStar', AutoStampHeart = 'ZoomVideoSDKAnnotationToolType_AutoStampHeart', AutoStampQm = 'ZoomVideoSDKAnnotationToolType_AutoStampQm', } export enum Errors { Success = 'ZoomVideoSDKError_Success', WrongUsage = 'ZoomVideoSDKError_Wrong_Usage', InternalError = 'ZoomVideoSDKError_Internal_Error', Uninitialize = 'ZoomVideoSDKError_Uninitialize', MemoryError = 'ZoomVideoSDKError_Memory_Error', LoadModuleError = 'ZoomVideoSDKError_Load_Module_Error', UnLoadModuleError = 'ZoomVideoSDKError_UnLoad_Module_Error', InvalidParameter = 'ZoomVideoSDKError_Invalid_Parameter', CallTooFrequntly = 'ZoomVideoSDKError_Call_Too_Frequently', NoImpl = 'ZoomVideoSDKError_No_Impl', DontSupportFeature = 'ZoomVideoSDKError_Dont_Support_Feature', Unknown = 'ZoomVideoSDKError_Unknown', AuthBase = 'ZoomVideoSDKError_Auth_Base', AuthError = 'ZoomVideoSDKError_Auth_Error', AuthEmptyKeyorSecret = 'ZoomVideoSDKError_Auth_Empty_Key_or_Secret', AuthWrongKeyorSecret = 'ZoomVideoSDKError_Auth_Wrong_Key_or_Secret', AuthDoesNotSupportSDK = 'ZoomVideoSDKError_Auth_DoesNot_Support_SDK', AuthDisableSDK = 'ZoomVideoSDKError_Auth_Disable_SDK', JoinSessionNoSessioName = 'ZoomVideoSDKError_JoinSession_NoSessionName', JoinSessioNoSessionToken = 'ZoomVideoSDKError_JoinSession_NoSessionToken', JoinSessionNoUserName = 'ZoomVideoSDKError_JoinSession_NoUserName', JoinSessionInvalidSessionName = 'ZoomVideoSDKError_JoinSession_Invalid_SessionName', JoinSessionInvalidPassword = 'ZoomVideoSDKError_JoinSession_InvalidPassword', JoinSessionInvalidSessionToken = 'ZoomVideoSDKError_JoinSession_Invalid_SessionToken', JoinSessionSessionNameTooLong = 'ZoomVideoSDKError_JoinSession_SessionName_TooLong', JoinSessionTokenMismatchedSessionName = 'ZoomVideoSDKError_JoinSession_Token_MismatchedSessionName', JoinSessionTokenNoSessionName = 'ZoomVideoSDKError_JoinSession_Token_NoSessionName', JoinSessionTokenRoleTypeEmptyOrWrong = 'ZoomVideoSDKError_JoinSession_Token_RoleType_EmptyOrWrong', JoinSessionTokenUserIdentityTooLong = 'ZoomVideoSDKError_JoinSession_Token_UserIdentity_TooLong', SessionBase = 'ZoomVideoSDKError_Session_Base', SessionModuleNotFound = 'ZoomVideoSDKError_Session_Module_Not_Found', SessionServiceInvaild = 'ZoomVideoSDKError_Session_Service_Invaild', SessionJoinFailed = 'ZoomVideoSDKError_Session_Join_Failed', SessionNoRights = 'ZoomVideoSDKError_Session_No_Rights', SessionAlreadyInProgress = 'ZoomVideoSDKError_Session_Already_In_Progress', SessionDontSupportSessionType = 'ZoomVideoSDKError_Session_Dont_Support_SessionType', SessionReconnecting = 'ZoomVideoSDKError_Session_Reconnecting', SessionDisconnecting = 'ZoomVideoSDKError_Session_Disconnecting', SessionNotStarted = 'ZoomVideoSDKError_Session_Not_Started', SessionNeedPassword = 'ZoomVideoSDKError_Session_Need_Password', SessionPasswordWrong = 'ZoomVideoSDKError_Session_Password_Wrong', SessionRemoteDBError = 'ZoomVideoSDKError_Session_Remote_DB_Error', SessionInvalidParam = 'ZoomVideoSDKError_Session_Invalid_Param', SessionAudioError = 'ZoomVideoSDKError_Session_Audio_Error', SessionAudioNoMicrophone = 'ZoomVideoSDKError_Session_Audio_No_Microphone', SessionVideoError = 'ZoomVideoSDKError_Session_Video_Error', SessionVideoDeviceError = 'ZoomVideoSDKError_Session_Video_Device_Error', SessionLiveStreamError = 'ZoomVideoSDKError_Session_Live_Stream_Error', SessionPhoneError = 'ZoomVideoSDKError_Session_Phone_Error', DontSupportMultiStreamVideoUser = 'ZoomVideoSDKError_Dont_Support_Multi_Stream_Video_User', FailAssignUserPrivilege = 'ZoomVideoSDKError_Fail_Assign_User_Privilege', NoRecordingInProcess = 'ZoomVideoSDKError_No_Recording_In_Process', MallocFailed = 'ZoomVideoSDKError_Malloc_Failed', NotInSession = 'ZoomVideoSDKError_Not_In_Session', NoLicense = 'ZoomVideoSDKError_No_License', VideoModuleNotReady = 'ZoomVideoSDKError_Video_Module_Not_Ready', VideoModuleError = 'ZoomVideoSDKError_Video_Module_Error', VideoDeviceError = 'ZoomVideoSDKError_Video_device_error', NoVideoData = 'ZoomVideoSDKError_No_Video_Data', ShareModuleNotReady = 'ZoomVideoSDKError_Share_Module_Not_Ready', ShareModuleError = 'ZoomVideoSDKError_Share_Module_Error', NoShareData = 'ZoomVideoSDKError_No_Share_Data', AudioModuleNotReady = 'ZoomVideoSDKError_Audio_Module_Not_Ready', AudioModuleError = 'ZoomVideoSDKError_Audio_Module_Error', NoAudioData = 'ZoomVideoSDKError_No_Audio_Data', PreprocessRawdataError = 'ZoomVideoSDKError_Preprocess_Rawdata_Error', RawdataNoDeviceRunning = 'ZoomVideoSDKError_Rawdata_No_Device_Running', RawdataInitDevice = 'ZoomVideoSDKError_Rawdata_Init_Device', RawdataVirtualDevice = 'ZoomVideoSDKError_Rawdata_Virtual_Device', RawdataCannotChangeVirtualDeviceInPreview = 'ZoomVideoSDKError_Rawdata_Cannot_Change_Virtual_Device_In_Preview', RawdataInternalError = 'ZoomVideoSDKError_Rawdata_Internal_Error', RawdataSendTooMuchDataInSingleTime = 'ZoomVideoSDKError_Rawdata_Send_Too_Much_Data_In_Single_Time', RawdataSendTooFrequently = 'ZoomVideoSDKError_Rawdata_Send_Too_Frequently', RawdataVirtualMicIsTerminate = 'ZoomVideoSDKError_Rawdata_Virtual_Mic_Is_Terminate', SessionShareError = 'ZoomVideoSDKError_Session_Share_Error', SessionShareModuleNotReady = 'ZoomVideoSDKError_Session_Share_Module_Not_Ready', SessionShareYouAreNotSharing = 'ZoomVideoSDKError_Session_Share_You_Are_Not_Sharing', SessionShareTypeIsNotSupport = 'ZoomVideoSDKError_Session_Share_Type_Is_Not_Support', SessionShareInternalError = 'ZoomVideoSDKError_Session_Share_Internal_Error', Permission_RECORD_AUDIO = 'ZoomVideoSDKError_Permission_RECORD_AUDIO', Permission_READ_PHONE_STATE = 'ZoomVideoSDKError_Permission_READ_PHONE_STATE', BLUETOOTH_CONNECT = 'ZoomVideoSDKError_Permission_BLUETOOTH_CONNECT', Session_Client_Incompatible = 'ZoomVideoSDKError_Session_Client_Incompatible', } export enum VideoSubscribeFailReason { NotSupport1080P = 'ZoomVideoSDKSubscribeFailReason_NotSupport1080P', HasSubscribe1080POr720P = 'ZoomVideoSDKSubscribeFailReason_HasSubscribe1080POr720P', HasSubscribeShare = 'ZoomVideoSDKSubscribeFailReason_HasSubscribeShare', HasSubscribeOneShare = 'ZoomVideoSDKSubscribeFailReason_HasSubscribeOneShare', HasSubscribeExceededLimit = 'ZoomVideoSDKSubscribeFailReason_HasSubscribeExceededLimit', None = 'ZoomVideoSDKSubscribeFailReason_None', TooFrequentCall = 'ZoomVideoSDKSubscribeFailReason_TooFrequentCall', } export enum ShareType { None = 'ZoomVideoSDKShareType_None', Normal = 'ZoomVideoSDKShareType_Normal', PureAudio = 'ZoomVideoSDKShareType_PureAudio', Camera = 'ZoomVideoSDKShareType_Camera', } export type InitConfig = { domain?: string; enableLog?: boolean; logFilePrefix?: string; appGroupId?: string; enableFullHD?: boolean; // Availble for certain Android hardware only. videoRawDataMemoryMode?: RawDataMemoryMode; audioRawDataMemoryMode?: RawDataMemoryMode; shareRawDataMemoryMode?: RawDataMemoryMode; speakerFilePath?: string; enableCallKit?: boolean; }; export type ShareActionType = { shareSourceId: number; shareStatus: ShareStatus; shareType: ShareType; subscribeFailReason: VideoSubscribeFailReason; isAnnotationPrivilegeEnabled: boolean; } /** * Share action information. */ export class ShareAction { /** * The shared content source id. */ shareSourceId: number; /** * The share status. */ shareStatus: ShareStatus; /** * The share type. */ shareType: ShareType; /** * video subscribe fail reason. */ subscribeFailReason: VideoSubscribeFailReason; /** * if the annotation privilege is enabled. */ isAnnotationPrivilegeEnabled: boolean; constructor(shareAction: ShareActionType) { this.shareSourceId = shareAction.shareSourceId; this.shareStatus = shareAction.shareStatus; this.shareType = shareAction.shareType; this.subscribeFailReason = shareAction.subscribeFailReason; this.isAnnotationPrivilegeEnabled = shareAction.isAnnotationPrivilegeEnabled; } } export type JoinSessionConfig = { /** * Session Name. sessionName The string length must be less than 150. Supported character scopes are: Letters, numbers, spaces, and the following characters: "!", "#", "$", "%", "&", "(", ")", "", "", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "", "}", "|", "~", "," */ sessionName: string; /** * Session Password */ sessionPassword?: string; /** * JWT token to join the session. */ token: string; /** * User Name. */ userName: string; /** * The audio option of join session */ audioOptions?: { /** * Local audio connect or not */ connect?: boolean; /** * Local audio mute or not */ mute?: boolean; /** * Set if it is able to auto-adjust the volume of the speaker when joining the meeting */ autoAdjustSpeakerVolume?: boolean; }; /** * The video option of join session */ videoOptions?: { /** * Local video on or off */ localVideoOn?: boolean; }; /** * The amount of time in minutes after which an idle session will end. Default value: 40. If the value is less than 0, the session will stay alive indefinitely. When there is only one user remaining in a session, that session is considered idle. */ sessionIdleTimeoutMins: number; }; /** * Zoom Video SDK API manager. The class that controls the video session creation, event callbacks and other main features of video SDK. */ export type ZoomVideoSdkType = { /** * Initialize the Zoom Video SDK */ initSdk: (config: InitConfig) => void; /** * Call this method to join a session with the appropriate [ZoomVideoSDKSessionContext] parameters. When successful, the SDK will attempt to join a session. Use the callbacks in the delegate to confirm whether the SDK actually joined. */ joinSession: (config: JoinSessionConfig) => Promise; /** * Call this method to leave a session previously joined through joinSession method call. When successful, the SDK will attempt to leave a session. Use the callbacks in the delegate to confirm whether the SDK actually left. */ leaveSession: (endSession?: boolean) => void; // Maybe the error result? /** * Returns the Zoom SDK internal version. */ getSdkVersion: () => Promise; /** * Un-initialize the Zoom SDK. */ cleanup: () => void; /** * Accept recording consent */ acceptRecordingConsent: () => Promise; /** * Decline recording consent */ declineRecordingConsent: () => Promise; /** * Get recording consent */ getRecordingConsentType: () => Promise; /** * Export log */ exportLog: () => Promise; /** * Delete the exported log files */ cleanAllExportedLogs: () => Promise; }; export enum ConsentType { ConsentType_Invalid = 'ConsentType_Invalid', ConsentType_Traditional = 'ConsentType_Traditional', ConsentType_Individual = 'ConsentType_Individual', } export enum ZoomVideoSdkCRCProtocolType { ZoomVideoSDKCRCProtocol_H323 = 'ZoomVideoSDKCRCProtocol_H323', ZoomVideoSDKCRCProtocol_SIP = 'ZoomVideoSDKCRCProtocol_SIP', } export class ZoomVideoSdk implements ZoomVideoSdkType { initSdk(config: InitConfig) { validateNonEmptyStringProp(config, 'initConfig', 'domain'); validateBooleanProp(config, 'initConfig', 'enableLog'); return RNZoomVideoSdk.initSdk(config); } joinSession(config: JoinSessionConfig) { validateNonEmptyStringProp(config, 'JoinSessionConfig', 'sessionName'); validateNonEmptyStringProp(config, 'JoinSessionConfig', 'userName'); validateNonEmptyStringProp(config, 'JoinSessionConfig', 'token'); return RNZoomVideoSdk.joinSession(config); } // We don't need to do anything right now so we just pass through the native call. leaveSession = RNZoomVideoSdk.leaveSession; getSdkVersion = RNZoomVideoSdk.getSdkVersion; isInSession = RNZoomVideoSdk.isInSession; cleanup = RNZoomVideoSdk.cleanup; acceptRecordingConsent = RNZoomVideoSdk.acceptRecordingConsent; declineRecordingConsent = RNZoomVideoSdk.declineRecordingConsent; getRecordingConsentType = RNZoomVideoSdk.getRecordingConsentType; exportLog = RNZoomVideoSdk.exportLog; cleanAllExportedLogs = RNZoomVideoSdk.cleanAllExportedLogs; } export enum ZoomVideoSDKChatPrivilegeType { ZoomVideoSDKChatPrivilege_Unknown = 'ZoomVideoSDKChatPrivilege_Unknown', ZoomVideoSDKChatPrivilege_Publicly_And_Privately = 'ZoomVideoSDKChatPrivilege_Publicly_And_Privately', ZoomVideoSDKChatPrivilege_No_One = 'ZoomVideoSDKChatPrivilege_No_One', ZoomVideoSDKChatPrivilege_Publicly = 'ZoomVideoSDKChatPrivilege_Publicly', } export enum ZoomVideoSDKTestMicStatus { CanPlay = 'ZoomVideoSDKMic_CanPlay', Recording = 'ZoomVideoSDKMic_Recording', CanTest = 'ZoomVideoSDKMic_CanTest', }