@defcomm/meetingsdk 0.2.9 → 0.3.0
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 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +76 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +76 -33
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1425,10 +1425,12 @@ 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");
|
|
1433
|
+
}
|
|
1432
1434
|
const existing = this.screenStream;
|
|
1433
1435
|
const existingTrack = this.screenSender.track;
|
|
1434
1436
|
if (existing || existingTrack && existingTrack.readyState === "live") {
|
|
@@ -1453,15 +1455,26 @@ var SFUClient = class {
|
|
|
1453
1455
|
try {
|
|
1454
1456
|
await this.screenSender.replaceTrack(screenTrack);
|
|
1455
1457
|
this.screenTransceiver.direction = "sendonly";
|
|
1456
|
-
this.send({
|
|
1458
|
+
this.send({
|
|
1459
|
+
type: "start_screen_share"
|
|
1460
|
+
});
|
|
1457
1461
|
const offer = await this.publisher.createOffer();
|
|
1458
1462
|
await this.publisher.setLocalDescription(offer);
|
|
1463
|
+
const localDescription = this.publisher.localDescription;
|
|
1464
|
+
if (!localDescription?.sdp) {
|
|
1465
|
+
throw new Error("Publisher did not produce a valid screen-share SDP");
|
|
1466
|
+
}
|
|
1459
1467
|
this.send({
|
|
1460
1468
|
type: "publish_offer",
|
|
1461
|
-
payload: {
|
|
1469
|
+
payload: {
|
|
1470
|
+
revision: ++this.publisherRevision,
|
|
1471
|
+
sdp: localDescription.sdp
|
|
1472
|
+
}
|
|
1462
1473
|
});
|
|
1463
1474
|
screenTrack.onended = () => {
|
|
1464
|
-
if (generation !== this.screenShareGeneration)
|
|
1475
|
+
if (generation !== this.screenShareGeneration) {
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1465
1478
|
void this.stopScreenShare();
|
|
1466
1479
|
};
|
|
1467
1480
|
return this.screenStream;
|
|
@@ -1471,10 +1484,18 @@ var SFUClient = class {
|
|
|
1471
1484
|
} catch {
|
|
1472
1485
|
}
|
|
1473
1486
|
this.screenTransceiver.direction = "inactive";
|
|
1474
|
-
|
|
1487
|
+
screenTrack.onended = null;
|
|
1488
|
+
screenStream.getTracks().forEach((track) => {
|
|
1489
|
+
try {
|
|
1490
|
+
track.stop();
|
|
1491
|
+
} catch {
|
|
1492
|
+
}
|
|
1493
|
+
});
|
|
1475
1494
|
this.screenStream = null;
|
|
1476
1495
|
try {
|
|
1477
|
-
this.send({
|
|
1496
|
+
this.send({
|
|
1497
|
+
type: "stop_screen_share"
|
|
1498
|
+
});
|
|
1478
1499
|
} catch {
|
|
1479
1500
|
}
|
|
1480
1501
|
throw error;
|
|
@@ -1483,32 +1504,52 @@ var SFUClient = class {
|
|
|
1483
1504
|
async stopScreenShare() {
|
|
1484
1505
|
const stream = this.screenStream;
|
|
1485
1506
|
const senderTrack = this.screenSender?.track || null;
|
|
1486
|
-
if (!stream && !senderTrack)
|
|
1507
|
+
if (!stream && !senderTrack) {
|
|
1508
|
+
return;
|
|
1509
|
+
}
|
|
1487
1510
|
++this.screenShareGeneration;
|
|
1488
|
-
if (senderTrack)
|
|
1511
|
+
if (senderTrack) {
|
|
1512
|
+
senderTrack.onended = null;
|
|
1513
|
+
}
|
|
1489
1514
|
try {
|
|
1490
1515
|
await this.screenSender?.replaceTrack(null);
|
|
1491
1516
|
} catch (error) {
|
|
1492
1517
|
this.onError(error);
|
|
1493
1518
|
}
|
|
1494
|
-
if (this.screenTransceiver)
|
|
1519
|
+
if (this.screenTransceiver) {
|
|
1520
|
+
this.screenTransceiver.direction = "inactive";
|
|
1521
|
+
}
|
|
1495
1522
|
try {
|
|
1496
|
-
|
|
1497
|
-
|
|
1523
|
+
if (this.publisher) {
|
|
1524
|
+
const offer = await this.publisher.createOffer();
|
|
1498
1525
|
await this.publisher.setLocalDescription(offer);
|
|
1499
|
-
this.
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1526
|
+
const localDescription = this.publisher.localDescription;
|
|
1527
|
+
if (localDescription?.sdp) {
|
|
1528
|
+
this.send({
|
|
1529
|
+
type: "publish_offer",
|
|
1530
|
+
payload: {
|
|
1531
|
+
revision: ++this.publisherRevision,
|
|
1532
|
+
sdp: localDescription.sdp
|
|
1533
|
+
}
|
|
1534
|
+
});
|
|
1535
|
+
}
|
|
1503
1536
|
}
|
|
1504
1537
|
} catch (error) {
|
|
1505
1538
|
this.onError(error);
|
|
1506
1539
|
}
|
|
1507
|
-
this.send({
|
|
1508
|
-
|
|
1540
|
+
this.send({
|
|
1541
|
+
type: "stop_screen_share"
|
|
1542
|
+
});
|
|
1543
|
+
stream?.getTracks().forEach((track) => {
|
|
1544
|
+
try {
|
|
1545
|
+
track.stop();
|
|
1546
|
+
} catch {
|
|
1547
|
+
}
|
|
1548
|
+
});
|
|
1509
1549
|
this.screenStream = null;
|
|
1510
|
-
if (this.currentParticipantId)
|
|
1550
|
+
if (this.currentParticipantId) {
|
|
1511
1551
|
this.onScreenShareStopped(this.currentParticipantId);
|
|
1552
|
+
}
|
|
1512
1553
|
}
|
|
1513
1554
|
muteAudio(muted) {
|
|
1514
1555
|
this.desiredAudioMuted = muted;
|
|
@@ -1615,7 +1656,7 @@ var SFUClient = class {
|
|
|
1615
1656
|
this.send({
|
|
1616
1657
|
type: "send_reaction",
|
|
1617
1658
|
payload: {
|
|
1618
|
-
reaction
|
|
1659
|
+
emoji: reaction
|
|
1619
1660
|
}
|
|
1620
1661
|
});
|
|
1621
1662
|
}
|
|
@@ -2510,21 +2551,23 @@ var VideoSDKCore = class {
|
|
|
2510
2551
|
throw err;
|
|
2511
2552
|
}
|
|
2512
2553
|
}
|
|
2513
|
-
stopScreenShare() {
|
|
2514
|
-
if (!this.
|
|
2554
|
+
async stopScreenShare() {
|
|
2555
|
+
if (!this.sfuClient) {
|
|
2515
2556
|
return;
|
|
2516
2557
|
}
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2558
|
+
try {
|
|
2559
|
+
await this.sfuClient.stopScreenShare();
|
|
2560
|
+
} finally {
|
|
2561
|
+
this.screenStream = null;
|
|
2562
|
+
this.isScreenSharing = false;
|
|
2563
|
+
this.state.updateLocalParticipant({
|
|
2564
|
+
media: {
|
|
2565
|
+
isScreenSharing: false,
|
|
2566
|
+
screenStream: null,
|
|
2567
|
+
screenTrack: void 0
|
|
2568
|
+
}
|
|
2569
|
+
});
|
|
2570
|
+
}
|
|
2528
2571
|
}
|
|
2529
2572
|
// RECORDING
|
|
2530
2573
|
async startRecording() {
|