Skip to content

Commit

Permalink
Fix duplicate ParticipantPermissionsChanged updates for the local par…
Browse files Browse the repository at this point in the history
…ticipant (#1270)

* Fix duplicate ParticipantPermissionsChanged updates for the local participant

also fixed incorrect comments indicating it's only for the local participant

* changeset
  • Loading branch information
davidzhao authored Oct 4, 2024
1 parent df3ea82 commit 719b73b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/three-cheetahs-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'livekit-client': patch
---

Fix duplicate ParticipantPermissionsChanged updates for the local participant
15 changes: 9 additions & 6 deletions example/sample.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
//@ts-ignore
import E2EEWorker from '../src/e2ee/worker/e2ee.worker?worker';
import type {
ChatMessage,
RoomConnectOptions,
RoomOptions,
ScalabilityMode,
SimulationScenario,
VideoCaptureOptions,
VideoCodec,
} from '../src/index';
import {
ConnectionQuality,
ConnectionState,
Expand All @@ -15,23 +24,17 @@ import {
RemoteTrackPublication,
RemoteVideoTrack,
Room,
RoomConnectOptions,
RoomEvent,
RoomOptions,
ScreenSharePresets,
Track,
TrackPublication,
VideoCaptureOptions,
VideoCodec,
VideoPresets,
VideoQuality,
createAudioAnalyser,
setLogLevel,
supportsAV1,
supportsVP9,
} from '../src/index';
import { ScalabilityMode } from '../src/room/track/options';
import type { ChatMessage, SimulationScenario } from '../src/room/types';
import { isSVCCodec } from '../src/room/utils';

const $ = <T extends HTMLElement>(id: string) => document.getElementById(id) as T;
Expand Down
4 changes: 2 additions & 2 deletions src/room/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export enum RoomEvent {
MediaDevicesError = 'mediaDevicesError',

/**
* A participant's permission has changed. Currently only fired on LocalParticipant.
* A participant's permission has changed.
* args: (prevPermissions: [[ParticipantPermission]], participant: [[Participant]])
*/
ParticipantPermissionsChanged = 'participantPermissionsChanged',
Expand Down Expand Up @@ -502,7 +502,7 @@ export enum ParticipantEvent {
AudioStreamAcquired = 'audioStreamAcquired',

/**
* A participant's permission has changed. Currently only fired on LocalParticipant.
* A participant's permission has changed.
* args: (prevPermissions: [[ParticipantPermission]])
*/
ParticipantPermissionsChanged = 'participantPermissionsChanged',
Expand Down
3 changes: 2 additions & 1 deletion src/room/participant/Participant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ export default class Participant extends (EventEmitter as new () => TypedEmitter
permissions.canPublishSources.length !== this.permissions.canPublishSources.length ||
permissions.canPublishSources.some(
(value, index) => value !== this.permissions?.canPublishSources[index],
);
) ||
permissions.canSubscribeMetrics !== this.permissions?.canSubscribeMetrics;
this.permissions = permissions;

if (changed) {
Expand Down

0 comments on commit 719b73b

Please sign in to comment.