import { NativeModules } from 'react-native'; import type { Errors, StreamingJoinStatus } from '../native/ZoomVideoSdk'; const { RNZoomVideoSdkBroadcastStreamingViewer } = NativeModules; /** * Streaming join context. * Token + channelID are obtained out-of-band from the broadcaster. */ export type StreamingJoinContext = { token: string; channelID: string; }; /** * Broadcast streaming viewer (audience side). * * Lets a user OUTSIDE any session join an active broadcast and receive * live media from the broadcaster. Joins do NOT require an active * Video SDK session. * * Status updates arrive via EventType.onStreamingJoinStatusChanged. * * Note: raw video / audio subscription (subscribeVideo / subscribeAudio * on the native helper) is NOT exposed in this wrapper version. */ export type ZoomVideoSdkBroadcastStreamingViewerType = { /** * Joins broadcast streaming asynchronously. * Result arrives via EventType.onStreamingJoinStatusChanged. */ joinStreaming: (ctx: StreamingJoinContext) => Promise; /** * Leaves broadcast streaming asynchronously. * Result arrives via EventType.onStreamingJoinStatusChanged. */ leaveStreaming: () => Promise; /** * Returns the current streaming join status. */ getStreamingJoinStatus: () => Promise; }; export class ZoomVideoSdkBroadcastStreamingViewer implements ZoomVideoSdkBroadcastStreamingViewerType { async joinStreaming(ctx: StreamingJoinContext) { return await RNZoomVideoSdkBroadcastStreamingViewer.joinStreaming(ctx); } async leaveStreaming() { return await RNZoomVideoSdkBroadcastStreamingViewer.leaveStreaming(); } async getStreamingJoinStatus() { return await RNZoomVideoSdkBroadcastStreamingViewer.getStreamingJoinStatus(); } }