livekit-client 0.17.5 → 0.17.6-rc1

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.
Files changed (153) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +26 -20
  3. package/dist/api/SignalClient.d.ts +1 -0
  4. package/dist/connect.d.ts +2 -0
  5. package/dist/index.d.ts +2 -2
  6. package/dist/livekit-client.esm.js +17344 -0
  7. package/dist/livekit-client.esm.js.map +1 -0
  8. package/dist/livekit-client.umd.js +17388 -0
  9. package/dist/livekit-client.umd.js.map +1 -0
  10. package/dist/logger.d.ts +22 -11
  11. package/dist/options.d.ts +4 -2
  12. package/dist/proto/google/protobuf/timestamp.d.ts +1 -1
  13. package/dist/proto/livekit_models.d.ts +4 -1
  14. package/dist/proto/livekit_rtc.d.ts +45 -2
  15. package/dist/room/DeviceManager.d.ts +1 -1
  16. package/dist/room/RTCEngine.d.ts +1 -1
  17. package/dist/room/Room.d.ts +2 -2
  18. package/dist/room/events.d.ts +1 -1
  19. package/dist/room/participant/LocalParticipant.d.ts +9 -5
  20. package/dist/room/participant/RemoteParticipant.d.ts +9 -0
  21. package/dist/room/track/RemoteAudioTrack.d.ts +11 -0
  22. package/dist/test/mocks.d.ts +11 -0
  23. package/package.json +40 -15
  24. package/.eslintrc.js +0 -17
  25. package/.gitmodules +0 -3
  26. package/dist/api/RequestQueue.js +0 -61
  27. package/dist/api/RequestQueue.js.map +0 -1
  28. package/dist/api/SignalClient.js +0 -428
  29. package/dist/api/SignalClient.js.map +0 -1
  30. package/dist/connect.js +0 -130
  31. package/dist/connect.js.map +0 -1
  32. package/dist/index.js +0 -71
  33. package/dist/index.js.map +0 -1
  34. package/dist/logger.js +0 -24
  35. package/dist/logger.js.map +0 -1
  36. package/dist/options.js +0 -3
  37. package/dist/options.js.map +0 -1
  38. package/dist/proto/google/protobuf/timestamp.js +0 -108
  39. package/dist/proto/google/protobuf/timestamp.js.map +0 -1
  40. package/dist/proto/livekit_models.js +0 -2262
  41. package/dist/proto/livekit_models.js.map +0 -1
  42. package/dist/proto/livekit_rtc.js +0 -2544
  43. package/dist/proto/livekit_rtc.js.map +0 -1
  44. package/dist/room/DeviceManager.js +0 -62
  45. package/dist/room/DeviceManager.js.map +0 -1
  46. package/dist/room/PCTransport.js +0 -91
  47. package/dist/room/PCTransport.js.map +0 -1
  48. package/dist/room/RTCEngine.js +0 -562
  49. package/dist/room/RTCEngine.js.map +0 -1
  50. package/dist/room/Room.js +0 -767
  51. package/dist/room/Room.js.map +0 -1
  52. package/dist/room/errors.js +0 -68
  53. package/dist/room/errors.js.map +0 -1
  54. package/dist/room/events.js +0 -385
  55. package/dist/room/events.js.map +0 -1
  56. package/dist/room/participant/LocalParticipant.js +0 -647
  57. package/dist/room/participant/LocalParticipant.js.map +0 -1
  58. package/dist/room/participant/Participant.js +0 -189
  59. package/dist/room/participant/Participant.js.map +0 -1
  60. package/dist/room/participant/ParticipantTrackPermission.js +0 -16
  61. package/dist/room/participant/ParticipantTrackPermission.js.map +0 -1
  62. package/dist/room/participant/RemoteParticipant.js +0 -194
  63. package/dist/room/participant/RemoteParticipant.js.map +0 -1
  64. package/dist/room/participant/publishUtils.js +0 -189
  65. package/dist/room/participant/publishUtils.js.map +0 -1
  66. package/dist/room/participant/publishUtils.test.d.ts +0 -1
  67. package/dist/room/participant/publishUtils.test.js +0 -118
  68. package/dist/room/participant/publishUtils.test.js.map +0 -1
  69. package/dist/room/stats.js +0 -26
  70. package/dist/room/stats.js.map +0 -1
  71. package/dist/room/track/LocalAudioTrack.js +0 -153
  72. package/dist/room/track/LocalAudioTrack.js.map +0 -1
  73. package/dist/room/track/LocalTrack.js +0 -158
  74. package/dist/room/track/LocalTrack.js.map +0 -1
  75. package/dist/room/track/LocalTrackPublication.js +0 -64
  76. package/dist/room/track/LocalTrackPublication.js.map +0 -1
  77. package/dist/room/track/LocalVideoTrack.js +0 -297
  78. package/dist/room/track/LocalVideoTrack.js.map +0 -1
  79. package/dist/room/track/LocalVideoTrack.test.d.ts +0 -1
  80. package/dist/room/track/LocalVideoTrack.test.js +0 -68
  81. package/dist/room/track/LocalVideoTrack.test.js.map +0 -1
  82. package/dist/room/track/RemoteAudioTrack.js +0 -64
  83. package/dist/room/track/RemoteAudioTrack.js.map +0 -1
  84. package/dist/room/track/RemoteTrack.js +0 -49
  85. package/dist/room/track/RemoteTrack.js.map +0 -1
  86. package/dist/room/track/RemoteTrackPublication.js +0 -178
  87. package/dist/room/track/RemoteTrackPublication.js.map +0 -1
  88. package/dist/room/track/RemoteVideoTrack.js +0 -201
  89. package/dist/room/track/RemoteVideoTrack.js.map +0 -1
  90. package/dist/room/track/Track.js +0 -283
  91. package/dist/room/track/Track.js.map +0 -1
  92. package/dist/room/track/TrackPublication.js +0 -92
  93. package/dist/room/track/TrackPublication.js.map +0 -1
  94. package/dist/room/track/create.js +0 -131
  95. package/dist/room/track/create.js.map +0 -1
  96. package/dist/room/track/defaults.js +0 -21
  97. package/dist/room/track/defaults.js.map +0 -1
  98. package/dist/room/track/options.js +0 -100
  99. package/dist/room/track/options.js.map +0 -1
  100. package/dist/room/track/types.js +0 -3
  101. package/dist/room/track/types.js.map +0 -1
  102. package/dist/room/track/utils.js +0 -113
  103. package/dist/room/track/utils.js.map +0 -1
  104. package/dist/room/track/utils.test.d.ts +0 -1
  105. package/dist/room/track/utils.test.js +0 -85
  106. package/dist/room/track/utils.test.js.map +0 -1
  107. package/dist/room/utils.js +0 -79
  108. package/dist/room/utils.js.map +0 -1
  109. package/dist/version.js +0 -6
  110. package/dist/version.js.map +0 -1
  111. package/jest.config.js +0 -6
  112. package/src/api/RequestQueue.ts +0 -53
  113. package/src/api/SignalClient.ts +0 -499
  114. package/src/connect.ts +0 -100
  115. package/src/index.ts +0 -47
  116. package/src/logger.ts +0 -22
  117. package/src/options.ts +0 -149
  118. package/src/proto/google/protobuf/timestamp.ts +0 -232
  119. package/src/proto/livekit_models.ts +0 -2676
  120. package/src/proto/livekit_rtc.ts +0 -3269
  121. package/src/room/DeviceManager.ts +0 -57
  122. package/src/room/PCTransport.ts +0 -86
  123. package/src/room/RTCEngine.ts +0 -652
  124. package/src/room/Room.ts +0 -951
  125. package/src/room/errors.ts +0 -65
  126. package/src/room/events.ts +0 -424
  127. package/src/room/participant/LocalParticipant.ts +0 -734
  128. package/src/room/participant/Participant.ts +0 -269
  129. package/src/room/participant/ParticipantTrackPermission.ts +0 -32
  130. package/src/room/participant/RemoteParticipant.ts +0 -243
  131. package/src/room/participant/publishUtils.test.ts +0 -145
  132. package/src/room/participant/publishUtils.ts +0 -225
  133. package/src/room/stats.ts +0 -130
  134. package/src/room/track/LocalAudioTrack.ts +0 -137
  135. package/src/room/track/LocalTrack.ts +0 -161
  136. package/src/room/track/LocalTrackPublication.ts +0 -66
  137. package/src/room/track/LocalVideoTrack.test.ts +0 -70
  138. package/src/room/track/LocalVideoTrack.ts +0 -293
  139. package/src/room/track/RemoteAudioTrack.ts +0 -58
  140. package/src/room/track/RemoteTrack.ts +0 -62
  141. package/src/room/track/RemoteTrackPublication.ts +0 -198
  142. package/src/room/track/RemoteVideoTrack.ts +0 -235
  143. package/src/room/track/Track.ts +0 -343
  144. package/src/room/track/TrackPublication.ts +0 -120
  145. package/src/room/track/create.ts +0 -121
  146. package/src/room/track/defaults.ts +0 -23
  147. package/src/room/track/options.ts +0 -281
  148. package/src/room/track/types.ts +0 -20
  149. package/src/room/track/utils.test.ts +0 -93
  150. package/src/room/track/utils.ts +0 -115
  151. package/src/room/utils.ts +0 -70
  152. package/src/version.ts +0 -2
  153. package/tsconfig.eslint.json +0 -11
