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,8 +1,8 @@
1
- import type { ReconnectContext, ReconnectPolicy } from './ReconnectPolicy';
2
- declare class DefaultReconnectPolicy implements ReconnectPolicy {
3
- private readonly _retryDelays;
4
- constructor(retryDelays?: number[]);
5
- nextRetryDelayInMs(context: ReconnectContext): number | null;
6
- }
7
- export default DefaultReconnectPolicy;
1
+ import type { ReconnectContext, ReconnectPolicy } from './ReconnectPolicy';
2
+ declare class DefaultReconnectPolicy implements ReconnectPolicy {
3
+ private readonly _retryDelays;
4
+ constructor(retryDelays?: number[]);
5
+ nextRetryDelayInMs(context: ReconnectContext): number | null;
6
+ }
7
+ export default DefaultReconnectPolicy;
8
8
  //# sourceMappingURL=DefaultReconnectPolicy.d.ts.map
@@ -1,9 +1,9 @@
1
- export default class DeviceManager {
2
- private static instance?;
3
- static mediaDeviceKinds: MediaDeviceKind[];
4
- static getInstance(): DeviceManager;
5
- static userMediaPromiseMap: Map<MediaDeviceKind, Promise<MediaStream>>;
6
- getDevices(kind?: MediaDeviceKind, requestPermissions?: boolean): Promise<MediaDeviceInfo[]>;
7
- normalizeDeviceId(kind: MediaDeviceKind, deviceId?: string, groupId?: string): Promise<string | undefined>;
8
- }
1
+ export default class DeviceManager {
2
+ private static instance?;
3
+ static mediaDeviceKinds: MediaDeviceKind[];
4
+ static getInstance(): DeviceManager;
5
+ static userMediaPromiseMap: Map<MediaDeviceKind, Promise<MediaStream>>;
6
+ getDevices(kind?: MediaDeviceKind, requestPermissions?: boolean): Promise<MediaDeviceInfo[]>;
7
+ normalizeDeviceId(kind: MediaDeviceKind, deviceId?: string, groupId?: string): Promise<string | undefined>;
8
+ }
9
9
  //# sourceMappingURL=DeviceManager.d.ts.map
