@whereby.com/browser-sdk 2.13.0 → 3.0.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/dist/cdn/{v2-embed.js → v3-embed.js} +6 -6
- package/dist/cdn/v3-react.js +3 -0
- package/dist/react/index.d.ts +67 -18
- package/dist/react/index.esm.js +1546 -114
- package/package.json +7 -7
- package/dist/cdn/v2-react.js +0 -3
package/dist/react/index.d.ts
CHANGED
|
@@ -1,27 +1,38 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { LocalMediaOptions, RemoteParticipant, LocalParticipant, Screenshare, ConnectionStatus, NotificationsEventEmitter, ClientView, ChatMessage as ChatMessage$1 } from '@whereby.com/core';
|
|
3
3
|
import { RoleName } from '@whereby.com/media';
|
|
4
4
|
|
|
5
|
+
interface ProviderProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare function Provider({ children }: ProviderProps): React.JSX.Element;
|
|
9
|
+
|
|
5
10
|
interface VideoViewSelfProps {
|
|
6
11
|
stream: MediaStream;
|
|
7
12
|
muted?: boolean;
|
|
8
13
|
mirror?: boolean;
|
|
9
14
|
style?: React.CSSProperties;
|
|
10
|
-
|
|
15
|
+
onVideoResize?: ({ width, height, stream }: {
|
|
11
16
|
width: number;
|
|
12
17
|
height: number;
|
|
13
18
|
stream: MediaStream;
|
|
14
19
|
}) => void;
|
|
15
|
-
onSetAspectRatio?: ({ aspectRatio }: {
|
|
16
|
-
aspectRatio: number;
|
|
17
|
-
}) => void;
|
|
18
20
|
}
|
|
19
|
-
type
|
|
20
|
-
|
|
21
|
+
type WherebyVideoElement = HTMLVideoElement & {
|
|
22
|
+
captureAspectRatio: () => number;
|
|
23
|
+
onVideoResize: ({ width, height, stream }: {
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
stream: MediaStream;
|
|
27
|
+
}) => void;
|
|
28
|
+
};
|
|
29
|
+
type VideoViewProps = VideoViewSelfProps & React.DetailedHTMLProps<React.VideoHTMLAttributes<WherebyVideoElement>, WherebyVideoElement>;
|
|
30
|
+
declare const VideoView: React.ForwardRefExoticComponent<Omit<VideoViewProps, "ref"> & React.RefAttributes<WherebyVideoElement>>;
|
|
21
31
|
|
|
22
32
|
interface LocalMediaState {
|
|
23
33
|
currentCameraDeviceId?: string;
|
|
24
34
|
currentMicrophoneDeviceId?: string;
|
|
35
|
+
currentSpeakerDeviceId?: string;
|
|
25
36
|
cameraDeviceError: unknown;
|
|
26
37
|
cameraDevices: MediaDeviceInfo[];
|
|
27
38
|
isSettingCameraDevice: boolean;
|
|
@@ -36,6 +47,7 @@ interface LocalMediaState {
|
|
|
36
47
|
interface LocalMediaActions {
|
|
37
48
|
setCameraDevice: (deviceId: string) => void;
|
|
38
49
|
setMicrophoneDevice: (deviceId: string) => void;
|
|
50
|
+
setSpeakerDevice: (deviceId: string) => void;
|
|
39
51
|
toggleCameraEnabled: (enabled?: boolean) => void;
|
|
40
52
|
toggleMicrophoneEnabled: (enabled?: boolean) => void;
|
|
41
53
|
toggleLowDataModeEnabled: (enabled?: boolean) => void;
|
|
@@ -43,7 +55,6 @@ interface LocalMediaActions {
|
|
|
43
55
|
type UseLocalMediaResult = {
|
|
44
56
|
state: LocalMediaState;
|
|
45
57
|
actions: LocalMediaActions;
|
|
46
|
-
store: Store;
|
|
47
58
|
};
|
|
48
59
|
type UseLocalMediaOptions = LocalMediaOptions;
|
|
49
60
|
|
|
@@ -75,15 +86,17 @@ type LiveStreamState = {
|
|
|
75
86
|
startedAt?: number;
|
|
76
87
|
};
|
|
77
88
|
interface RoomConnectionState {
|
|
89
|
+
connectionStatus: ConnectionStatus;
|
|
78
90
|
chatMessages: ChatMessage[];
|
|
79
91
|
cloudRecording?: CloudRecordingState;
|
|
92
|
+
events?: NotificationsEventEmitter;
|
|
93
|
+
liveStream?: LiveStreamState;
|
|
80
94
|
localScreenshareStatus?: LocalScreenshareStatus;
|
|
81
95
|
localParticipant?: LocalParticipantState;
|
|
82
96
|
remoteParticipants: RemoteParticipantState[];
|
|
83
97
|
screenshares: Screenshare[];
|
|
84
|
-
connectionStatus: ConnectionStatus;
|
|
85
|
-
liveStream?: LiveStreamState;
|
|
86
98
|
waitingParticipants: WaitingParticipantState[];
|
|
99
|
+
spotlightedParticipants: ClientView[];
|
|
87
100
|
}
|
|
88
101
|
interface RoomConnectionOptions {
|
|
89
102
|
displayName?: string;
|
|
@@ -97,6 +110,8 @@ interface UseRoomConnectionOptions extends Omit<RoomConnectionOptions, "localMed
|
|
|
97
110
|
}
|
|
98
111
|
interface RoomConnectionActions {
|
|
99
112
|
toggleLowDataMode(enabled?: boolean): void;
|
|
113
|
+
toggleRaiseHand(enabled?: boolean): void;
|
|
114
|
+
askToSpeak(participantId: string): void;
|
|
100
115
|
acceptWaitingParticipant(participantId: string): void;
|
|
101
116
|
knock(): void;
|
|
102
117
|
joinRoom(): void;
|
|
@@ -114,20 +129,54 @@ interface RoomConnectionActions {
|
|
|
114
129
|
stopScreenshare(): void;
|
|
115
130
|
toggleCamera(enabled?: boolean): void;
|
|
116
131
|
toggleMicrophone(enabled?: boolean): void;
|
|
132
|
+
spotlightParticipant(clientId: string): void;
|
|
133
|
+
removeSpotlight(clientId: string): void;
|
|
117
134
|
}
|
|
118
135
|
|
|
119
|
-
type VideoViewComponentProps = Omit<React.ComponentProps<typeof _default>, "onResize">;
|
|
120
|
-
interface RoomConnectionComponents {
|
|
121
|
-
VideoView: (props: VideoViewComponentProps) => ReturnType<typeof _default>;
|
|
122
|
-
}
|
|
123
136
|
type RoomConnectionRef = {
|
|
124
|
-
state: RoomConnectionState
|
|
137
|
+
state: Omit<RoomConnectionState, "events">;
|
|
125
138
|
actions: RoomConnectionActions;
|
|
126
|
-
|
|
127
|
-
_ref: Store;
|
|
139
|
+
events?: NotificationsEventEmitter;
|
|
128
140
|
};
|
|
129
141
|
declare function useRoomConnection(roomUrl: string, roomConnectionOptions?: UseRoomConnectionOptions): RoomConnectionRef;
|
|
130
142
|
|
|
131
143
|
declare function useLocalMedia(optionsOrStream?: UseLocalMediaOptions | MediaStream): UseLocalMediaResult;
|
|
132
144
|
|
|
133
|
-
|
|
145
|
+
type Origin = {
|
|
146
|
+
top: number;
|
|
147
|
+
left: number;
|
|
148
|
+
};
|
|
149
|
+
type Bounds = {
|
|
150
|
+
width: number;
|
|
151
|
+
height: number;
|
|
152
|
+
};
|
|
153
|
+
type CellView = {
|
|
154
|
+
aspectRatio?: number;
|
|
155
|
+
avatarSize?: number;
|
|
156
|
+
cellPaddings?: {
|
|
157
|
+
top: number;
|
|
158
|
+
right: number;
|
|
159
|
+
};
|
|
160
|
+
client?: ClientView;
|
|
161
|
+
clientId: string;
|
|
162
|
+
isDraggable?: boolean;
|
|
163
|
+
isPlaceholder?: boolean;
|
|
164
|
+
isSubgrid?: boolean;
|
|
165
|
+
type: string;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
interface GridProps {
|
|
169
|
+
renderParticipant?: ({ cell, participant, }: {
|
|
170
|
+
cell: {
|
|
171
|
+
clientId: string;
|
|
172
|
+
bounds: Bounds;
|
|
173
|
+
origin: Origin;
|
|
174
|
+
};
|
|
175
|
+
participant: CellView["client"];
|
|
176
|
+
}) => React.ReactNode;
|
|
177
|
+
videoGridGap?: number;
|
|
178
|
+
stageParticipantLimit?: number;
|
|
179
|
+
}
|
|
180
|
+
declare function Grid({ renderParticipant, stageParticipantLimit, videoGridGap }: GridProps): React.JSX.Element;
|
|
181
|
+
|
|
182
|
+
export { type ChatMessageState as ChatMessage, type LocalParticipantState as LocalParticipant, type RemoteParticipantState as RemoteParticipant, type RoomConnectionState as RoomConnection, type ScreenshareState as Screenshare, type UseLocalMediaResult, Grid as VideoGrid, VideoView, type WaitingParticipantState as WaitingParticipant, Provider as WherebyProvider, useLocalMedia, useRoomConnection };
|