@defcomm/meetingsdk 0.3.2 → 0.3.4
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/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +28 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -512,6 +512,9 @@ var SFUClient = class {
|
|
|
512
512
|
getScreenStream() {
|
|
513
513
|
return this.screenStream;
|
|
514
514
|
}
|
|
515
|
+
getRemoteScreenStream(participantId) {
|
|
516
|
+
return this.remoteScreenStreams.get(participantId) || null;
|
|
517
|
+
}
|
|
515
518
|
setLocalStream(stream) {
|
|
516
519
|
this.localStream = stream;
|
|
517
520
|
}
|
|
@@ -931,19 +934,7 @@ var SFUClient = class {
|
|
|
931
934
|
}
|
|
932
935
|
case "screen_share_stopped": {
|
|
933
936
|
const participantId = payload.participant_id;
|
|
934
|
-
const screenStream = participantId ? this.remoteScreenStreams.get(participantId) : null;
|
|
935
937
|
const trackId = payload.track_id;
|
|
936
|
-
if (screenStream) {
|
|
937
|
-
for (const track of screenStream.getVideoTracks()) {
|
|
938
|
-
if (!trackId || this.normalizeRemoteTrackId(track.id) === String(trackId)) {
|
|
939
|
-
screenStream.removeTrack(track);
|
|
940
|
-
track.stop();
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
if (screenStream.getTracks().length === 0 && participantId) {
|
|
944
|
-
this.remoteScreenStreams.delete(participantId);
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
938
|
this.onScreenShareStopped(participantId, trackId);
|
|
948
939
|
break;
|
|
949
940
|
}
|
|
@@ -2330,11 +2321,11 @@ var VideoSDKCore = class {
|
|
|
2330
2321
|
// SCREEN SHARE
|
|
2331
2322
|
onScreenShareStarted: (participantId, _track) => {
|
|
2332
2323
|
console.log("[SFU] Screen share started", participantId);
|
|
2333
|
-
if (participantId === this.myId && !this.screenStream) {
|
|
2334
|
-
this.screenStream = this.sfuClient?.getScreenStream() ?? null;
|
|
2335
|
-
}
|
|
2336
|
-
this.state.setPresenterId(participantId);
|
|
2337
2324
|
if (participantId === this.myId) {
|
|
2325
|
+
if (!this.screenStream) {
|
|
2326
|
+
this.screenStream = this.sfuClient?.getScreenStream() ?? null;
|
|
2327
|
+
}
|
|
2328
|
+
this.state.setPresenterId(participantId);
|
|
2338
2329
|
this.state.updateLocalParticipant({
|
|
2339
2330
|
media: {
|
|
2340
2331
|
isScreenSharing: true,
|
|
@@ -2344,11 +2335,28 @@ var VideoSDKCore = class {
|
|
|
2344
2335
|
});
|
|
2345
2336
|
return;
|
|
2346
2337
|
}
|
|
2338
|
+
this.state.setPresenterId(participantId);
|
|
2339
|
+
const existingRemoteScreen = this.sfuClient?.getRemoteScreenStream(participantId) ?? this.remoteScreenStreams.get(participantId) ?? null;
|
|
2340
|
+
if (existingRemoteScreen) {
|
|
2341
|
+
this.remoteScreenStreams.set(participantId, existingRemoteScreen);
|
|
2342
|
+
const screenTrack = existingRemoteScreen.getVideoTracks()[0];
|
|
2343
|
+
this.state.updateParticipantMedia(participantId, {
|
|
2344
|
+
isScreenSharing: true,
|
|
2345
|
+
screenStream: existingRemoteScreen,
|
|
2346
|
+
screenTrack
|
|
2347
|
+
});
|
|
2348
|
+
this.events.onScreenShareStarted?.(
|
|
2349
|
+
participantId,
|
|
2350
|
+
existingRemoteScreen
|
|
2351
|
+
);
|
|
2352
|
+
return;
|
|
2353
|
+
}
|
|
2347
2354
|
const current = this.state.getParticipant(participantId);
|
|
2348
2355
|
if (current) {
|
|
2349
2356
|
this.state.updateParticipantMedia(participantId, {
|
|
2350
2357
|
isScreenSharing: true,
|
|
2351
|
-
screenStream: current.media?.screenStream ?? null
|
|
2358
|
+
screenStream: current.media?.screenStream ?? null,
|
|
2359
|
+
screenTrack: current.media?.screenTrack
|
|
2352
2360
|
});
|
|
2353
2361
|
}
|
|
2354
2362
|
},
|
|
@@ -2366,13 +2374,8 @@ var VideoSDKCore = class {
|
|
|
2366
2374
|
});
|
|
2367
2375
|
return;
|
|
2368
2376
|
}
|
|
2369
|
-
const screen = this.remoteScreenStreams.get(participantId);
|
|
2370
|
-
screen?.getTracks().forEach((track) => track.stop());
|
|
2371
|
-
this.remoteScreenStreams.delete(participantId);
|
|
2372
2377
|
this.state.updateParticipantMedia(participantId, {
|
|
2373
|
-
isScreenSharing: false
|
|
2374
|
-
screenStream: null,
|
|
2375
|
-
screenTrack: void 0
|
|
2378
|
+
isScreenSharing: false
|
|
2376
2379
|
});
|
|
2377
2380
|
this.events.onScreenShareStopped?.(participantId);
|
|
2378
2381
|
},
|
|
@@ -2396,8 +2399,8 @@ var VideoSDKCore = class {
|
|
|
2396
2399
|
await client.getToken(roomId, {
|
|
2397
2400
|
displayName: name,
|
|
2398
2401
|
participantId: this.myId,
|
|
2399
|
-
audioMuted: this.
|
|
2400
|
-
videoMuted: this.
|
|
2402
|
+
audioMuted: !(this.localStream?.getAudioTracks()[0]?.enabled ?? true),
|
|
2403
|
+
videoMuted: !(this.localStream?.getVideoTracks()[0]?.enabled ?? true)
|
|
2401
2404
|
});
|
|
2402
2405
|
}
|
|
2403
2406
|
// SFU STATE
|