@@ -1,38 +1,38 @@
1
- /// <reference types="node" />
2
- import EventEmitter from 'events';
3
- /** @internal */
4
- interface TrackBitrateInfo {
5
- sid: string;
6
- codec: string;
7
- maxbr: number;
8
- }
9
- export declare const PCEvents: {
10
- readonly NegotiationStarted: "negotiationStarted";
11
- readonly NegotiationComplete: "negotiationComplete";
12
- };
13
- /** @internal */
14
- export default class PCTransport extends EventEmitter {
15
- pc: RTCPeerConnection;
16
- pendingCandidates: RTCIceCandidateInit[];
17
- restartingIce: boolean;
18
- renegotiate: boolean;
19
- trackBitrates: TrackBitrateInfo[];
20
- remoteStereoMids: string[];
21
- remoteNackMids: string[];
22
- onOffer?: (offer: RTCSessionDescriptionInit) => void;
23
- constructor(config?: RTCConfiguration);
24
- get isICEConnected(): boolean;
25
- addIceCandidate(candidate: RTCIceCandidateInit): Promise<void>;
26
- setRemoteDescription(sd: RTCSessionDescriptionInit): Promise<void>;
27
- negotiate: {
28
- (this: unknown, ...args: [onError?: ((e: Error) => void) | undefined] & any[]): Promise<void>;
29
- cancel: (reason?: any) => void;
30
- };
31
- createAndSendOffer(options?: RTCOfferOptions): Promise<void>;
32
- createAndSetAnswer(): Promise<RTCSessionDescriptionInit>;
33
- setTrackCodecBitrate(sid: string, codec: string, maxbr: number): void;
34
- close(): void;
35
- private setMungedLocalDescription;
36
- }
37
- export {};
1
+ /// <reference types="node" />
2
+ import EventEmitter from 'events';
3
+ /** @internal */
4
+ interface TrackBitrateInfo {
5
+ sid: string;
6
+ codec: string;
7
+ maxbr: number;
8
+ }
9
+ export declare const PCEvents: {
10
+ readonly NegotiationStarted: "negotiationStarted";
11
+ readonly NegotiationComplete: "negotiationComplete";
12
+ };
13
+ /** @internal */
14
+ export default class PCTransport extends EventEmitter {
15
+ pc: RTCPeerConnection;
16
+ pendingCandidates: RTCIceCandidateInit[];
17
+ restartingIce: boolean;
18
+ renegotiate: boolean;
19
+ trackBitrates: TrackBitrateInfo[];
20
+ remoteStereoMids: string[];
21
+ remoteNackMids: string[];
22
+ onOffer?: (offer: RTCSessionDescriptionInit) => void;
23
+ constructor(config?: RTCConfiguration, mediaConstraints?: Record<string, unknown>);
24
+ get isICEConnected(): boolean;
25
+ addIceCandidate(candidate: RTCIceCandidateInit): Promise<void>;
26
+ setRemoteDescription(sd: RTCSessionDescriptionInit): Promise<void>;
27
+ negotiate: {
28
+ (this: unknown, ...args: [onError?: ((e: Error) => void) | undefined] & any[]): Promise<void>;
29
+ cancel: (reason?: any) => void;
30
+ };
31
+ createAndSendOffer(options?: RTCOfferOptions): Promise<void>;
32
+ createAndSetAnswer(): Promise<RTCSessionDescriptionInit>;
33
+ setTrackCodecBitrate(sid: string, codec: string, maxbr: number): void;
34
+ close(): void;
35
+ private setMungedLocalDescription;
36
+ }
37
+ export {};
38
38
  //# sourceMappingURL=PCTransport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PCTransport.d.ts","sourceRoot":"","sources":["../../../src/room/PCTransport.ts"],"names":[],"mappings":";AAAA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAOlC,gBAAgB;AAChB,UAAU,gBAAgB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,QAAQ;;;CAGX,CAAC;AAEX,gBAAgB;AAChB,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,YAAY;IACnD,EAAE,EAAE,iBAAiB,CAAC;IAEtB,iBAAiB,EAAE,mBAAmB,EAAE,CAAM;IAE9C,aAAa,EAAE,OAAO,CAAS;IAE/B,WAAW,EAAE,OAAO,CAAS;IAE7B,aAAa,EAAE,gBAAgB,EAAE,CAAM;IAEvC,gBAAgB,EAAE,MAAM,EAAE,CAAM;IAEhC,cAAc,EAAE,MAAM,EAAE,CAAM;IAE9B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAC;gBAEzC,MAAM,CAA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AQrF,IAAI,cAAc,IAAI,OAAO,CAE5B;IAEK,eAAe,CAAC,SAAS,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAO9D,oBAAoB,CAAC,EAAE,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBxE,SAAS;iDAA2B,KAAK,KAAK,IAAI;;MAW1C;IAEF,kBAAkB,CAAC,OAAO,CAAC,EAAE,eAAe;IAwF5C,kBAAkB,IAAI,OAAO,CAAC,yBAAyB,CAAC;IAY9D,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAQ9D,KAAK;YAMS,yBAAyB;CA4BxC"}
