@reactoo/watchtogether-sdk-js 2.6.25 → 2.6.27
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/package.json
CHANGED
package/src/modules/wt-room.js
CHANGED
|
@@ -518,8 +518,23 @@ class RoomSession {
|
|
|
518
518
|
this.id = msg["id"];
|
|
519
519
|
this.privateId = msg["private_id"];
|
|
520
520
|
this.isConnected = true;
|
|
521
|
-
this.emit('joined', true);
|
|
522
521
|
this._log('We have successfully joined Room');
|
|
522
|
+
this.emit('joined', true, this.constructId);
|
|
523
|
+
this.emit('addLocalParticipant', {
|
|
524
|
+
tid: generateUUID(),
|
|
525
|
+
id: handle.handleId,
|
|
526
|
+
constructId: this.constructId,
|
|
527
|
+
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
528
|
+
role: decodeJanusDisplay(this.display)?.role,
|
|
529
|
+
track: null,
|
|
530
|
+
stream: null,
|
|
531
|
+
streamMap: {},
|
|
532
|
+
source: null,
|
|
533
|
+
adding: false,
|
|
534
|
+
removing: false,
|
|
535
|
+
hasAudioTrack: false,
|
|
536
|
+
hasVideoTrack: false,
|
|
537
|
+
});
|
|
523
538
|
for (let f in list) {
|
|
524
539
|
let userId = list[f]["display"];
|
|
525
540
|
let streams = list[f]["streams"] || [];
|
|
@@ -736,6 +751,7 @@ class RoomSession {
|
|
|
736
751
|
source: null,
|
|
737
752
|
track: null,
|
|
738
753
|
adding: false,
|
|
754
|
+
removing: false,
|
|
739
755
|
constructId: this.constructId,
|
|
740
756
|
hasAudioTrack: false,
|
|
741
757
|
hasVideoTrack: false
|
|
@@ -1397,9 +1413,9 @@ class RoomSession {
|
|
|
1397
1413
|
streamMap: structuredClone(config.streamMap),
|
|
1398
1414
|
track: null,
|
|
1399
1415
|
source: null,
|
|
1400
|
-
optional: true,
|
|
1401
1416
|
constructId: this.constructId,
|
|
1402
1417
|
adding: false,
|
|
1418
|
+
removing: false,
|
|
1403
1419
|
hasAudioTrack: !!(config.stream && config.stream.getAudioTracks().length),
|
|
1404
1420
|
hasVideoTrack: !!(config.stream && config.stream.getVideoTracks().length)
|
|
1405
1421
|
})
|
|
@@ -1420,7 +1436,6 @@ class RoomSession {
|
|
|
1420
1436
|
streamMap: structuredClone(config.streamMap),
|
|
1421
1437
|
track: null,
|
|
1422
1438
|
source: null,
|
|
1423
|
-
optional: true,
|
|
1424
1439
|
constructId: this.constructId,
|
|
1425
1440
|
adding: false,
|
|
1426
1441
|
hasAudioTrack: !!(config.stream && config.stream.getAudioTracks().length),
|
|
@@ -1507,6 +1522,7 @@ class RoomSession {
|
|
|
1507
1522
|
track: event.track,
|
|
1508
1523
|
constructId: this.constructId,
|
|
1509
1524
|
adding: true,
|
|
1525
|
+
removing: false,
|
|
1510
1526
|
hasAudioTrack: !!(config.stream && config.stream.getAudioTracks().length),
|
|
1511
1527
|
hasVideoTrack: !!(config.stream && config.stream.getVideoTracks().length)
|
|
1512
1528
|
});
|
|
@@ -2008,7 +2024,12 @@ class RoomSession {
|
|
|
2008
2024
|
let needsNegotiation = false;
|
|
2009
2025
|
let transceivers = config.pc.getTransceivers();
|
|
2010
2026
|
let existingTracks = [...(config.streamMap[source] || [])];
|
|
2011
|
-
|
|
2027
|
+
|
|
2028
|
+
if(stream?.getTracks().length) {
|
|
2029
|
+
config.streamMap[source] = stream?.getTracks()?.map(track => track.id) || [];
|
|
2030
|
+
} else {
|
|
2031
|
+
delete config.streamMap[source];
|
|
2032
|
+
}
|
|
2012
2033
|
|
|
2013
2034
|
// remove old audio track related to this source
|
|
2014
2035
|
let oldAudioStream = config?.stream?.getAudioTracks()?.find(track => existingTracks.includes(track.id));
|
|
@@ -2158,6 +2179,12 @@ class RoomSession {
|
|
|
2158
2179
|
config.stream.onremovetrack = (ev) => {};
|
|
2159
2180
|
|
|
2160
2181
|
let trackremoved = (ev) => {
|
|
2182
|
+
|
|
2183
|
+
config.streamMap[source] = config.streamMap[source].filter(id => id !== ev.detail.id);
|
|
2184
|
+
if(config.streamMap[source].length === 0) {
|
|
2185
|
+
delete config.streamMap[source];
|
|
2186
|
+
}
|
|
2187
|
+
|
|
2161
2188
|
this.emit('addLocalParticipant', {
|
|
2162
2189
|
tid: generateUUID(),
|
|
2163
2190
|
id: handle.handleId,
|
|
@@ -2211,7 +2238,6 @@ class RoomSession {
|
|
|
2211
2238
|
})
|
|
2212
2239
|
}
|
|
2213
2240
|
|
|
2214
|
-
//TODO: legacy event, remove in future
|
|
2215
2241
|
else {
|
|
2216
2242
|
this.emit('addLocalParticipant', {
|
|
2217
2243
|
tid: generateUUID(),
|