@cloudflare/realtimekit-react 1.2.0-staging.2 → 1.2.0-staging.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import RTKClient, { RealtimeKitClientOptions } from '@cloudflare/realtimekit';
1
+ import RTKClient, { RTKSelfMedia, MediaConstraints, CachedUserDetails, RTKClientOptions } from '@cloudflare/realtimekit';
2
2
  export { ActiveTab, ActiveTabType, AudioConsumerScoreStats, AudioMiddleware, AudioProducerScoreStats, BroadcastMessagePayload, ChatChannel, ChatUpdateParams, CustomMessage, DeviceConfig, FileMessage, ImageMessage, JoinedPeer, LeaveRoomState, LivestreamIngestionCredentials, LivestreamState, LogData, MediaConnectionState, MediaConnectionUpdate, MediaKind, MediaPermission, Message, ProducerScoreStats, RTKBasicParticipant, RTKChat, RTKConnectedMeetings, RTKLivestream, RTKMeta, RTKParticipant, RTKParticipantMap, RTKParticipants, RTKPermissionsPreset, RTKPlugin, RTKPluginMap, RTKPlugins, RTKPolls, RTKRecording, RTKSelf, RTKSelfMedia, RTKStore, RTKThemePreset, RecordingState, RequestToJoinType, SocketConnectionState, StageStatus, StartLivestreamConfig, TextMessage, VideoConsumerScoreStats, VideoMiddleware, VideoProducerScoreStats, VideoQualityConstraints, leaveRoomState } from '@cloudflare/realtimekit';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
4
  import React, { ReactNode } from 'react';
4
5
 
5
6
  type Listener = () => void;
@@ -17,7 +18,7 @@ declare const RealtimeKitContext: React.Context<{
17
18
  updates: RTKUpdates | undefined;
18
19
  }>;
19
20
  /**
20
- * Provider component which makes the RealtimeKit meeting object
21
+ * Provider component which makes the RealtimeKit object
21
22
  * available to nested components
22
23
  * @component
23
24
  * @param value The RealtimeKitClient instance from `useRealtimeKitClient()`
@@ -27,28 +28,35 @@ declare function RealtimeKitProvider({ value, children, fallback, }: {
27
28
  value: RTKClient | undefined;
28
29
  children: ReactNode;
29
30
  fallback?: ReactNode;
30
- }): React.JSX.Element;
31
+ }): react_jsx_runtime.JSX.Element;
31
32
  /**
32
- * Hook which returns the reference to the RealtimeKit meeting object
33
- * @returns meeting instance
33
+ * Hook which returns the reference to the RealtimeKitClient object
34
+ * @returns meeting instance from `useRealtimeKitClient()`
34
35
  */
35
36
  declare const useRealtimeKitMeeting: () => {
36
37
  meeting: RTKClient;
37
38
  };
38
39
 
39
- interface DyteClientParams {
40
+ interface RealtimeKitClientParams {
40
41
  resetOnLeave?: boolean;
41
42
  }
43
+ type SelfMedia = Pick<RTKSelfMedia, 'addAudioMiddleware' | 'addVideoMiddleware' | 'audioEnabled' | 'audioTrack' | 'disableAudio' | 'disableScreenShare' | 'disableVideo' | 'enableAudio' | 'enableScreenShare' | 'enableVideo' | 'getAudioDevices' | 'getCurrentDevices' | 'getDeviceById' | 'getSpeakerDevices' | 'getVideoDevices' | 'init' | 'mediaPermissions' | 'rawAudioTrack' | 'rawVideoTrack' | 'removeAllAudioMiddlewares' | 'removeAllVideoMiddlewares' | 'removeVideoMiddleware' | 'removeAudioMiddleware' | 'screenShareEnabled' | 'screenShareTracks' | 'setDevice' | 'videoEnabled' | 'videoTrack' | 'setVideoMiddlewareGlobalConfig'>;
42
44
  /**
43
- * Hook to get and intialise an instance of RealtimeKit meeting object
45
+ * Hook to initialise media before initialising RTKClient
44
46
  */
45
- declare const useRealtimeKitClient: (dyteClientParams?: DyteClientParams) => readonly [RTKClient | undefined, (options: RealtimeKitClientOptions) => Promise<RTKClient | undefined>];
47
+ declare const initRTKMedia: (options?: {
48
+ video?: boolean;
49
+ audio?: boolean;
50
+ constraints?: MediaConstraints;
51
+ }, skipAwaits?: boolean, cachedUserDetails?: CachedUserDetails | undefined) => SelfMedia;
52
+ /**
53
+ * Hook which manages a RTKClient instance
54
+ */
55
+ declare const useRealtimeKitClient: (clientParams?: RealtimeKitClientParams) => [RTKClient, (options: RTKClientOptions) => Promise<RTKClient | undefined>];
46
56
  type StateSelector<T extends object, U> = (state: T) => U;
47
57
  /**
48
- * Hook which extracts data from the RealtimeKit meeting object and re-renders on change.
49
- * @param selector The selector function which takes the meeting object and returns a slice of state
50
- * @returns The slice of state returned by the selector function
58
+ * Hook which extracts data from the RTKClient object
51
59
  */
52
60
  declare const useRealtimeKitSelector: <StateSlice>(selector: StateSelector<RTKClient, StateSlice>) => StateSlice;
53
61
 
54
- export { RealtimeKitContext, RealtimeKitProvider, useRealtimeKitClient, useRealtimeKitMeeting, useRealtimeKitSelector };
62
+ export { RealtimeKitContext, RealtimeKitProvider, SelfMedia, initRTKMedia, useRealtimeKitClient, useRealtimeKitMeeting, useRealtimeKitSelector };