@whereby.com/browser-sdk 2.0.0-alpha10 → 2.0.0-alpha12
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 +16 -15
- package/dist/lib.cjs +61 -60
- package/dist/lib.esm.js +61 -60
- package/dist/types.d.ts +3 -3
- package/dist/{v2-alpha10.js → v2-alpha12.js} +10 -10
- package/package.json +81 -81
package/README.md
CHANGED
|
@@ -6,11 +6,13 @@ Whereby browser SDK is a library for seamless integration of Whereby (https://wh
|
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
|
-
```
|
|
9
|
+
```shell
|
|
10
10
|
npm install @whereby.com/browser-sdk
|
|
11
11
|
```
|
|
12
|
+
|
|
12
13
|
or
|
|
13
|
-
|
|
14
|
+
|
|
15
|
+
```shell
|
|
14
16
|
yarn add @whereby.com/browser-sdk
|
|
15
17
|
```
|
|
16
18
|
|
|
@@ -21,10 +23,11 @@ yarn add @whereby.com/browser-sdk
|
|
|
21
23
|
### React hooks
|
|
22
24
|
|
|
23
25
|
#### useLocalMedia
|
|
26
|
+
|
|
24
27
|
The `useLocalMedia` hook enables preview and selection of local devices (camera & microphone) prior to establishing a connection within a Whereby room. Use this hook to build rich pre-call
|
|
25
28
|
experiences, allowing end users to confirm their device selection up-front. This hook works seamlessly with the `useRoomConnection` hook described below.
|
|
26
29
|
|
|
27
|
-
```
|
|
30
|
+
```js
|
|
28
31
|
import { useLocalMedia, VideoView } from “@whereby.com/browser-sdk”;
|
|
29
32
|
|
|
30
33
|
function MyPreCallUX() {
|
|
@@ -54,18 +57,18 @@ function MyPreCallUX() {
|
|
|
54
57
|
|
|
55
58
|
```
|
|
56
59
|
|
|
57
|
-
|
|
58
60
|
#### useRoomConnection
|
|
61
|
+
|
|
59
62
|
The `useRoomConnection` hook provides a way to connect participants in a given room, subscribe to state updates, and perform actions on the connection, like toggling camera or microphone.
|
|
60
63
|
|
|
61
|
-
```
|
|
64
|
+
```js
|
|
62
65
|
import { useRoomConnection } from “@whereby.com/browser-sdk”;
|
|
63
66
|
|
|
64
67
|
function MyCallUX( { roomUrl, localStream }) {
|
|
65
|
-
const
|
|
68
|
+
const { state, actions, components } = useRoomConnection(
|
|
66
69
|
"<room_url>"
|
|
67
70
|
{
|
|
68
|
-
localMedia: null, // Supply localMedia from `useLocalMedia` hook, or constraints
|
|
71
|
+
localMedia: null, // Supply localMedia from `useLocalMedia` hook, or constraints
|
|
69
72
|
localMediaConstraints: {
|
|
70
73
|
audio: true,
|
|
71
74
|
video: true,
|
|
@@ -91,23 +94,21 @@ function MyCallUX( { roomUrl, localStream }) {
|
|
|
91
94
|
|
|
92
95
|
Use the `<whereby-embed />` web component to make use of Whereby's pre-built responsive UI. Refer to our [documentation](https://docs.whereby.com/embedding-rooms/in-a-web-page/using-the-whereby-embed-element) to learn which attributes are supported.
|
|
93
96
|
|
|
94
|
-
|
|
95
97
|
#### React
|
|
96
98
|
|
|
97
|
-
```
|
|
98
|
-
import "@whereby.com/browser-sdk"
|
|
99
|
+
```js
|
|
100
|
+
import "@whereby.com/browser-sdk";
|
|
99
101
|
|
|
100
102
|
const MyComponent = ({ roomUrl }) => {
|
|
101
|
-
return <whereby-embed chat="off" room={roomUrl}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export default MyComponent
|
|
103
|
+
return <whereby-embed chat="off" room={roomUrl} />;
|
|
104
|
+
};
|
|
105
105
|
|
|
106
|
+
export default MyComponent;
|
|
106
107
|
```
|
|
107
108
|
|
|
108
109
|
#### In plain HTML
|
|
109
110
|
|
|
110
|
-
```
|
|
111
|
+
```html
|
|
111
112
|
<html>
|
|
112
113
|
<head>
|
|
113
114
|
<script src="...."></script>
|
package/dist/lib.cjs
CHANGED
|
@@ -94,8 +94,7 @@ heresy.define("WherebyEmbed", {
|
|
|
94
94
|
// Commands
|
|
95
95
|
_postCommand(command, args = []) {
|
|
96
96
|
if (this.iframe.current) {
|
|
97
|
-
|
|
98
|
-
this.iframe.current.contentWindow.postMessage({ command, args }, url.origin);
|
|
97
|
+
this.iframe.current.contentWindow.postMessage({ command, args }, this.url.origin);
|
|
99
98
|
}
|
|
100
99
|
},
|
|
101
100
|
startRecording() {
|
|
@@ -114,8 +113,7 @@ heresy.define("WherebyEmbed", {
|
|
|
114
113
|
this._postCommand("toggle_screenshare", [enabled]);
|
|
115
114
|
},
|
|
116
115
|
onmessage({ origin, data }) {
|
|
117
|
-
|
|
118
|
-
if (origin !== url.origin)
|
|
116
|
+
if (origin !== this.url.origin)
|
|
119
117
|
return;
|
|
120
118
|
const { type, payload: detail } = data;
|
|
121
119
|
this.dispatchEvent(new CustomEvent(type, { detail }));
|
|
@@ -125,22 +123,30 @@ heresy.define("WherebyEmbed", {
|
|
|
125
123
|
if (!room)
|
|
126
124
|
return this.html `Whereby: Missing room attribute.`;
|
|
127
125
|
// Get subdomain from room URL, or use it specified
|
|
128
|
-
const m = /https:\/\/([^.]+)\.whereby.com\/.+/.exec(room);
|
|
126
|
+
const m = /https:\/\/([^.]+)(\.whereby.com|-ip-\d+-\d+-\d+-\d+.hereby.dev:4443)\/.+/.exec(room);
|
|
129
127
|
const subdomain = (m && m[1]) || this.subdomain;
|
|
130
128
|
if (!subdomain)
|
|
131
129
|
return this.html `Whereby: Missing subdomain attr.`;
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
if (!m) {
|
|
131
|
+
return this.html `could not parse URL.`;
|
|
132
|
+
}
|
|
133
|
+
const baseURL = m[2] || `.whereby.com`;
|
|
134
|
+
this.url = new URL(room, `https://${subdomain}${baseURL}`);
|
|
135
|
+
const roomUrl = new URL(room);
|
|
136
|
+
if (roomUrl.searchParams.get("roomKey")) {
|
|
137
|
+
this.url.searchParams.append("roomKey", roomUrl.searchParams.get("roomKey"));
|
|
138
|
+
}
|
|
139
|
+
Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha12", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
|
|
134
140
|
// add to URL if set in any way
|
|
135
141
|
(o, v) => (this[v.toLowerCase()] != null ? Object.assign(Object.assign({}, o), { [v]: this[v.toLowerCase()] }) : o), {}))).forEach(([k, v]) => {
|
|
136
|
-
if (!url.searchParams.has(k) && typeof v === "string") {
|
|
137
|
-
url.searchParams.set(k, v);
|
|
142
|
+
if (!this.url.searchParams.has(k) && typeof v === "string") {
|
|
143
|
+
this.url.searchParams.set(k, v);
|
|
138
144
|
}
|
|
139
145
|
});
|
|
140
146
|
return this.html `
|
|
141
147
|
<iframe
|
|
142
148
|
ref=${this.iframe}
|
|
143
|
-
src=${url}
|
|
149
|
+
src=${this.url}
|
|
144
150
|
allow="autoplay; camera; microphone; fullscreen; speaker; display-capture" />
|
|
145
151
|
`;
|
|
146
152
|
},
|
|
@@ -5277,14 +5283,15 @@ class LocalParticipant extends RoomParticipant {
|
|
|
5277
5283
|
}
|
|
5278
5284
|
}
|
|
5279
5285
|
|
|
5280
|
-
const API_BASE_URL = "https://api.whereby.dev";
|
|
5281
|
-
const SIGNAL_BASE_URL = "wss://signal.appearin.net";
|
|
5286
|
+
const API_BASE_URL = process.env["REACT_APP_API_BASE_URL"] || "https://api.whereby.dev";
|
|
5287
|
+
const SIGNAL_BASE_URL = process.env["REACT_APP_SIGNAL_BASE_URL"] || "wss://signal.appearin.net";
|
|
5282
5288
|
const NON_PERSON_ROLES = ["recorder", "streamer"];
|
|
5283
5289
|
function createSocket() {
|
|
5284
5290
|
const parsedUrl = new URL(SIGNAL_BASE_URL);
|
|
5285
5291
|
const path = `${parsedUrl.pathname.replace(/^\/$/, "")}/protocol/socket.io/v4`;
|
|
5286
5292
|
const SOCKET_HOST = parsedUrl.origin;
|
|
5287
5293
|
const socketConf = {
|
|
5294
|
+
autoConnect: false,
|
|
5288
5295
|
host: SOCKET_HOST,
|
|
5289
5296
|
path,
|
|
5290
5297
|
reconnectionDelay: 5000,
|
|
@@ -5370,6 +5377,31 @@ class RoomConnection extends TypedEventTarget {
|
|
|
5370
5377
|
const { enabled } = e.detail;
|
|
5371
5378
|
this.signalSocket.emit("enable_audio", { enabled });
|
|
5372
5379
|
});
|
|
5380
|
+
const webrtcProvider = {
|
|
5381
|
+
getMediaConstraints: () => ({
|
|
5382
|
+
audio: this.localMedia.isMicrophoneEnabled(),
|
|
5383
|
+
video: this.localMedia.isCameraEnabled(),
|
|
5384
|
+
}),
|
|
5385
|
+
deferrable(clientId) {
|
|
5386
|
+
return !clientId;
|
|
5387
|
+
},
|
|
5388
|
+
};
|
|
5389
|
+
this.rtcManagerDispatcher = new RtcManagerDispatcher({
|
|
5390
|
+
emitter: {
|
|
5391
|
+
emit: this._handleRtcEvent.bind(this),
|
|
5392
|
+
},
|
|
5393
|
+
serverSocket: this.signalSocket,
|
|
5394
|
+
webrtcProvider,
|
|
5395
|
+
features: {
|
|
5396
|
+
lowDataModeEnabled: false,
|
|
5397
|
+
sfuServerOverrideHost: undefined,
|
|
5398
|
+
turnServerOverrideHost: undefined,
|
|
5399
|
+
useOnlyTURN: undefined,
|
|
5400
|
+
vp9On: false,
|
|
5401
|
+
h264On: false,
|
|
5402
|
+
simulcastScreenshareOn: false,
|
|
5403
|
+
},
|
|
5404
|
+
});
|
|
5373
5405
|
}
|
|
5374
5406
|
get roomKey() {
|
|
5375
5407
|
return this._roomKey;
|
|
@@ -5589,6 +5621,7 @@ class RoomConnection extends TypedEventTarget {
|
|
|
5589
5621
|
return;
|
|
5590
5622
|
}
|
|
5591
5623
|
this.logger.log("Joining room");
|
|
5624
|
+
this.signalSocket.connect();
|
|
5592
5625
|
this.roomConnectionStatus = "connecting";
|
|
5593
5626
|
this.dispatchEvent(new CustomEvent("room_connection_status_changed", {
|
|
5594
5627
|
detail: {
|
|
@@ -5603,31 +5636,6 @@ class RoomConnection extends TypedEventTarget {
|
|
|
5603
5636
|
if (this._ownsLocalMedia) {
|
|
5604
5637
|
yield this.localMedia.start();
|
|
5605
5638
|
}
|
|
5606
|
-
const webrtcProvider = {
|
|
5607
|
-
getMediaConstraints: () => ({
|
|
5608
|
-
audio: this.localMedia.isMicrophoneEnabled(),
|
|
5609
|
-
video: this.localMedia.isCameraEnabled(),
|
|
5610
|
-
}),
|
|
5611
|
-
deferrable(clientId) {
|
|
5612
|
-
return !clientId;
|
|
5613
|
-
},
|
|
5614
|
-
};
|
|
5615
|
-
this.rtcManagerDispatcher = new RtcManagerDispatcher({
|
|
5616
|
-
emitter: {
|
|
5617
|
-
emit: this._handleRtcEvent.bind(this),
|
|
5618
|
-
},
|
|
5619
|
-
serverSocket: this.signalSocket,
|
|
5620
|
-
webrtcProvider,
|
|
5621
|
-
features: {
|
|
5622
|
-
lowDataModeEnabled: false,
|
|
5623
|
-
sfuServerOverrideHost: undefined,
|
|
5624
|
-
turnServerOverrideHost: undefined,
|
|
5625
|
-
useOnlyTURN: undefined,
|
|
5626
|
-
vp9On: false,
|
|
5627
|
-
h264On: false,
|
|
5628
|
-
simulcastScreenshareOn: false,
|
|
5629
|
-
},
|
|
5630
|
-
});
|
|
5631
5639
|
// Identify device on signal connection
|
|
5632
5640
|
const deviceCredentials = yield this.credentialsService.getCredentials();
|
|
5633
5641
|
this.logger.log("Connected to signal socket");
|
|
@@ -5655,28 +5663,21 @@ class RoomConnection extends TypedEventTarget {
|
|
|
5655
5663
|
});
|
|
5656
5664
|
}
|
|
5657
5665
|
leave() {
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
}, 200);
|
|
5674
|
-
this.signalSocket.once("room_left", () => {
|
|
5675
|
-
clearTimeout(leaveTimeout);
|
|
5676
|
-
this.signalSocket.disconnect();
|
|
5677
|
-
resolve();
|
|
5678
|
-
});
|
|
5679
|
-
});
|
|
5666
|
+
this.roomConnectionStatus = "disconnecting";
|
|
5667
|
+
if (this._ownsLocalMedia) {
|
|
5668
|
+
this.localMedia.stop();
|
|
5669
|
+
}
|
|
5670
|
+
if (this.rtcManager) {
|
|
5671
|
+
this.localMedia.removeRtcManager(this.rtcManager);
|
|
5672
|
+
this.rtcManager.disconnectAll();
|
|
5673
|
+
this.rtcManager = undefined;
|
|
5674
|
+
}
|
|
5675
|
+
if (!this.signalSocket) {
|
|
5676
|
+
return;
|
|
5677
|
+
}
|
|
5678
|
+
this.signalSocket.emit("leave_room");
|
|
5679
|
+
this.signalSocket.disconnect();
|
|
5680
|
+
this.roomConnectionStatus = "disconnected";
|
|
5680
5681
|
}
|
|
5681
5682
|
sendChatMessage(text) {
|
|
5682
5683
|
this.signalSocket.emit("chat_message", {
|
|
@@ -5860,7 +5861,7 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
|
|
|
5860
5861
|
};
|
|
5861
5862
|
}
|
|
5862
5863
|
|
|
5863
|
-
const sdkVersion = "2.0.0-
|
|
5864
|
+
const sdkVersion = "2.0.0-alpha12";
|
|
5864
5865
|
|
|
5865
5866
|
exports.VideoView = VideoView;
|
|
5866
5867
|
exports.sdkVersion = sdkVersion;
|
package/dist/lib.esm.js
CHANGED
|
@@ -79,8 +79,7 @@ define("WherebyEmbed", {
|
|
|
79
79
|
// Commands
|
|
80
80
|
_postCommand(command, args = []) {
|
|
81
81
|
if (this.iframe.current) {
|
|
82
|
-
|
|
83
|
-
this.iframe.current.contentWindow.postMessage({ command, args }, url.origin);
|
|
82
|
+
this.iframe.current.contentWindow.postMessage({ command, args }, this.url.origin);
|
|
84
83
|
}
|
|
85
84
|
},
|
|
86
85
|
startRecording() {
|
|
@@ -99,8 +98,7 @@ define("WherebyEmbed", {
|
|
|
99
98
|
this._postCommand("toggle_screenshare", [enabled]);
|
|
100
99
|
},
|
|
101
100
|
onmessage({ origin, data }) {
|
|
102
|
-
|
|
103
|
-
if (origin !== url.origin)
|
|
101
|
+
if (origin !== this.url.origin)
|
|
104
102
|
return;
|
|
105
103
|
const { type, payload: detail } = data;
|
|
106
104
|
this.dispatchEvent(new CustomEvent(type, { detail }));
|
|
@@ -110,22 +108,30 @@ define("WherebyEmbed", {
|
|
|
110
108
|
if (!room)
|
|
111
109
|
return this.html `Whereby: Missing room attribute.`;
|
|
112
110
|
// Get subdomain from room URL, or use it specified
|
|
113
|
-
const m = /https:\/\/([^.]+)\.whereby.com\/.+/.exec(room);
|
|
111
|
+
const m = /https:\/\/([^.]+)(\.whereby.com|-ip-\d+-\d+-\d+-\d+.hereby.dev:4443)\/.+/.exec(room);
|
|
114
112
|
const subdomain = (m && m[1]) || this.subdomain;
|
|
115
113
|
if (!subdomain)
|
|
116
114
|
return this.html `Whereby: Missing subdomain attr.`;
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
if (!m) {
|
|
116
|
+
return this.html `could not parse URL.`;
|
|
117
|
+
}
|
|
118
|
+
const baseURL = m[2] || `.whereby.com`;
|
|
119
|
+
this.url = new URL(room, `https://${subdomain}${baseURL}`);
|
|
120
|
+
const roomUrl = new URL(room);
|
|
121
|
+
if (roomUrl.searchParams.get("roomKey")) {
|
|
122
|
+
this.url.searchParams.append("roomKey", roomUrl.searchParams.get("roomKey"));
|
|
123
|
+
}
|
|
124
|
+
Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha12", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
|
|
119
125
|
// add to URL if set in any way
|
|
120
126
|
(o, v) => (this[v.toLowerCase()] != null ? Object.assign(Object.assign({}, o), { [v]: this[v.toLowerCase()] }) : o), {}))).forEach(([k, v]) => {
|
|
121
|
-
if (!url.searchParams.has(k) && typeof v === "string") {
|
|
122
|
-
url.searchParams.set(k, v);
|
|
127
|
+
if (!this.url.searchParams.has(k) && typeof v === "string") {
|
|
128
|
+
this.url.searchParams.set(k, v);
|
|
123
129
|
}
|
|
124
130
|
});
|
|
125
131
|
return this.html `
|
|
126
132
|
<iframe
|
|
127
133
|
ref=${this.iframe}
|
|
128
|
-
src=${url}
|
|
134
|
+
src=${this.url}
|
|
129
135
|
allow="autoplay; camera; microphone; fullscreen; speaker; display-capture" />
|
|
130
136
|
`;
|
|
131
137
|
},
|
|
@@ -5262,14 +5268,15 @@ class LocalParticipant extends RoomParticipant {
|
|
|
5262
5268
|
}
|
|
5263
5269
|
}
|
|
5264
5270
|
|
|
5265
|
-
const API_BASE_URL = "https://api.whereby.dev";
|
|
5266
|
-
const SIGNAL_BASE_URL = "wss://signal.appearin.net";
|
|
5271
|
+
const API_BASE_URL = process.env["REACT_APP_API_BASE_URL"] || "https://api.whereby.dev";
|
|
5272
|
+
const SIGNAL_BASE_URL = process.env["REACT_APP_SIGNAL_BASE_URL"] || "wss://signal.appearin.net";
|
|
5267
5273
|
const NON_PERSON_ROLES = ["recorder", "streamer"];
|
|
5268
5274
|
function createSocket() {
|
|
5269
5275
|
const parsedUrl = new URL(SIGNAL_BASE_URL);
|
|
5270
5276
|
const path = `${parsedUrl.pathname.replace(/^\/$/, "")}/protocol/socket.io/v4`;
|
|
5271
5277
|
const SOCKET_HOST = parsedUrl.origin;
|
|
5272
5278
|
const socketConf = {
|
|
5279
|
+
autoConnect: false,
|
|
5273
5280
|
host: SOCKET_HOST,
|
|
5274
5281
|
path,
|
|
5275
5282
|
reconnectionDelay: 5000,
|
|
@@ -5355,6 +5362,31 @@ class RoomConnection extends TypedEventTarget {
|
|
|
5355
5362
|
const { enabled } = e.detail;
|
|
5356
5363
|
this.signalSocket.emit("enable_audio", { enabled });
|
|
5357
5364
|
});
|
|
5365
|
+
const webrtcProvider = {
|
|
5366
|
+
getMediaConstraints: () => ({
|
|
5367
|
+
audio: this.localMedia.isMicrophoneEnabled(),
|
|
5368
|
+
video: this.localMedia.isCameraEnabled(),
|
|
5369
|
+
}),
|
|
5370
|
+
deferrable(clientId) {
|
|
5371
|
+
return !clientId;
|
|
5372
|
+
},
|
|
5373
|
+
};
|
|
5374
|
+
this.rtcManagerDispatcher = new RtcManagerDispatcher({
|
|
5375
|
+
emitter: {
|
|
5376
|
+
emit: this._handleRtcEvent.bind(this),
|
|
5377
|
+
},
|
|
5378
|
+
serverSocket: this.signalSocket,
|
|
5379
|
+
webrtcProvider,
|
|
5380
|
+
features: {
|
|
5381
|
+
lowDataModeEnabled: false,
|
|
5382
|
+
sfuServerOverrideHost: undefined,
|
|
5383
|
+
turnServerOverrideHost: undefined,
|
|
5384
|
+
useOnlyTURN: undefined,
|
|
5385
|
+
vp9On: false,
|
|
5386
|
+
h264On: false,
|
|
5387
|
+
simulcastScreenshareOn: false,
|
|
5388
|
+
},
|
|
5389
|
+
});
|
|
5358
5390
|
}
|
|
5359
5391
|
get roomKey() {
|
|
5360
5392
|
return this._roomKey;
|
|
@@ -5574,6 +5606,7 @@ class RoomConnection extends TypedEventTarget {
|
|
|
5574
5606
|
return;
|
|
5575
5607
|
}
|
|
5576
5608
|
this.logger.log("Joining room");
|
|
5609
|
+
this.signalSocket.connect();
|
|
5577
5610
|
this.roomConnectionStatus = "connecting";
|
|
5578
5611
|
this.dispatchEvent(new CustomEvent("room_connection_status_changed", {
|
|
5579
5612
|
detail: {
|
|
@@ -5588,31 +5621,6 @@ class RoomConnection extends TypedEventTarget {
|
|
|
5588
5621
|
if (this._ownsLocalMedia) {
|
|
5589
5622
|
yield this.localMedia.start();
|
|
5590
5623
|
}
|
|
5591
|
-
const webrtcProvider = {
|
|
5592
|
-
getMediaConstraints: () => ({
|
|
5593
|
-
audio: this.localMedia.isMicrophoneEnabled(),
|
|
5594
|
-
video: this.localMedia.isCameraEnabled(),
|
|
5595
|
-
}),
|
|
5596
|
-
deferrable(clientId) {
|
|
5597
|
-
return !clientId;
|
|
5598
|
-
},
|
|
5599
|
-
};
|
|
5600
|
-
this.rtcManagerDispatcher = new RtcManagerDispatcher({
|
|
5601
|
-
emitter: {
|
|
5602
|
-
emit: this._handleRtcEvent.bind(this),
|
|
5603
|
-
},
|
|
5604
|
-
serverSocket: this.signalSocket,
|
|
5605
|
-
webrtcProvider,
|
|
5606
|
-
features: {
|
|
5607
|
-
lowDataModeEnabled: false,
|
|
5608
|
-
sfuServerOverrideHost: undefined,
|
|
5609
|
-
turnServerOverrideHost: undefined,
|
|
5610
|
-
useOnlyTURN: undefined,
|
|
5611
|
-
vp9On: false,
|
|
5612
|
-
h264On: false,
|
|
5613
|
-
simulcastScreenshareOn: false,
|
|
5614
|
-
},
|
|
5615
|
-
});
|
|
5616
5624
|
// Identify device on signal connection
|
|
5617
5625
|
const deviceCredentials = yield this.credentialsService.getCredentials();
|
|
5618
5626
|
this.logger.log("Connected to signal socket");
|
|
@@ -5640,28 +5648,21 @@ class RoomConnection extends TypedEventTarget {
|
|
|
5640
5648
|
});
|
|
5641
5649
|
}
|
|
5642
5650
|
leave() {
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
}, 200);
|
|
5659
|
-
this.signalSocket.once("room_left", () => {
|
|
5660
|
-
clearTimeout(leaveTimeout);
|
|
5661
|
-
this.signalSocket.disconnect();
|
|
5662
|
-
resolve();
|
|
5663
|
-
});
|
|
5664
|
-
});
|
|
5651
|
+
this.roomConnectionStatus = "disconnecting";
|
|
5652
|
+
if (this._ownsLocalMedia) {
|
|
5653
|
+
this.localMedia.stop();
|
|
5654
|
+
}
|
|
5655
|
+
if (this.rtcManager) {
|
|
5656
|
+
this.localMedia.removeRtcManager(this.rtcManager);
|
|
5657
|
+
this.rtcManager.disconnectAll();
|
|
5658
|
+
this.rtcManager = undefined;
|
|
5659
|
+
}
|
|
5660
|
+
if (!this.signalSocket) {
|
|
5661
|
+
return;
|
|
5662
|
+
}
|
|
5663
|
+
this.signalSocket.emit("leave_room");
|
|
5664
|
+
this.signalSocket.disconnect();
|
|
5665
|
+
this.roomConnectionStatus = "disconnected";
|
|
5665
5666
|
}
|
|
5666
5667
|
sendChatMessage(text) {
|
|
5667
5668
|
this.signalSocket.emit("chat_message", {
|
|
@@ -5845,6 +5846,6 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
|
|
|
5845
5846
|
};
|
|
5846
5847
|
}
|
|
5847
5848
|
|
|
5848
|
-
const sdkVersion = "2.0.0-
|
|
5849
|
+
const sdkVersion = "2.0.0-alpha12";
|
|
5849
5850
|
|
|
5850
5851
|
export { VideoView, sdkVersion, useLocalMedia, useRoomConnection };
|
package/dist/types.d.ts
CHANGED
|
@@ -165,7 +165,7 @@ interface RoomConnectionOptions {
|
|
|
165
165
|
localMedia?: LocalMedia;
|
|
166
166
|
}
|
|
167
167
|
type ChatMessage = Pick<ChatMessage$1, "senderId" | "timestamp" | "text">;
|
|
168
|
-
type RoomConnectionStatus = "" | "connecting" | "connected" | "room_locked" | "knocking" | "disconnected" | "accepted" | "rejected";
|
|
168
|
+
type RoomConnectionStatus = "" | "connecting" | "connected" | "room_locked" | "knocking" | "disconnecting" | "disconnected" | "accepted" | "rejected";
|
|
169
169
|
type RoomJoinedEvent = {
|
|
170
170
|
localParticipant: LocalParticipant;
|
|
171
171
|
remoteParticipants: RemoteParticipant[];
|
|
@@ -262,7 +262,7 @@ declare class RoomConnection extends TypedEventTarget {
|
|
|
262
262
|
private _joinRoom;
|
|
263
263
|
join(): Promise<void>;
|
|
264
264
|
knock(): void;
|
|
265
|
-
leave():
|
|
265
|
+
leave(): void;
|
|
266
266
|
sendChatMessage(text: string): void;
|
|
267
267
|
setDisplayName(displayName: string): void;
|
|
268
268
|
acceptWaitingParticipant(participantId: string): void;
|
|
@@ -303,6 +303,6 @@ type RoomConnectionRef = {
|
|
|
303
303
|
};
|
|
304
304
|
declare function useRoomConnection(roomUrl: string, roomConnectionOptions: UseRoomConnectionOptions): RoomConnectionRef;
|
|
305
305
|
|
|
306
|
-
declare const sdkVersion = "2.0.0-
|
|
306
|
+
declare const sdkVersion = "2.0.0-alpha12";
|
|
307
307
|
|
|
308
308
|
export { _default as VideoView, sdkVersion, useLocalMedia, useRoomConnection };
|