@@ -1,121 +1,127 @@
1
- import type TypedEventEmitter from 'typed-emitter';
2
- import { SignalClient, SignalOptions } from '../api/SignalClient';
3
- import type { InternalRoomOptions } from '../options';
4
- import { DataPacket, DataPacket_Kind, DisconnectReason, SpeakerInfo, TrackInfo, UserPacket } from '../proto/livekit_models';
5
- import { AddTrackRequest, JoinResponse } from '../proto/livekit_rtc';
6
- import PCTransport from './PCTransport';
7
- import type LocalTrack from './track/LocalTrack';
8
- import type LocalVideoTrack from './track/LocalVideoTrack';
9
- import type { SimulcastTrackInfo } from './track/LocalVideoTrack';
10
- import type { TrackPublishOptions } from './track/options';
11
- declare const RTCEngine_base: new () => TypedEventEmitter<EngineEventCallbacks>;
12
- /** @internal */
13
- export default class RTCEngine extends RTCEngine_base {
14
- private options;
15
- publisher?: PCTransport;
16
- subscriber?: PCTransport;
17
- client: SignalClient;
18
- rtcConfig: RTCConfiguration;
19
- peerConnectionTimeout: number;
20
- fullReconnectOnNext: boolean;
21
- get isClosed(): boolean;
22
- private lossyDC?;
23
- private lossyDCSub?;
24
- private reliableDC?;
25
- private dcBufferStatus;
26
- private reliableDCSub?;
27
- private subscriberPrimary;
28
- private primaryPC?;
29
- private pcState;
30
- private _isClosed;
31
- private pendingTrackResolvers;
32
- private hasPublished;
33
- private url?;
34
- private token?;
35
- private signalOpts?;
36
- private reconnectAttempts;
37
- private reconnectStart;
38
- private clientConfiguration?;
39
- private attemptingReconnect;
40
- private reconnectPolicy;
41
- private reconnectTimeout?;
42
- private participantSid?;
43
- /** keeps track of how often an initial join connection has been tried */
44
- private joinAttempts;
45
- /** specifies how often an initial join connection is allowed to retry */
46
- private maxJoinAttempts;
47
- private closingLock;
48
- private dataProcessLock;
49
- private shouldFailNext;
50
- private regionUrlProvider?;
51
- constructor(options: InternalRoomOptions);
52
- join(url: string, token: string, opts: SignalOptions, abortSignal?: AbortSignal): Promise<JoinResponse>;
53
- close(): Promise<void>;
54
- addTrack(req: AddTrackRequest): Promise<TrackInfo>;
55
- /**
56
- * Removes sender from PeerConnection, returning true if it was removed successfully
57
- * and a negotiation is necessary
58
- * @param sender
59
- * @returns
60
- */
61
- removeTrack(sender: RTCRtpSender): boolean;
62
- updateMuteStatus(trackSid: string, muted: boolean): void;
63
- get dataSubscriberReadyState(): string | undefined;
64
- getConnectedServerAddress(): Promise<string | undefined>;
65
- private configure;
66
- private makeRTCConfiguration;
67
- private createDataChannels;
68
- private handleDataChannel;
69
- private handleDataMessage;
70
- private handleDataError;
71
- private handleBufferedAmountLow;
72
- private setPreferredCodec;
73
- createSender(track: LocalTrack, opts: TrackPublishOptions, encodings?: RTCRtpEncodingParameters[]): Promise<RTCRtpSender>;
74
- createSimulcastSender(track: LocalVideoTrack, simulcastTrack: SimulcastTrackInfo, opts: TrackPublishOptions, encodings?: RTCRtpEncodingParameters[]): Promise<RTCRtpSender | undefined>;
75
- private createTransceiverRTCRtpSender;
76
- private createSimulcastTransceiverSender;
77
- private createRTCRtpSender;
78
- private handleDisconnect;
79
- private attemptReconnect;
80
- private getNextRetryDelay;
81
- private restartConnection;
82
- private resumeConnection;
83
- waitForPCInitialConnection(timeout?: number, abortController?: AbortController): Promise<void>;
84
- private waitForPCReconnected;
85
- waitForRestarted: () => Promise<void>;
86
- sendDataPacket(packet: DataPacket, kind: DataPacket_Kind): Promise<void>;
87
- private updateAndEmitDCBufferStatus;
88
- private isBufferStatusLow;
89
- /**
90
- * @internal
91
- */
92
- ensureDataTransportConnected(kind: DataPacket_Kind, subscriber?: boolean): Promise<void>;
93
- private ensurePublisherConnected;
94
- /** @internal */
95
- negotiate(): Promise<void>;
96
- dataChannelForKind(kind: DataPacket_Kind, sub?: boolean): RTCDataChannel | undefined;
97
- failNext(): void;
98
- private clearReconnectTimeout;
99
- private clearPendingReconnect;
100
- private handleBrowserOnLine;
101
- private registerOnLineListener;
102
- private deregisterOnLineListener;
103
- }
104
- export type EngineEventCallbacks = {
105
- connected: (joinResp: JoinResponse) => void;
106
- disconnected: (reason?: DisconnectReason) => void;
107
- resuming: () => void;
108
- resumed: () => void;
109
- restarting: () => void;
110
- restarted: () => void;
111
- signalResumed: () => void;
112
- signalRestarted: (joinResp: JoinResponse) => void;
113
- closing: () => void;
114
- mediaTrackAdded: (track: MediaStreamTrack, streams: MediaStream, receiver?: RTCRtpReceiver) => void;
115
- activeSpeakersUpdate: (speakers: Array<SpeakerInfo>) => void;
116
- dataPacketReceived: (userPacket: UserPacket, kind: DataPacket_Kind) => void;
117
- transportsCreated: (publisher: PCTransport, subscriber: PCTransport) => void;
118
- dcBufferStatusChanged: (isLow: boolean, kind: DataPacket_Kind) => void;
119
- };
120
- export {};
1
+ import type TypedEventEmitter from 'typed-emitter';
2
+ import { SignalClient } from '../api/SignalClient';
3
+ import type { SignalOptions } from '../api/SignalClient';
4
+ import type { InternalRoomOptions } from '../options';
5
+ import { DataPacket, DataPacket_Kind, DisconnectReason, SpeakerInfo, TrackInfo, UserPacket } from '../proto/livekit_models';
6
+ import { AddTrackRequest, JoinResponse } from '../proto/livekit_rtc';
7
+ import PCTransport from './PCTransport';
8
+ import type LocalTrack from './track/LocalTrack';
9
+ import type LocalVideoTrack from './track/LocalVideoTrack';
10
+ import type { SimulcastTrackInfo } from './track/LocalVideoTrack';
11
+ import type { TrackPublishOptions } from './track/options';
12
+ declare const RTCEngine_base: new () => TypedEventEmitter<EngineEventCallbacks>;
13
+ /** @internal */
14
+ export default class RTCEngine extends RTCEngine_base {
15
+ private options;
16
+ publisher?: PCTransport;
17
+ subscriber?: PCTransport;
18
+ client: SignalClient;
19
+ rtcConfig: RTCConfiguration;
20
+ peerConnectionTimeout: number;
21
+ fullReconnectOnNext: boolean;
22
+ /**
23
+ * @internal
24
+ */
25
+ latestJoinResponse?: JoinResponse;
26
+ get isClosed(): boolean;
27
+ private lossyDC?;
28
+ private lossyDCSub?;
29
+ private reliableDC?;
30
+ private dcBufferStatus;
31
+ private reliableDCSub?;
32
+ private subscriberPrimary;
33
+ private primaryPC?;
34
+ private pcState;
35
+ private _isClosed;
36
+ private pendingTrackResolvers;
37
+ private hasPublished;
38
+ private url?;
39
+ private token?;
40
+ private signalOpts?;
41
+ private reconnectAttempts;
42
+ private reconnectStart;
43
+ private clientConfiguration?;
44
+ private attemptingReconnect;
45
+ private reconnectPolicy;
46
+ private reconnectTimeout?;
47
+ private participantSid?;
48
+ /** keeps track of how often an initial join connection has been tried */
49
+ private joinAttempts;
50
+ /** specifies how often an initial join connection is allowed to retry */
51
+ private maxJoinAttempts;
52
+ private closingLock;
53
+ private dataProcessLock;
54
+ private shouldFailNext;
55
+ private regionUrlProvider?;
56
+ constructor(options: InternalRoomOptions);
57
+ join(url: string, token: string, opts: SignalOptions, abortSignal?: AbortSignal): Promise<JoinResponse>;
58
+ close(): Promise<void>;
59
+ addTrack(req: AddTrackRequest): Promise<TrackInfo>;
60
+ /**
61
+ * Removes sender from PeerConnection, returning true if it was removed successfully
62
+ * and a negotiation is necessary
63
+ * @param sender
64
+ * @returns
65
+ */
66
+ removeTrack(sender: RTCRtpSender): boolean;
67
+ updateMuteStatus(trackSid: string, muted: boolean): void;
68
+ get dataSubscriberReadyState(): string | undefined;
69
+ getConnectedServerAddress(): Promise<string | undefined>;
70
+ private configure;
71
+ private makeRTCConfiguration;
72
+ private createDataChannels;
73
+ private handleDataChannel;
74
+ private handleDataMessage;
75
+ private handleDataError;
76
+ private handleBufferedAmountLow;
77
+ private setPreferredCodec;
78
+ createSender(track: LocalTrack, opts: TrackPublishOptions, encodings?: RTCRtpEncodingParameters[]): Promise<RTCRtpSender>;
79
+ createSimulcastSender(track: LocalVideoTrack, simulcastTrack: SimulcastTrackInfo, opts: TrackPublishOptions, encodings?: RTCRtpEncodingParameters[]): Promise<RTCRtpSender | undefined>;
80
+ private createTransceiverRTCRtpSender;
81
+ private createSimulcastTransceiverSender;
82
+ private createRTCRtpSender;
83
+ private handleDisconnect;
84
+ private attemptReconnect;
85
+ private getNextRetryDelay;
86
+ private restartConnection;
87
+ private resumeConnection;
88
+ waitForPCInitialConnection(timeout?: number, abortController?: AbortController): Promise<void>;
89
+ private waitForPCReconnected;
90
+ waitForRestarted: () => Promise<void>;
91
+ sendDataPacket(packet: DataPacket, kind: DataPacket_Kind): Promise<void>;
92
+ private updateAndEmitDCBufferStatus;
93
+ private isBufferStatusLow;
94
+ /**
95
+ * @internal
96
+ */
97
+ ensureDataTransportConnected(kind: DataPacket_Kind, subscriber?: boolean): Promise<void>;
98
+ private ensurePublisherConnected;
99
+ verifyTransport(): boolean;
100
+ /** @internal */
101
+ negotiate(): Promise<void>;
102
+ dataChannelForKind(kind: DataPacket_Kind, sub?: boolean): RTCDataChannel | undefined;
103
+ failNext(): void;
104
+ private clearReconnectTimeout;
105
+ private clearPendingReconnect;
106
+ private handleBrowserOnLine;
107
+ private registerOnLineListener;
108
+ private deregisterOnLineListener;
109
+ }
110
+ export type EngineEventCallbacks = {
111
+ connected: (joinResp: JoinResponse) => void;
112
+ disconnected: (reason?: DisconnectReason) => void;
113
+ resuming: () => void;
114
+ resumed: () => void;
115
+ restarting: () => void;
116
+ restarted: () => void;
117
+ signalResumed: () => void;
118
+ signalRestarted: (joinResp: JoinResponse) => void;
119
+ closing: () => void;
120
+ mediaTrackAdded: (track: MediaStreamTrack, streams: MediaStream, receiver?: RTCRtpReceiver) => void;
121
+ activeSpeakersUpdate: (speakers: Array<SpeakerInfo>) => void;
122
+ dataPacketReceived: (userPacket: UserPacket, kind: DataPacket_Kind) => void;
123
+ transportsCreated: (publisher: PCTransport, subscriber: PCTransport) => void;
124
+ dcBufferStatusChanged: (isLow: boolean, kind: DataPacket_Kind) => void;
125
+ };
126
+ export {};
121
127
  //# sourceMappingURL=RTCEngine.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RTCEngine.d.ts","sourceRoot":"","sources":["../../../src/room/RTCEngine.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,iBAAiB,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAGL,UAAU,EACV,eAAe,EACf,gBAAgB,EAEhB,WAAW,EACX,SAAS,EACT,UAAU,EACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,eAAe,EACf,YAAY,EAKb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,WAAyB,MAAM,eAAe,CAAC;AAatD,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,eAAe,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,KAAK,EAAE,mBAAmB,EAAc,MAAM,iBAAiB,CAAC;wCAyBL,kBAAkB,oBAAoB,CAAC;AADzG,gBAAgB;AAChB,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,cAAmE;IAgF5F,OAAO,CAAC,OAAO;IA/E3B,SAAS,CAAC,EAAE,WAAW,CAAC;IAExB,UAAU,CAAC,EAAE,WAAW,CAAC;IAEzB,MAAM,EAAE,YAAY,CAAC;IAErB,SAAS,EAAE,gBAAgB,CAAM;IAEjC,qBAAqB,EAAE,MAAM,CAAmD;IAEhF,mBAAmB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/** Called after disconnect was detected