package/dist/logger.d.ts CHANGED
@@ -1,13 +1,24 @@
1
- import log from 'loglevel';
2
- export declare type LogLevelDesc = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent';
3
1
  export declare enum LogLevel {
4
- trace = "trace",
5
- debug = "debug",
6
- info = "info",
7
- warn = "warn",
8
- error = "error",
9
- silent = "silent"
2
+ trace = 0,
3
+ debug = 1,
4
+ info = 2,
5
+ warn = 3,
6
+ error = 4,
7
+ silent = 5
10
8
  }
11
- declare const livekitLogger: log.Logger;
12
- export default livekitLogger;
13
- export declare function setLogLevel(level: LogLevel | LogLevelDesc): void;
9
+ declare type StructuredLogger = {
10
+ trace: (msg: string, context?: object) => void;
11
+ debug: (msg: string, context?: object) => void;
12
+ info: (msg: string, context?: object) => void;
13
+ warn: (msg: string, context?: object) => void;
14
+ error: (msg: string, context?: object) => void;
15
+ };
16
+ declare const _default: StructuredLogger;
17
+ export default _default;
18
+ export declare function setLogLevel(level: LogLevel): void;
19
+ export declare type LogExtension = (level: LogLevel, msg: string, context?: object) => void;
20
+ /**
21
+ * use this to hook into the logging function to allow sending internal livekit logs to third party services
22
+ * if set, the browser logs will lose their stacktrace information (see https://github.com/pimterry/loglevel#writing-plugins)
23
+ */
24
+ export declare function setLogExtension(extension: LogExtension): void;
package/dist/options.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { LogLevel, LogLevelDesc } from './logger';
1
+ import { LogLevel } from './logger';
2
2
  import { AudioCaptureOptions, CreateLocalTracksOptions, TrackPublishDefaults, VideoCaptureOptions } from './room/track/options';
