@whereby.com/browser-sdk 2.0.0-beta2 → 2.0.0-beta3
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/README.md +0 -14
- package/dist/embed/index.d.ts +4 -1
- package/dist/embed/{index.js → index.esm.js} +117 -109
- package/dist/react/index.d.ts +397 -6
- package/dist/react/index.esm.js +8245 -0
- package/dist/utils/index.d.ts +5 -2
- package/dist/utils/{fakeWebcamFrame.js → index.esm.js} +68 -47
- package/dist/v2-beta3.js +15 -0
- package/package.json +22 -12
- package/dist/LocalMedia.d.ts +0 -70
- package/dist/LocalMedia.js +0 -208
- package/dist/RoomConnection.d.ts +0 -190
- package/dist/RoomConnection.js +0 -646
- package/dist/RoomParticipant.d.ts +0 -50
- package/dist/RoomParticipant.js +0 -48
- package/dist/api/ApiClient.d.ts +0 -26
- package/dist/api/ApiClient.js +0 -61
- package/dist/api/Credentials.d.ts +0 -17
- package/dist/api/Credentials.js +0 -16
- package/dist/api/HttpClient.d.ts +0 -16
- package/dist/api/HttpClient.js +0 -52
- package/dist/api/MultipartHttpClient.d.ts +0 -10
- package/dist/api/MultipartHttpClient.js +0 -25
- package/dist/api/OrganizationApiClient.d.ts +0 -16
- package/dist/api/OrganizationApiClient.js +0 -28
- package/dist/api/Response.d.ts +0 -29
- package/dist/api/Response.js +0 -9
- package/dist/api/credentialsService/index.d.ts +0 -27
- package/dist/api/credentialsService/index.js +0 -89
- package/dist/api/deviceService/index.d.ts +0 -9
- package/dist/api/deviceService/index.js +0 -23
- package/dist/api/extractUtils.d.ts +0 -16
- package/dist/api/extractUtils.js +0 -51
- package/dist/api/index.d.ts +0 -7
- package/dist/api/index.js +0 -7
- package/dist/api/localStorageWrapper/index.d.ts +0 -2
- package/dist/api/localStorageWrapper/index.js +0 -15
- package/dist/api/models/Account.d.ts +0 -20
- package/dist/api/models/Account.js +0 -24
- package/dist/api/models/Meeting.d.ts +0 -12
- package/dist/api/models/Meeting.js +0 -29
- package/dist/api/models/Organization.d.ts +0 -102
- package/dist/api/models/Organization.js +0 -81
- package/dist/api/models/Room.d.ts +0 -4
- package/dist/api/models/Room.js +0 -38
- package/dist/api/models/account/EmbeddedFreeTierStatus.d.ts +0 -13
- package/dist/api/models/account/EmbeddedFreeTierStatus.js +0 -17
- package/dist/api/modules/AbstractStore.d.ts +0 -5
- package/dist/api/modules/AbstractStore.js +0 -1
- package/dist/api/modules/ChromeStorageStore.d.ts +0 -10
- package/dist/api/modules/ChromeStorageStore.js +0 -21
- package/dist/api/modules/LocalStorageStore.d.ts +0 -9
- package/dist/api/modules/LocalStorageStore.js +0 -35
- package/dist/api/modules/tests/__mocks__/storage.d.ts +0 -10
- package/dist/api/modules/tests/__mocks__/storage.js +0 -19
- package/dist/api/organizationService/index.d.ts +0 -46
- package/dist/api/organizationService/index.js +0 -158
- package/dist/api/organizationServiceCache/index.d.ts +0 -13
- package/dist/api/organizationServiceCache/index.js +0 -16
- package/dist/api/parameterAssertUtils.d.ts +0 -13
- package/dist/api/parameterAssertUtils.js +0 -64
- package/dist/api/roomService/index.d.ts +0 -54
- package/dist/api/roomService/index.js +0 -160
- package/dist/api/test/helpers.d.ts +0 -7
- package/dist/api/test/helpers.js +0 -32
- package/dist/api/types.d.ts +0 -5
- package/dist/api/types.js +0 -1
- package/dist/react/VideoView.d.ts +0 -15
- package/dist/react/VideoView.js +0 -37
- package/dist/react/index.js +0 -4
- package/dist/react/useLocalMedia.d.ts +0 -29
- package/dist/react/useLocalMedia.js +0 -109
- package/dist/react/useRoomConnection.d.ts +0 -57
- package/dist/react/useRoomConnection.js +0 -340
- package/dist/utils/debounce.d.ts +0 -9
- package/dist/utils/debounce.js +0 -18
- package/dist/utils/fakeAudioStream.d.ts +0 -1
- package/dist/utils/fakeAudioStream.js +0 -18
- package/dist/utils/fakeWebcamFrame.d.ts +0 -1
- package/dist/utils/index.js +0 -2
- package/dist/v2-beta2.js +0 -2000
- package/dist/version.d.ts +0 -1
- package/dist/version.js +0 -1
package/README.md
CHANGED
|
@@ -102,20 +102,6 @@ function MyCallUX( { roomUrl, localStream }) {
|
|
|
102
102
|
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
-
#### Usage with Vite development environment
|
|
106
|
-
|
|
107
|
-
There is a [known Vite issue](https://github.com/vitejs/vite/issues/1973) where modules trying to access `process.env` throw `Uncaught ReferenceError: process is not defined`.
|
|
108
|
-
This can be solved in `vite.config.js` with the following line:
|
|
109
|
-
|
|
110
|
-
``` javascript
|
|
111
|
-
export default defineConfig({
|
|
112
|
-
...rest,
|
|
113
|
-
define: {
|
|
114
|
-
'process.env': {}
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
```
|
|
118
|
-
|
|
119
105
|
#### Usage with Next.js
|
|
120
106
|
|
|
121
107
|
If you are integrating these React hooks with Next.js, you need to ensure your
|
package/dist/embed/index.d.ts
CHANGED
|
@@ -1,60 +1,62 @@
|
|
|
1
|
-
import { define, ref } from
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
1
|
+
import { define, ref } from 'heresy';
|
|
2
|
+
|
|
3
|
+
const sdkVersion = "2.0.0-beta3";
|
|
4
|
+
|
|
5
|
+
const boolAttrs = [
|
|
6
|
+
"audio",
|
|
7
|
+
"background",
|
|
8
|
+
"cameraaccess",
|
|
9
|
+
"chat",
|
|
10
|
+
"people",
|
|
11
|
+
"embed",
|
|
12
|
+
"emptyRoomInvitation",
|
|
13
|
+
"help",
|
|
14
|
+
"leaveButton",
|
|
15
|
+
"precallReview",
|
|
16
|
+
"screenshare",
|
|
17
|
+
"video",
|
|
18
|
+
"floatSelf",
|
|
19
|
+
"recording",
|
|
20
|
+
"logo",
|
|
21
|
+
"locking",
|
|
22
|
+
"participantCount",
|
|
23
|
+
"settingsButton",
|
|
24
|
+
"pipButton",
|
|
25
|
+
"moreButton",
|
|
26
|
+
"personality",
|
|
27
|
+
"subgridLabels",
|
|
28
|
+
"lowData",
|
|
29
|
+
"breakout",
|
|
30
|
+
];
|
|
31
|
+
define("WherebyEmbed", {
|
|
32
|
+
oninit() {
|
|
33
|
+
this.iframe = ref();
|
|
34
|
+
},
|
|
35
|
+
onconnected() {
|
|
36
|
+
window.addEventListener("message", this.onmessage.bind(this));
|
|
37
|
+
},
|
|
38
|
+
ondisconnected() {
|
|
39
|
+
window.removeEventListener("message", this.onmessage.bind(this));
|
|
40
|
+
},
|
|
41
|
+
observedAttributes: [
|
|
42
|
+
"displayName",
|
|
43
|
+
"minimal",
|
|
44
|
+
"room",
|
|
45
|
+
"subdomain",
|
|
46
|
+
"lang",
|
|
47
|
+
"metadata",
|
|
48
|
+
"groups",
|
|
49
|
+
"virtualBackgroundUrl",
|
|
50
|
+
"avatarUrl",
|
|
51
|
+
"externalId",
|
|
52
|
+
...boolAttrs,
|
|
53
|
+
].map((a) => a.toLowerCase()),
|
|
54
|
+
onattributechanged({ attributeName, oldValue }) {
|
|
55
|
+
if (["room", "subdomain"].includes(attributeName) && oldValue == null)
|
|
56
|
+
return;
|
|
57
|
+
this.render();
|
|
58
|
+
},
|
|
59
|
+
style(self) {
|
|
58
60
|
return `
|
|
59
61
|
${self} {
|
|
60
62
|
display: block;
|
|
@@ -64,61 +66,67 @@ define("WherebyEmbed", {
|
|
|
64
66
|
height: 100%;
|
|
65
67
|
width: 100%;
|
|
66
68
|
}
|
|
67
|
-
`;
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (!
|
|
104
|
-
return this.html `
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
})
|
|
69
|
+
`;
|
|
70
|
+
},
|
|
71
|
+
// Commands
|
|
72
|
+
_postCommand(command, args = []) {
|
|
73
|
+
if (this.iframe.current) {
|
|
74
|
+
this.iframe.current.contentWindow.postMessage({ command, args }, this.url.origin);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
startRecording() {
|
|
78
|
+
this._postCommand("start_recording");
|
|
79
|
+
},
|
|
80
|
+
stopRecording() {
|
|
81
|
+
this._postCommand("stop_recording");
|
|
82
|
+
},
|
|
83
|
+
toggleCamera(enabled) {
|
|
84
|
+
this._postCommand("toggle_camera", [enabled]);
|
|
85
|
+
},
|
|
86
|
+
toggleMicrophone(enabled) {
|
|
87
|
+
this._postCommand("toggle_microphone", [enabled]);
|
|
88
|
+
},
|
|
89
|
+
toggleScreenshare(enabled) {
|
|
90
|
+
this._postCommand("toggle_screenshare", [enabled]);
|
|
91
|
+
},
|
|
92
|
+
onmessage({ origin, data }) {
|
|
93
|
+
if (origin !== this.url.origin)
|
|
94
|
+
return;
|
|
95
|
+
const { type, payload: detail } = data;
|
|
96
|
+
this.dispatchEvent(new CustomEvent(type, { detail }));
|
|
97
|
+
},
|
|
98
|
+
render() {
|
|
99
|
+
const { avatarurl: avatarUrl, displayname: displayName, externalId: externalId, lang, metadata, minimal, room, groups, virtualbackgroundurl: virtualBackgroundUrl, } = this;
|
|
100
|
+
if (!room)
|
|
101
|
+
return this.html `Whereby: Missing room attribute.`;
|
|
102
|
+
// Get subdomain from room URL, or use it specified
|
|
103
|
+
const m = /https:\/\/([^.]+)(\.whereby.com|-ip-\d+-\d+-\d+-\d+.hereby.dev:4443)\/.+/.exec(room);
|
|
104
|
+
const subdomain = (m && m[1]) || this.subdomain;
|
|
105
|
+
if (!subdomain)
|
|
106
|
+
return this.html `Whereby: Missing subdomain attr.`;
|
|
107
|
+
if (!m) {
|
|
108
|
+
return this.html `could not parse URL.`;
|
|
109
|
+
}
|
|
110
|
+
const baseURL = m[2] || `.whereby.com`;
|
|
111
|
+
this.url = new URL(room, `https://${subdomain}${baseURL}`);
|
|
112
|
+
const roomUrl = new URL(room);
|
|
113
|
+
if (roomUrl.searchParams.get("roomKey")) {
|
|
114
|
+
this.url.searchParams.append("roomKey", roomUrl.searchParams.get("roomKey"));
|
|
115
|
+
}
|
|
116
|
+
Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-beta3", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (externalId && { externalId })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
|
|
117
|
+
// add to URL if set in any way
|
|
118
|
+
(o, v) => (this[v.toLowerCase()] != null ? Object.assign(Object.assign({}, o), { [v]: this[v.toLowerCase()] }) : o), {}))).forEach(([k, v]) => {
|
|
119
|
+
if (!this.url.searchParams.has(k) && typeof v === "string") {
|
|
120
|
+
this.url.searchParams.set(k, v);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
117
123
|
return this.html `
|
|
118
124
|
<iframe
|
|
119
125
|
ref=${this.iframe}
|
|
120
126
|
src=${this.url}
|
|
121
127
|
allow="autoplay; camera; microphone; fullscreen; speaker; display-capture" />
|
|
122
|
-
`;
|
|
123
|
-
},
|
|
128
|
+
`;
|
|
129
|
+
},
|
|
124
130
|
});
|
|
131
|
+
|
|
132
|
+
export { sdkVersion };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,6 +1,397 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import RtcManager from '@whereby/jslib-media/src/webrtc/RtcManager';
|
|
3
|
+
import { ChatMessage as ChatMessage$1 } from '@whereby/jslib-media/src/utils/ServerSocket';
|
|
4
|
+
|
|
5
|
+
interface VideoViewSelfProps {
|
|
6
|
+
stream: MediaStream;
|
|
7
|
+
muted?: boolean;
|
|
8
|
+
mirror?: boolean;
|
|
9
|
+
style?: React.CSSProperties;
|
|
10
|
+
onResize?: ({ width, height, stream }: {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
stream: MediaStream;
|
|
14
|
+
}) => void;
|
|
15
|
+
}
|
|
16
|
+
type VideoViewProps = VideoViewSelfProps & React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>;
|
|
17
|
+
declare const _default: ({ muted, mirror, stream, onResize, ...rest }: VideoViewProps) => React.JSX.Element;
|
|
18
|
+
|
|
19
|
+
type CameraEnabledEvent = {
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
};
|
|
22
|
+
type MicrophoneEnabledEvent = {
|
|
23
|
+
enabled: boolean;
|
|
24
|
+
};
|
|
25
|
+
type DeviceListUpdatedEvent = {
|
|
26
|
+
cameraDevices: MediaDeviceInfo[];
|
|
27
|
+
microphoneDevices: MediaDeviceInfo[];
|
|
28
|
+
speakerDevices: MediaDeviceInfo[];
|
|
29
|
+
};
|
|
30
|
+
type DeviceListUpdateErrorEvent = {
|
|
31
|
+
error: unknown;
|
|
32
|
+
};
|
|
33
|
+
type StreamUpdatedEvent = {
|
|
34
|
+
stream: MediaStream;
|
|
35
|
+
};
|
|
36
|
+
type StopResumeVideoEvent = {
|
|
37
|
+
track: MediaStreamTrack;
|
|
38
|
+
enable: boolean;
|
|
39
|
+
};
|
|
40
|
+
interface LocalMediaEventsMap {
|
|
41
|
+
camera_enabled: CustomEvent<CameraEnabledEvent>;
|
|
42
|
+
device_list_updated: CustomEvent<DeviceListUpdatedEvent>;
|
|
43
|
+
device_list_update_error: CustomEvent<DeviceListUpdateErrorEvent>;
|
|
44
|
+
microphone_enabled: CustomEvent<MicrophoneEnabledEvent>;
|
|
45
|
+
stream_updated: CustomEvent<StreamUpdatedEvent>;
|
|
46
|
+
stopresumevideo: CustomEvent<StopResumeVideoEvent>;
|
|
47
|
+
}
|
|
48
|
+
interface LocalMediaEventTarget extends EventTarget {
|
|
49
|
+
addEventListener<K extends keyof LocalMediaEventsMap>(type: K, listener: (ev: LocalMediaEventsMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
50
|
+
addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
|
|
51
|
+
}
|
|
52
|
+
declare const TypedLocalMediaEventTarget: new () => LocalMediaEventTarget;
|
|
53
|
+
interface LocalMediaOptions {
|
|
54
|
+
audio: boolean;
|
|
55
|
+
video: boolean;
|
|
56
|
+
}
|
|
57
|
+
declare class LocalMedia extends TypedLocalMediaEventTarget {
|
|
58
|
+
private _options;
|
|
59
|
+
_rtcManagers: RtcManager[];
|
|
60
|
+
private _devices;
|
|
61
|
+
stream: MediaStream;
|
|
62
|
+
screenshareStream?: MediaStream;
|
|
63
|
+
private _cameraEnabled;
|
|
64
|
+
private _currentCameraDeviceId;
|
|
65
|
+
private _isTogglingCameraEnabled;
|
|
66
|
+
private _microphoneEnabled;
|
|
67
|
+
private _currentMicrophoneDeviceId;
|
|
68
|
+
constructor(optionsOrStream: LocalMediaOptions | MediaStream);
|
|
69
|
+
addRtcManager(rtcManager: RtcManager): void;
|
|
70
|
+
removeRtcManager(rtcManager: RtcManager): void;
|
|
71
|
+
getCameraDeviceId(): string | undefined;
|
|
72
|
+
getMicrophoneDeviceId(): string | undefined;
|
|
73
|
+
isCameraEnabled(): boolean;
|
|
74
|
+
isMicrophoneEnabled(): boolean;
|
|
75
|
+
toggleCameraEnabled(enabled?: boolean): Promise<void>;
|
|
76
|
+
toggleMichrophoneEnabled(enabled?: boolean): void;
|
|
77
|
+
startScreenshare(): Promise<MediaStream>;
|
|
78
|
+
stopScreenshare(): void;
|
|
79
|
+
private _getConstraintsOptions;
|
|
80
|
+
private _setDevice;
|
|
81
|
+
setCameraDevice(deviceId: string): Promise<void>;
|
|
82
|
+
setMicrophoneDevice(deviceId: string): Promise<void>;
|
|
83
|
+
private _updateDeviceList;
|
|
84
|
+
start(): Promise<MediaStream>;
|
|
85
|
+
stop(): void;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
interface LocalMediaState {
|
|
89
|
+
currentCameraDeviceId?: string;
|
|
90
|
+
currentMicrophoneDeviceId?: string;
|
|
91
|
+
cameraDeviceError: unknown;
|
|
92
|
+
cameraDevices: MediaDeviceInfo[];
|
|
93
|
+
isSettingCameraDevice: boolean;
|
|
94
|
+
isSettingMicrophoneDevice: boolean;
|
|
95
|
+
isStarting: boolean;
|
|
96
|
+
localStream?: MediaStream;
|
|
97
|
+
microphoneDeviceError: unknown;
|
|
98
|
+
microphoneDevices: MediaDeviceInfo[];
|
|
99
|
+
speakerDevices: MediaDeviceInfo[];
|
|
100
|
+
startError: unknown;
|
|
101
|
+
}
|
|
102
|
+
interface LocalMediaActions {
|
|
103
|
+
setCameraDevice: InstanceType<typeof LocalMedia>["setCameraDevice"];
|
|
104
|
+
setMicrophoneDevice: InstanceType<typeof LocalMedia>["setMicrophoneDevice"];
|
|
105
|
+
toggleCameraEnabled: InstanceType<typeof LocalMedia>["toggleCameraEnabled"];
|
|
106
|
+
toggleMicrophoneEnabled: InstanceType<typeof LocalMedia>["toggleMichrophoneEnabled"];
|
|
107
|
+
}
|
|
108
|
+
type LocalMediaRef = {
|
|
109
|
+
state: LocalMediaState;
|
|
110
|
+
actions: LocalMediaActions;
|
|
111
|
+
_ref: LocalMedia;
|
|
112
|
+
};
|
|
113
|
+
type UseLocalMediaOptions = LocalMediaOptions;
|
|
114
|
+
declare function useLocalMedia(optionsOrStream?: UseLocalMediaOptions | MediaStream): LocalMediaRef;
|
|
115
|
+
|
|
116
|
+
interface RoomParticipantData {
|
|
117
|
+
displayName: string;
|
|
118
|
+
id: string;
|
|
119
|
+
stream?: MediaStream;
|
|
120
|
+
isAudioEnabled: boolean;
|
|
121
|
+
isVideoEnabled: boolean;
|
|
122
|
+
}
|
|
123
|
+
declare class RoomParticipant {
|
|
124
|
+
readonly displayName: string;
|
|
125
|
+
readonly id: string;
|
|
126
|
+
readonly stream?: MediaStream;
|
|
127
|
+
readonly isAudioEnabled: boolean;
|
|
128
|
+
readonly isLocalParticipant: boolean;
|
|
129
|
+
readonly isVideoEnabled: boolean;
|
|
130
|
+
constructor({ displayName, id, stream, isAudioEnabled, isVideoEnabled }: RoomParticipantData);
|
|
131
|
+
}
|
|
132
|
+
interface RemoteParticipantData {
|
|
133
|
+
newJoiner: boolean;
|
|
134
|
+
streams: string[];
|
|
135
|
+
}
|
|
136
|
+
type StreamState = "new_accept" | "to_accept" | "old_accept" | "done_accept" | "to_unaccept" | "done_unaccept" | "auto";
|
|
137
|
+
interface Stream {
|
|
138
|
+
id: string;
|
|
139
|
+
state: StreamState;
|
|
140
|
+
}
|
|
141
|
+
declare class RemoteParticipant extends RoomParticipant {
|
|
142
|
+
readonly newJoiner: boolean;
|
|
143
|
+
readonly streams: Stream[];
|
|
144
|
+
constructor({ displayName, id, newJoiner, streams, isAudioEnabled, isVideoEnabled, }: RoomParticipantData & RemoteParticipantData);
|
|
145
|
+
addStream(streamId: string, state: StreamState): void;
|
|
146
|
+
removeStream(streamId: string): void;
|
|
147
|
+
updateStreamState(streamId: string, state: StreamState): void;
|
|
148
|
+
}
|
|
149
|
+
declare class LocalParticipant extends RoomParticipant {
|
|
150
|
+
readonly isLocalParticipant = true;
|
|
151
|
+
constructor({ displayName, id, stream, isAudioEnabled, isVideoEnabled }: RoomParticipantData);
|
|
152
|
+
}
|
|
153
|
+
interface WaitingParticipant {
|
|
154
|
+
id: string;
|
|
155
|
+
displayName: string | null;
|
|
156
|
+
}
|
|
157
|
+
declare class Screenshare {
|
|
158
|
+
readonly participantId: string;
|
|
159
|
+
readonly id: string;
|
|
160
|
+
readonly hasAudioTrack: boolean;
|
|
161
|
+
readonly stream?: MediaStream;
|
|
162
|
+
readonly isLocal: boolean;
|
|
163
|
+
constructor({ participantId, id, hasAudioTrack, stream, isLocal }: Screenshare);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
type Logger = Pick<Console, "debug" | "error" | "log" | "warn" | "info">;
|
|
167
|
+
interface RoomConnectionOptions {
|
|
168
|
+
displayName?: string;
|
|
169
|
+
localMediaOptions?: LocalMediaOptions;
|
|
170
|
+
roomKey?: string;
|
|
171
|
+
logger?: Logger;
|
|
172
|
+
localMedia?: LocalMedia;
|
|
173
|
+
externalId?: string;
|
|
174
|
+
}
|
|
175
|
+
type ChatMessage = Pick<ChatMessage$1, "senderId" | "timestamp" | "text">;
|
|
176
|
+
type ConnectionStatus = "initializing" | "connecting" | "connected" | "room_locked" | "knocking" | "disconnecting" | "disconnected" | "knock_rejected";
|
|
177
|
+
type CloudRecordingState = {
|
|
178
|
+
error?: string;
|
|
179
|
+
status: "recording" | "requested" | "error";
|
|
180
|
+
startedAt?: number;
|
|
181
|
+
};
|
|
182
|
+
type LiveStreamState = {
|
|
183
|
+
status: "streaming";
|
|
184
|
+
startedAt: number;
|
|
185
|
+
};
|
|
186
|
+
type RoomJoinedEvent = {
|
|
187
|
+
localParticipant: LocalParticipant;
|
|
188
|
+
remoteParticipants: RemoteParticipant[];
|
|
189
|
+
waitingParticipants: WaitingParticipant[];
|
|
190
|
+
};
|
|
191
|
+
type ConnectionStatusChangedEvent = {
|
|
192
|
+
connectionStatus: ConnectionStatus;
|
|
193
|
+
};
|
|
194
|
+
type ParticipantJoinedEvent = {
|
|
195
|
+
remoteParticipant: RemoteParticipant;
|
|
196
|
+
};
|
|
197
|
+
type ParticipantLeftEvent = {
|
|
198
|
+
participantId: string;
|
|
199
|
+
};
|
|
200
|
+
type ParticipantStreamAddedEvent = {
|
|
201
|
+
participantId: string;
|
|
202
|
+
stream: MediaStream;
|
|
203
|
+
streamId: string;
|
|
204
|
+
};
|
|
205
|
+
type ParticipantAudioEnabledEvent = {
|
|
206
|
+
participantId: string;
|
|
207
|
+
isAudioEnabled: boolean;
|
|
208
|
+
};
|
|
209
|
+
type ParticipantVideoEnabledEvent = {
|
|
210
|
+
participantId: string;
|
|
211
|
+
isVideoEnabled: boolean;
|
|
212
|
+
};
|
|
213
|
+
type ParticipantMetadataChangedEvent = {
|
|
214
|
+
participantId: string;
|
|
215
|
+
displayName: string;
|
|
216
|
+
};
|
|
217
|
+
type ScreenshareStartedEvent = {
|
|
218
|
+
participantId: string;
|
|
219
|
+
id: string;
|
|
220
|
+
hasAudioTrack: boolean;
|
|
221
|
+
stream: MediaStream;
|
|
222
|
+
isLocal: boolean;
|
|
223
|
+
};
|
|
224
|
+
type ScreenshareStoppedEvent = {
|
|
225
|
+
participantId: string;
|
|
226
|
+
id: string;
|
|
227
|
+
};
|
|
228
|
+
type WaitingParticipantJoinedEvent = {
|
|
229
|
+
participantId: string;
|
|
230
|
+
displayName: string | null;
|
|
231
|
+
};
|
|
232
|
+
type WaitingParticipantLeftEvent = {
|
|
233
|
+
participantId: string;
|
|
234
|
+
};
|
|
235
|
+
type LocalCameraEnabledEvent = {
|
|
236
|
+
enabled: boolean;
|
|
237
|
+
};
|
|
238
|
+
type LocalMicrophoneEnabledEvent = {
|
|
239
|
+
enabled: boolean;
|
|
240
|
+
};
|
|
241
|
+
interface RoomEventsMap {
|
|
242
|
+
chat_message: (e: CustomEvent<ChatMessage>) => void;
|
|
243
|
+
cloud_recording_request_started: (e: CustomEvent<CloudRecordingState>) => void;
|
|
244
|
+
cloud_recording_started: (e: CustomEvent<CloudRecordingState>) => void;
|
|
245
|
+
cloud_recording_started_error: (e: CustomEvent<CloudRecordingState>) => void;
|
|
246
|
+
cloud_recording_stopped: (e: CustomEvent<CloudRecordingState>) => void;
|
|
247
|
+
local_camera_enabled: (e: CustomEvent<LocalCameraEnabledEvent>) => void;
|
|
248
|
+
local_microphone_enabled: (e: CustomEvent<LocalMicrophoneEnabledEvent>) => void;
|
|
249
|
+
participant_audio_enabled: (e: CustomEvent<ParticipantAudioEnabledEvent>) => void;
|
|
250
|
+
participant_joined: (e: CustomEvent<ParticipantJoinedEvent>) => void;
|
|
251
|
+
participant_left: (e: CustomEvent<ParticipantLeftEvent>) => void;
|
|
252
|
+
participant_metadata_changed: (e: CustomEvent<ParticipantMetadataChangedEvent>) => void;
|
|
253
|
+
participant_stream_added: (e: CustomEvent<ParticipantStreamAddedEvent>) => void;
|
|
254
|
+
participant_video_enabled: (e: CustomEvent<ParticipantVideoEnabledEvent>) => void;
|
|
255
|
+
connection_status_changed: (e: CustomEvent<ConnectionStatusChangedEvent>) => void;
|
|
256
|
+
room_joined: (e: CustomEvent<RoomJoinedEvent>) => void;
|
|
257
|
+
screenshare_started: (e: CustomEvent<ScreenshareStartedEvent>) => void;
|
|
258
|
+
screenshare_stopped: (e: CustomEvent<ScreenshareStoppedEvent>) => void;
|
|
259
|
+
streaming_started: (e: CustomEvent<LiveStreamState>) => void;
|
|
260
|
+
streaming_stopped: (e: CustomEvent<LiveStreamState>) => void;
|
|
261
|
+
waiting_participant_joined: (e: CustomEvent<WaitingParticipantJoinedEvent>) => void;
|
|
262
|
+
waiting_participant_left: (e: CustomEvent<WaitingParticipantLeftEvent>) => void;
|
|
263
|
+
}
|
|
264
|
+
interface RoomEventTarget extends EventTarget {
|
|
265
|
+
addEventListener<K extends keyof RoomEventsMap>(type: K, listener: RoomEventsMap[K], options?: boolean | AddEventListenerOptions): void;
|
|
266
|
+
addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
|
|
267
|
+
removeEventListener<K extends keyof RoomEventsMap>(type: K, listener: RoomEventsMap[K], options?: boolean | EventListenerOptions): void;
|
|
268
|
+
removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
|
|
269
|
+
}
|
|
270
|
+
declare const TypedEventTarget: new () => RoomEventTarget;
|
|
271
|
+
declare class RoomConnection extends TypedEventTarget {
|
|
272
|
+
localMedia: LocalMedia;
|
|
273
|
+
localParticipant?: LocalParticipant;
|
|
274
|
+
roomUrl: URL;
|
|
275
|
+
remoteParticipants: RemoteParticipant[];
|
|
276
|
+
screenshares: Screenshare[];
|
|
277
|
+
readonly localMediaConstraints?: MediaStreamConstraints;
|
|
278
|
+
readonly roomName: string;
|
|
279
|
+
private organizationId;
|
|
280
|
+
private credentialsService;
|
|
281
|
+
private apiClient;
|
|
282
|
+
private organizationService;
|
|
283
|
+
private organizationServiceCache;
|
|
284
|
+
private organizationApiClient;
|
|
285
|
+
private roomService;
|
|
286
|
+
private _deviceCredentials;
|
|
287
|
+
private signalSocket;
|
|
288
|
+
private signalSocketManager;
|
|
289
|
+
private rtcManagerDispatcher?;
|
|
290
|
+
private rtcManager?;
|
|
291
|
+
private connectionStatus;
|
|
292
|
+
private selfId;
|
|
293
|
+
private logger;
|
|
294
|
+
private _ownsLocalMedia;
|
|
295
|
+
private displayName?;
|
|
296
|
+
private externalId?;
|
|
297
|
+
private _roomKey;
|
|
298
|
+
constructor(roomUrl: string, { displayName, localMedia, localMediaOptions: localMediaConstraints, logger, roomKey, externalId, }: RoomConnectionOptions);
|
|
299
|
+
get roomKey(): string | null;
|
|
300
|
+
private _handleNewChatMessage;
|
|
301
|
+
private _handleCloudRecordingStarted;
|
|
302
|
+
private _handleRecorderClientJoined;
|
|
303
|
+
private _handleStreamingStarted;
|
|
304
|
+
private _handleNewClient;
|
|
305
|
+
private _handleClientLeft;
|
|
306
|
+
private _handleClientAudioEnabled;
|
|
307
|
+
private _handleClientVideoEnabled;
|
|
308
|
+
private _handleClientMetadataReceived;
|
|
309
|
+
private _handleKnockHandled;
|
|
310
|
+
private _handleKnockerLeft;
|
|
311
|
+
private _handleRoomJoined;
|
|
312
|
+
private _handleRoomKnocked;
|
|
313
|
+
private _handleReconnect;
|
|
314
|
+
private _handleDisconnect;
|
|
315
|
+
private _handleCloudRecordingStopped;
|
|
316
|
+
private _handleStreamingStopped;
|
|
317
|
+
private _handleScreenshareStarted;
|
|
318
|
+
private _handleScreenshareStopped;
|
|
319
|
+
private _handleRtcEvent;
|
|
320
|
+
private _handleRtcManagerCreated;
|
|
321
|
+
private _handleRtcManagerDestroyed;
|
|
322
|
+
private _handleAcceptStreams;
|
|
323
|
+
private _handleStreamAdded;
|
|
324
|
+
private _joinRoom;
|
|
325
|
+
join(): Promise<void>;
|
|
326
|
+
knock(): void;
|
|
327
|
+
leave(): void;
|
|
328
|
+
sendChatMessage(text: string): void;
|
|
329
|
+
setDisplayName(displayName: string): void;
|
|
330
|
+
acceptWaitingParticipant(participantId: string): void;
|
|
331
|
+
rejectWaitingParticipant(participantId: string): void;
|
|
332
|
+
updateStreamResolution({ streamId, width, height }: {
|
|
333
|
+
streamId?: string;
|
|
334
|
+
width: number;
|
|
335
|
+
height: number;
|
|
336
|
+
}): void;
|
|
337
|
+
startScreenshare(): Promise<void>;
|
|
338
|
+
stopScreenshare(): void;
|
|
339
|
+
startCloudRecording(): void;
|
|
340
|
+
stopCloudRecording(): void;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
type RemoteParticipantState = Omit<RemoteParticipant, "updateStreamState" | "newJoiner" | "streams" | "addStream" | "removeStream">;
|
|
344
|
+
type LocalParticipantState = LocalParticipant;
|
|
345
|
+
interface WaitingParticipantState {
|
|
346
|
+
id: string;
|
|
347
|
+
displayName: string | null;
|
|
348
|
+
}
|
|
349
|
+
interface ChatMessageState {
|
|
350
|
+
senderId: string;
|
|
351
|
+
timestamp: string;
|
|
352
|
+
text: string;
|
|
353
|
+
}
|
|
354
|
+
type ScreenshareState = Screenshare;
|
|
355
|
+
type LocalScreenshareStatus = "starting" | "active";
|
|
356
|
+
interface RoomConnectionState {
|
|
357
|
+
chatMessages: ChatMessage[];
|
|
358
|
+
cloudRecording?: CloudRecordingState;
|
|
359
|
+
localScreenshareStatus?: LocalScreenshareStatus;
|
|
360
|
+
localParticipant?: LocalParticipantState;
|
|
361
|
+
remoteParticipants: RemoteParticipantState[];
|
|
362
|
+
screenshares: Screenshare[];
|
|
363
|
+
connectionStatus: ConnectionStatus;
|
|
364
|
+
liveStream?: LiveStreamState;
|
|
365
|
+
waitingParticipants: WaitingParticipantState[];
|
|
366
|
+
}
|
|
367
|
+
interface UseRoomConnectionOptions extends Omit<RoomConnectionOptions, "localMedia"> {
|
|
368
|
+
localMedia?: LocalMediaRef;
|
|
369
|
+
}
|
|
370
|
+
interface RoomConnectionActions {
|
|
371
|
+
sendChatMessage(text: string): void;
|
|
372
|
+
knock(): void;
|
|
373
|
+
setDisplayName(displayName: string): void;
|
|
374
|
+
toggleCamera(enabled?: boolean): void;
|
|
375
|
+
toggleMicrophone(enabled?: boolean): void;
|
|
376
|
+
acceptWaitingParticipant(participantId: string): void;
|
|
377
|
+
rejectWaitingParticipant(participantId: string): void;
|
|
378
|
+
startCloudRecording(): void;
|
|
379
|
+
startScreenshare(): void;
|
|
380
|
+
stopCloudRecording(): void;
|
|
381
|
+
stopScreenshare(): void;
|
|
382
|
+
}
|
|
383
|
+
type VideoViewComponentProps = Omit<React.ComponentProps<typeof _default>, "onResize">;
|
|
384
|
+
interface RoomConnectionComponents {
|
|
385
|
+
VideoView: (props: VideoViewComponentProps) => ReturnType<typeof _default>;
|
|
386
|
+
}
|
|
387
|
+
type RoomConnectionRef = {
|
|
388
|
+
state: RoomConnectionState;
|
|
389
|
+
actions: RoomConnectionActions;
|
|
390
|
+
components: RoomConnectionComponents;
|
|
391
|
+
_ref: RoomConnection;
|
|
392
|
+
};
|
|
393
|
+
declare function useRoomConnection(roomUrl: string, roomConnectionOptions?: UseRoomConnectionOptions): RoomConnectionRef;
|
|
394
|
+
|
|
395
|
+
declare const sdkVersion = "__SDK_VERSION__";
|
|
396
|
+
|
|
397
|
+
export { type ChatMessageState as ChatMessage, type LocalParticipantState as LocalParticipant, type RemoteParticipantState as RemoteParticipant, type RoomConnectionState as RoomConnection, type ScreenshareState as Screenshare, type LocalMediaRef as UseLocalMediaResult, _default as VideoView, type WaitingParticipantState as WaitingParticipant, sdkVersion, useLocalMedia, useRoomConnection };
|