livekit-client 1.9.1 → 1.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. package/dist/livekit-client.esm.mjs +3338 -3037
  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 +98 -97
  6. package/dist/src/api/SignalClient.d.ts.map +1 -1
  7. package/dist/src/connectionHelper/ConnectionCheck.d.ts +25 -24
  8. package/dist/src/connectionHelper/ConnectionCheck.d.ts.map +1 -1
  9. package/dist/src/connectionHelper/checks/Checker.d.ts +58 -58
  10. package/dist/src/connectionHelper/checks/publishAudio.d.ts +5 -5
  11. package/dist/src/connectionHelper/checks/publishVideo.d.ts +5 -5
  12. package/dist/src/connectionHelper/checks/reconnect.d.ts +5 -5
  13. package/dist/src/connectionHelper/checks/turn.d.ts +5 -5
  14. package/dist/src/connectionHelper/checks/webrtc.d.ts +5 -5
  15. package/dist/src/connectionHelper/checks/websocket.d.ts +5 -5
  16. package/dist/src/index.d.ts +34 -31
  17. package/dist/src/index.d.ts.map +1 -1
  18. package/dist/src/logger.d.ts +25 -25
  19. package/dist/src/options.d.ts +98 -98
  20. package/dist/src/proto/google/protobuf/timestamp.d.ts +145 -145
  21. package/dist/src/proto/livekit_models.d.ts +2300 -2300
  22. package/dist/src/proto/livekit_rtc.d.ts +14032 -14032
  23. package/dist/src/room/DefaultReconnectPolicy.d.ts +7 -7
  24. package/dist/src/room/DeviceManager.d.ts +8 -8
  25. package/dist/src/room/PCTransport.d.ts +37 -37
  26. package/dist/src/room/PCTransport.d.ts.map +1 -1
  27. package/dist/src/room/RTCEngine.d.ts +126 -120
  28. package/dist/src/room/RTCEngine.d.ts.map +1 -1
  29. package/dist/src/room/ReconnectPolicy.d.ts +23 -23
  30. package/dist/src/room/RegionUrlProvider.d.ts +13 -13
  31. package/dist/src/room/Room.d.ts +232 -229
  32. package/dist/src/room/Room.d.ts.map +1 -1
  33. package/dist/src/room/defaults.d.ts +7 -7
  34. package/dist/src/room/defaults.d.ts.map +1 -1
  35. package/dist/src/room/errors.d.ts +42 -42
  36. package/dist/src/room/events.d.ts +455 -455
  37. package/dist/src/room/participant/LocalParticipant.d.ts +170 -170
  38. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  39. package/dist/src/room/participant/Participant.d.ts +93 -93
  40. package/dist/src/room/participant/ParticipantTrackPermission.d.ts +25 -25
  41. package/dist/src/room/participant/RemoteParticipant.d.ts +52 -51
  42. package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
  43. package/dist/src/room/participant/publishUtils.d.ts +19 -18
  44. package/dist/src/room/participant/publishUtils.d.ts.map +1 -1
  45. package/dist/src/room/stats.d.ts +66 -66
  46. package/dist/src/room/timers.d.ts +12 -12
  47. package/dist/src/room/track/LocalAudioTrack.d.ts +24 -24
  48. package/dist/src/room/track/LocalAudioTrack.d.ts.map +1 -1
  49. package/dist/src/room/track/LocalTrack.d.ts +43 -43
  50. package/dist/src/room/track/LocalTrackPublication.d.ts +37 -37
  51. package/dist/src/room/track/LocalVideoTrack.d.ts +53 -53
  52. package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
  53. package/dist/src/room/track/RemoteAudioTrack.d.ts +52 -52
  54. package/dist/src/room/track/RemoteAudioTrack.d.ts.map +1 -1
  55. package/dist/src/room/track/RemoteTrack.d.ts +14 -14
  56. package/dist/src/room/track/RemoteTrackPublication.d.ts +60 -60
  57. package/dist/src/room/track/RemoteVideoTrack.d.ts +52 -52
  58. package/dist/src/room/track/RemoteVideoTrack.d.ts.map +1 -1
  59. package/dist/src/room/track/Track.d.ts +124 -124
  60. package/dist/src/room/track/TrackPublication.d.ts +67 -67
  61. package/dist/src/room/track/create.d.ts +23 -23
  62. package/dist/src/room/track/create.d.ts.map +1 -1
  63. package/dist/src/room/track/options.d.ts +255 -247
  64. package/dist/src/room/track/options.d.ts.map +1 -1
  65. package/dist/src/room/track/types.d.ts +22 -22
  66. package/dist/src/room/track/utils.d.ts +13 -13
  67. package/dist/src/room/types.d.ts +25 -25
  68. package/dist/src/room/utils.d.ts +86 -85
  69. package/dist/src/room/utils.d.ts.map +1 -1
  70. package/dist/src/test/MockMediaStreamTrack.d.ts +25 -25
  71. package/dist/src/test/mocks.d.ts +10 -10
  72. package/dist/src/version.d.ts +2 -2
  73. package/dist/ts4.2/src/api/SignalClient.d.ts +1 -0
  74. package/dist/ts4.2/src/connectionHelper/ConnectionCheck.d.ts +2 -1
  75. package/dist/ts4.2/src/index.d.ts +8 -6
  76. package/dist/ts4.2/src/room/PCTransport.d.ts +1 -1
  77. package/dist/ts4.2/src/room/RTCEngine.d.ts +7 -1
  78. package/dist/ts4.2/src/room/Room.d.ts +3 -0
  79. package/dist/ts4.2/src/room/defaults.d.ts +1 -1
  80. package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +4 -4
  81. package/dist/ts4.2/src/room/participant/RemoteParticipant.d.ts +2 -1
  82. package/dist/ts4.2/src/room/participant/publishUtils.d.ts +2 -1
  83. package/dist/ts4.2/src/room/track/LocalAudioTrack.d.ts +1 -1
  84. package/dist/ts4.2/src/room/track/LocalVideoTrack.d.ts +1 -1
  85. package/dist/ts4.2/src/room/track/RemoteAudioTrack.d.ts +1 -1
  86. package/dist/ts4.2/src/room/track/create.d.ts +1 -1
  87. package/dist/ts4.2/src/room/track/options.d.ts +10 -2
  88. package/dist/ts4.2/src/room/utils.d.ts +1 -0
  89. package/package.json +12 -12
  90. package/src/api/SignalClient.ts +19 -16
  91. package/src/connectionHelper/ConnectionCheck.ts +2 -1
  92. package/src/index.ts +13 -8
  93. package/src/room/PCTransport.ts +9 -5
  94. package/src/room/RTCEngine.ts +44 -4
  95. package/src/room/Room.ts +87 -42
  96. package/src/room/defaults.ts +6 -4
  97. package/src/room/participant/LocalParticipant.ts +10 -9
  98. package/src/room/participant/RemoteParticipant.ts +2 -1
  99. package/src/room/participant/publishUtils.ts +7 -5
  100. package/src/room/track/LocalAudioTrack.ts +2 -1
  101. package/src/room/track/LocalVideoTrack.ts +3 -2
  102. package/src/room/track/RemoteAudioTrack.ts +2 -1
  103. package/src/room/track/RemoteVideoTrack.ts +4 -8
  104. package/src/room/track/create.ts +2 -2
  105. package/src/room/track/options.ts +23 -7
  106. package/src/room/utils.ts +15 -2