3
3
  import { AdaptiveStreamSettings } from './room/track/types';
4
4
  /**
@@ -60,6 +60,8 @@ export interface RoomConnectOptions {
60
60
  publishOnly?: string;
61
61
  }
62
62
  /**
63
+ * @deprecated use new Room([[RoomOptions]]) and room.connect([[RoomConnectOptions]]) instead
64
+ *
63
65
  * if video or audio tracks are created as part of [[connect]], it'll automatically
64
66
  * publish those tracks to the room.
65
67
  */
@@ -80,7 +82,7 @@ export interface ConnectOptions extends CreateLocalTracksOptions {
80
82
  */
81
83
  dynacast?: boolean;
82
84
  /** configures LiveKit internal log level */
83
- logLevel?: LogLevel | LogLevelDesc;
85
+ logLevel?: LogLevel;
84
86
  /**
85
87
  * set ICE servers. When deployed correctly, LiveKit automatically uses the built-in TURN servers
86
88
  */
@@ -1,4 +1,4 @@
1
- import * as _m0 from "protobufjs/minimal";
1
+ import * as _m0 from 'protobufjs/minimal';
2
2
  export declare const protobufPackage = "google.protobuf";
3
3
  /**
4
4
  * A Timestamp represents a point in time independent of any time zone or local
@@ -1,4 +1,4 @@
1
- import * as _m0 from "protobufjs/minimal";
1
+ import * as _m0 from 'protobufjs/minimal';
2
2
  export declare const protobufPackage = "livekit";
3
3
  export declare enum TrackType {
4
4
  AUDIO = 0,
@@ -82,6 +82,7 @@ export interface ParticipantInfo {
82
82
  name: string;
83
83
  version: number;
84
84
  permission?: ParticipantPermission;
85
+ region: string;
85
86
  }
86
87
  export declare enum ParticipantInfo_State {
87
88
  /** JOINING - websocket' connected, but not offered yet */
@@ -358,6 +359,7 @@ export declare const ParticipantInfo: {
358
359
  hidden?: boolean | undefined;
359
360
  recorder?: boolean | undefined;
360
361
  } | undefined;
362
+ region?: string | undefined;
361
363
  } & {
362
364
  sid?: string | undefined;
363
365
  identity?: string | undefined;
@@ -474,6 +476,7 @@ export declare const ParticipantInfo: {
474
476
  hidden?: boolean | undefined;
475
477
  recorder?: boolean | undefined;
476
478
  } & Record<Exclude<keyof I["permission"], keyof ParticipantPermission>, never>) | undefined;
479
+ region?: string | undefined;
477
480
  } & Record<Exclude<keyof I, keyof ParticipantInfo>, never>>(object: I): ParticipantInfo;
478
481
  };
