livekit-client 2.22.3 → 2.23.0

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 (272) hide show
  1. package/README.md +35 -0
  2. package/dist/livekit-client.e2ee.worker.js +1 -1
  3. package/dist/livekit-client.e2ee.worker.js.map +1 -1
  4. package/dist/livekit-client.e2ee.worker.mjs +71 -8
  5. package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
  6. package/dist/livekit-client.esm.mjs +1746 -547
  7. package/dist/livekit-client.esm.mjs.map +1 -1
  8. package/dist/livekit-client.fm.worker.js +1 -1
  9. package/dist/livekit-client.fm.worker.js.map +1 -1
  10. package/dist/livekit-client.fm.worker.mjs +2 -1
  11. package/dist/livekit-client.fm.worker.mjs.map +1 -1
  12. package/dist/livekit-client.umd.js +1 -1
  13. package/dist/livekit-client.umd.js.map +1 -1
  14. package/dist/src/api/SignalClient.d.ts +4 -2
  15. package/dist/src/api/SignalClient.d.ts.map +1 -1
  16. package/dist/src/api/WebSocketStream.d.ts +1 -0
  17. package/dist/src/api/WebSocketStream.d.ts.map +1 -1
  18. package/dist/src/api/utils.d.ts +1 -1
  19. package/dist/src/api/utils.d.ts.map +1 -1
  20. package/dist/src/e2ee/E2eeManager.d.ts.map +1 -1
  21. package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
  22. package/dist/src/e2ee/worker/naluUtils.d.ts +12 -1
  23. package/dist/src/e2ee/worker/naluUtils.d.ts.map +1 -1
  24. package/dist/src/index.d.ts +2 -2
  25. package/dist/src/index.d.ts.map +1 -1
  26. package/dist/src/options.d.ts +14 -0
  27. package/dist/src/options.d.ts.map +1 -1
  28. package/dist/src/room/DefaultReconnectPolicy.d.ts.map +1 -1
  29. package/dist/src/room/PCTransport.d.ts +100 -7
  30. package/dist/src/room/PCTransport.d.ts.map +1 -1
  31. package/dist/src/room/PCTransportManager.d.ts.map +1 -1
  32. package/dist/src/room/RTCEngine.d.ts +16 -0
  33. package/dist/src/room/RTCEngine.d.ts.map +1 -1
  34. package/dist/src/room/Room.d.ts +54 -1
  35. package/dist/src/room/Room.d.ts.map +1 -1
  36. package/dist/src/room/data-channel/DataChannelManager.d.ts +9 -8
  37. package/dist/src/room/data-channel/DataChannelManager.d.ts.map +1 -1
  38. package/dist/src/room/data-channel/FlowControlledDataChannel.d.ts +25 -12
  39. package/dist/src/room/data-channel/FlowControlledDataChannel.d.ts.map +1 -1
  40. package/dist/src/room/data-channel/LossyDataChannel.d.ts.map +1 -1
  41. package/dist/src/room/data-channel/ReliableDataChannel.d.ts.map +1 -1
  42. package/dist/src/room/data-stream/incoming/IncomingDataStreamManager.d.ts.map +1 -1
  43. package/dist/src/room/defaults.d.ts.map +1 -1
  44. package/dist/src/room/errors.d.ts +18 -0
  45. package/dist/src/room/errors.d.ts.map +1 -1
  46. package/dist/src/room/events.d.ts +3 -2
  47. package/dist/src/room/events.d.ts.map +1 -1
  48. package/dist/src/room/participant/LocalParticipant.d.ts +4 -0
  49. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  50. package/dist/src/room/participant/Participant.d.ts +1 -1
  51. package/dist/src/room/participant/Participant.d.ts.map +1 -1
  52. package/dist/src/room/participant/publishUtils.d.ts.map +1 -1
  53. package/dist/src/room/rpc/client/RpcClientManager.d.ts.map +1 -1
  54. package/dist/src/room/rpc/utils.d.ts.map +1 -1
  55. package/dist/src/room/track/LocalAudioTrack.d.ts +24 -1
  56. package/dist/src/room/track/LocalAudioTrack.d.ts.map +1 -1
  57. package/dist/src/room/track/LocalTrack.d.ts +18 -0
  58. package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
  59. package/dist/src/room/track/LocalVideoTrack.d.ts +9 -0
  60. package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
  61. package/dist/src/room/track/RemoteAudioTrack.d.ts +6 -0
  62. package/dist/src/room/track/RemoteAudioTrack.d.ts.map +1 -1
  63. package/dist/src/room/track/processor/types.d.ts +11 -0
  64. package/dist/src/room/track/processor/types.d.ts.map +1 -1
  65. package/dist/src/room/track/utils.d.ts +13 -0
  66. package/dist/src/room/track/utils.d.ts.map +1 -1
  67. package/dist/src/room/utils.d.ts +60 -1
  68. package/dist/src/room/utils.d.ts.map +1 -1
  69. package/dist/src/test/compressionStreamStubs.d.ts +12 -0
  70. package/dist/src/test/compressionStreamStubs.d.ts.map +1 -0
  71. package/dist/ts4.2/api/SignalClient.d.ts +187 -185
  72. package/dist/ts4.2/api/SignalClientStateMachine.d.ts +85 -85
  73. package/dist/ts4.2/api/WebSocketStream.d.ts +34 -33
  74. package/dist/ts4.2/api/utils.d.ts +9 -9
  75. package/dist/ts4.2/connectionHelper/ConnectionCheck.d.ts +30 -30
  76. package/dist/ts4.2/connectionHelper/checks/Checker.d.ts +62 -62
  77. package/dist/ts4.2/connectionHelper/checks/cloudRegion.d.ts +18 -18
  78. package/dist/ts4.2/connectionHelper/checks/connectionProtocol.d.ts +20 -20
  79. package/dist/ts4.2/connectionHelper/checks/publishAudio.d.ts +6 -6
  80. package/dist/ts4.2/connectionHelper/checks/publishVideo.d.ts +7 -7
  81. package/dist/ts4.2/connectionHelper/checks/reconnect.d.ts +6 -6
  82. package/dist/ts4.2/connectionHelper/checks/turn.d.ts +6 -6
  83. package/dist/ts4.2/connectionHelper/checks/webrtc.d.ts +6 -6
  84. package/dist/ts4.2/connectionHelper/checks/websocket.d.ts +6 -6
  85. package/dist/ts4.2/e2ee/E2eeManager.d.ts +111 -111
  86. package/dist/ts4.2/e2ee/KeyProvider.d.ts +54 -54
  87. package/dist/ts4.2/e2ee/constants.d.ts +21 -21
  88. package/dist/ts4.2/e2ee/errors.d.ts +12 -12
  89. package/dist/ts4.2/e2ee/events.d.ts +39 -39
  90. package/dist/ts4.2/e2ee/index.d.ts +6 -6
  91. package/dist/ts4.2/e2ee/types.d.ts +231 -231
  92. package/dist/ts4.2/e2ee/utils.d.ts +32 -32
  93. package/dist/ts4.2/e2ee/worker/DataCryptor.d.ts +16 -16
  94. package/dist/ts4.2/e2ee/worker/ErrorRateLimiter.d.ts +21 -21
  95. package/dist/ts4.2/e2ee/worker/FrameCryptor.d.ts +209 -209
  96. package/dist/ts4.2/e2ee/worker/ParticipantKeyHandler.d.ts +81 -84
  97. package/dist/ts4.2/e2ee/worker/e2ee.worker.d.ts +2 -2
  98. package/dist/ts4.2/e2ee/worker/naluUtils.d.ts +39 -28
  99. package/dist/ts4.2/e2ee/worker/sifPayload.d.ts +23 -23
  100. package/dist/ts4.2/frameMetadata/FrameMetadataManager.d.ts +53 -53
  101. package/dist/ts4.2/frameMetadata/frameMetadata.d.ts +33 -33
  102. package/dist/ts4.2/frameMetadata/types.d.ts +62 -62
  103. package/dist/ts4.2/frameMetadata/utils.d.ts +9 -9
  104. package/dist/ts4.2/frameMetadata/worker/frameMetadata.worker.d.ts +2 -2
  105. package/dist/ts4.2/index.d.ts +76 -76
  106. package/dist/ts4.2/logger.d.ts +66 -66
  107. package/dist/ts4.2/options.d.ts +163 -149
  108. package/dist/ts4.2/room/BackOffStrategy.d.ts +27 -27
  109. package/dist/ts4.2/room/DefaultReconnectPolicy.d.ts +8 -8
  110. package/dist/ts4.2/room/DeviceManager.d.ts +12 -12
  111. package/dist/ts4.2/room/PCTransport.d.ts +268 -175
  112. package/dist/ts4.2/room/PCTransportManager.d.ts +77 -77
  113. package/dist/ts4.2/room/RTCEngine.d.ts +277 -262
  114. package/dist/ts4.2/room/ReconnectPolicy.d.ts +24 -24
  115. package/dist/ts4.2/room/RegionUrlProvider.d.ts +36 -36
  116. package/dist/ts4.2/room/Room.d.ts +407 -365
  117. package/dist/ts4.2/room/attribute-typings.d.ts +35 -35
  118. package/dist/ts4.2/room/data-channel/DataChannelManager.d.ts +63 -62
  119. package/dist/ts4.2/room/data-channel/FlowControlledDataChannel.d.ts +107 -95
  120. package/dist/ts4.2/room/data-channel/LossyDataChannel.d.ts +41 -41
  121. package/dist/ts4.2/room/data-channel/ReliableDataChannel.d.ts +57 -57
  122. package/dist/ts4.2/room/data-channel/types.d.ts +12 -12
  123. package/dist/ts4.2/room/data-stream/compression.d.ts +49 -49
  124. package/dist/ts4.2/room/data-stream/constants.d.ts +18 -18
  125. package/dist/ts4.2/room/data-stream/incoming/IncomingDataStreamManager.d.ts +29 -29
  126. package/dist/ts4.2/room/data-stream/incoming/StreamReader.d.ts +80 -80
  127. package/dist/ts4.2/room/data-stream/outgoing/OutgoingDataStreamManager.d.ts +73 -73
  128. package/dist/ts4.2/room/data-stream/outgoing/StreamWriter.d.ts +16 -16
  129. package/dist/ts4.2/room/data-stream/outgoing/header-utils.d.ts +18 -18
  130. package/dist/ts4.2/room/data-track/LocalDataTrack.d.ts +79 -80
  131. package/dist/ts4.2/room/data-track/RemoteDataTrack.d.ts +50 -50
  132. package/dist/ts4.2/room/data-track/depacketizer.d.ts +59 -59
  133. package/dist/ts4.2/room/data-track/frame.d.ts +22 -22
  134. package/dist/ts4.2/room/data-track/handle.d.ts +27 -27
  135. package/dist/ts4.2/room/data-track/incoming/IncomingDataTrackManager.d.ts +124 -124
  136. package/dist/ts4.2/room/data-track/incoming/errors.d.ts +24 -24
  137. package/dist/ts4.2/room/data-track/incoming/pipeline.d.ts +41 -41
  138. package/dist/ts4.2/room/data-track/incoming/types.d.ts +20 -20
  139. package/dist/ts4.2/room/data-track/outgoing/OutgoingDataTrackManager.d.ts +126 -126
  140. package/dist/ts4.2/room/data-track/outgoing/errors.d.ts +74 -74
  141. package/dist/ts4.2/room/data-track/outgoing/pipeline.d.ts +23 -23
  142. package/dist/ts4.2/room/data-track/outgoing/types.d.ts +48 -48
  143. package/dist/ts4.2/room/data-track/packet/constants.d.ts +20 -20
  144. package/dist/ts4.2/room/data-track/packet/errors.d.ts +40 -40
  145. package/dist/ts4.2/room/data-track/packet/extensions.d.ts +69 -69
  146. package/dist/ts4.2/room/data-track/packet/index.d.ts +98 -98
  147. package/dist/ts4.2/room/data-track/packet/serializable.d.ts +13 -13
  148. package/dist/ts4.2/room/data-track/packetizer.d.ts +43 -43
  149. package/dist/ts4.2/room/data-track/track-interfaces.d.ts +23 -23
  150. package/dist/ts4.2/room/data-track/types.d.ts +22 -22
  151. package/dist/ts4.2/room/data-track/utils.d.ts +60 -60
  152. package/dist/ts4.2/room/debounce.d.ts +11 -11
  153. package/dist/ts4.2/room/defaults.d.ts +9 -9
  154. package/dist/ts4.2/room/errors.d.ts +180 -162
  155. package/dist/ts4.2/room/events.d.ts +638 -637
  156. package/dist/ts4.2/room/participant/LocalParticipant.d.ts +291 -287
  157. package/dist/ts4.2/room/participant/Participant.d.ts +142 -144
  158. package/dist/ts4.2/room/participant/ParticipantTrackPermission.d.ts +26 -26
  159. package/dist/ts4.2/room/participant/RemoteParticipant.d.ts +85 -86
  160. package/dist/ts4.2/room/participant/publishUtils.d.ts +53 -53
  161. package/dist/ts4.2/room/rpc/client/RpcClientManager.d.ts +43 -43
  162. package/dist/ts4.2/room/rpc/client/events.d.ts +8 -8
  163. package/dist/ts4.2/room/rpc/index.d.ts +7 -7
  164. package/dist/ts4.2/room/rpc/server/RpcServerManager.d.ts +44 -44
  165. package/dist/ts4.2/room/rpc/server/events.d.ts +8 -8
  166. package/dist/ts4.2/room/rpc/utils.d.ts +131 -131
  167. package/dist/ts4.2/room/stats.d.ts +71 -71
  168. package/dist/ts4.2/room/statsSummary.d.ts +13 -13
  169. package/dist/ts4.2/room/timers.d.ts +12 -12
  170. package/dist/ts4.2/room/token-source/TokenSource.d.ts +82 -82
  171. package/dist/ts4.2/room/token-source/types.d.ts +70 -70
  172. package/dist/ts4.2/room/token-source/utils.d.ts +8 -8
  173. package/dist/ts4.2/room/track/FrameMetadataExtractor.d.ts +19 -19
  174. package/dist/ts4.2/room/track/LocalAudioTrack.d.ts +62 -42
  175. package/dist/ts4.2/room/track/LocalTrack.d.ts +143 -125
  176. package/dist/ts4.2/room/track/LocalTrackPublication.d.ts +42 -42
  177. package/dist/ts4.2/room/track/LocalVideoTrack.d.ts +109 -100
  178. package/dist/ts4.2/room/track/RemoteAudioTrack.d.ts +61 -55
  179. package/dist/ts4.2/room/track/RemoteTrack.d.ts +38 -38
  180. package/dist/ts4.2/room/track/RemoteTrackPublication.d.ts +72 -75
  181. package/dist/ts4.2/room/track/RemoteVideoTrack.d.ts +73 -76
  182. package/dist/ts4.2/room/track/Track.d.ts +156 -166
  183. package/dist/ts4.2/room/track/TrackPublication.d.ts +75 -81
  184. package/dist/ts4.2/room/track/create.d.ts +25 -25
  185. package/dist/ts4.2/room/track/facingMode.d.ts +41 -41
  186. package/dist/ts4.2/room/track/options.d.ts +403 -403
  187. package/dist/ts4.2/room/track/processor/types.d.ts +42 -31
  188. package/dist/ts4.2/room/track/record.d.ts +13 -13
  189. package/dist/ts4.2/room/track/types.d.ts +28 -28
  190. package/dist/ts4.2/room/track/utils.d.ts +60 -47
  191. package/dist/ts4.2/room/types.d.ts +127 -127
  192. package/dist/ts4.2/room/utils.d.ts +273 -214
  193. package/dist/ts4.2/test/MockMediaStreamTrack.d.ts +26 -26
  194. package/dist/ts4.2/test/compressionStreamStubs.d.ts +12 -0
  195. package/dist/ts4.2/test/mocks.d.ts +12 -12
  196. package/dist/ts4.2/test/promiseState.d.ts +12 -12
  197. package/dist/ts4.2/test/signalToken.d.ts +26 -26
  198. package/dist/ts4.2/type-polyfills/non-shared-typed-arrays.d.ts +2 -2
  199. package/dist/ts4.2/utils/AsyncQueue.d.ts +23 -23
  200. package/dist/ts4.2/utils/TypedPromise.d.ts +17 -17
  201. package/dist/ts4.2/utils/abort-signal-polyfill.d.ts +13 -13
  202. package/dist/ts4.2/utils/browserParser.d.ts +13 -13
  203. package/dist/ts4.2/utils/camelToSnakeCase.d.ts +8 -8
  204. package/dist/ts4.2/utils/cloneDeep.d.ts +2 -2
  205. package/dist/ts4.2/utils/dataPacketBuffer.d.ts +34 -34
  206. package/dist/ts4.2/utils/deferrable-map.d.ts +32 -32
  207. package/dist/ts4.2/utils/machineInspector.d.ts +54 -54
  208. package/dist/ts4.2/utils/serializer.d.ts +48 -48
  209. package/dist/ts4.2/utils/subscribeToEvents.d.ts +15 -15
  210. package/dist/ts4.2/utils/ttlmap.d.ts +20 -20
  211. package/dist/ts4.2/version.d.ts +15 -15
  212. package/package.json +5 -4
  213. package/src/api/SignalClient.e2e.test.ts +1 -3
  214. package/src/api/SignalClient.test.ts +394 -10
  215. package/src/api/SignalClient.ts +132 -76
  216. package/src/api/WebSocketStream.test.ts +11 -0
  217. package/src/api/WebSocketStream.ts +22 -1
  218. package/src/api/utils.ts +1 -1
  219. package/src/e2ee/E2eeManager.test.ts +43 -0
  220. package/src/e2ee/E2eeManager.ts +6 -2
  221. package/src/e2ee/worker/FrameCryptor.test.ts +212 -90
  222. package/src/e2ee/worker/FrameCryptor.ts +21 -4
  223. package/src/e2ee/worker/naluUtils.test.ts +123 -0
  224. package/src/e2ee/worker/naluUtils.ts +57 -2
  225. package/src/index.ts +2 -0
  226. package/src/options.ts +16 -0
  227. package/src/room/DefaultReconnectPolicy.test.ts +58 -0
  228. package/src/room/DefaultReconnectPolicy.ts +14 -2
  229. package/src/room/PCTransport.test.ts +327 -9
  230. package/src/room/PCTransport.ts +339 -36
  231. package/src/room/PCTransportManager.ts +3 -1
  232. package/src/room/RTCEngine.test.ts +318 -2
  233. package/src/room/RTCEngine.ts +126 -12
  234. package/src/room/Room.test.ts +148 -6
  235. package/src/room/Room.ts +312 -80
  236. package/src/room/data-channel/DataChannelManager.test.ts +24 -7
  237. package/src/room/data-channel/DataChannelManager.ts +43 -38
  238. package/src/room/data-channel/FlowControlledDataChannel.test.ts +60 -18
  239. package/src/room/data-channel/FlowControlledDataChannel.ts +40 -22
  240. package/src/room/data-channel/LossyDataChannel.test.ts +38 -0
  241. package/src/room/data-channel/LossyDataChannel.ts +10 -1
  242. package/src/room/data-channel/ReliableDataChannel.test.ts +72 -0
  243. package/src/room/data-channel/ReliableDataChannel.ts +16 -5
  244. package/src/room/data-stream/incoming/IncomingDataStreamManager.test.ts +47 -20
  245. package/src/room/data-stream/incoming/IncomingDataStreamManager.ts +16 -5
  246. package/src/room/data-stream/outgoing/OutgoingDataStreamManager.test.ts +60 -39
  247. package/src/room/data-stream/outgoing/OutgoingDataStreamManager.ts +4 -4
  248. package/src/room/defaults.ts +1 -0
  249. package/src/room/errors.test.ts +36 -0
  250. package/src/room/errors.ts +27 -0
  251. package/src/room/events.ts +2 -1
  252. package/src/room/participant/LocalParticipant.test.ts +136 -1
  253. package/src/room/participant/LocalParticipant.ts +66 -17
  254. package/src/room/participant/Participant.ts +6 -3
  255. package/src/room/participant/publishUtils.ts +0 -19
  256. package/src/room/participant/restartOnDefaultAudioDevice.test.ts +177 -0
  257. package/src/room/rpc/client/RpcClientManager.test.ts +51 -0
  258. package/src/room/rpc/client/RpcClientManager.ts +32 -15
  259. package/src/room/rpc/utils.test.ts +32 -0
  260. package/src/room/rpc/utils.ts +7 -0
  261. package/src/room/track/LocalAudioTrack.ts +101 -10
  262. package/src/room/track/LocalTrack.ts +87 -19
  263. package/src/room/track/LocalVideoTrack.ts +17 -3
  264. package/src/room/track/RemoteAudioTrack.ts +59 -14
  265. package/src/room/track/RemoteVideoTrack.test.ts +210 -0
  266. package/src/room/track/RemoteVideoTrack.ts +29 -3
  267. package/src/room/track/processor/types.ts +11 -0
  268. package/src/room/track/utils.test.ts +206 -2
  269. package/src/room/track/utils.ts +117 -5
  270. package/src/room/utils.test.ts +250 -0
  271. package/src/room/utils.ts +152 -19
  272. package/src/test/compressionStreamStubs.ts +53 -0
