@livedigital/client 3.20.1 → 3.20.2

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.
@@ -345,5 +345,6 @@ export declare type ChangePeerProducePermissionPayload = {
345
345
  export interface ChannelChangeProducePermissionsPayload {
346
346
  groups: PeerGroup[];
347
347
  producePermissions: TrackLabel[];
348
+ changedProducePermissions: TrackLabel[];
348
349
  }
349
350
  export declare type TrackLabelString = 'camera' | 'microphone' | 'screen-video' | 'screen-audio';
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@livedigital/client",
3
3
  "author": "vlprojects",
4
4
  "license": "MIT",
5
- "version": "3.20.1",
5
+ "version": "3.20.2",
6
6
  "private": false,
7
7
  "bugs": {
8
8
  "url": "https://github.com/vlprojects/livedigital-sdk/issues"
@@ -82,13 +82,16 @@ class ChannelEventHandler {
82
82
  });
83
83
 
84
84
  connection.on(CHANNEL_EVENTS.changeProducePermissions, (payload: ChannelChangeProducePermissionsPayload) => {
85
- const { producePermissions, groups } = payload;
85
+ const { producePermissions, groups, changedProducePermissions } = payload;
86
86
  const peers = this.engine.peers.filter((peer) => peer.groups.some((group) => groups.includes(group)));
87
87
  peers.forEach((peer) => {
88
+ const newProducePermissions = Array.from(new Set([...peer.producePermissions, ...changedProducePermissions]))
89
+ .filter((label) => (changedProducePermissions.includes(label) ? producePermissions.includes(label) : true));
90
+
88
91
  // eslint-disable-next-line no-param-reassign
89
- peer.producePermissions = producePermissions;
92
+ peer.producePermissions = newProducePermissions;
90
93
  peer.observer.safeEmit(PEER_EVENTS.producePermissionsChanged, {
91
- labels: producePermissions,
94
+ labels: newProducePermissions,
92
95
  });
93
96
  });
94
97
 
@@ -424,6 +424,7 @@ export type ChangePeerProducePermissionPayload = {
424
424
  export interface ChannelChangeProducePermissionsPayload {
425
425
  groups: PeerGroup[];
426
426
  producePermissions: TrackLabel[];
427
+ changedProducePermissions: TrackLabel[];
427
428
  }
428
429
 
429
430
  export type TrackLabelString = 'camera' | 'microphone' | 'screen-video' | 'screen-audio';