479
482
  export declare const TrackInfo: {
@@ -1,5 +1,5 @@
1
- import * as _m0 from "protobufjs/minimal";
2
- import { TrackType, TrackSource, Room, ParticipantInfo, ClientConfiguration, TrackInfo, VideoQuality, ConnectionQuality, VideoLayer, ParticipantTracks, SpeakerInfo } from "./livekit_models";
1
+ import * as _m0 from 'protobufjs/minimal';
2
+ import { TrackType, TrackSource, Room, ParticipantInfo, ClientConfiguration, TrackInfo, VideoQuality, ConnectionQuality, VideoLayer, ParticipantTracks, SpeakerInfo } from './livekit_models';
3
3
  export declare const protobufPackage = "livekit";
4
4
  export declare enum SignalTarget {
5
5
  PUBLISHER = 0,
@@ -220,6 +220,7 @@ export interface SyncState {
220
220
  export interface DataChannelInfo {
221
221
  label: string;
222
222
  id: number;
223
+ target: SignalTarget;
223
224
  }
224
225
  export interface SimulateScenario {
225
226
  /** simulate N seconds of speaker activity */
@@ -345,6 +346,7 @@ export declare const SignalRequest: {
345
346
  dataChannels?: {
346
347
  label?: string | undefined;
347
348
  id?: number | undefined;
349
+ target?: SignalTarget | undefined;
348
350
  }[] | undefined;
349
351
  } | undefined;
350
352
  simulate?: {
@@ -578,6 +580,7 @@ export declare const SignalRequest: {
578
580
  dataChannels?: {
579
581
  label?: string | undefined;
580
582
  id?: number | undefined;
583
+ target?: SignalTarget | undefined;
581
584
  }[] | undefined;
582
585
  } & {
583
586
  answer?: ({
@@ -740,15 +743,19 @@ export declare const SignalRequest: {
740
743
  dataChannels?: ({
741
744
  label?: string | undefined;
742
745
  id?: number | undefined;
746
+ target?: SignalTarget | undefined;
743
747
  }[] & ({
744
748
  label?: string | undefined;
745
749
  id?: number | undefined;
750
+ target?: SignalTarget | undefined;
746
751
  } & {
747
752
  label?: string | undefined;
748
753
  id?: number | undefined;
754
+ target?: SignalTarget | undefined;
749
755
  } & Record<Exclude<keyof I["syncState"]["dataChannels"][number], keyof DataChannelInfo>, never>)[] & Record<Exclude<keyof I["syncState"]["dataChannels"], number | keyof {
750
756
  label?: string | undefined;
751
757
  id?: number | undefined;
758
+ target?: SignalTarget | undefined;
752
759
  }[]>, never>) | undefined;
753
760
  } & Record<Exclude<keyof I["syncState"], keyof SyncState>, never>) | undefined;
754
761
  simulate?: ({
@@ -821,6 +828,7 @@ export declare const SignalResponse: {
821
828
  hidden?: boolean | undefined;
822
829
  recorder?: boolean | undefined;
823
830
  } | undefined;
831
+ region?: string | undefined;
824
832
  } | undefined;
825
833
  otherParticipants?: {
826
834
  sid?: string | undefined;
@@ -857,6 +865,7 @@ export declare const SignalResponse: {
857
865
  hidden?: boolean | undefined;
858
866
  recorder?: boolean | undefined;
859
867
  } | undefined;
868
+ region?: string | undefined;
860
869
  }[] | undefined;
861
870
  serverVersion?: string | undefined;
862
871
  iceServers?: {
@@ -925,6 +934,7 @@ export declare const SignalResponse: {
925
934
  hidden?: boolean | undefined;
926
935
  recorder?: boolean | undefined;
927
936
  } | undefined;
937
+ region?: string | undefined;
928
938
  }[] | undefined;
929
939
  } | undefined;
930
940
  trackPublished?: {
@@ -1063,6 +1073,7 @@ export declare const SignalResponse: {
1063
1073
  hidden?: boolean | undefined;
1064
1074
  recorder?: boolean | undefined;
1065
1075
  } | undefined;
1076
+ region?: string | undefined;
1066
1077
  } | undefined;
1067
1078
  otherParticipants?: {
1068
1079
  sid?: string | undefined;
@@ -1099,6 +1110,7 @@ export declare const SignalResponse: {
1099
1110
  hidden?: boolean | undefined;
1100
1111
  recorder?: boolean | undefined;
1101
1112
  } | undefined;
1113
+ region?: string | undefined;
1102
1114
  }[] | undefined;
1103
1115
  serverVersion?: string | undefined;
1104
1116
  iceServers?: {
@@ -1192,6 +1204,7 @@ export declare const SignalResponse: {
1192
1204
  hidden?: boolean | undefined;
1193
1205
  recorder?: boolean | undefined;
1194
1206
  } | undefined;
1207
+ region?: string | undefined;
1195
1208
  } & {
1196
1209
  sid?: string | undefined;
1197
1210
  identity?: string | undefined;
@@ -1308,6 +1321,7 @@ export declare const SignalResponse: {
1308
1321
  hidden?: boolean | undefined;
1309
1322
  recorder?: boolean | undefined;
1310
1323
  } & Record<Exclude<keyof I["join"]["participant"]["permission"], keyof import("./livekit_models").ParticipantPermission>, never>) | undefined;
1324
+ region?: string | undefined;
1311
1325
  } & Record<Exclude<keyof I["join"]["participant"], keyof ParticipantInfo>, never>) | undefined;
1312
1326
  otherParticipants?: ({
1313
1327
  sid?: string | undefined;
@@ -1344,6 +1358,7 @@ export declare const SignalResponse: {
1344
1358
  hidden?: boolean | undefined;
1345
1359
  recorder?: boolean | undefined;
1346
1360
  } | undefined;
1361
+ region?: string | undefined;
1347
1362
  }[] & ({
1348
1363
  sid?: string | undefined;
1349
1364
  identity?: string | undefined;
@@ -1379,6 +1394,7 @@ export declare const SignalResponse: {
1379
1394
  hidden?: boolean | undefined;
1380
1395
  recorder?: boolean | undefined;
1381
1396
  } | undefined;
1397
+ region?: string | undefined;
1382
1398
  } & {
1383
1399
  sid?: string | undefined;
1384
1400
  identity?: string | undefined;
@@ -1495,6 +1511,7 @@ export declare const SignalResponse: {
1495
1511
  hidden?: boolean | undefined;
1496
1512
  recorder?: boolean | undefined;
1497
1513
  } & Record<Exclude<keyof I["join"]["otherParticipants"][number]["permission"], keyof import("./livekit_models").ParticipantPermission>, never>) | undefined;
1514
+ region?: string | undefined;
1498
1515
  } & Record<Exclude<keyof I["join"]["otherParticipants"][number], keyof ParticipantInfo>, never>)[] & Record<Exclude<keyof I["join"]["otherParticipants"], number | keyof {
1499
1516
  sid?: string | undefined;
1500
1517
  identity?: string | undefined;
@@ -1530,6 +1547,7 @@ export declare const SignalResponse: {
1530
1547
  hidden?: boolean | undefined;
1531
1548
  recorder?: boolean | undefined;
1532
1549
  } | undefined;
1550
+ region?: string | undefined;
1533
1551
  }[]>, never>) | undefined;
1534
1552
  serverVersion?: string | undefined;
1535
1553
  iceServers?: ({
@@ -1631,6 +1649,7 @@ export declare const SignalResponse: {
1631
1649
  hidden?: boolean | undefined;
1632
1650
  recorder?: boolean | undefined;
1633
1651
  } | undefined;
1652
+ region?: string | undefined;
1634
1653
  }[] | undefined;
1635
1654
  } & {
1636
1655
  participants?: ({
@@ -1668,6 +1687,7 @@ export declare const SignalResponse: {
1668
1687
  hidden?: boolean | undefined;
1669
1688
  recorder?: boolean | undefined;
1670
1689
  } | undefined;
1690
+ region?: string | undefined;
1671
1691
  }[] & ({
1672
1692
  sid?: string | undefined;
1673
1693
  identity?: string | undefined;
@@ -1703,6 +1723,7 @@ export declare const SignalResponse: {
1703
1723
  hidden?: boolean | undefined;
1704
1724
  recorder?: boolean | undefined;
1705
1725
  } | undefined;
1726
+ region?: string | undefined;
1706
1727
  } & {
1707
1728
  sid?: string | undefined;
1708
1729
  identity?: string | undefined;
@@ -1819,6 +1840,7 @@ export declare const SignalResponse: {
1819
1840
  hidden?: boolean | undefined;
1820
1841
  recorder?: boolean | undefined;
1821
1842
  } & Record<Exclude<keyof I["update"]["participants"][number]["permission"], keyof import("./livekit_models").ParticipantPermission>, never>) | undefined;
1843
+ region?: string | undefined;
1822
1844
  } & Record<Exclude<keyof I["update"]["participants"][number], keyof ParticipantInfo>, never>)[] & Record<Exclude<keyof I["update"]["participants"], number | keyof {
1823
1845
  sid?: string | undefined;
1824
1846
  identity?: string | undefined;
@@ -1854,6 +1876,7 @@ export declare const SignalResponse: {
1854
1876
  hidden?: boolean | undefined;
1855
1877
  recorder?: boolean | undefined;
1856
1878
  } | undefined;
1879
+ region?: string | undefined;
1857
1880
  }[]>, never>) | undefined;
1858
1881
  } & Record<Exclude<keyof I["update"], "participants">, never>) | undefined;
1859
1882
  trackPublished?: ({
@@ -2259,6 +2282,7 @@ export declare const JoinResponse: {
2259
2282
  hidden?: boolean | undefined;
2260
2283
  recorder?: boolean | undefined;
2261
2284
  } | undefined;
2285
+ region?: string | undefined;
2262
2286
  } | undefined;
2263
2287
  otherParticipants?: {
2264
2288
  sid?: string | undefined;
@@ -2295,6 +2319,7 @@ export declare const JoinResponse: {
2295
2319
  hidden?: boolean | undefined;
2296
2320
  recorder?: boolean | undefined;
2297
2321
  } | undefined;
2322
+ region?: string | undefined;
2298
2323
  }[] | undefined;
2299
2324
  serverVersion?: string | undefined;
2300
2325
  iceServers?: {
@@ -2388,6 +2413,7 @@ export declare const JoinResponse: {
2388
2413
  hidden?: boolean | undefined;
2389
2414
  recorder?: boolean | undefined;
2390
2415
  } | undefined;
2416
+ region?: string | undefined;
2391
2417
  } & {
2392
2418
  sid?: string | undefined;
2393
2419
  identity?: string | undefined;
@@ -2504,6 +2530,7 @@ export declare const JoinResponse: {
2504
2530
  hidden?: boolean | undefined;
2505
2531
  recorder?: boolean | undefined;
2506
2532
  } & Record<Exclude<keyof I["participant"]["permission"], keyof import("./livekit_models").ParticipantPermission>, never>) | undefined;
2533
+ region?: string | undefined;
2507
2534
  } & Record<Exclude<keyof I["participant"], keyof ParticipantInfo>, never>) | undefined;
2508
2535
  otherParticipants?: ({
2509
2536
  sid?: string | undefined;
@@ -2540,6 +2567,7 @@ export declare const JoinResponse: {
2540
2567
  hidden?: boolean | undefined;
2541
2568
  recorder?: boolean | undefined;
2542
2569
  } | undefined;
2570
+ region?: string | undefined;
2543
2571
  }[] & ({
2544
2572
  sid?: string | undefined;
2545
2573
  identity?: string | undefined;
@@ -2575,6 +2603,7 @@ export declare const JoinResponse: {
2575
2603
  hidden?: boolean | undefined;
2576
2604
  recorder?: boolean | undefined;
2577
2605
  } | undefined;
2606
+ region?: string | undefined;
2578
2607
  } & {
2579
2608
  sid?: string | undefined;
2580
2609
  identity?: string | undefined;
@@ -2691,6 +2720,7 @@ export declare const JoinResponse: {
2691
2720
  hidden?: boolean | undefined;
2692
2721
  recorder?: boolean | undefined;
2693
2722
  } & Record<Exclude<keyof I["otherParticipants"][number]["permission"], keyof import("./livekit_models").ParticipantPermission>, never>) | undefined;
2723
+ region?: string | undefined;
2694
2724
  } & Record<Exclude<keyof I["otherParticipants"][number], keyof ParticipantInfo>, never>)[] & Record<Exclude<keyof I["otherParticipants"], number | keyof {
2695
2725
  sid?: string | undefined;
2696
2726
  identity?: string | undefined;
@@ -2726,6 +2756,7 @@ export declare const JoinResponse: {
2726
2756
  hidden?: boolean | undefined;
2727
2757
  recorder?: boolean | undefined;
2728
2758
  } | undefined;
2759
+ region?: string | undefined;
2729
2760
  }[]>, never>) | undefined;
