@defcomm/meetingsdk 0.3.0 → 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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +29 -62
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -62
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -219,7 +219,7 @@ declare class VideoSDKCore {
|
|
|
219
219
|
rejectJoinRequest(requestId: string, reason?: string): Promise<void>;
|
|
220
220
|
toggleMic(): void;
|
|
221
221
|
toggleCam(): void;
|
|
222
|
-
startScreenShare(): Promise<MediaStream
|
|
222
|
+
startScreenShare(): Promise<MediaStream>;
|
|
223
223
|
stopScreenShare(): Promise<void>;
|
|
224
224
|
startRecording(): Promise<void>;
|
|
225
225
|
stopRecording(): Promise<void>;
|
|
@@ -436,7 +436,7 @@ declare class SFUClient {
|
|
|
436
436
|
video?: boolean | undefined;
|
|
437
437
|
}): Promise<MediaStream>;
|
|
438
438
|
private publishExistingTracks;
|
|
439
|
-
shareScreen(): Promise<MediaStream
|
|
439
|
+
shareScreen(): Promise<MediaStream>;
|
|
440
440
|
stopScreenShare(): Promise<void>;
|
|
441
441
|
muteAudio(muted: boolean): void;
|
|
442
442
|
muteVideo(muted: boolean): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -219,7 +219,7 @@ declare class VideoSDKCore {
|
|
|
219
219
|
rejectJoinRequest(requestId: string, reason?: string): Promise<void>;
|
|
220
220
|
toggleMic(): void;
|
|
221
221
|
toggleCam(): void;
|
|
222
|
-
startScreenShare(): Promise<MediaStream
|
|
222
|
+
startScreenShare(): Promise<MediaStream>;
|
|
223
223
|
stopScreenShare(): Promise<void>;
|
|
224
224
|
startRecording(): Promise<void>;
|
|
225
225
|
stopRecording(): Promise<void>;
|
|
@@ -436,7 +436,7 @@ declare class SFUClient {
|
|
|
436
436
|
video?: boolean | undefined;
|
|
437
437
|
}): Promise<MediaStream>;
|
|
438
438
|
private publishExistingTracks;
|
|
439
|
-
shareScreen(): Promise<MediaStream
|
|
439
|
+
shareScreen(): Promise<MediaStream>;
|
|
440
440
|
stopScreenShare(): Promise<void>;
|
|
441
441
|
muteAudio(muted: boolean): void;
|
|
442
442
|
muteVideo(muted: boolean): void;
|
package/dist/index.js
CHANGED
|
@@ -1467,16 +1467,9 @@ var SFUClient = class {
|
|
|
1467
1467
|
if (!this.screenTransceiver || !this.screenSender) {
|
|
1468
1468
|
throw new Error("Screen transceiver is not initialized");
|
|
1469
1469
|
}
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
if (existing || existingTrack && existingTrack.readyState === "live") {
|
|
1473
|
-
return existing;
|
|
1474
|
-
}
|
|
1475
|
-
try {
|
|
1476
|
-
await this.screenSender.replaceTrack(null);
|
|
1477
|
-
} catch {
|
|
1470
|
+
if (this.screenStream) {
|
|
1471
|
+
return this.screenStream;
|
|
1478
1472
|
}
|
|
1479
|
-
this.screenTransceiver.direction = "inactive";
|
|
1480
1473
|
const screenStream = await navigator.mediaDevices.getDisplayMedia({
|
|
1481
1474
|
video: true,
|
|
1482
1475
|
audio: false
|
|
@@ -1486,33 +1479,29 @@ var SFUClient = class {
|
|
|
1486
1479
|
screenStream.getTracks().forEach((track) => track.stop());
|
|
1487
1480
|
throw new Error("Screen share returned no video track");
|
|
1488
1481
|
}
|
|
1489
|
-
const generation = ++this.screenShareGeneration;
|
|
1490
1482
|
this.screenStream = screenStream;
|
|
1491
1483
|
try {
|
|
1492
1484
|
await this.screenSender.replaceTrack(screenTrack);
|
|
1493
1485
|
this.screenTransceiver.direction = "sendonly";
|
|
1494
|
-
this.send({
|
|
1495
|
-
type: "start_screen_share"
|
|
1496
|
-
});
|
|
1497
1486
|
const offer = await this.publisher.createOffer();
|
|
1498
1487
|
await this.publisher.setLocalDescription(offer);
|
|
1499
|
-
const localDescription = this.publisher.localDescription;
|
|
1500
|
-
if (!localDescription?.sdp) {
|
|
1501
|
-
throw new Error("Publisher did not produce a valid screen-share SDP");
|
|
1502
|
-
}
|
|
1503
1488
|
this.send({
|
|
1504
1489
|
type: "publish_offer",
|
|
1505
1490
|
payload: {
|
|
1506
1491
|
revision: ++this.publisherRevision,
|
|
1507
|
-
sdp:
|
|
1492
|
+
sdp: offer.sdp
|
|
1508
1493
|
}
|
|
1509
1494
|
});
|
|
1495
|
+
this.send({ type: "start_screen_share" });
|
|
1510
1496
|
screenTrack.onended = () => {
|
|
1511
|
-
if (generation !== this.screenShareGeneration) {
|
|
1512
|
-
return;
|
|
1513
|
-
}
|
|
1514
1497
|
void this.stopScreenShare();
|
|
1515
1498
|
};
|
|
1499
|
+
console.info("[publisher] Screen track attached", {
|
|
1500
|
+
screenTrackId: screenTrack.id,
|
|
1501
|
+
cameraTrackId: this.videoSender?.track?.id,
|
|
1502
|
+
screenMid: this.screenTransceiver.mid,
|
|
1503
|
+
cameraMid: this.cameraTransceiver?.mid
|
|
1504
|
+
});
|
|
1516
1505
|
return this.screenStream;
|
|
1517
1506
|
} catch (error) {
|
|
1518
1507
|
try {
|
|
@@ -1520,33 +1509,19 @@ var SFUClient = class {
|
|
|
1520
1509
|
} catch {
|
|
1521
1510
|
}
|
|
1522
1511
|
this.screenTransceiver.direction = "inactive";
|
|
1523
|
-
|
|
1524
|
-
screenStream.getTracks().forEach((track) => {
|
|
1525
|
-
try {
|
|
1526
|
-
track.stop();
|
|
1527
|
-
} catch {
|
|
1528
|
-
}
|
|
1529
|
-
});
|
|
1512
|
+
screenStream.getTracks().forEach((track) => track.stop());
|
|
1530
1513
|
this.screenStream = null;
|
|
1531
1514
|
try {
|
|
1532
|
-
this.send({
|
|
1533
|
-
type: "stop_screen_share"
|
|
1534
|
-
});
|
|
1515
|
+
this.send({ type: "stop_screen_share" });
|
|
1535
1516
|
} catch {
|
|
1536
1517
|
}
|
|
1537
1518
|
throw error;
|
|
1538
1519
|
}
|
|
1539
1520
|
}
|
|
1540
1521
|
async stopScreenShare() {
|
|
1541
|
-
|
|
1542
|
-
const
|
|
1543
|
-
if (
|
|
1544
|
-
return;
|
|
1545
|
-
}
|
|
1546
|
-
++this.screenShareGeneration;
|
|
1547
|
-
if (senderTrack) {
|
|
1548
|
-
senderTrack.onended = null;
|
|
1549
|
-
}
|
|
1522
|
+
if (!this.screenStream && !this.screenSender?.track) return;
|
|
1523
|
+
const screenTrack = this.screenSender?.track || null;
|
|
1524
|
+
if (screenTrack) screenTrack.onended = null;
|
|
1550
1525
|
try {
|
|
1551
1526
|
await this.screenSender?.replaceTrack(null);
|
|
1552
1527
|
} catch (error) {
|
|
@@ -1555,33 +1530,23 @@ var SFUClient = class {
|
|
|
1555
1530
|
if (this.screenTransceiver) {
|
|
1556
1531
|
this.screenTransceiver.direction = "inactive";
|
|
1557
1532
|
}
|
|
1533
|
+
this.send({ type: "stop_screen_share" });
|
|
1558
1534
|
try {
|
|
1559
|
-
|
|
1560
|
-
|
|
1535
|
+
const offer = await this.publisher?.createOffer();
|
|
1536
|
+
if (offer && this.publisher) {
|
|
1561
1537
|
await this.publisher.setLocalDescription(offer);
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
}
|
|
1570
|
-
});
|
|
1571
|
-
}
|
|
1538
|
+
this.send({
|
|
1539
|
+
type: "publish_offer",
|
|
1540
|
+
payload: {
|
|
1541
|
+
revision: ++this.publisherRevision,
|
|
1542
|
+
sdp: offer.sdp
|
|
1543
|
+
}
|
|
1544
|
+
});
|
|
1572
1545
|
}
|
|
1573
1546
|
} catch (error) {
|
|
1574
1547
|
this.onError(error);
|
|
1575
1548
|
}
|
|
1576
|
-
this.
|
|
1577
|
-
type: "stop_screen_share"
|
|
1578
|
-
});
|
|
1579
|
-
stream?.getTracks().forEach((track) => {
|
|
1580
|
-
try {
|
|
1581
|
-
track.stop();
|
|
1582
|
-
} catch {
|
|
1583
|
-
}
|
|
1584
|
-
});
|
|
1549
|
+
this.screenStream?.getTracks().forEach((track) => track.stop());
|
|
1585
1550
|
this.screenStream = null;
|
|
1586
1551
|
if (this.currentParticipantId) {
|
|
1587
1552
|
this.onScreenShareStopped(this.currentParticipantId);
|
|
@@ -2410,7 +2375,9 @@ var VideoSDKCore = class {
|
|
|
2410
2375
|
client.setLocalStream(this.localStream);
|
|
2411
2376
|
await client.getToken(roomId, {
|
|
2412
2377
|
displayName: name,
|
|
2413
|
-
participantId: this.myId
|
|
2378
|
+
participantId: this.myId,
|
|
2379
|
+
audioMuted: this.state.localParticipant?.media?.micEnabled,
|
|
2380
|
+
videoMuted: this.state.localParticipant?.media?.camEnabled
|
|
2414
2381
|
});
|
|
2415
2382
|
}
|
|
2416
2383
|
// SFU STATE
|