@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.d.mts
CHANGED
|
@@ -219,8 +219,8 @@ declare class VideoSDKCore {
|
|
|
219
219
|
rejectJoinRequest(requestId: string, reason?: string): Promise<void>;
|
|
220
220
|
toggleMic(): void;
|
|
221
221
|
toggleCam(): void;
|
|
222
|
-
startScreenShare(): Promise<MediaStream
|
|
223
|
-
stopScreenShare(): void
|
|
222
|
+
startScreenShare(): Promise<MediaStream>;
|
|
223
|
+
stopScreenShare(): Promise<void>;
|
|
224
224
|
startRecording(): Promise<void>;
|
|
225
225
|
stopRecording(): Promise<void>;
|
|
226
226
|
getRecordingStatus(): Promise<{
|
|
@@ -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,8 +219,8 @@ declare class VideoSDKCore {
|
|
|
219
219
|
rejectJoinRequest(requestId: string, reason?: string): Promise<void>;
|
|
220
220
|
toggleMic(): void;
|
|
221
221
|
toggleCam(): void;
|
|
222
|
-
startScreenShare(): Promise<MediaStream
|
|
223
|
-
stopScreenShare(): void
|
|
222
|
+
startScreenShare(): Promise<MediaStream>;
|
|
223
|
+
stopScreenShare(): Promise<void>;
|
|
224
224
|
startRecording(): Promise<void>;
|
|
225
225
|
stopRecording(): Promise<void>;
|
|
226
226
|
getRecordingStatus(): Promise<{
|
|
@@ -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
|
@@ -1461,20 +1461,15 @@ var SFUClient = class {
|
|
|
1461
1461
|
}
|
|
1462
1462
|
}
|
|
1463
1463
|
async shareScreen() {
|
|
1464
|
-
if (!this.publisher)
|
|
1464
|
+
if (!this.publisher) {
|
|
1465
1465
|
throw new Error("Publisher PeerConnection is not initialized");
|
|
1466
|
-
|
|
1466
|
+
}
|
|
1467
|
+
if (!this.screenTransceiver || !this.screenSender) {
|
|
1467
1468
|
throw new Error("Screen transceiver is not initialized");
|
|
1468
|
-
const existing = this.screenStream;
|
|
1469
|
-
const existingTrack = this.screenSender.track;
|
|
1470
|
-
if (existing || existingTrack && existingTrack.readyState === "live") {
|
|
1471
|
-
return existing;
|
|
1472
1469
|
}
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
} catch {
|
|
1470
|
+
if (this.screenStream) {
|
|
1471
|
+
return this.screenStream;
|
|
1476
1472
|
}
|
|
1477
|
-
this.screenTransceiver.direction = "inactive";
|
|
1478
1473
|
const screenStream = await navigator.mediaDevices.getDisplayMedia({
|
|
1479
1474
|
video: true,
|
|
1480
1475
|
audio: false
|
|
@@ -1484,22 +1479,29 @@ var SFUClient = class {
|
|
|
1484
1479
|
screenStream.getTracks().forEach((track) => track.stop());
|
|
1485
1480
|
throw new Error("Screen share returned no video track");
|
|
1486
1481
|
}
|
|
1487
|
-
const generation = ++this.screenShareGeneration;
|
|
1488
1482
|
this.screenStream = screenStream;
|
|
1489
1483
|
try {
|
|
1490
1484
|
await this.screenSender.replaceTrack(screenTrack);
|
|
1491
1485
|
this.screenTransceiver.direction = "sendonly";
|
|
1492
|
-
this.send({ type: "start_screen_share" });
|
|
1493
1486
|
const offer = await this.publisher.createOffer();
|
|
1494
1487
|
await this.publisher.setLocalDescription(offer);
|
|
1495
1488
|
this.send({
|
|
1496
1489
|
type: "publish_offer",
|
|
1497
|
-
payload: {
|
|
1490
|
+
payload: {
|
|
1491
|
+
revision: ++this.publisherRevision,
|
|
1492
|
+
sdp: offer.sdp
|
|
1493
|
+
}
|
|
1498
1494
|
});
|
|
1495
|
+
this.send({ type: "start_screen_share" });
|
|
1499
1496
|
screenTrack.onended = () => {
|
|
1500
|
-
if (generation !== this.screenShareGeneration) return;
|
|
1501
1497
|
void this.stopScreenShare();
|
|
1502
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
|
+
});
|
|
1503
1505
|
return this.screenStream;
|
|
1504
1506
|
} catch (error) {
|
|
1505
1507
|
try {
|
|
@@ -1517,34 +1519,38 @@ var SFUClient = class {
|
|
|
1517
1519
|
}
|
|
1518
1520
|
}
|
|
1519
1521
|
async stopScreenShare() {
|
|
1520
|
-
|
|
1521
|
-
const
|
|
1522
|
-
if (
|
|
1523
|
-
++this.screenShareGeneration;
|
|
1524
|
-
if (senderTrack) senderTrack.onended = null;
|
|
1522
|
+
if (!this.screenStream && !this.screenSender?.track) return;
|
|
1523
|
+
const screenTrack = this.screenSender?.track || null;
|
|
1524
|
+
if (screenTrack) screenTrack.onended = null;
|
|
1525
1525
|
try {
|
|
1526
1526
|
await this.screenSender?.replaceTrack(null);
|
|
1527
1527
|
} catch (error) {
|
|
1528
1528
|
this.onError(error);
|
|
1529
1529
|
}
|
|
1530
|
-
if (this.screenTransceiver)
|
|
1530
|
+
if (this.screenTransceiver) {
|
|
1531
|
+
this.screenTransceiver.direction = "inactive";
|
|
1532
|
+
}
|
|
1533
|
+
this.send({ type: "stop_screen_share" });
|
|
1531
1534
|
try {
|
|
1532
1535
|
const offer = await this.publisher?.createOffer();
|
|
1533
1536
|
if (offer && this.publisher) {
|
|
1534
1537
|
await this.publisher.setLocalDescription(offer);
|
|
1535
1538
|
this.send({
|
|
1536
1539
|
type: "publish_offer",
|
|
1537
|
-
payload: {
|
|
1540
|
+
payload: {
|
|
1541
|
+
revision: ++this.publisherRevision,
|
|
1542
|
+
sdp: offer.sdp
|
|
1543
|
+
}
|
|
1538
1544
|
});
|
|
1539
1545
|
}
|
|
1540
1546
|
} catch (error) {
|
|
1541
1547
|
this.onError(error);
|
|
1542
1548
|
}
|
|
1543
|
-
this.
|
|
1544
|
-
stream?.getTracks().forEach((track) => track.stop());
|
|
1549
|
+
this.screenStream?.getTracks().forEach((track) => track.stop());
|
|
1545
1550
|
this.screenStream = null;
|
|
1546
|
-
if (this.currentParticipantId)
|
|
1551
|
+
if (this.currentParticipantId) {
|
|
1547
1552
|
this.onScreenShareStopped(this.currentParticipantId);
|
|
1553
|
+
}
|
|
1548
1554
|
}
|
|
1549
1555
|
muteAudio(muted) {
|
|
1550
1556
|
this.desiredAudioMuted = muted;
|
|
@@ -1651,7 +1657,7 @@ var SFUClient = class {
|
|
|
1651
1657
|
this.send({
|
|
1652
1658
|
type: "send_reaction",
|
|
1653
1659
|
payload: {
|
|
1654
|
-
reaction
|
|
1660
|
+
emoji: reaction
|
|
1655
1661
|
}
|
|
1656
1662
|
});
|
|
1657
1663
|
}
|
|
@@ -2369,7 +2375,9 @@ var VideoSDKCore = class {
|
|
|
2369
2375
|
client.setLocalStream(this.localStream);
|
|
2370
2376
|
await client.getToken(roomId, {
|
|
2371
2377
|
displayName: name,
|
|
2372
|
-
participantId: this.myId
|
|
2378
|
+
participantId: this.myId,
|
|
2379
|
+
audioMuted: this.state.localParticipant?.media?.micEnabled,
|
|
2380
|
+
videoMuted: this.state.localParticipant?.media?.camEnabled
|
|
2373
2381
|
});
|
|
2374
2382
|
}
|
|
2375
2383
|
// SFU STATE
|
|
@@ -2546,21 +2554,23 @@ var VideoSDKCore = class {
|
|
|
2546
2554
|
throw err;
|
|
2547
2555
|
}
|
|
2548
2556
|
}
|
|
2549
|
-
stopScreenShare() {
|
|
2550
|
-
if (!this.
|
|
2557
|
+
async stopScreenShare() {
|
|
2558
|
+
if (!this.sfuClient) {
|
|
2551
2559
|
return;
|
|
2552
2560
|
}
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2561
|
+
try {
|
|
2562
|
+
await this.sfuClient.stopScreenShare();
|
|
2563
|
+
} finally {
|
|
2564
|
+
this.screenStream = null;
|
|
2565
|
+
this.isScreenSharing = false;
|
|
2566
|
+
this.state.updateLocalParticipant({
|
|
2567
|
+
media: {
|
|
2568
|
+
isScreenSharing: false,
|
|
2569
|
+
screenStream: null,
|
|
2570
|
+
screenTrack: void 0
|
|
2571
|
+
}
|
|
2572
|
+
});
|
|
2573
|
+
}
|
|
2564
2574
|
}
|
|
2565
2575
|
// RECORDING
|
|
2566
2576
|
async startRecording() {
|