2730
2761
  serverVersion?: string | undefined;
2731
2762
  iceServers?: ({
@@ -2924,6 +2955,7 @@ export declare const ParticipantUpdate: {
2924
2955
  hidden?: boolean | undefined;
2925
2956
  recorder?: boolean | undefined;
2926
2957
  } | undefined;
2958
+ region?: string | undefined;
2927
2959
  }[] | undefined;
2928
2960
  } & {
2929
2961
  participants?: ({
@@ -2961,6 +2993,7 @@ export declare const ParticipantUpdate: {
2961
2993
  hidden?: boolean | undefined;
2962
2994
  recorder?: boolean | undefined;
2963
2995
  } | undefined;
2996
+ region?: string | undefined;
2964
2997
  }[] & ({
2965
2998
  sid?: string | undefined;
2966
2999
  identity?: string | undefined;
@@ -2996,6 +3029,7 @@ export declare const ParticipantUpdate: {
2996
3029
  hidden?: boolean | undefined;
2997
3030
  recorder?: boolean | undefined;
2998
3031
  } | undefined;
3032
+ region?: string | undefined;
2999
3033
  } & {
3000
3034
  sid?: string | undefined;
3001
3035
  identity?: string | undefined;
@@ -3112,6 +3146,7 @@ export declare const ParticipantUpdate: {
3112
3146
  hidden?: boolean | undefined;
3113
3147
  recorder?: boolean | undefined;
3114
3148
  } & Record<Exclude<keyof I["participants"][number]["permission"], keyof import("./livekit_models").ParticipantPermission>, never>) | undefined;
3149
+ region?: string | undefined;
3115
3150
  } & Record<Exclude<keyof I["participants"][number], keyof ParticipantInfo>, never>)[] & Record<Exclude<keyof I["participants"], number | keyof {
3116
3151
  sid?: string | undefined;
3117
3152
  identity?: string | undefined;
@@ -3147,6 +3182,7 @@ export declare const ParticipantUpdate: {
3147
3182
  hidden?: boolean | undefined;
3148
3183
  recorder?: boolean | undefined;
3149
3184
  } | undefined;
3185
+ region?: string | undefined;
3150
3186
  }[]>, never>) | undefined;
