@whereby.com/browser-sdk 2.0.0 → 2.1.0-beta.2
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 +58 -38
- package/dist/cdn/{v2-embed.js → v2-embed-beta.js} +2 -2
- package/dist/cdn/v2-react-beta.js +3 -0
- package/dist/core/index.d.ts +2320 -0
- package/dist/core/index.js +63283 -0
- package/dist/embed/index.d.ts +63 -3
- package/dist/embed/index.esm.js +134 -134
- package/dist/react/index.d.ts +122 -95
- package/dist/react/index.esm.js +9609 -7862
- package/dist/utils/index.esm.js +65 -65
- package/package.json +20 -22
package/dist/embed/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactHTMLElement } from 'react';
|
|
2
|
+
|
|
3
|
+
interface WherebyEmbedElementAttributes extends ReactHTMLElement<HTMLElement> {
|
|
2
4
|
audio: string;
|
|
3
5
|
avatarUrl: string;
|
|
4
6
|
background: string;
|
|
@@ -35,10 +37,68 @@ interface WherebyEmbedAttributes {
|
|
|
35
37
|
video: string;
|
|
36
38
|
virtualBackgroundUrl: string;
|
|
37
39
|
}
|
|
40
|
+
interface WherebyEmbedElementEventMap {
|
|
41
|
+
ready: CustomEvent;
|
|
42
|
+
knock: CustomEvent;
|
|
43
|
+
participantupdate: CustomEvent<{
|
|
44
|
+
count: number;
|
|
45
|
+
}>;
|
|
46
|
+
join: CustomEvent;
|
|
47
|
+
leave: CustomEvent<{
|
|
48
|
+
removed: boolean;
|
|
49
|
+
}>;
|
|
50
|
+
participant_join: CustomEvent<{
|
|
51
|
+
participant: {
|
|
52
|
+
metadata: string;
|
|
53
|
+
};
|
|
54
|
+
}>;
|
|
55
|
+
participant_leave: CustomEvent<{
|
|
56
|
+
participant: {
|
|
57
|
+
metadata: string;
|
|
58
|
+
};
|
|
59
|
+
}>;
|
|
60
|
+
microphone_toggle: CustomEvent<{
|
|
61
|
+
enabled: boolean;
|
|
62
|
+
}>;
|
|
63
|
+
camera_toggle: CustomEvent<{
|
|
64
|
+
enabled: boolean;
|
|
65
|
+
}>;
|
|
66
|
+
chat_toggle: CustomEvent<{
|
|
67
|
+
open: boolean;
|
|
68
|
+
}>;
|
|
69
|
+
pip_toggle: CustomEvent<{
|
|
70
|
+
open: boolean;
|
|
71
|
+
}>;
|
|
72
|
+
deny_device_permission: CustomEvent<{
|
|
73
|
+
denied: boolean;
|
|
74
|
+
}>;
|
|
75
|
+
screenshare_toggle: CustomEvent<{
|
|
76
|
+
enabled: boolean;
|
|
77
|
+
}>;
|
|
78
|
+
streaming_status_change: CustomEvent<{
|
|
79
|
+
status: string;
|
|
80
|
+
}>;
|
|
81
|
+
connection_status_change: CustomEvent<{
|
|
82
|
+
status: "stable" | "unstable";
|
|
83
|
+
}>;
|
|
84
|
+
}
|
|
85
|
+
interface WherebyEmbedElementCommands {
|
|
86
|
+
startRecording: () => void;
|
|
87
|
+
stopRecording: () => void;
|
|
88
|
+
startStreaming: () => void;
|
|
89
|
+
stopStreaming: () => void;
|
|
90
|
+
toggleCamera: (enabled?: boolean) => void;
|
|
91
|
+
toggleMicrophone: (enabled?: boolean) => void;
|
|
92
|
+
toggleScreenshare: (enabled?: boolean) => void;
|
|
93
|
+
toogleChat: (enabled?: boolean) => void;
|
|
94
|
+
}
|
|
95
|
+
interface WherebyEmbedElement extends HTMLIFrameElement, WherebyEmbedElementCommands {
|
|
96
|
+
addEventListener<K extends keyof (WherebyEmbedElementEventMap & HTMLElementEventMap)>(type: K, listener: (this: HTMLIFrameElement, ev: (WherebyEmbedElementEventMap & HTMLElementEventMap)[K]) => void, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
97
|
+
}
|
|
38
98
|
declare global {
|
|
39
99
|
namespace JSX {
|
|
40
100
|
interface IntrinsicElements {
|
|
41
|
-
["whereby-embed"]: Partial<
|
|
101
|
+
["whereby-embed"]: Partial<WherebyEmbedElementAttributes>;
|
|
42
102
|
}
|
|
43
103
|
}
|
|
44
104
|
}
|
|
@@ -46,4 +106,4 @@ declare const _default: {
|
|
|
46
106
|
sdkVersion: string;
|
|
47
107
|
};
|
|
48
108
|
|
|
49
|
-
export { _default as default };
|
|
109
|
+
export { type WherebyEmbedElement, _default as default };
|
package/dist/embed/index.esm.js
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
1
|
import { define, ref } from 'heresy';
|
|
2
2
|
|
|
3
|
-
function parseRoomUrlAndSubdomain(roomAttribute, subdomainAttribute) {
|
|
4
|
-
if (!roomAttribute) {
|
|
5
|
-
throw new Error("Missing room attribute");
|
|
6
|
-
}
|
|
7
|
-
// Get subdomain from room URL, or use it specified
|
|
8
|
-
const m = /https:\/\/([^.]+)(\.whereby\.com|-ip-\d+-\d+-\d+-\d+.hereby.dev:4443)\/.+/.exec(roomAttribute);
|
|
9
|
-
const subdomain = (m && m[1]) || subdomainAttribute;
|
|
10
|
-
if (!subdomain) {
|
|
11
|
-
throw new Error("Missing subdomain attribute");
|
|
12
|
-
}
|
|
13
|
-
if (!m) {
|
|
14
|
-
throw new Error("Could not parse room URL");
|
|
15
|
-
}
|
|
16
|
-
const roomUrl = new URL(roomAttribute);
|
|
17
|
-
return {
|
|
18
|
-
subdomain,
|
|
19
|
-
roomUrl,
|
|
20
|
-
};
|
|
3
|
+
function parseRoomUrlAndSubdomain(roomAttribute, subdomainAttribute) {
|
|
4
|
+
if (!roomAttribute) {
|
|
5
|
+
throw new Error("Missing room attribute");
|
|
6
|
+
}
|
|
7
|
+
// Get subdomain from room URL, or use it specified
|
|
8
|
+
const m = /https:\/\/([^.]+)(\.whereby\.com|-ip-\d+-\d+-\d+-\d+.hereby.dev:4443)\/.+/.exec(roomAttribute);
|
|
9
|
+
const subdomain = (m && m[1]) || subdomainAttribute;
|
|
10
|
+
if (!subdomain) {
|
|
11
|
+
throw new Error("Missing subdomain attribute");
|
|
12
|
+
}
|
|
13
|
+
if (!m) {
|
|
14
|
+
throw new Error("Could not parse room URL");
|
|
15
|
+
}
|
|
16
|
+
const roomUrl = new URL(roomAttribute);
|
|
17
|
+
return {
|
|
18
|
+
subdomain,
|
|
19
|
+
roomUrl,
|
|
20
|
+
};
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const sdkVersion = "2.0.
|
|
23
|
+
const sdkVersion = "2.1.0-beta.2";
|
|
24
24
|
|
|
25
|
-
const boolAttrs = [
|
|
26
|
-
"audio",
|
|
27
|
-
"background",
|
|
28
|
-
"cameraAccess",
|
|
29
|
-
"chat",
|
|
30
|
-
"people",
|
|
31
|
-
"embed",
|
|
32
|
-
"emptyRoomInvitation",
|
|
33
|
-
"help",
|
|
34
|
-
"leaveButton",
|
|
35
|
-
"precallReview",
|
|
36
|
-
"screenshare",
|
|
37
|
-
"video",
|
|
38
|
-
"floatSelf",
|
|
39
|
-
"recording",
|
|
40
|
-
"logo",
|
|
41
|
-
"locking",
|
|
42
|
-
"participantCount",
|
|
43
|
-
"settingsButton",
|
|
44
|
-
"pipButton",
|
|
45
|
-
"moreButton",
|
|
46
|
-
"personality",
|
|
47
|
-
"subgridLabels",
|
|
48
|
-
"lowData",
|
|
49
|
-
"breakout",
|
|
50
|
-
];
|
|
51
|
-
define("WherebyEmbed", {
|
|
52
|
-
oninit() {
|
|
53
|
-
this.iframe = ref();
|
|
54
|
-
},
|
|
55
|
-
onconnected() {
|
|
56
|
-
window.addEventListener("message", this.onmessage.bind(this));
|
|
57
|
-
},
|
|
58
|
-
ondisconnected() {
|
|
59
|
-
window.removeEventListener("message", this.onmessage.bind(this));
|
|
60
|
-
},
|
|
61
|
-
observedAttributes: [
|
|
62
|
-
"displayName",
|
|
63
|
-
"minimal",
|
|
64
|
-
"room",
|
|
65
|
-
"subdomain",
|
|
66
|
-
"lang",
|
|
67
|
-
"metadata",
|
|
68
|
-
"groups",
|
|
69
|
-
"virtualBackgroundUrl",
|
|
70
|
-
"avatarUrl",
|
|
71
|
-
"externalId",
|
|
72
|
-
"title",
|
|
73
|
-
...boolAttrs,
|
|
74
|
-
].map((a) => a.toLowerCase()),
|
|
75
|
-
onattributechanged({ attributeName, oldValue }) {
|
|
76
|
-
if (["room", "subdomain"].includes(attributeName) && oldValue == null)
|
|
77
|
-
return;
|
|
78
|
-
this.render();
|
|
79
|
-
},
|
|
80
|
-
style(self) {
|
|
25
|
+
const boolAttrs = [
|
|
26
|
+
"audio",
|
|
27
|
+
"background",
|
|
28
|
+
"cameraAccess",
|
|
29
|
+
"chat",
|
|
30
|
+
"people",
|
|
31
|
+
"embed",
|
|
32
|
+
"emptyRoomInvitation",
|
|
33
|
+
"help",
|
|
34
|
+
"leaveButton",
|
|
35
|
+
"precallReview",
|
|
36
|
+
"screenshare",
|
|
37
|
+
"video",
|
|
38
|
+
"floatSelf",
|
|
39
|
+
"recording",
|
|
40
|
+
"logo",
|
|
41
|
+
"locking",
|
|
42
|
+
"participantCount",
|
|
43
|
+
"settingsButton",
|
|
44
|
+
"pipButton",
|
|
45
|
+
"moreButton",
|
|
46
|
+
"personality",
|
|
47
|
+
"subgridLabels",
|
|
48
|
+
"lowData",
|
|
49
|
+
"breakout",
|
|
50
|
+
];
|
|
51
|
+
define("WherebyEmbed", {
|
|
52
|
+
oninit() {
|
|
53
|
+
this.iframe = ref();
|
|
54
|
+
},
|
|
55
|
+
onconnected() {
|
|
56
|
+
window.addEventListener("message", this.onmessage.bind(this));
|
|
57
|
+
},
|
|
58
|
+
ondisconnected() {
|
|
59
|
+
window.removeEventListener("message", this.onmessage.bind(this));
|
|
60
|
+
},
|
|
61
|
+
observedAttributes: [
|
|
62
|
+
"displayName",
|
|
63
|
+
"minimal",
|
|
64
|
+
"room",
|
|
65
|
+
"subdomain",
|
|
66
|
+
"lang",
|
|
67
|
+
"metadata",
|
|
68
|
+
"groups",
|
|
69
|
+
"virtualBackgroundUrl",
|
|
70
|
+
"avatarUrl",
|
|
71
|
+
"externalId",
|
|
72
|
+
"title",
|
|
73
|
+
...boolAttrs,
|
|
74
|
+
].map((a) => a.toLowerCase()),
|
|
75
|
+
onattributechanged({ attributeName, oldValue }) {
|
|
76
|
+
if (["room", "subdomain"].includes(attributeName) && oldValue == null)
|
|
77
|
+
return;
|
|
78
|
+
this.render();
|
|
79
|
+
},
|
|
80
|
+
style(self) {
|
|
81
81
|
return `
|
|
82
82
|
${self} {
|
|
83
83
|
display: block;
|
|
@@ -87,70 +87,70 @@ define("WherebyEmbed", {
|
|
|
87
87
|
height: 100%;
|
|
88
88
|
width: 100%;
|
|
89
89
|
}
|
|
90
|
-
`;
|
|
91
|
-
},
|
|
92
|
-
// Commands
|
|
93
|
-
_postCommand(command, args = []) {
|
|
94
|
-
if (this.iframe.current) {
|
|
95
|
-
this.iframe.current.contentWindow.postMessage({ command, args }, this.roomUrl.origin);
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
startRecording() {
|
|
99
|
-
this._postCommand("start_recording");
|
|
100
|
-
},
|
|
101
|
-
stopRecording() {
|
|
102
|
-
this._postCommand("stop_recording");
|
|
103
|
-
},
|
|
104
|
-
startStreaming() {
|
|
105
|
-
this._postCommand("start_streaming");
|
|
106
|
-
},
|
|
107
|
-
stopStreaming() {
|
|
108
|
-
this._postCommand("stop_streaming");
|
|
109
|
-
},
|
|
110
|
-
toggleCamera(enabled) {
|
|
111
|
-
this._postCommand("toggle_camera", [enabled]);
|
|
112
|
-
},
|
|
113
|
-
toggleMicrophone(enabled) {
|
|
114
|
-
this._postCommand("toggle_microphone", [enabled]);
|
|
115
|
-
},
|
|
116
|
-
toggleScreenshare(enabled) {
|
|
117
|
-
this._postCommand("toggle_screenshare", [enabled]);
|
|
118
|
-
},
|
|
119
|
-
toggleChat(enabled) {
|
|
120
|
-
this._postCommand("toggle_chat", [enabled]);
|
|
121
|
-
},
|
|
122
|
-
onmessage({ origin, data }) {
|
|
123
|
-
if (!this.roomUrl || origin !== this.roomUrl.origin)
|
|
124
|
-
return;
|
|
125
|
-
const { type, payload: detail } = data;
|
|
126
|
-
this.dispatchEvent(new CustomEvent(type, { detail }));
|
|
127
|
-
},
|
|
128
|
-
render() {
|
|
129
|
-
const { avatarurl: avatarUrl, displayname: displayName, lang, metadata, externalid: externalId, minimal, room, groups, virtualbackgroundurl: virtualBackgroundUrl, title, } = this;
|
|
130
|
-
let roomUrl, subdomain;
|
|
131
|
-
try {
|
|
132
|
-
({ roomUrl, subdomain } = parseRoomUrlAndSubdomain(room, this.subdomain));
|
|
133
|
-
}
|
|
134
|
-
catch (error) {
|
|
135
|
-
return this.html `Whereby: ${error instanceof Error ? error.message : "unknown error"}`;
|
|
136
|
-
}
|
|
137
|
-
this.roomUrl = roomUrl;
|
|
138
|
-
Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: sdkVersion, iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang: lang })), (metadata && { metadata: metadata })), (externalId && { externalId })), (groups && { groups: groups })), (virtualBackgroundUrl && { virtualBackgroundUrl: virtualBackgroundUrl })), (avatarUrl && { avatarUrl: avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
|
|
139
|
-
// add to URL if set in any way
|
|
140
|
-
(o, v) => (this[v.toLowerCase()] != null ? Object.assign(Object.assign({}, o), { [v]: this[v.toLowerCase()] }) : o), {}))).forEach(([k, v]) => {
|
|
141
|
-
if (!this.roomUrl.searchParams.has(k)) {
|
|
142
|
-
this.roomUrl.searchParams.set(k, v);
|
|
143
|
-
}
|
|
144
|
-
});
|
|
90
|
+
`;
|
|
91
|
+
},
|
|
92
|
+
// Commands
|
|
93
|
+
_postCommand(command, args = []) {
|
|
94
|
+
if (this.iframe.current) {
|
|
95
|
+
this.iframe.current.contentWindow.postMessage({ command, args }, this.roomUrl.origin);
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
startRecording() {
|
|
99
|
+
this._postCommand("start_recording");
|
|
100
|
+
},
|
|
101
|
+
stopRecording() {
|
|
102
|
+
this._postCommand("stop_recording");
|
|
103
|
+
},
|
|
104
|
+
startStreaming() {
|
|
105
|
+
this._postCommand("start_streaming");
|
|
106
|
+
},
|
|
107
|
+
stopStreaming() {
|
|
108
|
+
this._postCommand("stop_streaming");
|
|
109
|
+
},
|
|
110
|
+
toggleCamera(enabled) {
|
|
111
|
+
this._postCommand("toggle_camera", [enabled]);
|
|
112
|
+
},
|
|
113
|
+
toggleMicrophone(enabled) {
|
|
114
|
+
this._postCommand("toggle_microphone", [enabled]);
|
|
115
|
+
},
|
|
116
|
+
toggleScreenshare(enabled) {
|
|
117
|
+
this._postCommand("toggle_screenshare", [enabled]);
|
|
118
|
+
},
|
|
119
|
+
toggleChat(enabled) {
|
|
120
|
+
this._postCommand("toggle_chat", [enabled]);
|
|
121
|
+
},
|
|
122
|
+
onmessage({ origin, data, }) {
|
|
123
|
+
if (!this.roomUrl || origin !== this.roomUrl.origin)
|
|
124
|
+
return;
|
|
125
|
+
const { type, payload: detail } = data;
|
|
126
|
+
this.dispatchEvent(new CustomEvent(type, { detail }));
|
|
127
|
+
},
|
|
128
|
+
render() {
|
|
129
|
+
const { avatarurl: avatarUrl, displayname: displayName, lang, metadata, externalid: externalId, minimal, room, groups, virtualbackgroundurl: virtualBackgroundUrl, title, } = this;
|
|
130
|
+
let roomUrl, subdomain;
|
|
131
|
+
try {
|
|
132
|
+
({ roomUrl, subdomain } = parseRoomUrlAndSubdomain(room, this.subdomain));
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
return this.html `Whereby: ${error instanceof Error ? error.message : "unknown error"}`;
|
|
136
|
+
}
|
|
137
|
+
this.roomUrl = roomUrl;
|
|
138
|
+
Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: sdkVersion, iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang: lang })), (metadata && { metadata: metadata })), (externalId && { externalId })), (groups && { groups: groups })), (virtualBackgroundUrl && { virtualBackgroundUrl: virtualBackgroundUrl })), (avatarUrl && { avatarUrl: avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
|
|
139
|
+
// add to URL if set in any way
|
|
140
|
+
(o, v) => (this[v.toLowerCase()] != null ? Object.assign(Object.assign({}, o), { [v]: this[v.toLowerCase()] }) : o), {}))).forEach(([k, v]) => {
|
|
141
|
+
if (!this.roomUrl.searchParams.has(k)) {
|
|
142
|
+
this.roomUrl.searchParams.set(k, v);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
145
|
this.html `
|
|
146
146
|
<iframe
|
|
147
147
|
title=${title || "Video calling component"}
|
|
148
148
|
ref=${this.iframe}
|
|
149
149
|
src=${this.roomUrl}
|
|
150
|
-
allow="autoplay; camera; microphone; fullscreen; speaker; display-capture" />
|
|
151
|
-
`;
|
|
152
|
-
},
|
|
153
|
-
});
|
|
150
|
+
allow="autoplay; camera; microphone; fullscreen; speaker; display-capture; media-capture" />
|
|
151
|
+
`;
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
154
|
var index = { sdkVersion: sdkVersion };
|
|
155
155
|
|
|
156
156
|
export { index as default };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import React__default from 'react';
|
|
3
|
-
import _whereby_jslib_media_src_utils_ServerSocket, { ChatMessage as ChatMessage$2 } from '@whereby/jslib-media/src/utils/ServerSocket';
|
|
1
|
+
import * as React$1 from 'react';
|
|
4
2
|
import * as redux_thunk from 'redux-thunk';
|
|
5
3
|
import { AxiosRequestConfig } from 'axios';
|
|
6
4
|
import EventEmitter from 'events';
|
|
7
5
|
import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
8
6
|
import * as redux from 'redux';
|
|
7
|
+
import _whereby_jslib_media_src_utils_ServerSocket, { ChatMessage as ChatMessage$2 } from '@whereby/jslib-media/src/utils/ServerSocket';
|
|
9
8
|
import RtcManagerDispatcher from '@whereby/jslib-media/src/webrtc/RtcManagerDispatcher';
|
|
10
9
|
import RtcManager from '@whereby/jslib-media/src/webrtc/RtcManager';
|
|
11
10
|
|
|
@@ -13,67 +12,18 @@ interface VideoViewSelfProps {
|
|
|
13
12
|
stream: MediaStream;
|
|
14
13
|
muted?: boolean;
|
|
15
14
|
mirror?: boolean;
|
|
16
|
-
style?:
|
|
15
|
+
style?: React$1.CSSProperties;
|
|
17
16
|
onResize?: ({ width, height, stream }: {
|
|
18
17
|
width: number;
|
|
19
18
|
height: number;
|
|
20
19
|
stream: MediaStream;
|
|
21
20
|
}) => void;
|
|
21
|
+
onSetAspectRatio?: ({ aspectRatio }: {
|
|
22
|
+
aspectRatio: number;
|
|
23
|
+
}) => void;
|
|
22
24
|
}
|
|
23
|
-
type VideoViewProps = VideoViewSelfProps &
|
|
24
|
-
declare const _default: ({ muted, mirror, stream, onResize, ...rest }: VideoViewProps) =>
|
|
25
|
-
|
|
26
|
-
interface RoomParticipantData {
|
|
27
|
-
displayName: string;
|
|
28
|
-
id: string;
|
|
29
|
-
stream?: MediaStream;
|
|
30
|
-
isAudioEnabled: boolean;
|
|
31
|
-
isVideoEnabled: boolean;
|
|
32
|
-
}
|
|
33
|
-
declare class RoomParticipant {
|
|
34
|
-
readonly displayName: string;
|
|
35
|
-
readonly id: string;
|
|
36
|
-
readonly stream?: MediaStream;
|
|
37
|
-
readonly isAudioEnabled: boolean;
|
|
38
|
-
readonly isLocalParticipant: boolean;
|
|
39
|
-
readonly isVideoEnabled: boolean;
|
|
40
|
-
constructor({ displayName, id, stream, isAudioEnabled, isVideoEnabled }: RoomParticipantData);
|
|
41
|
-
}
|
|
42
|
-
type StreamState = "new_accept" | "to_accept" | "old_accept" | "done_accept" | "to_unaccept" | "done_unaccept" | "auto";
|
|
43
|
-
interface Stream {
|
|
44
|
-
id: string;
|
|
45
|
-
state: StreamState;
|
|
46
|
-
}
|
|
47
|
-
interface RemoteParticipant {
|
|
48
|
-
id: string;
|
|
49
|
-
displayName: string;
|
|
50
|
-
isAudioEnabled: boolean;
|
|
51
|
-
isVideoEnabled: boolean;
|
|
52
|
-
isLocalParticipant: boolean;
|
|
53
|
-
stream: (MediaStream & {
|
|
54
|
-
inboundId?: string;
|
|
55
|
-
}) | null;
|
|
56
|
-
streams: Stream[];
|
|
57
|
-
newJoiner: boolean;
|
|
58
|
-
presentationStream: (MediaStream & {
|
|
59
|
-
inboundId?: string;
|
|
60
|
-
}) | null;
|
|
61
|
-
}
|
|
62
|
-
declare class LocalParticipant extends RoomParticipant {
|
|
63
|
-
readonly isLocalParticipant = true;
|
|
64
|
-
constructor({ displayName, id, stream, isAudioEnabled, isVideoEnabled }: RoomParticipantData);
|
|
65
|
-
}
|
|
66
|
-
interface WaitingParticipant {
|
|
67
|
-
id: string;
|
|
68
|
-
displayName: string | null;
|
|
69
|
-
}
|
|
70
|
-
interface Screenshare {
|
|
71
|
-
participantId: string;
|
|
72
|
-
id: string;
|
|
73
|
-
hasAudioTrack: boolean;
|
|
74
|
-
stream?: MediaStream;
|
|
75
|
-
isLocal: boolean;
|
|
76
|
-
}
|
|
25
|
+
type VideoViewProps = VideoViewSelfProps & React$1.DetailedHTMLProps<React$1.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>;
|
|
26
|
+
declare const _default: ({ muted, mirror, stream, onResize, onSetAspectRatio, ...rest }: VideoViewProps) => React$1.JSX.Element;
|
|
77
27
|
|
|
78
28
|
type Json = string | number | boolean | null | Array<Json> | {
|
|
79
29
|
[key: string]: Json;
|
|
@@ -495,6 +445,65 @@ declare class OrganizationService {
|
|
|
495
445
|
}): Promise<undefined>;
|
|
496
446
|
}
|
|
497
447
|
|
|
448
|
+
interface RoomParticipantData {
|
|
449
|
+
displayName: string;
|
|
450
|
+
id: string;
|
|
451
|
+
stream?: MediaStream;
|
|
452
|
+
isAudioEnabled: boolean;
|
|
453
|
+
isVideoEnabled: boolean;
|
|
454
|
+
}
|
|
455
|
+
declare class RoomParticipant {
|
|
456
|
+
readonly displayName: string;
|
|
457
|
+
readonly id: string;
|
|
458
|
+
readonly stream?: MediaStream;
|
|
459
|
+
readonly isAudioEnabled: boolean;
|
|
460
|
+
readonly isLocalParticipant: boolean;
|
|
461
|
+
readonly isVideoEnabled: boolean;
|
|
462
|
+
constructor({ displayName, id, stream, isAudioEnabled, isVideoEnabled }: RoomParticipantData);
|
|
463
|
+
}
|
|
464
|
+
type StreamState = "new_accept" | "to_accept" | "old_accept" | "done_accept" | "to_unaccept" | "done_unaccept" | "auto";
|
|
465
|
+
interface Stream {
|
|
466
|
+
id: string;
|
|
467
|
+
state: StreamState;
|
|
468
|
+
}
|
|
469
|
+
interface RemoteParticipant {
|
|
470
|
+
id: string;
|
|
471
|
+
displayName: string;
|
|
472
|
+
isAudioEnabled: boolean;
|
|
473
|
+
isVideoEnabled: boolean;
|
|
474
|
+
isLocalParticipant: boolean;
|
|
475
|
+
stream: (MediaStream & {
|
|
476
|
+
inboundId?: string;
|
|
477
|
+
}) | null;
|
|
478
|
+
streams: Stream[];
|
|
479
|
+
newJoiner: boolean;
|
|
480
|
+
presentationStream: (MediaStream & {
|
|
481
|
+
inboundId?: string;
|
|
482
|
+
}) | null;
|
|
483
|
+
}
|
|
484
|
+
declare class LocalParticipant extends RoomParticipant {
|
|
485
|
+
readonly isLocalParticipant = true;
|
|
486
|
+
constructor({ displayName, id, stream, isAudioEnabled, isVideoEnabled }: RoomParticipantData);
|
|
487
|
+
}
|
|
488
|
+
interface WaitingParticipant {
|
|
489
|
+
id: string;
|
|
490
|
+
displayName: string | null;
|
|
491
|
+
}
|
|
492
|
+
interface Screenshare {
|
|
493
|
+
participantId: string;
|
|
494
|
+
id: string;
|
|
495
|
+
hasAudioTrack: boolean;
|
|
496
|
+
stream?: MediaStream;
|
|
497
|
+
isLocal: boolean;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Reducer
|
|
502
|
+
*/
|
|
503
|
+
interface WaitingParticipantsState {
|
|
504
|
+
waitingParticipants: WaitingParticipant[];
|
|
505
|
+
}
|
|
506
|
+
|
|
498
507
|
/**
|
|
499
508
|
* Reducer
|
|
500
509
|
*/
|
|
@@ -553,6 +562,7 @@ interface AppState {
|
|
|
553
562
|
displayName: string | null;
|
|
554
563
|
sdkVersion: string | null;
|
|
555
564
|
externalId: string | null;
|
|
565
|
+
isNodeSdk: boolean;
|
|
556
566
|
}
|
|
557
567
|
|
|
558
568
|
/**
|
|
@@ -563,6 +573,34 @@ interface DeviceCredentialsState {
|
|
|
563
573
|
data?: Credentials | null;
|
|
564
574
|
}
|
|
565
575
|
|
|
576
|
+
type LocalMediaOptions = {
|
|
577
|
+
disabled?: boolean;
|
|
578
|
+
audio: boolean;
|
|
579
|
+
video: boolean;
|
|
580
|
+
};
|
|
581
|
+
/**
|
|
582
|
+
* Reducer
|
|
583
|
+
*/
|
|
584
|
+
interface LocalMediaState$1 {
|
|
585
|
+
busyDeviceIds: string[];
|
|
586
|
+
cameraDeviceError?: unknown;
|
|
587
|
+
cameraEnabled: boolean;
|
|
588
|
+
currentCameraDeviceId?: string;
|
|
589
|
+
currentMicrophoneDeviceId?: string;
|
|
590
|
+
devices: MediaDeviceInfo[];
|
|
591
|
+
isSettingCameraDevice: boolean;
|
|
592
|
+
isSettingMicrophoneDevice: boolean;
|
|
593
|
+
isTogglingCamera: boolean;
|
|
594
|
+
microphoneDeviceError?: unknown;
|
|
595
|
+
microphoneEnabled: boolean;
|
|
596
|
+
options?: LocalMediaOptions;
|
|
597
|
+
status: "" | "stopped" | "starting" | "started" | "error";
|
|
598
|
+
startError?: unknown;
|
|
599
|
+
stream?: MediaStream;
|
|
600
|
+
isSwitchingStream: boolean;
|
|
601
|
+
onDeviceChange?: () => void;
|
|
602
|
+
}
|
|
603
|
+
|
|
566
604
|
/**
|
|
567
605
|
* Reducer
|
|
568
606
|
*/
|
|
@@ -691,42 +729,10 @@ declare const createStore: ({ preloadedState, injectServices, }: {
|
|
|
691
729
|
fetchOrganizationFromRoomUrl: (roomUrl: string) => Promise<Organization | null>;
|
|
692
730
|
};
|
|
693
731
|
}, redux.UnknownAction>;
|
|
694
|
-
}
|
|
732
|
+
}>, redux.StoreEnhancer]>>;
|
|
695
733
|
type Store = ReturnType<typeof createStore>;
|
|
696
734
|
|
|
697
|
-
|
|
698
|
-
* Reducer
|
|
699
|
-
*/
|
|
700
|
-
interface WaitingParticipantsState {
|
|
701
|
-
waitingParticipants: WaitingParticipant[];
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
type LocalMediaOptions = {
|
|
705
|
-
audio: boolean;
|
|
706
|
-
video: boolean;
|
|
707
|
-
};
|
|
708
|
-
/**
|
|
709
|
-
* Reducer
|
|
710
|
-
*/
|
|
711
|
-
interface LocalMediaState$1 {
|
|
712
|
-
busyDeviceIds: string[];
|
|
713
|
-
cameraDeviceError?: unknown;
|
|
714
|
-
cameraEnabled: boolean;
|
|
715
|
-
currentCameraDeviceId?: string;
|
|
716
|
-
currentMicrophoneDeviceId?: string;
|
|
717
|
-
devices: MediaDeviceInfo[];
|
|
718
|
-
isSettingCameraDevice: boolean;
|
|
719
|
-
isSettingMicrophoneDevice: boolean;
|
|
720
|
-
isTogglingCamera: boolean;
|
|
721
|
-
microphoneDeviceError?: unknown;
|
|
722
|
-
microphoneEnabled: boolean;
|
|
723
|
-
options?: LocalMediaOptions;
|
|
724
|
-
status: "" | "stopped" | "starting" | "started" | "error";
|
|
725
|
-
startError?: unknown;
|
|
726
|
-
stream?: MediaStream;
|
|
727
|
-
isSwitchingStream: boolean;
|
|
728
|
-
onDeviceChange?: () => void;
|
|
729
|
-
}
|
|
735
|
+
declare const sdkVersion = "__SDK_VERSION__";
|
|
730
736
|
|
|
731
737
|
interface LocalMediaState {
|
|
732
738
|
currentCameraDeviceId?: string;
|
|
@@ -813,7 +819,6 @@ interface RoomConnectionActions {
|
|
|
813
819
|
stopCloudRecording(): void;
|
|
814
820
|
stopScreenshare(): void;
|
|
815
821
|
}
|
|
816
|
-
|
|
817
822
|
type VideoViewComponentProps = Omit<React.ComponentProps<typeof _default>, "onResize">;
|
|
818
823
|
interface RoomConnectionComponents {
|
|
819
824
|
VideoView: (props: VideoViewComponentProps) => ReturnType<typeof _default>;
|
|
@@ -824,10 +829,32 @@ type RoomConnectionRef = {
|
|
|
824
829
|
components: RoomConnectionComponents;
|
|
825
830
|
_ref: Store;
|
|
826
831
|
};
|
|
832
|
+
|
|
827
833
|
declare function useRoomConnection(roomUrl: string, roomConnectionOptions?: UseRoomConnectionOptions): RoomConnectionRef;
|
|
828
834
|
|
|
829
835
|
declare function useLocalMedia(optionsOrStream?: UseLocalMediaOptions | MediaStream): UseLocalMediaResult;
|
|
830
836
|
|
|
831
|
-
|
|
837
|
+
type Origin = {
|
|
838
|
+
top: number;
|
|
839
|
+
left: number;
|
|
840
|
+
};
|
|
841
|
+
type Bounds = {
|
|
842
|
+
width: number;
|
|
843
|
+
height: number;
|
|
844
|
+
};
|
|
845
|
+
|
|
846
|
+
interface GridProps {
|
|
847
|
+
roomConnection: RoomConnectionRef;
|
|
848
|
+
renderParticipant?: ({ cell, participant, }: {
|
|
849
|
+
cell: {
|
|
850
|
+
clientId: string;
|
|
851
|
+
bounds: Bounds;
|
|
852
|
+
origin: Origin;
|
|
853
|
+
};
|
|
854
|
+
participant: RemoteParticipantState | LocalParticipantState;
|
|
855
|
+
}) => React$1.ReactNode;
|
|
856
|
+
videoGridGap?: number;
|
|
857
|
+
}
|
|
858
|
+
declare function Grid({ roomConnection, renderParticipant, videoGridGap }: GridProps): React$1.JSX.Element;
|
|
832
859
|
|
|
833
|
-
export { type ChatMessageState as ChatMessage, type LocalParticipantState as LocalParticipant, type RemoteParticipantState as RemoteParticipant, type RoomConnectionState as RoomConnection, type ScreenshareState as Screenshare, type UseLocalMediaResult, _default as VideoView, type WaitingParticipantState as WaitingParticipant, sdkVersion, useLocalMedia, useRoomConnection };
|
|
860
|
+
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, _default as VideoView, type WaitingParticipantState as WaitingParticipant, sdkVersion, useLocalMedia, useRoomConnection };
|