@defcomm/meetingsdk 0.2.9 → 0.3.1
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 +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +49 -39
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -39
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1425,20 +1425,15 @@ var SFUClient = class {
|
|
|
1425
1425
|
}
|
|
1426
1426
|
}
|
|
1427
1427
|
async shareScreen() {
|
|
1428
|
-
if (!this.publisher)
|
|
1428
|
+
if (!this.publisher) {
|
|
1429
1429
|
throw new Error("Publisher PeerConnection is not initialized");
|
|
1430
|
-
|
|
1430
|
+
}
|
|
1431
|
+
if (!this.screenTransceiver || !this.screenSender) {
|
|
1431
1432
|
throw new Error("Screen transceiver is not initialized");
|
|
1432
|
-
const existing = this.screenStream;
|
|
1433
|
-
const existingTrack = this.screenSender.track;
|
|
1434
|
-
if (existing || existingTrack && existingTrack.readyState === "live") {
|
|
1435
|
-
return existing;
|
|
1436
1433
|
}
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
} catch {
|
|
1434
|
+
if (this.screenStream) {
|
|
1435
|
+
return this.screenStream;
|
|
1440
1436
|
}
|
|
1441
|
-
this.screenTransceiver.direction = "inactive";
|
|
1442
1437
|
const screenStream = await navigator.mediaDevices.getDisplayMedia({
|
|
1443
1438
|
video: true,
|
|
1444
1439
|
audio: false
|
|
@@ -1448,22 +1443,29 @@ var SFUClient = class {
|
|
|
1448
1443
|
screenStream.getTracks().forEach((track) => track.stop());
|
|
1449
1444
|
throw new Error("Screen share returned no video track");
|
|
1450
1445
|
}
|
|
1451
|
-
const generation = ++this.screenShareGeneration;
|
|
1452
1446
|
this.screenStream = screenStream;
|
|
1453
1447
|
try {
|
|
1454
1448
|
await this.screenSender.replaceTrack(screenTrack);
|
|
1455
1449
|
this.screenTransceiver.direction = "sendonly";
|
|
1456
|
-
this.send({ type: "start_screen_share" });
|
|
1457
1450
|
const offer = await this.publisher.createOffer();
|
|
1458
1451
|
await this.publisher.setLocalDescription(offer);
|
|
1459
1452
|
this.send({
|
|
1460
1453
|
type: "publish_offer",
|
|
1461
|
-
payload: {
|
|
1454
|
+
payload: {
|
|
1455
|
+
revision: ++this.publisherRevision,
|
|
1456
|
+
sdp: offer.sdp
|
|
1457
|
+
}
|
|
1462
1458
|
});
|
|
1459
|
+
this.send({ type: "start_screen_share" });
|
|
1463
1460
|
screenTrack.onended = () => {
|
|
1464
|
-
if (generation !== this.screenShareGeneration) return;
|
|
1465
1461
|
void this.stopScreenShare();
|
|
1466
1462
|
};
|
|
1463
|
+
console.info("[publisher] Screen track attached", {
|
|
1464
|
+
screenTrackId: screenTrack.id,
|
|
1465
|
+
cameraTrackId: this.videoSender?.track?.id,
|
|
1466
|
+
screenMid: this.screenTransceiver.mid,
|
|
1467
|
+
cameraMid: this.cameraTransceiver?.mid
|
|
1468
|
+
});
|
|
1467
1469
|
return this.screenStream;
|
|
1468
1470
|
} catch (error) {
|
|
1469
1471
|
try {
|
|
@@ -1481,34 +1483,38 @@ var SFUClient = class {
|
|
|
1481
1483
|
}
|
|
1482
1484
|
}
|
|
1483
1485
|
async stopScreenShare() {
|
|
1484
|
-
|
|
1485
|
-
const
|
|
1486
|
-
if (
|
|
1487
|
-
++this.screenShareGeneration;
|
|
1488
|
-
if (senderTrack) senderTrack.onended = null;
|
|
1486
|
+
if (!this.screenStream && !this.screenSender?.track) return;
|
|
1487
|
+
const screenTrack = this.screenSender?.track || null;
|
|
1488
|
+
if (screenTrack) screenTrack.onended = null;
|
|
1489
1489
|
try {
|
|
1490
1490
|
await this.screenSender?.replaceTrack(null);
|
|
1491
1491
|
} catch (error) {
|
|
1492
1492
|
this.onError(error);
|
|
1493
1493
|
}
|
|
1494
|
-
if (this.screenTransceiver)
|
|
1494
|
+
if (this.screenTransceiver) {
|
|
1495
|
+
this.screenTransceiver.direction = "inactive";
|
|
1496
|
+
}
|
|
1497
|
+
this.send({ type: "stop_screen_share" });
|
|
1495
1498
|
try {
|
|
1496
1499
|
const offer = await this.publisher?.createOffer();
|
|
1497
1500
|
if (offer && this.publisher) {
|
|
1498
1501
|
await this.publisher.setLocalDescription(offer);
|
|
1499
1502
|
this.send({
|
|
1500
1503
|
type: "publish_offer",
|
|
1501
|
-
payload: {
|
|
1504
|
+
payload: {
|
|
1505
|
+
revision: ++this.publisherRevision,
|
|
1506
|
+
sdp: offer.sdp
|
|
1507
|
+
}
|
|
1502
1508
|
});
|
|
1503
1509
|
}
|
|
1504
1510
|
} catch (error) {
|
|
1505
1511
|
this.onError(error);
|
|
1506
1512
|
}
|
|
1507
|
-
this.
|
|
1508
|
-
stream?.getTracks().forEach((track) => track.stop());
|
|
1513
|
+
this.screenStream?.getTracks().forEach((track) => track.stop());
|
|
1509
1514
|
this.screenStream = null;
|
|
1510
|
-
if (this.currentParticipantId)
|
|
1515
|
+
if (this.currentParticipantId) {
|
|
1511
1516
|
this.onScreenShareStopped(this.currentParticipantId);
|
|
1517
|
+
}
|
|
1512
1518
|
}
|
|
1513
1519
|
muteAudio(muted) {
|
|
1514
1520
|
this.desiredAudioMuted = muted;
|
|
@@ -1615,7 +1621,7 @@ var SFUClient = class {
|
|
|
1615
1621
|
this.send({
|
|
1616
1622
|
type: "send_reaction",
|
|
1617
1623
|
payload: {
|
|
1618
|
-
reaction
|
|
1624
|
+
emoji: reaction
|
|
1619
1625
|
}
|
|
1620
1626
|
});
|
|
1621
1627
|
}
|
|
@@ -2333,7 +2339,9 @@ var VideoSDKCore = class {
|
|
|
2333
2339
|
client.setLocalStream(this.localStream);
|
|
2334
2340
|
await client.getToken(roomId, {
|
|
2335
2341
|
displayName: name,
|
|
2336
|
-
participantId: this.myId
|
|
2342
|
+
participantId: this.myId,
|
|
2343
|
+
audioMuted: this.state.localParticipant?.media?.micEnabled,
|
|
2344
|
+
videoMuted: this.state.localParticipant?.media?.camEnabled
|
|
2337
2345
|
});
|
|
2338
2346
|
}
|
|
2339
2347
|
// SFU STATE
|
|
@@ -2510,21 +2518,23 @@ var VideoSDKCore = class {
|
|
|
2510
2518
|
throw err;
|
|
2511
2519
|
}
|
|
2512
2520
|
}
|
|
2513
|
-
stopScreenShare() {
|
|
2514
|
-
if (!this.
|
|
2521
|
+
async stopScreenShare() {
|
|
2522
|
+
if (!this.sfuClient) {
|
|
2515
2523
|
return;
|
|
2516
2524
|
}
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2525
|
+
try {
|
|
2526
|
+
await this.sfuClient.stopScreenShare();
|
|
2527
|
+
} finally {
|
|
2528
|
+
this.screenStream = null;
|
|
2529
|
+
this.isScreenSharing = false;
|
|
2530
|
+
this.state.updateLocalParticipant({
|
|
2531
|
+
media: {
|
|
2532
|
+
isScreenSharing: false,
|
|
2533
|
+
screenStream: null,
|
|
2534
|
+
screenTrack: void 0
|
|
2535
|
+
}
|
|
2536
|
+
});
|
|
2537
|
+
}
|
|
2528
2538
|
}
|
|
2529
2539
|
// RECORDING
|
|
2530
2540
|
async startRecording() {
|