@@ -1,6 +1,7 @@
1
1
  import log from '../../logger';
2
2
  import { TrackEvent } from '../events';
3
- import { AudioSenderStats, computeBitrate, monitorFrequency } from '../stats';
3
+ import { computeBitrate, monitorFrequency } from '../stats';
4
+ import type { AudioSenderStats } from '../stats';
4
5
  import { isWeb } from '../utils';
5
6
  import LocalTrack from './LocalTrack';
6
7
  import { Track } from './Track';
@@ -2,7 +2,8 @@ import type { SignalClient } from '../../api/SignalClient';
2
2
  import log from '../../logger';
3
3
  import { VideoLayer, VideoQuality } from '../../proto/livekit_models';
4
4
  import type { SubscribedCodec, SubscribedQuality } from '../../proto/livekit_rtc';
5
- import { VideoSenderStats, computeBitrate, monitorFrequency } from '../stats';
5
+ import { computeBitrate, monitorFrequency } from '../stats';
6
+ import type { VideoSenderStats } from '../stats';
6
7
  import { Mutex, isFireFox, isMobile, isWeb } from '../utils';
7
8
  import LocalTrack from './LocalTrack';
8
9
  import { Track } from './Track';
@@ -153,7 +154,7 @@ export default class LocalVideoTrack extends LocalTrack {
153
154
  qualityLimitationResolutionChanges: v.qualityLimitationResolutionChanges,
154
155
  };
