@cloudflare/realtimekit-react 1.2.0-staging.9 → 1.2.1-staging.1
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/LICENSE +201 -0
- package/build-types.sh +12 -0
- package/dist/index.cjs.js +1 -23
- package/dist/index.d.ts +20 -12
- package/dist/index.es.js +41 -30640
- package/example/App.tsx +34 -0
- package/example/components/Chat.tsx +51 -0
- package/example/components/Meeting.tsx +83 -0
- package/example/components/Participants.tsx +122 -0
- package/example/index.css +24 -0
- package/example/main.tsx +11 -0
- package/example/vite-env.d.ts +1 -0
- package/package.json +3 -6
- package/tsconfig.node.json +8 -0
- package/types/context.d.ts +36 -0
- package/types/index.d.ts +14 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import RTKClient, {
|
|
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
|
|
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
|
-
}):
|
|
31
|
+
}): react_jsx_runtime.JSX.Element;
|
|
31
32
|
/**
|
|
32
|
-
* Hook which returns the reference to the
|
|
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
|
|
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
|
|
45
|
+
* Hook to initialise media before initialising RTKClient
|
|
44
46
|
*/
|
|
45
|
-
declare const
|
|
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
|
|
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 };
|