4
- *
5
- * @returns {number | null} Amount of time in milliseconds to delay the next reconnect attempt, `null` signals to stop retrying.
6
- */
7
- nextRetryDelayInMs(context: ReconnectContext): number | null;
8
- }
9
- export interface ReconnectContext {
10
- /**
11
- * Number of failed reconnect attempts
12
- */
13
- readonly retryCount: number;
14
- /**
15
- * Elapsed amount of time in milliseconds since the disconnect.
16
- */
17
- readonly elapsedMs: number;
18
- /**
19
- * Reason for retrying
20
- */
21
- readonly retryReason?: Error;
22
- readonly serverUrl?: string;
23
- }
1
+ /** Controls reconnecting of the client */
2
+ export interface ReconnectPolicy {
3
+ /** Called after disconnect was detected
4
+ *
5
+ * @returns {number | null} Amount of time in milliseconds to delay the next reconnect attempt, `null` signals to stop retrying.
6
+ */
7
+ nextRetryDelayInMs(context: ReconnectContext): number | null;
8
+ }
9
+ export interface ReconnectContext {
10
+ /**
11
+ * Number of failed reconnect attempts
12
+ */
13
+ readonly retryCount: number;
14
+ /**
15
+ * Elapsed amount of time in milliseconds since the disconnect.
16
+ */
17
+ readonly elapsedMs: number;
18
+ /**
19
+ * Reason for retrying
20
+ */
21
+ readonly retryReason?: Error;
22
+ readonly serverUrl?: string;
23
+ }
24
24
  //# sourceMappingURL=ReconnectPolicy.d.ts.map
@@ -1,14 +1,14 @@
1
- export declare class RegionUrlProvider {
2
- private serverUrl;
3
- private token;
4
- private regionSettings;
5
- private lastUpdateAt;
6
- private settingsCacheTime;
7
- private attemptedRegions;
8
- constructor(url: string, token: string);
9
- isCloud(): boolean;
10
- getNextBestRegionUrl(abortSignal?: AbortSignal): Promise<string | null>;
11
- resetAttempts(): void;
12
- private fetchRegionSettings;
13
- }
1
+ export declare class RegionUrlProvider {
2
+ private serverUrl;
3
+ private token;
4
+ private regionSettings;
5
+ private lastUpdateAt;
6
+ private settingsCacheTime;
7
+ private attemptedRegions;
8
+ constructor(url: string, token: string);
9
+ isCloud(): boolean;
10
+ getNextBestRegionUrl(abortSignal?: AbortSignal): Promise<string | null>;
11
+ resetAttempts(): void;
12
+ private fetchRegionSettings;
13
+ }
14
14
  //# sourceMappingURL=RegionUrlProvider.d.ts.map