155
156
 
156
- // locate the appropriate remote-inbound-rtp item
157
+ // locate the appropriate remote-inbound-rtp item
157
158
  const r = stats.get(v.remoteId);
158
159
  if (r) {
159
160
  vs.jitter = r.jitter;
@@ -1,6 +1,7 @@
1
1
  import log from '../../logger';
2
2
  import { TrackEvent } from '../events';
3
- import { AudioReceiverStats, computeBitrate } from '../stats';
3
+ import { computeBitrate } from '../stats';
4
+ import type { AudioReceiverStats } from '../stats';
4
5
  import { supportsSetSinkId } from '../utils';
5
6
  import RemoteTrack from './RemoteTrack';
6
7
  import { Track } from './Track';
@@ -1,15 +1,11 @@
1
1
  import { debounce } from 'ts-debounce';
2
2
  import log from '../../logger';
3
3
  import { TrackEvent } from '../events';
4
- import { VideoReceiverStats, computeBitrate } from '../stats';
4
+ import { computeBitrate } from '../stats';
5
+ import type { VideoReceiverStats } from '../stats';
5
6
  import CriticalTimers from '../timers';
6
- import {
7
- ObservableMediaElement,
8
- getDevicePixelRatio,
9
- getIntersectionObserver,
10
- getResizeObserver,
11
- isWeb,
12
- } from '../utils';
7
+ import { getDevicePixelRatio, getIntersectionObserver, getResizeObserver, isWeb } from '../utils';
8
+ import type { ObservableMediaElement } from '../utils';
13
9
  import RemoteTrack from './RemoteTrack';
14
10
  import { Track, attachToElement, detachTrack } from './Track';
15
11
  import type { AdaptiveStreamSettings } from './types';
@@ -6,12 +6,12 @@ import LocalAudioTrack from './LocalAudioTrack';
6
6
  import type LocalTrack from './LocalTrack';
7
7
  import LocalVideoTrack from './LocalVideoTrack';
8
8
  import { Track } from './Track';
9
- import {
9
+ import { VideoPresets } from './options';
10
+ import type {
10
11
  AudioCaptureOptions,
11
12
  CreateLocalTracksOptions,
12
13
  ScreenShareCaptureOptions,
13
14
  VideoCaptureOptions,
14
- VideoPresets,
15
15
  } from './options';
16
16
  import { constraintsForOptions, mergeDefaultOptions } from './utils';
17
17
 
@@ -23,10 +23,17 @@ export interface TrackPublishDefaults {
23
23
  videoCodec?: VideoCodec;
24
24
 
25
25
  /**
26
- * max audio bitrate, defaults to [[AudioPresets.speech]]
26
+ * max audio bitrate, defaults to [[AudioPresets.music]]
27
+ * @deprecated use `audioPreset` instead
27
28
  */
28
29
  audioBitrate?: number;
29
30
 
31
+ /**
32
+ * which audio preset should be used for publishing (audio) tracks
33
+ * defaults to [[AudioPresets.music]]
34
+ */
35
+ audioPreset?: AudioPreset;
36
+
30
37
  /**
31
38
  * dtx (Discontinuous Transmission of audio), enabled by default for mono tracks.
32
39
  */
@@ -215,6 +222,7 @@ export interface VideoResolution {
215
222
  export interface VideoEncoding {
216
223
  maxBitrate: number;
217
224
  maxFramerate?: number;
225
+ priority?: RTCPriorityType;
218
226
  }
219
227
 
220
228
  export class VideoPreset {
@@ -224,12 +232,19 @@ export class VideoPreset {
224
232
 
225
233
  height: number;
226
234
 
227
- constructor(width: number, height: number, maxBitrate: number, maxFramerate?: number) {
235
+ constructor(
236
+ width: number,
237
+ height: number,
238
+ maxBitrate: number,
239
+ maxFramerate?: number,
240
+ priority?: RTCPriorityType,
241
+ ) {
228
242
  this.width = width;
229
243
  this.height = height;
230
244
  this.encoding = {
231
245
  maxBitrate,
232
246
  maxFramerate,
247
+ priority,
233
248
  };
234
249
  }
235
250
 
@@ -245,6 +260,7 @@ export class VideoPreset {
245
260
 
246
261
  export interface AudioPreset {
247
262
  maxBitrate: number;
263
+ priority?: RTCPriorityType;
248
264
  }
249
265
 
250
266
  const codecs = ['vp8', 'h264', 'vp9', 'av1'] as const;
@@ -322,9 +338,9 @@ export const VideoPresets43 = {
322
338
  } as const;
323
339
 
324
340
  export const ScreenSharePresets = {
325
- h360fps3: new VideoPreset(640, 360, 200_000, 3),
326
- h720fps5: new VideoPreset(1280, 720, 400_000, 5),
327
- h720fps15: new VideoPreset(1280, 720, 1_000_000, 15),
328
- h1080fps15: new VideoPreset(1920, 1080, 1_500_000, 15),
329
- h1080fps30: new VideoPreset(1920, 1080, 3_000_000, 30),
341
+ h360fps3: new VideoPreset(640, 360, 200_000, 3, 'medium'),
342
+ h720fps5: new VideoPreset(1280, 720, 400_000, 5, 'medium'),
343
+ h720fps15: new VideoPreset(1280, 720, 1_000_000, 15, 'medium'),
344
+ h1080fps15: new VideoPreset(1920, 1080, 1_500_000, 15, 'medium'),
345
+ h1080fps30: new VideoPreset(1920, 1080, 3_000_000, 30, 'medium'),
330
346
  } as const;
package/src/room/utils.ts CHANGED
@@ -41,7 +41,10 @@ export function supportsDynacast() {
41
41
  }
42
42
 
43
43
  export function supportsAV1(): boolean {
44
- const capabilities = RTCRtpReceiver.getCapabilities('video');
44
+ if (!('getCapabilities' in RTCRtpSender)) {
45
+ return false;
46
+ }
47
+ const capabilities = RTCRtpSender.getCapabilities('video');
45
48
  let hasAV1 = false;
46
49
  if (capabilities) {
47
50
  for (const codec of capabilities.codecs) {
@@ -55,7 +58,12 @@ export function supportsAV1(): boolean {
55
58
  }
56
59
 
57
60
  export function supportsVP9(): boolean {
58
- const capabilities = RTCRtpReceiver.getCapabilities('video');
61
+ if (!('getCapabilities' in RTCRtpSender)) {
62
+ // technically speaking FireFox supports VP9, but SVC publishing is broken
63
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1633876
64
+ return false;
65
+ }
66
+ const capabilities = RTCRtpSender.getCapabilities('video');
59
67
  let hasVP9 = false;
60
68
  if (capabilities) {
61
69
  for (const codec of capabilities.codecs) {
@@ -119,6 +127,11 @@ export function isFireFox(): boolean {
119
127
  return navigator.userAgent.indexOf('Firefox') !== -1;
120
128
  }
121
129
 
130
+ export function isChromiumBased(): boolean {
131
+ if (!isWeb()) return false;
132
+ return navigator.userAgent.indexOf('Chrom') !== -1;
133
+ }
134
+
122
135
  export function isSafari(): boolean {
123
136
  if (!isWeb()) return false;
124
137
  return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);