@@ -1,144 +1,142 @@
1
- import type { SipDTMF } from '@livekit/protocol';
2
- import { DataPacket_Kind, Encryption_Type, ParticipantInfo, ParticipantInfo_Kind as ParticipantKind, ParticipantPermission, ConnectionQuality as ProtoQuality, SubscriptionError } from '@livekit/protocol';
3
- import type TypedEmitter from 'typed-emitter';
4
- import type { StructuredLogger } from '../../logger';
5
- import type { NonSharedUint8Array } from '../../type-polyfills/non-shared-typed-arrays';
6
- import type LocalTrackPublication from '../track/LocalTrackPublication';
7
- import type LocalVideoTrack from '../track/LocalVideoTrack';
8
- import type RemoteTrack from '../track/RemoteTrack';
9
- import type RemoteTrackPublication from '../track/RemoteTrackPublication';
10
- import { Track } from '../track/Track';
11
- import type { TrackPublication } from '../track/TrackPublication';
12
- import type { ChatMessage, LoggerOptions, TranscriptionSegment } from '../types';
13
- import { Future } from '../utils';
14
- export declare enum ConnectionQuality {
15
- Excellent = "excellent",
16
- Good = "good",
17
- Poor = "poor",
18
- /**
19
- * Indicates that a participant has temporarily (or permanently) lost connection to LiveKit.
20
- * For permanent disconnection a `ParticipantDisconnected` event will be emitted after a timeout
21
- */
22
- Lost = "lost",
23
- Unknown = "unknown"
24
- }
25
- export { ParticipantKind };
26
- declare const Participant_base: new () => TypedEmitter<ParticipantEventCallbacks>;
27
- export default class Participant extends Participant_base {
28
- protected participantInfo?: ParticipantInfo;
29
- audioTrackPublications: Map<string, TrackPublication>;
30
- videoTrackPublications: Map<string, TrackPublication>;
31
- /** map of track sid => all published tracks */
32
- trackPublications: Map<string, TrackPublication>;
33
- /** audio level between 0-1.0, 1 being loudest, 0 being softest */
34
- audioLevel: number;
35
- /** if participant is currently speaking */
36
- isSpeaking: boolean;
37
- /** server assigned unique id */
38
- sid: string;
39
- /** client assigned identity, encoded in JWT token */
40
- identity: string;
41
- /** client assigned display name, encoded in JWT token */
42
- name?: string;
43
- /** client metadata, opaque to livekit */
44
- metadata?: string;
45
- private _attributes;
46
- lastSpokeAt?: Date | undefined;
47
- permissions?: ParticipantPermission;
48
- protected _kind: ParticipantKind;
49
- private _connectionQuality;
50
- protected audioContext?: AudioContext;
51
- protected log: StructuredLogger;
52
- protected loggerOptions?: LoggerOptions;
53
- protected activeFuture?: Future<void, Error>;
54
- protected get logContext(): {
55
- [x: string]: unknown;
56
- };
57
- get isEncrypted(): boolean;
58
- get isAgent(): boolean;
59
- get isActive(): boolean;
60
- get kind(): ParticipantKind;
61
- /** participant attributes, similar to metadata, but as a key/value map */
62
- get attributes(): Readonly<Record<string, string>>;
63
- /** @internal */
64
- constructor(sid: string, identity: string, name?: string, metadata?: string, attributes?: Record<string, string>, loggerOptions?: LoggerOptions, kind?: ParticipantKind);
65
- getTrackPublications(): TrackPublication[];
66
- /**
67
- * Finds the first track that matches the source filter, for example, getting
68
- * the user's camera track with getTrackBySource(Track.Source.Camera).
69
- */
70
- getTrackPublication(source: Track.Source): TrackPublication | undefined;
71
- /**
72
- * Finds the first track that matches the track's name.
73
- */
74
- getTrackPublicationByName(name: string): TrackPublication | undefined;
75
- /**
76
- * Waits until the participant is active and ready to receive data messages
77
- * @returns a promise that resolves when the participant is active
78
- */
79
- waitUntilActive(): Promise<void>;
80
- get connectionQuality(): ConnectionQuality;
81
- get isCameraEnabled(): boolean;
82
- get isMicrophoneEnabled(): boolean;
83
- get isScreenShareEnabled(): boolean;
84
- get isLocal(): boolean;
85
- /** when participant joined the room */
86
- get joinedAt(): Date | undefined;
87
- /** @internal */
88
- updateInfo(info: ParticipantInfo): boolean;
89
- /**
90
- * Updates metadata from server
91
- **/
92
- private _setMetadata;
93
- private _setName;
94
- /**
95
- * Updates metadata from server
96
- **/
97
- private _setAttributes;
98
- /** @internal */
99
- setPermissions(permissions: ParticipantPermission): boolean;
100
- /** @internal */
101
- setIsSpeaking(speaking: boolean): void;
102
- /** @internal */
103
- setConnectionQuality(q: ProtoQuality): void;
104
- /**
105
- * @internal
106
- */
107
- setDisconnected(): void;
108
- /**
109
- * @internal
110
- */
111
- setAudioContext(ctx: AudioContext | undefined): void;
112
- protected addTrackPublication(publication: TrackPublication): void;
113
- }
114
- export type ParticipantEventCallbacks = {
115
- trackPublished: (publication: RemoteTrackPublication) => void;
116
- trackSubscribed: (track: RemoteTrack, publication: RemoteTrackPublication) => void;
117
- trackSubscriptionFailed: (trackSid: string, reason?: SubscriptionError) => void;
118
- trackUnpublished: (publication: RemoteTrackPublication) => void;
119
- trackUnsubscribed: (track: RemoteTrack, publication: RemoteTrackPublication) => void;
120
- trackMuted: (publication: TrackPublication) => void;
121
- trackUnmuted: (publication: TrackPublication) => void;
122
- localTrackPublished: (publication: LocalTrackPublication) => void;
123
- localTrackUnpublished: (publication: LocalTrackPublication) => void;
124
- localTrackCpuConstrained: (track: LocalVideoTrack, publication: LocalTrackPublication) => void;
125
- localSenderCreated: (sender: RTCRtpSender, track: Track) => void;
126
- participantMetadataChanged: (prevMetadata: string | undefined, participant?: any) => void;
127
- participantNameChanged: (name: string) => void;
128
- dataReceived: (payload: NonSharedUint8Array, kind: DataPacket_Kind, encryptionType?: Encryption_Type) => void;
129
- sipDTMFReceived: (dtmf: SipDTMF) => void;
130
- transcriptionReceived: (transcription: TranscriptionSegment[], publication?: TrackPublication) => void;
131
- isSpeakingChanged: (speaking: boolean) => void;
132
- connectionQualityChanged: (connectionQuality: ConnectionQuality) => void;
133
- trackStreamStateChanged: (publication: RemoteTrackPublication, streamState: Track.StreamState) => void;
134
- trackSubscriptionPermissionChanged: (publication: RemoteTrackPublication, status: TrackPublication.PermissionStatus) => void;
135
- mediaDevicesError: (error: Error, kind?: MediaDeviceKind) => void;
136
- audioStreamAcquired: () => void;
137
- participantPermissionsChanged: (prevPermissions?: ParticipantPermission) => void;
138
- trackSubscriptionStatusChanged: (publication: RemoteTrackPublication, status: TrackPublication.SubscriptionStatus) => void;
139
- attributesChanged: (changedAttributes: Record<string, string>) => void;
140
- localTrackSubscribed: (trackPublication: LocalTrackPublication) => void;
141
- chatMessage: (msg: ChatMessage) => void;
142
- active: () => void;
143
- };
144
- //# sourceMappingURL=Participant.d.ts.map
1
+ import type { SipDTMF } from '@livekit/protocol';
2
+ import { DataPacket_Kind, Encryption_Type, ParticipantInfo, ParticipantInfo_Kind as ParticipantKind, ParticipantPermission, ConnectionQuality as ProtoQuality, SubscriptionError } from '@livekit/protocol';
3
+ import type TypedEmitter from 'typed-emitter';
4
+ import type { StructuredLogger } from '../../logger';
5
+ import type { NonSharedUint8Array } from '../../type-polyfills/non-shared-typed-arrays';
6
+ import type LocalTrackPublication from '../track/LocalTrackPublication';
7
+ import type LocalVideoTrack from '../track/LocalVideoTrack';
8
+ import type RemoteTrack from '../track/RemoteTrack';
9
+ import type RemoteTrackPublication from '../track/RemoteTrackPublication';
10
+ import { Track } from '../track/Track';
11
+ import type { TrackPublication } from '../track/TrackPublication';
12
+ import type { ChatMessage, LoggerOptions, TranscriptionSegment } from '../types';
13
+ import { Future } from '../utils';
14
+ export declare enum ConnectionQuality {
15
+ Excellent = "excellent",
16
+ Good = "good",
17
+ Poor = "poor",
18
+ /**
19
+ * Indicates that a participant has temporarily (or permanently) lost connection to LiveKit.
20
+ * For permanent disconnection a `ParticipantDisconnected` event will be emitted after a timeout
21
+ */
22
+ Lost = "lost",
23
+ Unknown = "unknown"
24
+ }
25
+ export { ParticipantKind };
26
+ declare const Participant_base: new () => TypedEmitter<ParticipantEventCallbacks>;
27
+ export default class Participant extends Participant_base {
28
+ protected participantInfo?: ParticipantInfo;
29
+ audioTrackPublications: Map<string, TrackPublication>;
30
+ videoTrackPublications: Map<string, TrackPublication>;
31
+ /** map of track sid => all published tracks */
32
+ trackPublications: Map<string, TrackPublication>;
33
+ /** audio level between 0-1.0, 1 being loudest, 0 being softest */
34
+ audioLevel: number;
35
+ /** if participant is currently speaking */
36
+ isSpeaking: boolean;
37
+ /** server assigned unique id */
38
+ sid: string;
39
+ /** client assigned identity, encoded in JWT token */
40
+ identity: string;
41
+ /** client assigned display name, encoded in JWT token */
42
+ name?: string;
43
+ /** client metadata, opaque to livekit */
44
+ metadata?: string;
45
+ private _attributes;
46
+ lastSpokeAt?: Date | undefined;
47
+ permissions?: ParticipantPermission;
48
+ protected _kind: ParticipantKind;
49
+ private _connectionQuality;
50
+ protected audioContext?: AudioContext;
51
+ protected log: StructuredLogger;
52
+ protected loggerOptions?: LoggerOptions;
53
+ protected activeFuture?: Future<void, Error>;
54
+ protected get logContext(): {
55
+ [x: string]: unknown;
56
+ };
57
+ get isEncrypted(): boolean;
58
+ get isAgent(): boolean;
59
+ get isActive(): boolean;
60
+ get kind(): ParticipantKind;
61
+ get attributes(): Readonly<Record<string, string>>;
62
+ /** @internal */
63
+ constructor(sid: string, identity: string, name?: string, metadata?: string, attributes?: Record<string, string>, loggerOptions?: LoggerOptions, kind?: ParticipantKind);
64
+ getTrackPublications(): TrackPublication[];
65
+ /**
66
+ * Finds the first track that matches the source filter, for example, getting
67
+ * the user's camera track with getTrackBySource(Track.Source.Camera).
68
+ */
69
+ getTrackPublication(source: Track.Source): TrackPublication | undefined;
70
+ /**
71
+ * Finds the first track that matches the track's name.
72
+ */
73
+ getTrackPublicationByName(name: string): TrackPublication | undefined;
74
+ /**
75
+ * Waits until the participant is active and ready to receive data messages
76
+ * @returns a promise that resolves when the participant is active
77
+ */
78
+ waitUntilActive(): Promise<void>;
79
+ get connectionQuality(): ConnectionQuality;
80
+ get isCameraEnabled(): boolean;
81
+ get isMicrophoneEnabled(): boolean;
82
+ get isScreenShareEnabled(): boolean;
83
+ get isLocal(): boolean;
84
+ get joinedAt(): (Date | undefined);
85
+ /** @internal */
86
+ updateInfo(info: ParticipantInfo): boolean;
87
+ /**
88
+ * Updates metadata from server
89
+ **/
90
+ private _setMetadata;
91
+ private _setName;
92
+ /**
93
+ * Updates metadata from server
94
+ **/
95
+ private _setAttributes;
96
+ /** @internal */
97
+ setPermissions(permissions: ParticipantPermission): boolean;
98
+ /** @internal */
99
+ setIsSpeaking(speaking: boolean): void;
100
+ /** @internal */
101
+ setConnectionQuality(q: ProtoQuality): void;
102
+ /**
103
+ * @internal
104
+ */
105
+ setDisconnected(): void;
106
+ /**
107
+ * @internal
108
+ */
109
+ setAudioContext(ctx: AudioContext | undefined): Promise<void>;
110
+ protected addTrackPublication(publication: TrackPublication): void;
111
+ }
112
+ export type ParticipantEventCallbacks = {
113
+ trackPublished: (publication: RemoteTrackPublication) => void;
114
+ trackSubscribed: (track: RemoteTrack, publication: RemoteTrackPublication) => void;
115
+ trackSubscriptionFailed: (trackSid: string, reason?: SubscriptionError) => void;
116
+ trackUnpublished: (publication: RemoteTrackPublication) => void;
117
+ trackUnsubscribed: (track: RemoteTrack, publication: RemoteTrackPublication) => void;
118
+ trackMuted: (publication: TrackPublication) => void;
119
+ trackUnmuted: (publication: TrackPublication) => void;
120
+ localTrackPublished: (publication: LocalTrackPublication) => void;
121
+ localTrackUnpublished: (publication: LocalTrackPublication) => void;
122
+ localTrackCpuConstrained: (track: LocalVideoTrack, publication: LocalTrackPublication) => void;
123
+ localSenderCreated: (sender: RTCRtpSender, track: Track) => void;
124
+ participantMetadataChanged: (prevMetadata: string | undefined, participant?: any) => void;
125
+ participantNameChanged: (name: string) => void;
126
+ dataReceived: (payload: NonSharedUint8Array, kind: DataPacket_Kind, encryptionType?: Encryption_Type) => void;
127
+ sipDTMFReceived: (dtmf: SipDTMF) => void;
128
+ transcriptionReceived: (transcription: TranscriptionSegment[], publication?: TrackPublication) => void;
129
+ isSpeakingChanged: (speaking: boolean) => void;
130
+ connectionQualityChanged: (connectionQuality: ConnectionQuality) => void;
131
+ trackStreamStateChanged: (publication: RemoteTrackPublication, streamState: Track.StreamState) => void;
132
+ trackSubscriptionPermissionChanged: (publication: RemoteTrackPublication, status: TrackPublication.PermissionStatus) => void;
133
+ mediaDevicesError: (error: Error, kind?: MediaDeviceKind) => void;
134
+ audioStreamAcquired: () => void;
135
+ participantPermissionsChanged: (prevPermissions?: ParticipantPermission) => void;
136
+ trackSubscriptionStatusChanged: (publication: RemoteTrackPublication, status: TrackPublication.SubscriptionStatus) => void;
137
+ attributesChanged: (changedAttributes: Record<string, string>) => void;
138
+ localTrackSubscribed: (trackPublication: LocalTrackPublication) => void;
139
+ chatMessage: (msg: ChatMessage) => void;
140
+ active: () => void;
141
+ };
142
+ //# sourceMappingURL=Participant.d.ts.map
@@ -1,26 +1,26 @@
1
- import { TrackPermission } from '@livekit/protocol';
2
- export interface ParticipantTrackPermission {
3
- /**
4
- * The participant identity this permission applies to.
5
- * You can either provide this or `participantSid`
6
- */
7
- participantIdentity?: string;
8
- /**
9
- * The participant server id this permission applies to.
10
- * You can either provide this or `participantIdentity`
11
- */
12
- participantSid?: string;
13
- /**
14
- * Grant permission to all all tracks. Takes precedence over allowedTrackSids.
15
- * false if unset.
16
- */
17
- allowAll?: boolean;
18
- /**
19
- * The list of track ids that the target participant can subscribe to.
20
- * When unset, it'll allow all tracks to be subscribed by the participant.
21
- * When empty, this participant is disallowed from subscribing to any tracks.
22
- */
23
- allowedTrackSids?: string[];
24
- }
25
- export declare function trackPermissionToProto(perms: ParticipantTrackPermission): TrackPermission;
26
- //# sourceMappingURL=ParticipantTrackPermission.d.ts.map
1
+ import { TrackPermission } from '@livekit/protocol';
2
+ export interface ParticipantTrackPermission {
3
+ /**
4
+ * The participant identity this permission applies to.
5
+ * You can either provide this or `participantSid`
6
+ */
7
+ participantIdentity?: string;
8
+ /**
9
+ * The participant server id this permission applies to.
10
+ * You can either provide this or `participantIdentity`
11
+ */
12
+ participantSid?: string;
13
+ /**
14
+ * Grant permission to all all tracks. Takes precedence over allowedTrackSids.
15
+ * false if unset.
16
+ */
17
+ allowAll?: boolean;
18
+ /**
19
+ * The list of track ids that the target participant can subscribe to.
20
+ * When unset, it'll allow all tracks to be subscribed by the participant.
21
+ * When empty, this participant is disallowed from subscribing to any tracks.
22
+ */
23
+ allowedTrackSids?: string[];
24
+ }
25
+ export declare function trackPermissionToProto(perms: ParticipantTrackPermission): TrackPermission;
26
+ //# sourceMappingURL=ParticipantTrackPermission.d.ts.map
@@ -1,86 +1,85 @@
1
- import type { ParticipantInfo } from '@livekit/protocol';
2
- import { ClientInfo_Capability } from '@livekit/protocol';
3
- import type { SignalClient } from '../../api/SignalClient';
4
- import { DeferrableMap } from '../../utils/deferrable-map';
5
- import RemoteDataTrack from '../data-track/RemoteDataTrack';
6
- import type IncomingDataTrackManager from '../data-track/incoming/IncomingDataTrackManager';
7
- import RemoteTrackPublication from '../track/RemoteTrackPublication';
8
- import { Track } from '../track/Track';
9
- import type { AudioOutputOptions } from '../track/options';
10
- import type { AdaptiveStreamSettings } from '../track/types';
11
- import type { LoggerOptions } from '../types';
12
- import Participant, { ParticipantKind } from './Participant';
13
- import type { ParticipantEventCallbacks } from './Participant';
14
- export default class RemoteParticipant extends Participant {
15
- audioTrackPublications: Map<string, RemoteTrackPublication>;
16
- videoTrackPublications: Map<string, RemoteTrackPublication>;
17
- trackPublications: Map<string, RemoteTrackPublication>;
18
- /** A map of data track name to the corresponding {@link RemoteDataTrack}.
19
- * @example
20
- * // An already existing data track:
21
- * const track = remoteParticipant.dataTracks.get("data track name");
22
- * // Wait for a data track which will be published soon:
23
- * const track = await remoteParticipant.dataTracks.getDeferred("data track name"); */
24
- dataTracks: DeferrableMap<RemoteDataTrack['info']['name'], RemoteDataTrack>;
25
- signalClient: SignalClient;
26
- /** A version number indicating the set of features that the report participant's client supports.
27
- * @internal
28
- **/
29
- clientProtocol: number;
30
- /** The client capabilities the remote participant advertises (e.g. deflate-raw compression
31
- * support). Used to decide which peer-to-peer features can be used when sending to them.
32
- *
33
- * Differs from clientProtocol in that these are truely optional "additions" which can be used
34
- * or not depending on client specific attributes rather than protocol level invariants.
35
- *
36
- * @internal
37
- **/
38
- capabilities: Array<ClientInfo_Capability>;
39
- private volumeMap;
40
- private audioOutput?;
41
- /** @internal */
42
- static fromParticipantInfo(signalClient: SignalClient, pi: ParticipantInfo, loggerOptions: LoggerOptions, manager: IncomingDataTrackManager): RemoteParticipant;
43
- protected get logContext(): {
44
- remoteParticipantID: string;
45
- remoteParticipant: string;
46
- };
47
- /** @internal */
48
- constructor(signalClient: SignalClient, sid: string, identity?: string, name?: string, metadata?: string, attributes?: Record<string, string>, loggerOptions?: LoggerOptions, kind?: ParticipantKind, remoteDataTracks?: Array<RemoteDataTrack>, clientProtocol?: number, capabilities?: Array<ClientInfo_Capability>);
49
- protected addTrackPublication(publication: RemoteTrackPublication): void;
50
- getTrackPublication(source: Track.Source): RemoteTrackPublication | undefined;
51
- getTrackPublicationByName(name: string): RemoteTrackPublication | undefined;
52
- /**
53
- * sets the volume on the participant's audio track
54
- * by default, this affects the microphone publication
55
- * a different source can be passed in as a second argument
56
- * if no track exists the volume will be applied when the microphone track is added
57
- */
58
- setVolume(volume: number, source?: Track.Source.Microphone | Track.Source.ScreenShareAudio): void;
59
- /**
60
- * gets the volume on the participant's microphone track
61
- */
62
- getVolume(source?: Track.Source.Microphone | Track.Source.ScreenShareAudio): number | undefined;
63
- /** @internal */
64
- addSubscribedMediaTrack(mediaTrack: MediaStreamTrack, sid: Track.SID, mediaStream: MediaStream, receiver: RTCRtpReceiver, adaptiveStreamSettings?: AdaptiveStreamSettings, triesLeft?: number): RemoteTrackPublication | undefined;
65
- /** @internal */
66
- get hasMetadata(): boolean;
67
- /**
68
- * @internal
69
- */
70
- getTrackPublicationBySid(sid: Track.SID): RemoteTrackPublication | undefined;
71
- /** @internal */
72
- updateInfo(info: ParticipantInfo): boolean;
73
- /** @internal */
74
- unpublishTrack(sid: Track.SID, sendUnpublish?: boolean): void;
75
- /**
76
- * @internal
77
- */
78
- setAudioOutput(output: AudioOutputOptions): Promise<void>;
79
- /** @internal */
80
- addRemoteDataTrack(remoteDataTrack: RemoteDataTrack): void;
81
- /** @internal */
82
- removeRemoteDataTrack(remoteDataTrackSid: RemoteDataTrack['info']['sid']): void;
83
- /** @internal */
84
- emit<E extends keyof ParticipantEventCallbacks>(event: E, ...args: Parameters<ParticipantEventCallbacks[E]>): boolean;
85
- }
86
- //# sourceMappingURL=RemoteParticipant.d.ts.map
1
+ import type { ParticipantInfo } from '@livekit/protocol';
2
+ import { ClientInfo_Capability } from '@livekit/protocol';
3
+ import type { SignalClient } from '../../api/SignalClient';
4
+ import { DeferrableMap } from '../../utils/deferrable-map';
5
+ import RemoteDataTrack from '../data-track/RemoteDataTrack';
6
+ import type IncomingDataTrackManager from '../data-track/incoming/IncomingDataTrackManager';
7
+ import RemoteTrackPublication from '../track/RemoteTrackPublication';
8
+ import { Track } from '../track/Track';
9
+ import type { AudioOutputOptions } from '../track/options';
10
+ import type { AdaptiveStreamSettings } from '../track/types';
11
+ import type { LoggerOptions } from '../types';
12
+ import Participant, { ParticipantKind } from './Participant';
13
+ import type { ParticipantEventCallbacks } from './Participant';
14
+ export default class RemoteParticipant extends Participant {
15
+ audioTrackPublications: Map<string, RemoteTrackPublication>;
16
+ videoTrackPublications: Map<string, RemoteTrackPublication>;
17
+ trackPublications: Map<string, RemoteTrackPublication>;
18
+ /** A map of data track name to the corresponding {@link RemoteDataTrack}.
19
+ * @example
20
+ * // An already existing data track:
21
+ * const track = remoteParticipant.dataTracks.get("data track name");
22
+ * // Wait for a data track which will be published soon:
23
+ * const track = await remoteParticipant.dataTracks.getDeferred("data track name"); */
24
+ dataTracks: DeferrableMap<RemoteDataTrack['info']['name'], RemoteDataTrack>;
25
+ signalClient: SignalClient;
26
+ /** A version number indicating the set of features that the report participant's client supports.
27
+ * @internal
28
+ **/
29
+ clientProtocol: number;
30
+ /** The client capabilities the remote participant advertises (e.g. deflate-raw compression
31
+ * support). Used to decide which peer-to-peer features can be used when sending to them.
32
+ *
33
+ * Differs from clientProtocol in that these are truely optional "additions" which can be used
34
+ * or not depending on client specific attributes rather than protocol level invariants.
35
+ *
36
+ * @internal
37
+ **/
38
+ capabilities: Array<ClientInfo_Capability>;
39
+ private volumeMap;
40
+ private audioOutput?;
41
+ /** @internal */
42
+ static fromParticipantInfo(signalClient: SignalClient, pi: ParticipantInfo, loggerOptions: LoggerOptions, manager: IncomingDataTrackManager): RemoteParticipant;
43
+ protected get logContext(): {
44
+ remoteParticipantID: string;
45
+ remoteParticipant: string;
46
+ };
47
+ /** @internal */
48
+ constructor(signalClient: SignalClient, sid: string, identity?: string, name?: string, metadata?: string, attributes?: Record<string, string>, loggerOptions?: LoggerOptions, kind?: ParticipantKind, remoteDataTracks?: Array<RemoteDataTrack>, clientProtocol?: number, capabilities?: Array<ClientInfo_Capability>);
49
+ protected addTrackPublication(publication: RemoteTrackPublication): void;
50
+ getTrackPublication(source: Track.Source): RemoteTrackPublication | undefined;
51
+ getTrackPublicationByName(name: string): RemoteTrackPublication | undefined;
52
+ /**
53
+ * sets the volume on the participant's audio track
54
+ * by default, this affects the microphone publication
55
+ * a different source can be passed in as a second argument
56
+ * if no track exists the volume will be applied when the microphone track is added
57
+ */
58
+ setVolume(volume: number, source?: Track.Source.Microphone | Track.Source.ScreenShareAudio): void;
59
+ /**
60
+ * gets the volume on the participant's microphone track
61
+ */
62
+ getVolume(source?: Track.Source.Microphone | Track.Source.ScreenShareAudio): number | undefined;
63
+ /** @internal */
64
+ addSubscribedMediaTrack(mediaTrack: MediaStreamTrack, sid: Track.SID, mediaStream: MediaStream, receiver: RTCRtpReceiver, adaptiveStreamSettings?: AdaptiveStreamSettings, triesLeft?: number): RemoteTrackPublication | undefined;
65
+ get hasMetadata(): boolean;
66
+ /**
67
+ * @internal
68
+ */
69
+ getTrackPublicationBySid(sid: Track.SID): RemoteTrackPublication | undefined;
70
+ /** @internal */
71
+ updateInfo(info: ParticipantInfo): boolean;
72
+ /** @internal */
73
+ unpublishTrack(sid: Track.SID, sendUnpublish?: boolean): void;
74
+ /**
75
+ * @internal
76
+ */
77
+ setAudioOutput(output: AudioOutputOptions): Promise<void>;
78
+ /** @internal */
79
+ addRemoteDataTrack(remoteDataTrack: RemoteDataTrack): void;
80
+ /** @internal */
81
+ removeRemoteDataTrack(remoteDataTrackSid: RemoteDataTrack['info']['sid']): void;
82
+ /** @internal */
83
+ emit<E extends keyof ParticipantEventCallbacks>(event: E, ...args: Parameters<ParticipantEventCallbacks[E]>): boolean;
84
+ }
85
+ //# sourceMappingURL=RemoteParticipant.d.ts.map
@@ -1,53 +1,53 @@
1
- import LocalAudioTrack from '../track/LocalAudioTrack';
2
- import LocalVideoTrack from '../track/LocalVideoTrack';
3
- import type { BackupVideoCodec, TrackPublishOptions, VideoCodec, VideoEncoding } from '../track/options';
4
- import { VideoPreset } from '../track/options';
5
- import type { LoggerOptions } from '../types';
6
- /** @internal */
7
- export declare function mediaTrackToLocalTrack(mediaStreamTrack: MediaStreamTrack, constraints?: MediaTrackConstraints, loggerOptions?: LoggerOptions): LocalVideoTrack | LocalAudioTrack;
8
- export declare const presets169: VideoPreset[];
9
- export declare const presets43: VideoPreset[];
10
- export declare const presetsScreenShare: VideoPreset[];
11
- export declare const defaultSimulcastPresets169: VideoPreset[];
12
- export declare const defaultSimulcastPresets43: VideoPreset[];
13
- export declare const computeDefaultScreenShareSimulcastPresets: (fromPreset: VideoPreset) => VideoPreset[];
14
- export declare function computeVideoEncodings(isScreenShare: boolean, width?: number, height?: number, options?: TrackPublishOptions): RTCRtpEncodingParameters[];
15
- /**
16
- * Bitrate to hint to the bandwidth estimator through `x-google-start-bitrate`, so that
17
- * a publish does not spend its first seconds ramping up from a very low rate.
18
- *
19
- * It has to be the total the encoder will put on the wire, which means picking the
20
- * encoding that carries the inclusive bitrate:
21
- * - SVC publishes a single stream with the layers built in. `encodings[0]` holds the
22
- * full bitrate — the legacy SVC shape orders its encodings `f`..`q`, so that holds
23
- * for both SVC shapes.
24
- * - Simulcast publishes independent streams ordered `q`..`f`, so the total is the sum.
25
- * This includes VP9/AV1 published as rid based simulcast, where `encodings[0]` is
26
- * the *smallest* layer even though the codec is SVC capable.
27
- *
28
- * @internal
29
- */
30
- export declare function computeStartTargetBitrate(codec: string, options: TrackPublishOptions | undefined, encodings: RTCRtpEncodingParameters[]): number;
31
- export declare function computeTrackBackupEncodings(track: LocalVideoTrack, videoCodec: BackupVideoCodec, opts: TrackPublishOptions): RTCRtpEncodingParameters[] | undefined;
32
- export declare function determineAppropriateEncoding(isScreenShare: boolean, width: number, height: number, codec?: VideoCodec): VideoEncoding;
33
- export declare function presetsForResolution(isScreenShare: boolean, width: number, height: number): VideoPreset[];
34
- export declare function defaultSimulcastLayers(isScreenShare: boolean, original: VideoPreset): VideoPreset[];
35
- /** @internal */
36
- export declare function sortPresets(presets: Array<VideoPreset> | undefined): VideoPreset[] | undefined;
37
- /** @internal */
38
- export declare class ScalabilityMode {
39
- spatial: number;
40
- temporal: number;
41
- suffix: undefined | 'h' | '_KEY' | '_KEY_SHIFT';
42
- constructor(scalabilityMode: string);
43
- toString(): string;
44
- }
45
- /**
46
- * Returns the appropriate degradation preference for a video track based on its source.
47
- *
48
- * - Camera: 'maintain-framerate' (smoother video for real-time communication)
49
- * - Screen share: 'maintain-resolution' (clarity is critical for reading text/UI)
50
- * - Other/unknown: 'balanced'
51
- */
52
- export declare function getDefaultDegradationPreference(track: LocalVideoTrack): RTCDegradationPreference;
53
- //# sourceMappingURL=publishUtils.d.ts.map
1
+ import LocalAudioTrack from '../track/LocalAudioTrack';
2
+ import LocalVideoTrack from '../track/LocalVideoTrack';
3
+ import type { BackupVideoCodec, TrackPublishOptions, VideoCodec, VideoEncoding } from '../track/options';
4
+ import { VideoPreset } from '../track/options';
5
+ import type { LoggerOptions } from '../types';
6
+ /** @internal */
7
+ export declare function mediaTrackToLocalTrack(mediaStreamTrack: MediaStreamTrack, constraints?: MediaTrackConstraints, loggerOptions?: LoggerOptions): LocalVideoTrack | LocalAudioTrack;
8
+ export declare const presets169: VideoPreset[];
9
+ export declare const presets43: VideoPreset[];
10
+ export declare const presetsScreenShare: VideoPreset[];
11
+ export declare const defaultSimulcastPresets169: VideoPreset[];
12
+ export declare const defaultSimulcastPresets43: VideoPreset[];
13
+ export declare const computeDefaultScreenShareSimulcastPresets: (fromPreset: VideoPreset) => VideoPreset[];
14
+ export declare function computeVideoEncodings(isScreenShare: boolean, width?: number, height?: number, options?: TrackPublishOptions): RTCRtpEncodingParameters[];
15
+ /**
16
+ * Bitrate to hint to the bandwidth estimator through `x-google-start-bitrate`, so that
17
+ * a publish does not spend its first seconds ramping up from a very low rate.
18
+ *
19
+ * It has to be the total the encoder will put on the wire, which means picking the
20
+ * encoding that carries the inclusive bitrate:
21
+ * - SVC publishes a single stream with the layers built in. `encodings[0]` holds the
22
+ * full bitrate — the legacy SVC shape orders its encodings `f`..`q`, so that holds
23
+ * for both SVC shapes.
24
+ * - Simulcast publishes independent streams ordered `q`..`f`, so the total is the sum.
25
+ * This includes VP9/AV1 published as rid based simulcast, where `encodings[0]` is
26
+ * the *smallest* layer even though the codec is SVC capable.
27
+ *
28
+ * @internal
29
+ */
30
+ export declare function computeStartTargetBitrate(codec: string, options: TrackPublishOptions | undefined, encodings: RTCRtpEncodingParameters[]): number;
31
+ export declare function computeTrackBackupEncodings(track: LocalVideoTrack, videoCodec: BackupVideoCodec, opts: TrackPublishOptions): RTCRtpEncodingParameters[] | undefined;
32
+ export declare function determineAppropriateEncoding(isScreenShare: boolean, width: number, height: number, codec?: VideoCodec): VideoEncoding;
33
+ export declare function presetsForResolution(isScreenShare: boolean, width: number, height: number): VideoPreset[];
34
+ export declare function defaultSimulcastLayers(isScreenShare: boolean, original: VideoPreset): VideoPreset[];
35
+ /** @internal */
36
+ export declare function sortPresets(presets: Array<VideoPreset> | undefined): VideoPreset[] | undefined;
37
+ /** @internal */
38
+ export declare class ScalabilityMode {
39
+ spatial: number;
40
+ temporal: number;
41
+ suffix: undefined | 'h' | '_KEY' | '_KEY_SHIFT';
42
+ constructor(scalabilityMode: string);
43
+ toString(): string;
44
+ }
45
+ /**
46
+ * Returns the appropriate degradation preference for a video track based on its source.
47
+ *
48
+ * - Camera: 'maintain-framerate' (smoother video for real-time communication)
49
+ * - Screen share: 'maintain-resolution' (clarity is critical for reading text/UI)
50
+ * - Other/unknown: 'balanced'
51
+ */
52
+ export declare function getDefaultDegradationPreference(track: LocalVideoTrack): RTCDegradationPreference;
53
+ //# sourceMappingURL=publishUtils.d.ts.map