@whereby.com/browser-sdk 2.0.0-alpha15 → 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/dist/lib.cjs +81 -4
- package/dist/lib.esm.js +81 -4
- package/dist/types.d.ts +26 -1
- package/dist/{v2-alpha15.js → v2-alpha16.js} +3 -3
- package/package.json +2 -2
package/dist/lib.cjs
CHANGED
|
@@ -150,7 +150,7 @@ heresy.define("WherebyEmbed", {
|
|
|
150
150
|
if (roomUrl.searchParams.get("roomKey")) {
|
|
151
151
|
this.url.searchParams.append("roomKey", roomUrl.searchParams.get("roomKey"));
|
|
152
152
|
}
|
|
153
|
-
Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-
|
|
153
|
+
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(
|
|
154
154
|
// add to URL if set in any way
|
|
155
155
|
(o, v) => (this[v.toLowerCase()] != null ? Object.assign(Object.assign({}, o), { [v]: this[v.toLowerCase()] }) : o), {}))).forEach(([k, v]) => {
|
|
156
156
|
if (!this.url.searchParams.has(k) && typeof v === "string") {
|
|
@@ -6825,6 +6825,7 @@ class VegaRtcManager {
|
|
|
6825
6825
|
clientId,
|
|
6826
6826
|
stream: webcamStream,
|
|
6827
6827
|
streamId: camStreamId,
|
|
6828
|
+
streamType: "webcam",
|
|
6828
6829
|
});
|
|
6829
6830
|
|
|
6830
6831
|
clientState.hasEmittedWebcamStream = true;
|
|
@@ -6836,6 +6837,7 @@ class VegaRtcManager {
|
|
|
6836
6837
|
clientId,
|
|
6837
6838
|
stream: screenStream,
|
|
6838
6839
|
streamId: screenShareStreamId,
|
|
6840
|
+
streamType: "screenshare",
|
|
6839
6841
|
});
|
|
6840
6842
|
|
|
6841
6843
|
clientState.hasEmittedScreenStream = true;
|
|
@@ -8338,6 +8340,15 @@ class RemoteParticipant extends RoomParticipant {
|
|
|
8338
8340
|
this.newJoiner = newJoiner;
|
|
8339
8341
|
this.streams = streams.map((streamId) => ({ id: streamId, state: newJoiner ? "new_accept" : "to_accept" }));
|
|
8340
8342
|
}
|
|
8343
|
+
addStream(streamId, state) {
|
|
8344
|
+
this.streams.push({ id: streamId, state });
|
|
8345
|
+
}
|
|
8346
|
+
removeStream(streamId) {
|
|
8347
|
+
const index = this.streams.findIndex((s) => s.id === streamId);
|
|
8348
|
+
if (index !== -1) {
|
|
8349
|
+
this.streams.splice(index, 1);
|
|
8350
|
+
}
|
|
8351
|
+
}
|
|
8341
8352
|
updateStreamState(streamId, state) {
|
|
8342
8353
|
const stream = this.streams.find((s) => s.id === streamId);
|
|
8343
8354
|
if (stream) {
|
|
@@ -8379,6 +8390,7 @@ class RoomConnection extends TypedEventTarget {
|
|
|
8379
8390
|
super();
|
|
8380
8391
|
this.localParticipant = null;
|
|
8381
8392
|
this.remoteParticipants = [];
|
|
8393
|
+
this.screenshares = [];
|
|
8382
8394
|
this._deviceCredentials = null;
|
|
8383
8395
|
this._ownsLocalMedia = false;
|
|
8384
8396
|
this.organizationId = "";
|
|
@@ -8440,6 +8452,8 @@ class RoomConnection extends TypedEventTarget {
|
|
|
8440
8452
|
this.signalSocket.on("room_joined", this._handleRoomJoined.bind(this));
|
|
8441
8453
|
this.signalSocket.on("room_knocked", this._handleRoomKnocked.bind(this));
|
|
8442
8454
|
this.signalSocket.on("cloud_recording_stopped", this._handleCloudRecordingStopped.bind(this));
|
|
8455
|
+
this.signalSocket.on("screenshare_started", this._handleScreenshareStarted.bind(this));
|
|
8456
|
+
this.signalSocket.on("screenshare_stopped", this._handleScreenshareStopped.bind(this));
|
|
8443
8457
|
this.signalSocket.on("streaming_stopped", this._handleStreamingStopped.bind(this));
|
|
8444
8458
|
this.signalSocket.on("disconnect", this._handleDisconnect.bind(this));
|
|
8445
8459
|
this.signalSocket.on("connect_error", this._handleDisconnect.bind(this));
|
|
@@ -8657,6 +8671,33 @@ class RoomConnection extends TypedEventTarget {
|
|
|
8657
8671
|
_handleStreamingStopped() {
|
|
8658
8672
|
this.dispatchEvent(new CustomEvent("streaming_stopped"));
|
|
8659
8673
|
}
|
|
8674
|
+
_handleScreenshareStarted(screenshare) {
|
|
8675
|
+
const { clientId: participantId, streamId: id, hasAudioTrack } = screenshare;
|
|
8676
|
+
const remoteParticipant = this.remoteParticipants.find((p) => p.id === participantId);
|
|
8677
|
+
if (!remoteParticipant) {
|
|
8678
|
+
this.logger.log("WARN: Could not find participant for screenshare");
|
|
8679
|
+
return;
|
|
8680
|
+
}
|
|
8681
|
+
const foundScreenshare = this.screenshares.find((s) => s.id === id);
|
|
8682
|
+
if (foundScreenshare) {
|
|
8683
|
+
this.logger.log("WARN: Screenshare already exists");
|
|
8684
|
+
return;
|
|
8685
|
+
}
|
|
8686
|
+
remoteParticipant.addStream(id, "to_accept");
|
|
8687
|
+
this._handleAcceptStreams([remoteParticipant]);
|
|
8688
|
+
this.screenshares = [...this.screenshares, { participantId, id, hasAudioTrack, stream: undefined }];
|
|
8689
|
+
}
|
|
8690
|
+
_handleScreenshareStopped(screenshare) {
|
|
8691
|
+
const { clientId: participantId, streamId: id } = screenshare;
|
|
8692
|
+
const remoteParticipant = this.remoteParticipants.find((p) => p.id === participantId);
|
|
8693
|
+
if (!remoteParticipant) {
|
|
8694
|
+
this.logger.log("WARN: Could not find participant for screenshare");
|
|
8695
|
+
return;
|
|
8696
|
+
}
|
|
8697
|
+
remoteParticipant.removeStream(id);
|
|
8698
|
+
this.screenshares = this.screenshares.filter((s) => !(s.participantId === participantId && s.id === id));
|
|
8699
|
+
this.dispatchEvent(new CustomEvent("screenshare_stopped", { detail: { participantId, id } }));
|
|
8700
|
+
}
|
|
8660
8701
|
_handleRtcEvent(eventName, data) {
|
|
8661
8702
|
if (eventName === "rtc_manager_created") {
|
|
8662
8703
|
return this._handleRtcManagerCreated(data);
|
|
@@ -8733,13 +8774,24 @@ class RoomConnection extends TypedEventTarget {
|
|
|
8733
8774
|
});
|
|
8734
8775
|
});
|
|
8735
8776
|
}
|
|
8736
|
-
_handleStreamAdded({ clientId, stream, streamId }) {
|
|
8777
|
+
_handleStreamAdded({ clientId, stream, streamId, streamType }) {
|
|
8737
8778
|
const remoteParticipant = this.remoteParticipants.find((p) => p.id === clientId);
|
|
8738
8779
|
if (!remoteParticipant) {
|
|
8739
8780
|
this.logger.log("WARN: Could not find participant for incoming stream");
|
|
8740
8781
|
return;
|
|
8741
8782
|
}
|
|
8742
|
-
|
|
8783
|
+
const remoteParticipantStream = remoteParticipant.streams.find((s) => s.id === streamId);
|
|
8784
|
+
if ((remoteParticipant.stream && remoteParticipant.stream.id === streamId) ||
|
|
8785
|
+
(!remoteParticipant.stream && streamType === "webcam") ||
|
|
8786
|
+
(!remoteParticipant.stream &&
|
|
8787
|
+
!streamType &&
|
|
8788
|
+
remoteParticipantStream &&
|
|
8789
|
+
remoteParticipant.streams.indexOf(remoteParticipantStream) < 1)) {
|
|
8790
|
+
this.dispatchEvent(new CustomEvent("participant_stream_added", { detail: { participantId: clientId, stream, streamId } }));
|
|
8791
|
+
return;
|
|
8792
|
+
}
|
|
8793
|
+
// screenshare
|
|
8794
|
+
this.dispatchEvent(new CustomEvent("screenshare_started", { detail: { participantId: clientId, stream, id: streamId } }));
|
|
8743
8795
|
}
|
|
8744
8796
|
_joinRoom() {
|
|
8745
8797
|
this.signalSocket.emit("join_room", {
|
|
@@ -8865,6 +8917,7 @@ const initialState = {
|
|
|
8865
8917
|
mostRecentChatMessage: null,
|
|
8866
8918
|
remoteParticipants: [],
|
|
8867
8919
|
roomConnectionStatus: "",
|
|
8920
|
+
screenshares: [],
|
|
8868
8921
|
streaming: {
|
|
8869
8922
|
status: "",
|
|
8870
8923
|
startedAt: null,
|
|
@@ -8883,6 +8936,13 @@ function updateParticipant(remoteParticipants, participantId, updates) {
|
|
|
8883
8936
|
...remoteParticipants.slice(index + 1),
|
|
8884
8937
|
];
|
|
8885
8938
|
}
|
|
8939
|
+
function addScreenshare(screenshares, screenshare) {
|
|
8940
|
+
const existingScreenshare = screenshares.find((ss) => ss.id === screenshare.id);
|
|
8941
|
+
if (existingScreenshare) {
|
|
8942
|
+
return screenshares;
|
|
8943
|
+
}
|
|
8944
|
+
return [...screenshares, screenshare];
|
|
8945
|
+
}
|
|
8886
8946
|
function reducer(state, action) {
|
|
8887
8947
|
switch (action.type) {
|
|
8888
8948
|
case "CHAT_MESSAGE":
|
|
@@ -8925,6 +8985,15 @@ function reducer(state, action) {
|
|
|
8925
8985
|
if (!state.localParticipant)
|
|
8926
8986
|
return state;
|
|
8927
8987
|
return Object.assign(Object.assign({}, state), { localParticipant: Object.assign(Object.assign({}, state.localParticipant), { displayName: action.payload.displayName }) });
|
|
8988
|
+
case "SCREENSHARE_STARTED":
|
|
8989
|
+
return Object.assign(Object.assign({}, state), { screenshares: addScreenshare(state.screenshares, {
|
|
8990
|
+
participantId: action.payload.participantId,
|
|
8991
|
+
id: action.payload.id,
|
|
8992
|
+
hasAudioTrack: action.payload.hasAudioTrack,
|
|
8993
|
+
stream: action.payload.stream,
|
|
8994
|
+
}) });
|
|
8995
|
+
case "SCREENSHARE_STOPPED":
|
|
8996
|
+
return Object.assign(Object.assign({}, state), { screenshares: state.screenshares.filter((ss) => ss.participantId !== action.payload.participantId || ss.id !== action.payload.id) });
|
|
8928
8997
|
case "STREAMING_STARTED":
|
|
8929
8998
|
return Object.assign(Object.assign({}, state), { streaming: {
|
|
8930
8999
|
status: action.payload.status,
|
|
@@ -8996,6 +9065,14 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
|
|
|
8996
9065
|
const { participantId, displayName } = e.detail;
|
|
8997
9066
|
dispatch({ type: "PARTICIPANT_METADATA_CHANGED", payload: { participantId, displayName } });
|
|
8998
9067
|
});
|
|
9068
|
+
roomConnection.addEventListener("screenshare_started", (e) => {
|
|
9069
|
+
const { participantId, id, hasAudioTrack, stream } = e.detail;
|
|
9070
|
+
dispatch({ type: "SCREENSHARE_STARTED", payload: { participantId, id, hasAudioTrack, stream } });
|
|
9071
|
+
});
|
|
9072
|
+
roomConnection.addEventListener("screenshare_stopped", (e) => {
|
|
9073
|
+
const { participantId, id } = e.detail;
|
|
9074
|
+
dispatch({ type: "SCREENSHARE_STOPPED", payload: { participantId, id } });
|
|
9075
|
+
});
|
|
8999
9076
|
roomConnection.addEventListener("streaming_started", (e) => {
|
|
9000
9077
|
const { status, startedAt } = e.detail;
|
|
9001
9078
|
dispatch({ type: "STREAMING_STARTED", payload: { status, startedAt } });
|
|
@@ -9049,7 +9126,7 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
|
|
|
9049
9126
|
};
|
|
9050
9127
|
}
|
|
9051
9128
|
|
|
9052
|
-
const sdkVersion = "2.0.0-
|
|
9129
|
+
const sdkVersion = "2.0.0-alpha16";
|
|
9053
9130
|
|
|
9054
9131
|
exports.VideoView = VideoView;
|
|
9055
9132
|
exports.sdkVersion = sdkVersion;
|
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,7 @@ class RoomConnection extends TypedEventTarget {
|
|
|
8357
8368
|
super();
|
|
8358
8369
|
this.localParticipant = null;
|
|
8359
8370
|
this.remoteParticipants = [];
|
|
8371
|
+
this.screenshares = [];
|
|
8360
8372
|
this._deviceCredentials = null;
|
|
8361
8373
|
this._ownsLocalMedia = false;
|
|
8362
8374
|
this.organizationId = "";
|
|
@@ -8418,6 +8430,8 @@ class RoomConnection extends TypedEventTarget {
|
|
|
8418
8430
|
this.signalSocket.on("room_joined", this._handleRoomJoined.bind(this));
|
|
8419
8431
|
this.signalSocket.on("room_knocked", this._handleRoomKnocked.bind(this));
|
|
8420
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));
|
|
8421
8435
|
this.signalSocket.on("streaming_stopped", this._handleStreamingStopped.bind(this));
|
|
8422
8436
|
this.signalSocket.on("disconnect", this._handleDisconnect.bind(this));
|
|
8423
8437
|
this.signalSocket.on("connect_error", this._handleDisconnect.bind(this));
|
|
@@ -8635,6 +8649,33 @@ class RoomConnection extends TypedEventTarget {
|
|
|
8635
8649
|
_handleStreamingStopped() {
|
|
8636
8650
|
this.dispatchEvent(new CustomEvent("streaming_stopped"));
|
|
8637
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
|
+
}
|
|
8638
8679
|
_handleRtcEvent(eventName, data) {
|
|
8639
8680
|
if (eventName === "rtc_manager_created") {
|
|
8640
8681
|
return this._handleRtcManagerCreated(data);
|
|
@@ -8711,13 +8752,24 @@ class RoomConnection extends TypedEventTarget {
|
|
|
8711
8752
|
});
|
|
8712
8753
|
});
|
|
8713
8754
|
}
|
|
8714
|
-
_handleStreamAdded({ clientId, stream, streamId }) {
|
|
8755
|
+
_handleStreamAdded({ clientId, stream, streamId, streamType }) {
|
|
8715
8756
|
const remoteParticipant = this.remoteParticipants.find((p) => p.id === clientId);
|
|
8716
8757
|
if (!remoteParticipant) {
|
|
8717
8758
|
this.logger.log("WARN: Could not find participant for incoming stream");
|
|
8718
8759
|
return;
|
|
8719
8760
|
}
|
|
8720
|
-
|
|
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 } }));
|
|
8721
8773
|
}
|
|
8722
8774
|
_joinRoom() {
|
|
8723
8775
|
this.signalSocket.emit("join_room", {
|
|
@@ -8843,6 +8895,7 @@ const initialState = {
|
|
|
8843
8895
|
mostRecentChatMessage: null,
|
|
8844
8896
|
remoteParticipants: [],
|
|
8845
8897
|
roomConnectionStatus: "",
|
|
8898
|
+
screenshares: [],
|
|
8846
8899
|
streaming: {
|
|
8847
8900
|
status: "",
|
|
8848
8901
|
startedAt: null,
|
|
@@ -8861,6 +8914,13 @@ function updateParticipant(remoteParticipants, participantId, updates) {
|
|
|
8861
8914
|
...remoteParticipants.slice(index + 1),
|
|
8862
8915
|
];
|
|
8863
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
|
+
}
|
|
8864
8924
|
function reducer(state, action) {
|
|
8865
8925
|
switch (action.type) {
|
|
8866
8926
|
case "CHAT_MESSAGE":
|
|
@@ -8903,6 +8963,15 @@ function reducer(state, action) {
|
|
|
8903
8963
|
if (!state.localParticipant)
|
|
8904
8964
|
return state;
|
|
8905
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) });
|
|
8906
8975
|
case "STREAMING_STARTED":
|
|
8907
8976
|
return Object.assign(Object.assign({}, state), { streaming: {
|
|
8908
8977
|
status: action.payload.status,
|
|
@@ -8974,6 +9043,14 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
|
|
|
8974
9043
|
const { participantId, displayName } = e.detail;
|
|
8975
9044
|
dispatch({ type: "PARTICIPANT_METADATA_CHANGED", payload: { participantId, displayName } });
|
|
8976
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
|
+
});
|
|
8977
9054
|
roomConnection.addEventListener("streaming_started", (e) => {
|
|
8978
9055
|
const { status, startedAt } = e.detail;
|
|
8979
9056
|
dispatch({ type: "STREAMING_STARTED", payload: { status, startedAt } });
|
|
@@ -9027,6 +9104,6 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
|
|
|
9027
9104
|
};
|
|
9028
9105
|
}
|
|
9029
9106
|
|
|
9030
|
-
const sdkVersion = "2.0.0-
|
|
9107
|
+
const sdkVersion = "2.0.0-alpha16";
|
|
9031
9108
|
|
|
9032
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">;
|
|
@@ -204,6 +213,16 @@ type ParticipantMetadataChangedEvent = {
|
|
|
204
213
|
participantId: string;
|
|
205
214
|
displayName: string;
|
|
206
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
|
+
};
|
|
207
226
|
type WaitingParticipantJoinedEvent = {
|
|
208
227
|
participantId: string;
|
|
209
228
|
displayName: string | null;
|
|
@@ -222,6 +241,8 @@ interface RoomEventsMap {
|
|
|
222
241
|
participant_video_enabled: CustomEvent<ParticipantVideoEnabledEvent>;
|
|
223
242
|
room_connection_status_changed: CustomEvent<RoomConnectionStatusChangedEvent>;
|
|
224
243
|
room_joined: CustomEvent<RoomJoinedEvent>;
|
|
244
|
+
screenshare_started: CustomEvent<ScreenshareStartedEvent>;
|
|
245
|
+
screenshare_stopped: CustomEvent<ScreenshareStoppedEvent>;
|
|
225
246
|
streaming_started: CustomEvent<StreamingState>;
|
|
226
247
|
waiting_participant_joined: CustomEvent<WaitingParticipantJoinedEvent>;
|
|
227
248
|
waiting_participant_left: CustomEvent<WaitingParticipantLeftEvent>;
|
|
@@ -236,6 +257,7 @@ declare class RoomConnection extends TypedEventTarget {
|
|
|
236
257
|
localParticipant: LocalParticipant | null;
|
|
237
258
|
roomUrl: URL;
|
|
238
259
|
remoteParticipants: RemoteParticipant[];
|
|
260
|
+
screenshares: Screenshare[];
|
|
239
261
|
readonly localMediaConstraints?: MediaStreamConstraints;
|
|
240
262
|
readonly roomName: string;
|
|
241
263
|
private organizationId;
|
|
@@ -274,6 +296,8 @@ declare class RoomConnection extends TypedEventTarget {
|
|
|
274
296
|
private _handleDisconnect;
|
|
275
297
|
private _handleCloudRecordingStopped;
|
|
276
298
|
private _handleStreamingStopped;
|
|
299
|
+
private _handleScreenshareStarted;
|
|
300
|
+
private _handleScreenshareStopped;
|
|
277
301
|
private _handleRtcEvent;
|
|
278
302
|
private _handleRtcManagerCreated;
|
|
279
303
|
private _handleRtcManagerDestroyed;
|
|
@@ -298,6 +322,7 @@ interface RoomConnectionState {
|
|
|
298
322
|
localParticipant?: LocalParticipant;
|
|
299
323
|
mostRecentChatMessage: ChatMessage | null;
|
|
300
324
|
remoteParticipants: RemoteParticipantState[];
|
|
325
|
+
screenshares: Screenshare[];
|
|
301
326
|
roomConnectionStatus: RoomConnectionStatus;
|
|
302
327
|
streaming: StreamingState;
|
|
303
328
|
waitingParticipants: WaitingParticipant[];
|
|
@@ -325,6 +350,6 @@ type RoomConnectionRef = {
|
|
|
325
350
|
};
|
|
326
351
|
declare function useRoomConnection(roomUrl: string, roomConnectionOptions: UseRoomConnectionOptions): RoomConnectionRef;
|
|
327
352
|
|
|
328
|
-
declare const sdkVersion = "2.0.0-
|
|
353
|
+
declare const sdkVersion = "2.0.0-alpha16";
|
|
329
354
|
|
|
330
355
|
export { _default as VideoView, sdkVersion, useLocalMedia, useRoomConnection };
|