livekit-client 1.6.3 → 1.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. package/dist/livekit-client.esm.mjs +158 -41
  2. package/dist/livekit-client.esm.mjs.map +1 -1
  3. package/dist/livekit-client.umd.js +1 -1
  4. package/dist/livekit-client.umd.js.map +1 -1
  5. package/dist/src/api/SignalClient.d.ts.map +1 -1
  6. package/dist/src/connectionHelper/ConnectionCheck.d.ts +2 -2
  7. package/dist/src/connectionHelper/ConnectionCheck.d.ts.map +1 -1
  8. package/dist/src/proto/livekit_models.d.ts +10 -3
  9. package/dist/src/proto/livekit_models.d.ts.map +1 -1
  10. package/dist/src/proto/livekit_rtc.d.ts +188 -98
  11. package/dist/src/proto/livekit_rtc.d.ts.map +1 -1
  12. package/dist/src/room/Room.d.ts +1 -1
  13. package/dist/src/room/Room.d.ts.map +1 -1
  14. package/dist/src/room/errors.d.ts +3 -0
  15. package/dist/src/room/errors.d.ts.map +1 -1
  16. package/dist/src/room/participant/LocalParticipant.d.ts +1 -3
  17. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  18. package/dist/src/room/participant/Participant.d.ts +1 -1
  19. package/dist/src/room/participant/Participant.d.ts.map +1 -1
  20. package/dist/src/room/track/create.d.ts.map +1 -1
  21. package/dist/src/room/track/options.d.ts +2 -2
  22. package/dist/src/room/track/options.d.ts.map +1 -1
  23. package/dist/src/test/mocks.d.ts +1 -1
  24. package/dist/ts4.2/src/connectionHelper/ConnectionCheck.d.ts +2 -2
  25. package/dist/ts4.2/src/proto/livekit_models.d.ts +14 -3
  26. package/dist/ts4.2/src/proto/livekit_rtc.d.ts +237 -129
  27. package/dist/ts4.2/src/room/Room.d.ts +1 -1
  28. package/dist/ts4.2/src/room/errors.d.ts +3 -0
  29. package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +1 -3
  30. package/dist/ts4.2/src/room/participant/Participant.d.ts +1 -1
  31. package/dist/ts4.2/src/room/track/options.d.ts +2 -2
  32. package/dist/ts4.2/src/test/mocks.d.ts +1 -1
  33. package/package.json +17 -17
  34. package/src/api/SignalClient.ts +5 -1
  35. package/src/connectionHelper/ConnectionCheck.ts +1 -1
  36. package/src/proto/google/protobuf/timestamp.ts +2 -2
  37. package/src/proto/livekit_models.ts +42 -9
  38. package/src/proto/livekit_rtc.ts +99 -4
  39. package/src/room/RTCEngine.ts +2 -2
  40. package/src/room/Room.ts +4 -7
  41. package/src/room/errors.ts +6 -0
  42. package/src/room/participant/LocalParticipant.ts +12 -17
  43. package/src/room/participant/Participant.ts +10 -2
  44. package/src/room/track/create.ts +6 -1
  45. package/src/room/track/options.ts +2 -2
@@ -173,14 +173,22 @@ export default class Participant extends (EventEmitter as new () => TypedEmitter
173
173
 
174
174
  /** @internal */
175
175
  setPermissions(permissions: ParticipantPermission): boolean {
176
+ const prevPermissions = this.permissions;
176
177
  const changed =
177
178
  permissions.canPublish !== this.permissions?.canPublish ||
178
179
  permissions.canSubscribe !== this.permissions?.canSubscribe ||
179
180
  permissions.canPublishData !== this.permissions?.canPublishData ||
180
181
  permissions.hidden !== this.permissions?.hidden ||
181
- permissions.recorder !== this.permissions?.recorder;
182
+ permissions.recorder !== this.permissions?.recorder ||
183
+ permissions.canPublishSources.length !== this.permissions.canPublishSources.length ||
184
+ permissions.canPublishSources.some(
185
+ (value, index) => value !== this.permissions?.canPublishSources[index],
186
+ );
182
187
  this.permissions = permissions;
183
188
 
189
+ if (changed) {
190
+ this.emit(ParticipantEvent.ParticipantPermissionsChanged, prevPermissions);
191
+ }
184
192
  return changed;
185
193
  }
186
194
 
@@ -257,7 +265,7 @@ export type ParticipantEventCallbacks = {
257
265
  status: TrackPublication.PermissionStatus,
258
266
  ) => void;
259
267
  mediaDevicesError: (error: Error) => void;
260
- participantPermissionsChanged: (prevPermissions: ParticipantPermission) => void;
268
+ participantPermissionsChanged: (prevPermissions?: ParticipantPermission) => void;
261
269
  trackSubscriptionStatusChanged: (
262
270
  publication: RemoteTrackPublication,
263
271
  status: TrackPublication.SubscriptionStatus,
@@ -1,5 +1,5 @@
1
1
  import DeviceManager from '../DeviceManager';
2
- import { TrackInvalidError } from '../errors';
2
+ import { DeviceUnsupportedError, TrackInvalidError } from '../errors';
3
3
  import { mediaTrackToLocalTrack } from '../participant/publishUtils';
4
4
  import { audioDefaults, videoDefaults } from '../defaults';
5
5
  import LocalAudioTrack from './LocalAudioTrack';
@@ -114,6 +114,11 @@ export async function createLocalScreenTracks(
114
114
  height: options.resolution.height,
115
115
  };
116
116
  }
117
+
118
+ if (navigator.mediaDevices.getDisplayMedia === undefined) {
119
+ throw new DeviceUnsupportedError('getDisplayMedia not supported');
120
+ }
121
+
117
122
  // typescript definition is missing getDisplayMedia: https://github.com/microsoft/TypeScript/issues/33232
118
123
  // @ts-ignore
119
124
  const stream: MediaStream = await navigator.mediaDevices.getDisplayMedia({
@@ -232,9 +232,9 @@ export interface AudioPreset {
232
232
  const codecs = ['vp8', 'h264', 'av1'] as const;
233
233
  const backupCodecs = ['vp8', 'h264'] as const;
234
234
 
235
- export type VideoCodec = typeof codecs[number];
235
+ export type VideoCodec = (typeof codecs)[number];
236
236
 
237
- export type BackupVideoCodec = typeof backupCodecs[number];
237
+ export type BackupVideoCodec = (typeof backupCodecs)[number];
238
238
 
239
239
  export function isBackupCodec(codec: string): codec is BackupVideoCodec {
240
240
  return !!backupCodecs.find((backup) => backup === codec);