3151
3187
  } & Record<Exclude<keyof I, "participants">, never>>(object: I): ParticipantUpdate;
3152
3188
  };
@@ -3601,6 +3637,7 @@ export declare const SyncState: {
3601
3637
  dataChannels?: {
3602
3638
  label?: string | undefined;
3603
3639
  id?: number | undefined;
3640
+ target?: SignalTarget | undefined;
3604
3641
  }[] | undefined;
3605
3642
  } & {
3606
3643
  answer?: ({
@@ -3763,15 +3800,19 @@ export declare const SyncState: {
3763
3800
  dataChannels?: ({
3764
3801
  label?: string | undefined;
3765
3802
  id?: number | undefined;
3803
+ target?: SignalTarget | undefined;
3766
3804
  }[] & ({
3767
3805
  label?: string | undefined;
3768
3806
  id?: number | undefined;
3807
+ target?: SignalTarget | undefined;
3769
3808
  } & {
3770
3809
  label?: string | undefined;
3771
3810
  id?: number | undefined;
3811
+ target?: SignalTarget | undefined;
3772
3812
  } & Record<Exclude<keyof I["dataChannels"][number], keyof DataChannelInfo>, never>)[] & Record<Exclude<keyof I["dataChannels"], number | keyof {
3773
3813
  label?: string | undefined;
3774
3814
  id?: number | undefined;
3815
+ target?: SignalTarget | undefined;
3775
3816
  }[]>, never>) | undefined;
3776
3817
  } & Record<Exclude<keyof I, keyof SyncState>, never>>(object: I): SyncState;
3777
3818
  };
@@ -3783,9 +3824,11 @@ export declare const DataChannelInfo: {
3783
3824
  fromPartial<I extends {
3784
3825
  label?: string | undefined;
3785
3826
  id?: number | undefined;
3827
+ target?: SignalTarget | undefined;
3786
3828
  } & {
3787
3829
  label?: string | undefined;
3788
3830
  id?: number | undefined;
3831
+ target?: SignalTarget | undefined;
3789
3832
  } & Record<Exclude<keyof I, keyof DataChannelInfo>, never>>(object: I): DataChannelInfo;
3790
3833
  };
3791
3834
  export declare const SimulateScenario: {
@@ -2,6 +2,6 @@ export default class DeviceManager {
2
2
  private static instance?;
3
3
  static mediaDeviceKinds: MediaDeviceKind[];
4
4
  static getInstance(): DeviceManager;
5
- getDevices(kind: MediaDeviceKind): Promise<MediaDeviceInfo[]>;
5
+ getDevices(kind?: MediaDeviceKind, requestPermissions?: boolean): Promise<MediaDeviceInfo[]>;
6
6
  normalizeDeviceId(kind: MediaDeviceKind, deviceId?: string, groupId?: string): Promise<string | undefined>;
7
7
  }
@@ -48,7 +48,7 @@ export default class RTCEngine extends RTCEngine_base {
48
48
  private ensurePublisherConnected;
49
49
  /** @internal */
50
50
  negotiate(): void;
51
- dataChannelForKind(kind: DataPacket_Kind): RTCDataChannel | undefined;
51
+ dataChannelForKind(kind: DataPacket_Kind, sub?: boolean): RTCDataChannel | undefined;
52
52
  }
53
53
  export declare type EngineEventCallbacks = {
54
54
  connected: () => void;
@@ -63,7 +63,7 @@ declare class Room extends Room_base {
63
63
  * @param kind
64
64
  * @returns a list of available local devices
65
65
  */
66
- static getLocalDevices(kind: MediaDeviceKind): Promise<MediaDeviceInfo[]>;
66
+ static getLocalDevices(kind?: MediaDeviceKind, requestPermissions?: boolean): Promise<MediaDeviceInfo[]>;
67
67
  connect: (url: string, token: string, opts?: RoomConnectOptions | undefined) => Promise<Room | undefined>;
68
68
  /**
69
69
  * disconnects the room, emits [[RoomEvent.Disconnected]]
@@ -150,7 +150,7 @@ export declare type RoomEventCallbacks = {
150
150
  localTrackUnpublished: (publication: LocalTrackPublication, participant: LocalParticipant) => void;
151
151
  /**
152
152
  * @deprecated use [[participantMetadataChanged]] instead
153
- */
153
+ */
154
154
  metadataChanged: (metadata: string | undefined, participant?: RemoteParticipant | LocalParticipant) => void;
155
155
  participantMetadataChanged: (metadata: string | undefined, participant: RemoteParticipant | LocalParticipant) => void;
156
156
  participantPermissionsChanged: (prevPermissions: ParticipantPermission, participant: RemoteParticipant | LocalParticipant) => void;
@@ -367,7 +367,7 @@ export declare enum TrackEvent {
367
367
  /**
368
368
  * @internal
369
369
  * Only fires on LocalAudioTrack instances
370
- */
370
+ */
371
371
  AudioSilenceDetected = "audioSilenceDetected",
372
372
  /** @internal */
373
373
  VisibilityChanged = "visibilityChanged",
@@ -29,23 +29,27 @@ export default class LocalParticipant extends Participant {
29
29
  * Enable or disable a participant's camera track.
30
30
  *
31
31
  * If a track has already published, it'll mute or unmute the track.
32
+ * Resolves with a `LocalTrackPublication` instance if successful and `undefined` otherwise
32
33
  */
33
- setCameraEnabled(enabled: boolean): Promise<void>;
34
+ setCameraEnabled(enabled: boolean): Promise<LocalTrackPublication | undefined>;
34
35
  /**
35
36
  * Enable or disable a participant's microphone track.
36
37
  *
37
38
  * If a track has already published, it'll mute or unmute the track.
39
+ * Resolves with a `LocalTrackPublication` instance if successful and `undefined` otherwise
38
40
  */
39
- setMicrophoneEnabled(enabled: boolean): Promise<void>;
41
+ setMicrophoneEnabled(enabled: boolean): Promise<LocalTrackPublication | undefined>;
40
42
  /**
41
43
  * Start or stop sharing a participant's screen
44
+ * Resolves with a `LocalTrackPublication` instance if successful and `undefined` otherwise
42
45
  */
43
- setScreenShareEnabled(enabled: boolean): Promise<void>;
46
+ setScreenShareEnabled(enabled: boolean): Promise<LocalTrackPublication | undefined>;
44
47
  /** @internal */
45
48
  setPermissions(permissions: ParticipantPermission): boolean;
46
49
  /**
47
50
  * Enable or disable publishing for a track by source. This serves as a simple
48
- * way to manage the common tracks (camera, mic, or screen share)
51
+ * way to manage the common tracks (camera, mic, or screen share).
52
+ * Resolves with LocalTrackPublication if successful and void otherwise
49
53
  */
50
54
  private setTrackEnabled;
51
55
  /**
@@ -71,7 +75,7 @@ export default class LocalParticipant extends Participant {
71
75
  * @param options
72
76
  */
73
77
  publishTrack(track: LocalTrack | MediaStreamTrack, options?: TrackPublishOptions): Promise<LocalTrackPublication>;
74
- unpublishTrack(track: LocalTrack | MediaStreamTrack, stopOnUnpublish?: boolean): LocalTrackPublication | null;
78
+ unpublishTrack(track: LocalTrack | MediaStreamTrack, stopOnUnpublish?: boolean): LocalTrackPublication | undefined;
75
79
  unpublishTracks(tracks: LocalTrack[] | MediaStreamTrack[]): LocalTrackPublication[];
76
80
  /**
77
81
  * Publish a new data payload to the room. Data will be forwarded to each
@@ -16,6 +16,15 @@ export default class RemoteParticipant extends Participant {
16
16
  protected addTrackPublication(publication: RemoteTrackPublication): void;
17
17
  getTrack(source: Track.Source): RemoteTrackPublication | undefined;
18
18
  getTrackByName(name: string): RemoteTrackPublication | undefined;
19
+ /**
20
+ * sets the volume on the participant's microphone track if it exists.
21
+ */
22
+ setVolume(volume: number): void;
23
+ /**
24
+ * gets the volume on the participant's microphone track
25
+ * returns undefined if no microphone track exists
26
+ */
27
+ getVolume(): number | undefined;
19
28
  /** @internal */
20
29
  addSubscribedMediaTrack(mediaTrack: MediaStreamTrack, sid: Track.SID, mediaStream: MediaStream, receiver?: RTCRtpReceiver, adaptiveStreamSettings?: AdaptiveStreamSettings, triesLeft?: number): RemoteTrackPublication | undefined;
21
30
  /** @internal */
@@ -2,7 +2,18 @@ import { AudioReceiverStats } from '../stats';
2
2
  import RemoteTrack from './RemoteTrack';
3
3
  export default class RemoteAudioTrack extends RemoteTrack {
4
4
  private prevStats?;
5
+ private elementVolume;
5
6
  constructor(mediaTrack: MediaStreamTrack, sid: string, receiver?: RTCRtpReceiver);
7
+ /**
8
+ * sets the volume for all attached audio elements
9
+ */
10
+ setVolume(volume: number): void;
11
+ /**
12
+ * gets the volume for all attached audio elements
13
+ */
14
+ getVolume(): number;
15
+ attach(): HTMLMediaElement;
16
+ attach(element: HTMLMediaElement): HTMLMediaElement;
6
17
  protected monitorReceiver: () => Promise<void>;
7
18
  protected getReceiverStats(): Promise<AudioReceiverStats | undefined>;
8
19
  }
@@ -0,0 +1,11 @@
1
+ /// <reference types="jest" />
2
+ import { SignalClient } from '../api/SignalClient';
3
+ import RTCEngine from '../room/RTCEngine';
4
+ declare const mocks: {
5
+ SignalClient: jest.MockedClass<typeof SignalClient>;
6
+ RTCEngine: jest.MockedClass<typeof RTCEngine>;
7
+ MockLocalVideoTrack: {
8
+ stop: jest.Mock<any, any>;
9
+ };
10
+ };
11
+ export default mocks;
package/package.json CHANGED
@@ -1,22 +1,35 @@
1
1
  {
2
2
  "name": "livekit-client",
3
- "version": "0.17.5",
3
+ "version": "0.17.6-rc1",
4
4
  "description": "JavaScript/TypeScript client SDK for LiveKit",
5
- "main": "dist/index.js",
5
+ "main": "./dist/livekit-client.umd.js",
6
+ "unpkg": "./dist/livekit-client.umd.js",
7
+ "module": "./dist/livekit-client.esm.js",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/livekit-client.esm.js",
11
+ "require": "./dist/livekit-client.umd.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
6
17
  "source": "src/index.ts",
7
18
  "types": "dist/index.d.ts",
8
19
  "repository": "git@github.com:livekit/client-sdk-js.git",
9
20
  "author": "David Zhao <david@davidzhao.com>",
10
21
  "license": "Apache-2.0",
11
22
  "scripts": {
12
- "build": "yarn exec tsc",
13
- "build-docs": "yarn exec typedoc",
23
+ "build": "rollup --config",
24
+ "build:watch": "rollup --watch --config rollup.config.js",
25
+ "build-docs": "typedoc",
14
26
  "proto": "protoc --plugin=node_modules/ts-proto/protoc-gen-ts_proto --ts_proto_opt=esModuleInterop=true --ts_proto_out=./src/proto --ts_proto_opt=outputClientImpl=false,useOptionals=true -I./protocol ./protocol/livekit_rtc.proto ./protocol/livekit_models.proto",
15
- "sample": "cd example && webpack serve",
16
- "build-sample": "cd example && webpack && cp styles.css index.html dist/",
27
+ "sample": "rollup --watch --config rollup.config.dev.js",
17
28
  "lint": "eslint src",
18
29
  "test": "jest",
19
- "deploy": "gh-pages -d example/dist"
30
+ "deploy": "gh-pages -d example/dist",
31
+ "format": "prettier --write .",
32
+ "format:check": "prettier --check ."
20
33
  },
21
34
  "dependencies": {
22
35
  "events": "^3.3.0",
@@ -27,23 +40,35 @@
27
40
  "webrtc-adapter": "^8.1.1"
28
41
  },
29
42
  "devDependencies": {
43
+ "@babel/preset-env": "^7.16.11",
44
+ "@rollup/plugin-babel": "^5.3.1",
45
+ "@rollup/plugin-commonjs": "^21.0.3",
46
+ "@rollup/plugin-node-resolve": "^13.1.3",
47
+ "@rollup/plugin-typescript": "^8.3.1",
30
48
  "@types/jest": "^27.0.3",
31
49
  "@types/ws": "^7.4.0",
32
50
  "@typescript-eslint/eslint-plugin": "^4.31.2",
33
- "@webpack-cli/serve": "^1.5.2",
34
51
  "eslint": "^7.32.0",
35
52
  "eslint-config-airbnb-typescript": "^12.3.1",
53
+ "eslint-config-prettier": "^8.5.0",
36
54
  "eslint-plugin-import": "^2.24.2",
37
55
  "gh-pages": "^3.2.3",
56
+ "glob": "^7.2.0",
38
57
  "jest": "^27.4.3",
58
+ "prettier": "^2.6.1",
59
+ "rollup": "^2.70.1",
60
+ "rollup-plugin-re": "^1.0.7",
61
+ "rollup-plugin-serve": "^1.1.0",
62
+ "rollup-plugin-terser": "^7.0.2",
39
63
  "ts-jest": "^27.0.7",
40
64
  "ts-loader": "^8.1.0",
41
65
  "ts-proto": "^1.110.1",
42
- "typedoc": "^0.20.35",
43
- "typedoc-plugin-no-inherit": "1.3.0",
44
- "typescript": "~4.2.3",
45
- "webpack": "^5.53.0",
46
- "webpack-cli": "^4.8.0",
47
- "webpack-dev-server": "^4.2.1"
48
- }
66
+ "typedoc": "^0.22.13",
67
+ "typedoc-plugin-no-inherit": "1.3.1",
68
+ "typescript": "~4.2.3"
69
+ },
70
+ "browserslist": [
71
+ "defaults",
72
+ "not IE 11"
73
+ ]
49
74
  }
package/.eslintrc.js DELETED
@@ -1,17 +0,0 @@
1
- module.exports = {
2
- extends: ['airbnb-typescript/base'],
3
- parserOptions: {
4
- project: './tsconfig.eslint.json',
5
- },
6
- rules: {
7
- 'import/export': 'off',
8
- 'max-classes-per-file': 'off',
9
- 'no-param-reassign': 'off',
10
- 'no-await-in-loop': 'off',
11
- 'no-restricted-syntax': 'off',
12
- 'consistent-return': 'off',
13
- 'class-methods-use-this': 'off',
14
- 'no-underscore-dangle': 'off',
15
- '@typescript-eslint/no-use-before-define': 'off',
16
- },
17
- };
package/.gitmodules DELETED
@@ -1,3 +0,0 @@
1
- [submodule "protocol"]
2
- path = protocol
3
- url = https://github.com/livekit/protocol