@reactoo/watchtogether-sdk-js 2.6.27 → 2.6.28

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactoo/watchtogether-sdk-js",
3
- "version": "2.6.27",
3
+ "version": "2.6.28",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "src/index.js",
6
6
  "unpkg": "dist/watchtogether-sdk.min.js",
@@ -2041,7 +2041,7 @@ class RoomSession {
2041
2041
  this._log(e);
2042
2042
  }
2043
2043
  config.stream.removeTrack(oldAudioStream);
2044
- config.stream.dispatchEvent(new Event("trackremoved", {detail: oldAudioStream}))
2044
+ config.stream.dispatchEvent(new CustomEvent("trackremoved", {detail: {track: oldAudioStream, source}}))
2045
2045
  }
2046
2046
 
2047
2047
  // remove old video track related to this source
@@ -2053,7 +2053,7 @@ class RoomSession {
2053
2053
  this._log(e);
2054
2054
  }
2055
2055
  config.stream.removeTrack(oldVideoStream);
2056
- config.stream.dispatchEvent(new Event("trackremoved", {detail: oldVideoStream}))
2056
+ config.stream.dispatchEvent(new CustomEvent("trackremoved", {detail: {track: oldVideoStream, source}}))
2057
2057
  }
2058
2058
 
2059
2059
  let audioTrackReplacePromise = Promise.resolve();
@@ -2180,9 +2180,9 @@ class RoomSession {
2180
2180
 
2181
2181
  let trackremoved = (ev) => {
2182
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];
2183
+ config.streamMap[ev.detail.source] = config.streamMap[ev.detail.source].filter(id => id !== ev.detail.track.id);
2184
+ if(config.streamMap[ev.detail.source].length === 0) {
2185
+ delete config.streamMap[ev.detail.source];
2186
2186
  }
2187
2187
 
2188
2188
  this.emit('addLocalParticipant', {
@@ -2191,10 +2191,10 @@ class RoomSession {
2191
2191
  constructId: this.constructId,
2192
2192
  userId: decodeJanusDisplay(handle.userId)?.userId,
2193
2193
  role: decodeJanusDisplay(this.display)?.role,
2194
- track: ev.detail,
2194
+ track: ev.detail.track,
2195
2195
  stream: config.stream,
2196
2196
  streamMap: structuredClone(config.streamMap),
2197
- source,
2197
+ source: ev.detail.source,
2198
2198
  adding: false,
2199
2199
  removing: true,
2200
2200
  hasAudioTrack: hasAudio,
@@ -2231,7 +2231,7 @@ class RoomSession {
2231
2231
 
2232
2232
  track.onended = (ev) => {
2233
2233
  config.stream.removeTrack(track);
2234
- config.stream.dispatchEvent(new Event("trackremoved", {detail: track}))
2234
+ config.stream.dispatchEvent(new CustomEvent("trackremoved", {detail: {track, source}}))
2235
2235
  this._republishOnTrackEnded(source);
2236
2236
  }
2237
2237
  }