@whereby.com/browser-sdk 2.0.0-alpha14 → 2.0.0-alpha16
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 +20 -0
- package/dist/lib.cjs +197 -7
- package/dist/lib.esm.js +197 -7
- package/dist/types.d.ts +48 -2
- package/dist/{v2-alpha14.js → v2-alpha16.js} +3 -3
- package/package.json +2 -2
package/dist/lib.esm.js
CHANGED
|
@@ -128,7 +128,7 @@ define("WherebyEmbed", {
|
|
|
128
128
|
if (roomUrl.searchParams.get("roomKey")) {
|
|
129
129
|
this.url.searchParams.append("roomKey", roomUrl.searchParams.get("roomKey"));
|
|
130
130
|
}
|
|
131
|
-
Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-
|
|
131
|
+
Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha16", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
|
|
132
132
|
// add to URL if set in any way
|
|
133
133
|
(o, v) => (this[v.toLowerCase()] != null ? Object.assign(Object.assign({}, o), { [v]: this[v.toLowerCase()] }) : o), {}))).forEach(([k, v]) => {
|
|
134
134
|
if (!this.url.searchParams.has(k) && typeof v === "string") {
|
|
@@ -6803,6 +6803,7 @@ class VegaRtcManager {
|
|
|
6803
6803
|
clientId,
|
|
6804
6804
|
stream: webcamStream,
|
|
6805
6805
|
streamId: camStreamId,
|
|
6806
|
+
streamType: "webcam",
|
|
6806
6807
|
});
|
|
6807
6808
|
|
|
6808
6809
|
clientState.hasEmittedWebcamStream = true;
|
|
@@ -6814,6 +6815,7 @@ class VegaRtcManager {
|
|
|
6814
6815
|
clientId,
|
|
6815
6816
|
stream: screenStream,
|
|
6816
6817
|
streamId: screenShareStreamId,
|
|
6818
|
+
streamType: "screenshare",
|
|
6817
6819
|
});
|
|
6818
6820
|
|
|
6819
6821
|
clientState.hasEmittedScreenStream = true;
|
|
@@ -8316,6 +8318,15 @@ class RemoteParticipant extends RoomParticipant {
|
|
|
8316
8318
|
this.newJoiner = newJoiner;
|
|
8317
8319
|
this.streams = streams.map((streamId) => ({ id: streamId, state: newJoiner ? "new_accept" : "to_accept" }));
|
|
8318
8320
|
}
|
|
8321
|
+
addStream(streamId, state) {
|
|
8322
|
+
this.streams.push({ id: streamId, state });
|
|
8323
|
+
}
|
|
8324
|
+
removeStream(streamId) {
|
|
8325
|
+
const index = this.streams.findIndex((s) => s.id === streamId);
|
|
8326
|
+
if (index !== -1) {
|
|
8327
|
+
this.streams.splice(index, 1);
|
|
8328
|
+
}
|
|
8329
|
+
}
|
|
8319
8330
|
updateStreamState(streamId, state) {
|
|
8320
8331
|
const stream = this.streams.find((s) => s.id === streamId);
|
|
8321
8332
|
if (stream) {
|
|
@@ -8357,6 +8368,8 @@ class RoomConnection extends TypedEventTarget {
|
|
|
8357
8368
|
super();
|
|
8358
8369
|
this.localParticipant = null;
|
|
8359
8370
|
this.remoteParticipants = [];
|
|
8371
|
+
this.screenshares = [];
|
|
8372
|
+
this._deviceCredentials = null;
|
|
8360
8373
|
this._ownsLocalMedia = false;
|
|
8361
8374
|
this.organizationId = "";
|
|
8362
8375
|
this.roomConnectionStatus = "";
|
|
@@ -8416,6 +8429,14 @@ class RoomConnection extends TypedEventTarget {
|
|
|
8416
8429
|
this.signalSocket.on("knocker_left", this._handleKnockerLeft.bind(this));
|
|
8417
8430
|
this.signalSocket.on("room_joined", this._handleRoomJoined.bind(this));
|
|
8418
8431
|
this.signalSocket.on("room_knocked", this._handleRoomKnocked.bind(this));
|
|
8432
|
+
this.signalSocket.on("cloud_recording_stopped", this._handleCloudRecordingStopped.bind(this));
|
|
8433
|
+
this.signalSocket.on("screenshare_started", this._handleScreenshareStarted.bind(this));
|
|
8434
|
+
this.signalSocket.on("screenshare_stopped", this._handleScreenshareStopped.bind(this));
|
|
8435
|
+
this.signalSocket.on("streaming_stopped", this._handleStreamingStopped.bind(this));
|
|
8436
|
+
this.signalSocket.on("disconnect", this._handleDisconnect.bind(this));
|
|
8437
|
+
this.signalSocket.on("connect_error", this._handleDisconnect.bind(this));
|
|
8438
|
+
this.signalSocketManager = this.signalSocket.getManager();
|
|
8439
|
+
this.signalSocketManager.on("reconnect", this._handleReconnect.bind(this));
|
|
8419
8440
|
// Set up local media listeners
|
|
8420
8441
|
this.localMedia.addEventListener("camera_enabled", (e) => {
|
|
8421
8442
|
const { enabled } = e.detail;
|
|
@@ -8457,7 +8478,35 @@ class RoomConnection extends TypedEventTarget {
|
|
|
8457
8478
|
_handleNewChatMessage(message) {
|
|
8458
8479
|
this.dispatchEvent(new CustomEvent("chat_message", { detail: message }));
|
|
8459
8480
|
}
|
|
8481
|
+
_handleCloudRecordingStarted({ client }) {
|
|
8482
|
+
this.dispatchEvent(new CustomEvent("cloud_recording_started", {
|
|
8483
|
+
detail: {
|
|
8484
|
+
status: "recording",
|
|
8485
|
+
startedAt: client.startedCloudRecordingAt
|
|
8486
|
+
? new Date(client.startedCloudRecordingAt).getTime()
|
|
8487
|
+
: new Date().getTime(),
|
|
8488
|
+
},
|
|
8489
|
+
}));
|
|
8490
|
+
}
|
|
8491
|
+
_handleStreamingStarted() {
|
|
8492
|
+
this.dispatchEvent(new CustomEvent("streaming_started", {
|
|
8493
|
+
detail: {
|
|
8494
|
+
status: "streaming",
|
|
8495
|
+
// We don't have the streaming start time stored on the
|
|
8496
|
+
// server, so we use the current time instead. This gives
|
|
8497
|
+
// an invalid timestamp for "Client B" if "Client A" has
|
|
8498
|
+
// been streaming for a while before "Client B" joins.
|
|
8499
|
+
startedAt: new Date().getTime(),
|
|
8500
|
+
},
|
|
8501
|
+
}));
|
|
8502
|
+
}
|
|
8460
8503
|
_handleNewClient({ client }) {
|
|
8504
|
+
if (client.role.roleName === "recorder") {
|
|
8505
|
+
this._handleCloudRecordingStarted({ client });
|
|
8506
|
+
}
|
|
8507
|
+
if (client.role.roleName === "streamer") {
|
|
8508
|
+
this._handleStreamingStarted();
|
|
8509
|
+
}
|
|
8461
8510
|
if (NON_PERSON_ROLES.includes(client.role.roleName)) {
|
|
8462
8511
|
return;
|
|
8463
8512
|
}
|
|
@@ -8549,8 +8598,17 @@ class RoomConnection extends TypedEventTarget {
|
|
|
8549
8598
|
if (!localClient)
|
|
8550
8599
|
throw new Error("Missing local client");
|
|
8551
8600
|
this.localParticipant = new LocalParticipant(Object.assign(Object.assign({}, localClient), { stream: this.localMedia.stream || undefined }));
|
|
8601
|
+
const recorderClient = clients.find((c) => c.role.roleName === "recorder");
|
|
8602
|
+
if (recorderClient) {
|
|
8603
|
+
this._handleCloudRecordingStarted({ client: recorderClient });
|
|
8604
|
+
}
|
|
8605
|
+
const streamerClient = clients.find((c) => c.role.roleName === "streamer");
|
|
8606
|
+
if (streamerClient) {
|
|
8607
|
+
this._handleStreamingStarted();
|
|
8608
|
+
}
|
|
8552
8609
|
this.remoteParticipants = clients
|
|
8553
8610
|
.filter((c) => c.id !== selfId)
|
|
8611
|
+
.filter((c) => !NON_PERSON_ROLES.includes(c.role.roleName))
|
|
8554
8612
|
.map((c) => new RemoteParticipant(Object.assign(Object.assign({}, c), { newJoiner: false })));
|
|
8555
8613
|
this.roomConnectionStatus = "connected";
|
|
8556
8614
|
this.dispatchEvent(new CustomEvent("room_joined", {
|
|
@@ -8570,6 +8628,54 @@ class RoomConnection extends TypedEventTarget {
|
|
|
8570
8628
|
detail: { participantId: clientId, displayName },
|
|
8571
8629
|
}));
|
|
8572
8630
|
}
|
|
8631
|
+
_handleReconnect() {
|
|
8632
|
+
this.logger.log("Reconnected to signal socket");
|
|
8633
|
+
this.signalSocket.emit("identify_device", { deviceCredentials: this._deviceCredentials });
|
|
8634
|
+
this.signalSocket.once("device_identified", () => {
|
|
8635
|
+
this._joinRoom();
|
|
8636
|
+
});
|
|
8637
|
+
}
|
|
8638
|
+
_handleDisconnect() {
|
|
8639
|
+
this.roomConnectionStatus = "disconnected";
|
|
8640
|
+
this.dispatchEvent(new CustomEvent("room_connection_status_changed", {
|
|
8641
|
+
detail: {
|
|
8642
|
+
roomConnectionStatus: this.roomConnectionStatus,
|
|
8643
|
+
},
|
|
8644
|
+
}));
|
|
8645
|
+
}
|
|
8646
|
+
_handleCloudRecordingStopped() {
|
|
8647
|
+
this.dispatchEvent(new CustomEvent("cloud_recording_stopped"));
|
|
8648
|
+
}
|
|
8649
|
+
_handleStreamingStopped() {
|
|
8650
|
+
this.dispatchEvent(new CustomEvent("streaming_stopped"));
|
|
8651
|
+
}
|
|
8652
|
+
_handleScreenshareStarted(screenshare) {
|
|
8653
|
+
const { clientId: participantId, streamId: id, hasAudioTrack } = screenshare;
|
|
8654
|
+
const remoteParticipant = this.remoteParticipants.find((p) => p.id === participantId);
|
|
8655
|
+
if (!remoteParticipant) {
|
|
8656
|
+
this.logger.log("WARN: Could not find participant for screenshare");
|
|
8657
|
+
return;
|
|
8658
|
+
}
|
|
8659
|
+
const foundScreenshare = this.screenshares.find((s) => s.id === id);
|
|
8660
|
+
if (foundScreenshare) {
|
|
8661
|
+
this.logger.log("WARN: Screenshare already exists");
|
|
8662
|
+
return;
|
|
8663
|
+
}
|
|
8664
|
+
remoteParticipant.addStream(id, "to_accept");
|
|
8665
|
+
this._handleAcceptStreams([remoteParticipant]);
|
|
8666
|
+
this.screenshares = [...this.screenshares, { participantId, id, hasAudioTrack, stream: undefined }];
|
|
8667
|
+
}
|
|
8668
|
+
_handleScreenshareStopped(screenshare) {
|
|
8669
|
+
const { clientId: participantId, streamId: id } = screenshare;
|
|
8670
|
+
const remoteParticipant = this.remoteParticipants.find((p) => p.id === participantId);
|
|
8671
|
+
if (!remoteParticipant) {
|
|
8672
|
+
this.logger.log("WARN: Could not find participant for screenshare");
|
|
8673
|
+
return;
|
|
8674
|
+
}
|
|
8675
|
+
remoteParticipant.removeStream(id);
|
|
8676
|
+
this.screenshares = this.screenshares.filter((s) => !(s.participantId === participantId && s.id === id));
|
|
8677
|
+
this.dispatchEvent(new CustomEvent("screenshare_stopped", { detail: { participantId, id } }));
|
|
8678
|
+
}
|
|
8573
8679
|
_handleRtcEvent(eventName, data) {
|
|
8574
8680
|
if (eventName === "rtc_manager_created") {
|
|
8575
8681
|
return this._handleRtcManagerCreated(data);
|
|
@@ -8577,6 +8683,9 @@ class RoomConnection extends TypedEventTarget {
|
|
|
8577
8683
|
else if (eventName === "stream_added") {
|
|
8578
8684
|
return this._handleStreamAdded(data);
|
|
8579
8685
|
}
|
|
8686
|
+
else if (eventName === "rtc_manager_destroyed") {
|
|
8687
|
+
return this._handleRtcManagerDestroyed();
|
|
8688
|
+
}
|
|
8580
8689
|
else {
|
|
8581
8690
|
this.logger.log(`Unhandled RTC event ${eventName}`);
|
|
8582
8691
|
}
|
|
@@ -8592,6 +8701,9 @@ class RoomConnection extends TypedEventTarget {
|
|
|
8592
8701
|
this._handleAcceptStreams(this.remoteParticipants);
|
|
8593
8702
|
}
|
|
8594
8703
|
}
|
|
8704
|
+
_handleRtcManagerDestroyed() {
|
|
8705
|
+
this.rtcManager = undefined;
|
|
8706
|
+
}
|
|
8595
8707
|
_handleAcceptStreams(remoteParticipants) {
|
|
8596
8708
|
var _a, _b;
|
|
8597
8709
|
if (!this.rtcManager) {
|
|
@@ -8640,13 +8752,24 @@ class RoomConnection extends TypedEventTarget {
|
|
|
8640
8752
|
});
|
|
8641
8753
|
});
|
|
8642
8754
|
}
|
|
8643
|
-
_handleStreamAdded({ clientId, stream, streamId }) {
|
|
8755
|
+
_handleStreamAdded({ clientId, stream, streamId, streamType }) {
|
|
8644
8756
|
const remoteParticipant = this.remoteParticipants.find((p) => p.id === clientId);
|
|
8645
8757
|
if (!remoteParticipant) {
|
|
8646
8758
|
this.logger.log("WARN: Could not find participant for incoming stream");
|
|
8647
8759
|
return;
|
|
8648
8760
|
}
|
|
8649
|
-
|
|
8761
|
+
const remoteParticipantStream = remoteParticipant.streams.find((s) => s.id === streamId);
|
|
8762
|
+
if ((remoteParticipant.stream && remoteParticipant.stream.id === streamId) ||
|
|
8763
|
+
(!remoteParticipant.stream && streamType === "webcam") ||
|
|
8764
|
+
(!remoteParticipant.stream &&
|
|
8765
|
+
!streamType &&
|
|
8766
|
+
remoteParticipantStream &&
|
|
8767
|
+
remoteParticipant.streams.indexOf(remoteParticipantStream) < 1)) {
|
|
8768
|
+
this.dispatchEvent(new CustomEvent("participant_stream_added", { detail: { participantId: clientId, stream, streamId } }));
|
|
8769
|
+
return;
|
|
8770
|
+
}
|
|
8771
|
+
// screenshare
|
|
8772
|
+
this.dispatchEvent(new CustomEvent("screenshare_started", { detail: { participantId: clientId, stream, id: streamId } }));
|
|
8650
8773
|
}
|
|
8651
8774
|
_joinRoom() {
|
|
8652
8775
|
this.signalSocket.emit("join_room", {
|
|
@@ -8690,9 +8813,9 @@ class RoomConnection extends TypedEventTarget {
|
|
|
8690
8813
|
yield this.localMedia.start();
|
|
8691
8814
|
}
|
|
8692
8815
|
// Identify device on signal connection
|
|
8693
|
-
|
|
8816
|
+
this._deviceCredentials = yield this.credentialsService.getCredentials();
|
|
8694
8817
|
this.logger.log("Connected to signal socket");
|
|
8695
|
-
this.signalSocket.emit("identify_device", { deviceCredentials });
|
|
8818
|
+
this.signalSocket.emit("identify_device", { deviceCredentials: this._deviceCredentials });
|
|
8696
8819
|
this.signalSocket.once("device_identified", () => {
|
|
8697
8820
|
this._joinRoom();
|
|
8698
8821
|
});
|
|
@@ -8763,11 +8886,20 @@ class RoomConnection extends TypedEventTarget {
|
|
|
8763
8886
|
|
|
8764
8887
|
const initialState = {
|
|
8765
8888
|
chatMessages: [],
|
|
8766
|
-
|
|
8889
|
+
cloudRecording: {
|
|
8890
|
+
status: "",
|
|
8891
|
+
startedAt: null,
|
|
8892
|
+
},
|
|
8767
8893
|
isJoining: false,
|
|
8768
8894
|
joinError: null,
|
|
8769
8895
|
mostRecentChatMessage: null,
|
|
8770
8896
|
remoteParticipants: [],
|
|
8897
|
+
roomConnectionStatus: "",
|
|
8898
|
+
screenshares: [],
|
|
8899
|
+
streaming: {
|
|
8900
|
+
status: "",
|
|
8901
|
+
startedAt: null,
|
|
8902
|
+
},
|
|
8771
8903
|
waitingParticipants: [],
|
|
8772
8904
|
};
|
|
8773
8905
|
function updateParticipant(remoteParticipants, participantId, updates) {
|
|
@@ -8782,10 +8914,27 @@ function updateParticipant(remoteParticipants, participantId, updates) {
|
|
|
8782
8914
|
...remoteParticipants.slice(index + 1),
|
|
8783
8915
|
];
|
|
8784
8916
|
}
|
|
8917
|
+
function addScreenshare(screenshares, screenshare) {
|
|
8918
|
+
const existingScreenshare = screenshares.find((ss) => ss.id === screenshare.id);
|
|
8919
|
+
if (existingScreenshare) {
|
|
8920
|
+
return screenshares;
|
|
8921
|
+
}
|
|
8922
|
+
return [...screenshares, screenshare];
|
|
8923
|
+
}
|
|
8785
8924
|
function reducer(state, action) {
|
|
8786
8925
|
switch (action.type) {
|
|
8787
8926
|
case "CHAT_MESSAGE":
|
|
8788
8927
|
return Object.assign(Object.assign({}, state), { chatMessages: [...state.chatMessages, action.payload], mostRecentChatMessage: action.payload });
|
|
8928
|
+
case "CLOUD_RECORDING_STARTED":
|
|
8929
|
+
return Object.assign(Object.assign({}, state), { cloudRecording: {
|
|
8930
|
+
status: action.payload.status,
|
|
8931
|
+
startedAt: action.payload.startedAt,
|
|
8932
|
+
} });
|
|
8933
|
+
case "CLOUD_RECORDING_STOPPED":
|
|
8934
|
+
return Object.assign(Object.assign({}, state), { cloudRecording: {
|
|
8935
|
+
status: "",
|
|
8936
|
+
startedAt: null,
|
|
8937
|
+
} });
|
|
8789
8938
|
case "ROOM_JOINED":
|
|
8790
8939
|
return Object.assign(Object.assign({}, state), { localParticipant: action.payload.localParticipant, remoteParticipants: action.payload.remoteParticipants, waitingParticipants: action.payload.waitingParticipants, roomConnectionStatus: "connected" });
|
|
8791
8940
|
case "ROOM_CONNECTION_STATUS_CHANGED":
|
|
@@ -8814,6 +8963,25 @@ function reducer(state, action) {
|
|
|
8814
8963
|
if (!state.localParticipant)
|
|
8815
8964
|
return state;
|
|
8816
8965
|
return Object.assign(Object.assign({}, state), { localParticipant: Object.assign(Object.assign({}, state.localParticipant), { displayName: action.payload.displayName }) });
|
|
8966
|
+
case "SCREENSHARE_STARTED":
|
|
8967
|
+
return Object.assign(Object.assign({}, state), { screenshares: addScreenshare(state.screenshares, {
|
|
8968
|
+
participantId: action.payload.participantId,
|
|
8969
|
+
id: action.payload.id,
|
|
8970
|
+
hasAudioTrack: action.payload.hasAudioTrack,
|
|
8971
|
+
stream: action.payload.stream,
|
|
8972
|
+
}) });
|
|
8973
|
+
case "SCREENSHARE_STOPPED":
|
|
8974
|
+
return Object.assign(Object.assign({}, state), { screenshares: state.screenshares.filter((ss) => ss.participantId !== action.payload.participantId || ss.id !== action.payload.id) });
|
|
8975
|
+
case "STREAMING_STARTED":
|
|
8976
|
+
return Object.assign(Object.assign({}, state), { streaming: {
|
|
8977
|
+
status: action.payload.status,
|
|
8978
|
+
startedAt: action.payload.startedAt,
|
|
8979
|
+
} });
|
|
8980
|
+
case "STREAMING_STOPPED":
|
|
8981
|
+
return Object.assign(Object.assign({}, state), { streaming: {
|
|
8982
|
+
status: "",
|
|
8983
|
+
startedAt: null,
|
|
8984
|
+
} });
|
|
8817
8985
|
case "WAITING_PARTICIPANT_JOINED":
|
|
8818
8986
|
return Object.assign(Object.assign({}, state), { waitingParticipants: [
|
|
8819
8987
|
...state.waitingParticipants,
|
|
@@ -8836,6 +9004,13 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
|
|
|
8836
9004
|
const chatMessage = e.detail;
|
|
8837
9005
|
dispatch({ type: "CHAT_MESSAGE", payload: chatMessage });
|
|
8838
9006
|
});
|
|
9007
|
+
roomConnection.addEventListener("cloud_recording_started", (e) => {
|
|
9008
|
+
const { status, startedAt } = e.detail;
|
|
9009
|
+
dispatch({ type: "CLOUD_RECORDING_STARTED", payload: { status, startedAt } });
|
|
9010
|
+
});
|
|
9011
|
+
roomConnection.addEventListener("cloud_recording_stopped", () => {
|
|
9012
|
+
dispatch({ type: "CLOUD_RECORDING_STOPPED" });
|
|
9013
|
+
});
|
|
8839
9014
|
roomConnection.addEventListener("participant_audio_enabled", (e) => {
|
|
8840
9015
|
const { participantId, isAudioEnabled } = e.detail;
|
|
8841
9016
|
dispatch({ type: "PARTICIPANT_AUDIO_ENABLED", payload: { participantId, isAudioEnabled } });
|
|
@@ -8868,6 +9043,21 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
|
|
|
8868
9043
|
const { participantId, displayName } = e.detail;
|
|
8869
9044
|
dispatch({ type: "PARTICIPANT_METADATA_CHANGED", payload: { participantId, displayName } });
|
|
8870
9045
|
});
|
|
9046
|
+
roomConnection.addEventListener("screenshare_started", (e) => {
|
|
9047
|
+
const { participantId, id, hasAudioTrack, stream } = e.detail;
|
|
9048
|
+
dispatch({ type: "SCREENSHARE_STARTED", payload: { participantId, id, hasAudioTrack, stream } });
|
|
9049
|
+
});
|
|
9050
|
+
roomConnection.addEventListener("screenshare_stopped", (e) => {
|
|
9051
|
+
const { participantId, id } = e.detail;
|
|
9052
|
+
dispatch({ type: "SCREENSHARE_STOPPED", payload: { participantId, id } });
|
|
9053
|
+
});
|
|
9054
|
+
roomConnection.addEventListener("streaming_started", (e) => {
|
|
9055
|
+
const { status, startedAt } = e.detail;
|
|
9056
|
+
dispatch({ type: "STREAMING_STARTED", payload: { status, startedAt } });
|
|
9057
|
+
});
|
|
9058
|
+
roomConnection.addEventListener("streaming_stopped", () => {
|
|
9059
|
+
dispatch({ type: "STREAMING_STOPPED" });
|
|
9060
|
+
});
|
|
8871
9061
|
roomConnection.addEventListener("waiting_participant_joined", (e) => {
|
|
8872
9062
|
const { participantId, displayName } = e.detail;
|
|
8873
9063
|
dispatch({ type: "WAITING_PARTICIPANT_JOINED", payload: { participantId, displayName } });
|
|
@@ -8914,6 +9104,6 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
|
|
|
8914
9104
|
};
|
|
8915
9105
|
}
|
|
8916
9106
|
|
|
8917
|
-
const sdkVersion = "2.0.0-
|
|
9107
|
+
const sdkVersion = "2.0.0-alpha16";
|
|
8918
9108
|
|
|
8919
9109
|
export { VideoView, sdkVersion, useLocalMedia, useRoomConnection };
|
package/dist/types.d.ts
CHANGED
|
@@ -145,6 +145,8 @@ declare class RemoteParticipant extends RoomParticipant {
|
|
|
145
145
|
readonly newJoiner: boolean;
|
|
146
146
|
readonly streams: Stream[];
|
|
147
147
|
constructor({ displayName, id, newJoiner, streams, isAudioEnabled, isVideoEnabled, }: RoomParticipantData & RemoteParticipantData);
|
|
148
|
+
addStream(streamId: string, state: StreamState): void;
|
|
149
|
+
removeStream(streamId: string): void;
|
|
148
150
|
updateStreamState(streamId: string, state: StreamState): void;
|
|
149
151
|
}
|
|
150
152
|
declare class LocalParticipant extends RoomParticipant {
|
|
@@ -154,6 +156,13 @@ declare class LocalParticipant extends RoomParticipant {
|
|
|
154
156
|
interface WaitingParticipant {
|
|
155
157
|
id: string;
|
|
156
158
|
displayName: string | null;
|
|
159
|
+
}
|
|
160
|
+
declare class Screenshare {
|
|
161
|
+
readonly participantId: string;
|
|
162
|
+
readonly id: string;
|
|
163
|
+
readonly hasAudioTrack: boolean;
|
|
164
|
+
readonly stream?: MediaStream;
|
|
165
|
+
constructor({ participantId, id, hasAudioTrack, stream }: Screenshare);
|
|
157
166
|
}
|
|
158
167
|
|
|
159
168
|
type Logger = Pick<Console, "debug" | "error" | "log" | "warn">;
|
|
@@ -166,6 +175,14 @@ interface RoomConnectionOptions {
|
|
|
166
175
|
}
|
|
167
176
|
type ChatMessage = Pick<ChatMessage$1, "senderId" | "timestamp" | "text">;
|
|
168
177
|
type RoomConnectionStatus = "" | "connecting" | "connected" | "room_locked" | "knocking" | "disconnecting" | "disconnected" | "accepted" | "rejected";
|
|
178
|
+
type CloudRecordingState = {
|
|
179
|
+
status: "" | "recording";
|
|
180
|
+
startedAt: number | null;
|
|
181
|
+
};
|
|
182
|
+
type StreamingState = {
|
|
183
|
+
status: "" | "streaming";
|
|
184
|
+
startedAt: number | null;
|
|
185
|
+
};
|
|
169
186
|
type RoomJoinedEvent = {
|
|
170
187
|
localParticipant: LocalParticipant;
|
|
171
188
|
remoteParticipants: RemoteParticipant[];
|
|
@@ -196,6 +213,16 @@ type ParticipantMetadataChangedEvent = {
|
|
|
196
213
|
participantId: string;
|
|
197
214
|
displayName: string;
|
|
198
215
|
};
|
|
216
|
+
type ScreenshareStartedEvent = {
|
|
217
|
+
participantId: string;
|
|
218
|
+
id: string;
|
|
219
|
+
hasAudioTrack: boolean;
|
|
220
|
+
stream: MediaStream;
|
|
221
|
+
};
|
|
222
|
+
type ScreenshareStoppedEvent = {
|
|
223
|
+
participantId: string;
|
|
224
|
+
id: string;
|
|
225
|
+
};
|
|
199
226
|
type WaitingParticipantJoinedEvent = {
|
|
200
227
|
participantId: string;
|
|
201
228
|
displayName: string | null;
|
|
@@ -205,6 +232,7 @@ type WaitingParticipantLeftEvent = {
|
|
|
205
232
|
};
|
|
206
233
|
interface RoomEventsMap {
|
|
207
234
|
chat_message: CustomEvent<ChatMessage>;
|
|
235
|
+
cloud_recording_started: CustomEvent<CloudRecordingState>;
|
|
208
236
|
participant_audio_enabled: CustomEvent<ParticipantAudioEnabledEvent>;
|
|
209
237
|
participant_joined: CustomEvent<ParticipantJoinedEvent>;
|
|
210
238
|
participant_left: CustomEvent<ParticipantLeftEvent>;
|
|
@@ -213,6 +241,9 @@ interface RoomEventsMap {
|
|
|
213
241
|
participant_video_enabled: CustomEvent<ParticipantVideoEnabledEvent>;
|
|
214
242
|
room_connection_status_changed: CustomEvent<RoomConnectionStatusChangedEvent>;
|
|
215
243
|
room_joined: CustomEvent<RoomJoinedEvent>;
|
|
244
|
+
screenshare_started: CustomEvent<ScreenshareStartedEvent>;
|
|
245
|
+
screenshare_stopped: CustomEvent<ScreenshareStoppedEvent>;
|
|
246
|
+
streaming_started: CustomEvent<StreamingState>;
|
|
216
247
|
waiting_participant_joined: CustomEvent<WaitingParticipantJoinedEvent>;
|
|
217
248
|
waiting_participant_left: CustomEvent<WaitingParticipantLeftEvent>;
|
|
218
249
|
}
|
|
@@ -226,6 +257,7 @@ declare class RoomConnection extends TypedEventTarget {
|
|
|
226
257
|
localParticipant: LocalParticipant | null;
|
|
227
258
|
roomUrl: URL;
|
|
228
259
|
remoteParticipants: RemoteParticipant[];
|
|
260
|
+
screenshares: Screenshare[];
|
|
229
261
|
readonly localMediaConstraints?: MediaStreamConstraints;
|
|
230
262
|
readonly roomName: string;
|
|
231
263
|
private organizationId;
|
|
@@ -235,7 +267,9 @@ declare class RoomConnection extends TypedEventTarget {
|
|
|
235
267
|
private organizationServiceCache;
|
|
236
268
|
private organizationApiClient;
|
|
237
269
|
private roomService;
|
|
270
|
+
private _deviceCredentials;
|
|
238
271
|
private signalSocket;
|
|
272
|
+
private signalSocketManager;
|
|
239
273
|
private rtcManagerDispatcher?;
|
|
240
274
|
private rtcManager?;
|
|
241
275
|
private roomConnectionStatus;
|
|
@@ -247,6 +281,8 @@ declare class RoomConnection extends TypedEventTarget {
|
|
|
247
281
|
constructor(roomUrl: string, { displayName, localMedia, localMediaConstraints, logger, roomKey }: RoomConnectionOptions);
|
|
248
282
|
get roomKey(): string | null;
|
|
249
283
|
private _handleNewChatMessage;
|
|
284
|
+
private _handleCloudRecordingStarted;
|
|
285
|
+
private _handleStreamingStarted;
|
|
250
286
|
private _handleNewClient;
|
|
251
287
|
private _handleClientLeft;
|
|
252
288
|
private _handleClientAudioEnabled;
|
|
@@ -256,8 +292,15 @@ declare class RoomConnection extends TypedEventTarget {
|
|
|
256
292
|
private _handleKnockerLeft;
|
|
257
293
|
private _handleRoomJoined;
|
|
258
294
|
private _handleRoomKnocked;
|
|
295
|
+
private _handleReconnect;
|
|
296
|
+
private _handleDisconnect;
|
|
297
|
+
private _handleCloudRecordingStopped;
|
|
298
|
+
private _handleStreamingStopped;
|
|
299
|
+
private _handleScreenshareStarted;
|
|
300
|
+
private _handleScreenshareStopped;
|
|
259
301
|
private _handleRtcEvent;
|
|
260
302
|
private _handleRtcManagerCreated;
|
|
303
|
+
private _handleRtcManagerDestroyed;
|
|
261
304
|
private _handleAcceptStreams;
|
|
262
305
|
private _handleStreamAdded;
|
|
263
306
|
private _joinRoom;
|
|
@@ -273,12 +316,15 @@ declare class RoomConnection extends TypedEventTarget {
|
|
|
273
316
|
type RemoteParticipantState = Omit<RemoteParticipant, "updateStreamState">;
|
|
274
317
|
interface RoomConnectionState {
|
|
275
318
|
chatMessages: ChatMessage[];
|
|
319
|
+
cloudRecording: CloudRecordingState;
|
|
276
320
|
isJoining: boolean;
|
|
277
321
|
joinError: unknown;
|
|
278
322
|
localParticipant?: LocalParticipant;
|
|
279
323
|
mostRecentChatMessage: ChatMessage | null;
|
|
280
|
-
roomConnectionStatus: RoomConnectionStatus;
|
|
281
324
|
remoteParticipants: RemoteParticipantState[];
|
|
325
|
+
screenshares: Screenshare[];
|
|
326
|
+
roomConnectionStatus: RoomConnectionStatus;
|
|
327
|
+
streaming: StreamingState;
|
|
282
328
|
waitingParticipants: WaitingParticipant[];
|
|
283
329
|
}
|
|
284
330
|
interface UseRoomConnectionOptions extends Omit<RoomConnectionOptions, "localMedia"> {
|
|
@@ -304,6 +350,6 @@ type RoomConnectionRef = {
|
|
|
304
350
|
};
|
|
305
351
|
declare function useRoomConnection(roomUrl: string, roomConnectionOptions: UseRoomConnectionOptions): RoomConnectionRef;
|
|
306
352
|
|
|
307
|
-
declare const sdkVersion = "2.0.0-
|
|
353
|
+
declare const sdkVersion = "2.0.0-alpha16";
|
|
308
354
|
|
|
309
355
|
export { _default as VideoView, sdkVersion, useLocalMedia, useRoomConnection };
|