@vkontakte/calls-sdk 2.8.11-dev.a7bd7233.0 → 2.8.11-dev.ad82f51b.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.
- package/CallsSDK.d.ts +2 -9
- package/abstract/BaseApi.d.ts +3 -4
- package/calls-sdk.cjs.js +9 -9
- package/calls-sdk.esm.js +1789 -1120
- package/classes/CallRegistry.d.ts +1 -0
- package/classes/Conversation.d.ts +29 -17
- package/classes/ConversationResponseValidator.d.ts +3 -0
- package/classes/StatsLogger.d.ts +17 -5
- package/classes/codec/WorkerBase.d.ts +2 -0
- package/classes/stat/CallLifecycleStats.d.ts +47 -0
- package/classes/stat/ConversationStats.d.ts +5 -4
- package/classes/stat/FirstMediaSentProbe.d.ts +13 -0
- package/classes/stat/StatFirstMediaReceived.d.ts +2 -1
- package/classes/stat/StatPings.d.ts +1 -2
- package/classes/stat/StatSignalingCommands.d.ts +1 -2
- package/classes/transport/BaseTransport.d.ts +7 -1
- package/classes/transport/DirectTransport.d.ts +6 -1
- package/classes/transport/ServerTransport.d.ts +1 -1
- package/classes/transport/Transport.d.ts +8 -1
- package/default/Api.d.ts +8 -2
- package/default/Signaling.d.ts +29 -45
- package/default/SignalingTransport.d.ts +68 -0
- package/enums/HangupType.d.ts +2 -1
- package/enums/SignalingNotification.d.ts +1 -0
- package/enums/Stat.d.ts +6 -1
- package/package.json +1 -1
- package/static/Params.d.ts +8 -8
- package/static/ParticipantConnectionStatusUtils.d.ts +16 -0
- package/types/Conversation.d.ts +12 -2
- package/types/Participant.d.ts +11 -1
- package/types/PushData.d.ts +3 -0
- package/types/SignalingMessage.d.ts +11 -1
- package/types/WebTransport.d.ts +4 -0
|
@@ -12,6 +12,7 @@ export declare class CallRegistry {
|
|
|
12
12
|
remove(id: string | null): void;
|
|
13
13
|
get(id: string): HoldableConversation | undefined;
|
|
14
14
|
getActive(): HoldableConversation | null;
|
|
15
|
+
getFirst(): HoldableConversation | null;
|
|
15
16
|
getActiveId(): string | null;
|
|
16
17
|
has(id: string): boolean;
|
|
17
18
|
getAll(): HoldableConversation[];
|
|
@@ -12,9 +12,8 @@ import UserType from '../enums/UserType';
|
|
|
12
12
|
import { JSONObject } from '../static/Json';
|
|
13
13
|
import { IAsrStartParams, IAsrStopParams } from '../types/Asr';
|
|
14
14
|
import { AudienceModeHandsResponse } from '../types/AudienceMode';
|
|
15
|
-
import { ConversationData, ConversationOnStartParams } from '../types/Conversation';
|
|
16
|
-
import { ExternalId, ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk
|
|
17
|
-
import type { FastJoinHandler } from '../types/FastJoin';
|
|
15
|
+
import { ConversationData, ConversationOnJoinParams, ConversationOnStartParams } from '../types/Conversation';
|
|
16
|
+
import { ExternalId, ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk } from '../types/ExternalId';
|
|
18
17
|
import MediaModifiers from '../types/MediaModifiers';
|
|
19
18
|
import MediaSettings, { IVideoDimentions } from '../types/MediaSettings';
|
|
20
19
|
import { IAddMovieParams, IUpdateMovieData } from '../types/MovieShare';
|
|
@@ -38,9 +37,12 @@ export default class Conversation extends EventEmitter {
|
|
|
38
37
|
private _myLastRequestedLayouts;
|
|
39
38
|
private _state;
|
|
40
39
|
private _previousState;
|
|
40
|
+
/** Если пользователь в зале ожидания, холд должен вызываться после промоута */
|
|
41
|
+
private _waitingHallHoldPending;
|
|
41
42
|
private _participantState;
|
|
42
43
|
private _participants;
|
|
43
44
|
private _pendingParticipants;
|
|
45
|
+
private _directTransportIsMaster?;
|
|
44
46
|
private _transport;
|
|
45
47
|
private _debugInfo;
|
|
46
48
|
private readonly _debug;
|
|
@@ -80,15 +82,7 @@ export default class Conversation extends EventEmitter {
|
|
|
80
82
|
static getSyncedTime(): number;
|
|
81
83
|
get debugSessionId(): string | null;
|
|
82
84
|
onStart({ opponentIds, opponentType, mediaOptions, payload, joiningAllowed, requireAuthToJoin, onlyAdminCanShareMovie, externalIds, onFastStart, conversationId, }: ConversationOnStartParams): Promise<ConversationData>;
|
|
83
|
-
onJoin(joinArgs:
|
|
84
|
-
conversationId?: string;
|
|
85
|
-
mediaOptions: MediaOption[];
|
|
86
|
-
chatId?: string;
|
|
87
|
-
joinLink?: string;
|
|
88
|
-
observedIds?: ExternalUserId[];
|
|
89
|
-
payload?: string;
|
|
90
|
-
onFastJoin?: FastJoinHandler;
|
|
91
|
-
}): Promise<ConversationData>;
|
|
85
|
+
onJoin(joinArgs: ConversationOnJoinParams): Promise<ConversationData>;
|
|
92
86
|
private _onJoinPart2;
|
|
93
87
|
private _extractExternalRooms;
|
|
94
88
|
private _extractExternalRoomsData;
|
|
@@ -101,7 +95,6 @@ export default class Conversation extends EventEmitter {
|
|
|
101
95
|
private _acceptConcurrent;
|
|
102
96
|
private _getMainRoomParticipants;
|
|
103
97
|
private _decodeExternalConversationParams;
|
|
104
|
-
private _logCallStartEvent;
|
|
105
98
|
accept(mediaOptions: MediaOption[]): Promise<ConversationData>;
|
|
106
99
|
decline(): Promise<void>;
|
|
107
100
|
hangup(): Promise<void>;
|
|
@@ -111,11 +104,12 @@ export default class Conversation extends EventEmitter {
|
|
|
111
104
|
setVolume(volume: number): void;
|
|
112
105
|
updateStatisticsInterval(): void;
|
|
113
106
|
private _openTransport;
|
|
107
|
+
private _allocateParticipantTransport;
|
|
114
108
|
private _close;
|
|
115
109
|
destroy(): Promise<void>;
|
|
116
110
|
private _getConversationParams;
|
|
117
111
|
private _setConversationParams;
|
|
118
|
-
private
|
|
112
|
+
private _buildSignalingEndpoint;
|
|
119
113
|
/**
|
|
120
114
|
* @throws ErrorEvent
|
|
121
115
|
*/
|
|
@@ -142,7 +136,12 @@ export default class Conversation extends EventEmitter {
|
|
|
142
136
|
private _registerParticipants;
|
|
143
137
|
/** Установим состояние локальных мьютов */
|
|
144
138
|
private _registerParticipantLocalMuteState;
|
|
145
|
-
private
|
|
139
|
+
private _remoteParticipantSessionState;
|
|
140
|
+
private _buildConnectionStatus;
|
|
141
|
+
private _isParticipantSessionStateApplicable;
|
|
142
|
+
private _setTransportStatus;
|
|
143
|
+
private _setSessionState;
|
|
144
|
+
private _emitParticipantTransition;
|
|
146
145
|
private _registerParticipantInCache;
|
|
147
146
|
private _getExistedParticipantByIdOrCreate;
|
|
148
147
|
private _getExternalIdByParticipantId;
|
|
@@ -182,6 +181,10 @@ export default class Conversation extends EventEmitter {
|
|
|
182
181
|
private _cleanupParticipants;
|
|
183
182
|
private _cleanupParticipantAgnosticStreams;
|
|
184
183
|
private _cleanupTransport;
|
|
184
|
+
private _finishLifecycle;
|
|
185
|
+
private _getFirstMediaSentCallback;
|
|
186
|
+
private _stopFirstMediaSentProbe;
|
|
187
|
+
private _cleanupTransportForHold;
|
|
185
188
|
private _cleanupSpeakerDetector;
|
|
186
189
|
private _cleanupSpecListener;
|
|
187
190
|
private _cleanupSignaling;
|
|
@@ -210,14 +213,17 @@ export default class Conversation extends EventEmitter {
|
|
|
210
213
|
changePriorities(priorities: ParticipantPriority[]): Promise<void>;
|
|
211
214
|
changeParticipantState(state: ParticipantStateData, compositeUserId?: CompositeUserId): Promise<void>;
|
|
212
215
|
hold(hold: boolean, lastActiveMediaSettings?: MediaSettings): Promise<void>;
|
|
216
|
+
private _holdLocally;
|
|
217
|
+
private _resumeLocalMedia;
|
|
218
|
+
private _restoreStateAfterHold;
|
|
219
|
+
private _isWaitingForPromotion;
|
|
220
|
+
private _getWaitingForPromotionStatus;
|
|
213
221
|
putHandsDown(): Promise<void>;
|
|
214
222
|
requestKeyFrame(participantStreamDescription: ParticipantStreamDescription): Promise<void | SignalingMessage>;
|
|
215
223
|
requestTestMode(consumerCommand: string, producerCommand: string): Promise<void>;
|
|
216
224
|
updateDisplayLayout(layouts: ParticipantLayout[]): Promise<void>;
|
|
217
225
|
requestDisplayLayout(requests: DisplayLayoutRequest[]): Promise<void>;
|
|
218
226
|
feedback(key: string): Promise<SignalingMessage>;
|
|
219
|
-
userFeedbackStats(userResponse: number, reason?: string, groupCallUsersCount?: number): void;
|
|
220
|
-
sendClientEvent(eventType: string, eventData?: Record<string, string | number | boolean>, immediately?: boolean): void;
|
|
221
227
|
private _changeMediaSettings;
|
|
222
228
|
private _stopStreaming;
|
|
223
229
|
/**
|
|
@@ -313,11 +319,17 @@ export default class Conversation extends EventEmitter {
|
|
|
313
319
|
private _changeMultipleParticipantState;
|
|
314
320
|
private _invokeRolesChangedCallbackIfNeeded;
|
|
315
321
|
private _onSignalingNotification;
|
|
322
|
+
private _onSignalingTopologyChanged;
|
|
316
323
|
private _onPromotionApproved;
|
|
317
324
|
private _onSignalingReconnect;
|
|
318
325
|
private _onSignalingFailed;
|
|
319
326
|
private _onAcceptedCall;
|
|
320
327
|
private _onHungup;
|
|
328
|
+
private _onSessionState;
|
|
329
|
+
private _reconcileParticipantSessionStates;
|
|
330
|
+
private _updateParticipantExternalId;
|
|
331
|
+
private _updateParticipantSessionState;
|
|
332
|
+
private _emitParticipantEffectiveStatusIfSessionOverridesTransport;
|
|
321
333
|
private _onAddedParticipant;
|
|
322
334
|
private _onJoinedParticipant;
|
|
323
335
|
private _onClosedConversation;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import ConversationResponse from '../types/ConversationResponse';
|
|
2
|
+
export type ConversationResponseSource = 'startConversation' | 'joinConversation' | 'joinConversationByLink' | 'fastStart' | 'fastJoin';
|
|
3
|
+
export declare function assertValidConversationResponse(response: ConversationResponse | null | undefined, source: ConversationResponseSource): void;
|
package/classes/StatsLogger.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import BaseApi from '../abstract/BaseApi';
|
|
2
2
|
import BaseLogger from '../abstract/BaseLogger';
|
|
3
3
|
import StatLog from '../enums/StatLog';
|
|
4
|
+
import TransportTopology from '../enums/TransportTopology';
|
|
5
|
+
type ClientStatsPayload = Record<string, string | number | boolean | undefined | null>;
|
|
6
|
+
export type LogClientStatsOptions = {
|
|
7
|
+
immediately?: boolean;
|
|
8
|
+
occurredAt?: number;
|
|
9
|
+
conversationId?: string | null;
|
|
10
|
+
deferUntilServerTime?: boolean;
|
|
11
|
+
};
|
|
4
12
|
/**
|
|
5
13
|
* Класс отвечает за отправку различной информации в сервис статистики (события, статистика и подобное)
|
|
6
14
|
*/
|
|
@@ -8,22 +16,26 @@ export default class StatsLogger extends BaseLogger {
|
|
|
8
16
|
private readonly _externalLogger;
|
|
9
17
|
private readonly _api;
|
|
10
18
|
private readonly _conversationIdProvider;
|
|
19
|
+
private readonly _topologyProvider;
|
|
11
20
|
private readonly _batchInterval;
|
|
12
21
|
private _batchedClientStats;
|
|
13
|
-
private _batchedClientEvents;
|
|
14
22
|
private _batchTimeout;
|
|
15
23
|
private _serverTimeDelta;
|
|
16
|
-
|
|
24
|
+
private _waitingForServerTime;
|
|
25
|
+
private _deferredClientStats;
|
|
26
|
+
constructor(api: BaseApi, externalLogger: BaseLogger | null, conversationIdProvider: () => string | null, topologyProvider?: () => TransportTopology | undefined);
|
|
17
27
|
log(name: StatLog, value?: string, immediately?: boolean): void;
|
|
18
|
-
logClientStats(data:
|
|
19
|
-
logClientEvent(data: Record<string, string | number | boolean | undefined | null>, immediately?: boolean): void;
|
|
28
|
+
logClientStats(data: ClientStatsPayload, immediatelyOrOptions?: boolean | LogClientStatsOptions): void;
|
|
20
29
|
destroy(): void;
|
|
30
|
+
private _logClientStats;
|
|
21
31
|
private _getConversationId;
|
|
32
|
+
private _getCallTopology;
|
|
22
33
|
private _sendBatch;
|
|
23
34
|
private _startTimeout;
|
|
24
35
|
private _stopTimeout;
|
|
25
36
|
private _sendClientStats;
|
|
26
|
-
private _sendClientEvents;
|
|
27
37
|
private _calculateServerTimeDelta;
|
|
38
|
+
private _flushDeferredClientStats;
|
|
28
39
|
private _now;
|
|
29
40
|
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import HangupReason from '../HangupReason';
|
|
2
|
+
import StatsLogger from '../StatsLogger';
|
|
3
|
+
export type CallLifecycleSource = 'outgoing' | 'incoming' | 'join' | 'anonym_join';
|
|
4
|
+
export interface CallLifecycleInitializationParams {
|
|
5
|
+
source: CallLifecycleSource;
|
|
6
|
+
conversationId?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface CallLifecycleClock {
|
|
9
|
+
wallNow(): number;
|
|
10
|
+
monotonicNow(): number;
|
|
11
|
+
}
|
|
12
|
+
export declare class CallLifecycleStats {
|
|
13
|
+
private readonly _logger;
|
|
14
|
+
private readonly _clock;
|
|
15
|
+
private _conversationId;
|
|
16
|
+
private _callStartLabel;
|
|
17
|
+
private _lifecycleStartedAtMonotonic;
|
|
18
|
+
private _warmupStartedAtMonotonic;
|
|
19
|
+
private _pendingEvents;
|
|
20
|
+
private _warmupCompleted;
|
|
21
|
+
private _callStarted;
|
|
22
|
+
private _accepted;
|
|
23
|
+
private _firstMediaSent;
|
|
24
|
+
private _finished;
|
|
25
|
+
private _destroyed;
|
|
26
|
+
constructor(logger: StatsLogger, clock?: CallLifecycleClock);
|
|
27
|
+
get firstMediaSentReported(): boolean;
|
|
28
|
+
get terminated(): boolean;
|
|
29
|
+
markInitializationStarted({ source, conversationId }: CallLifecycleInitializationParams): void;
|
|
30
|
+
bindConversationId(conversationId: string): void;
|
|
31
|
+
markWarmupStarted(): void;
|
|
32
|
+
markWarmupCompleted(): void;
|
|
33
|
+
markCallStarted(): void;
|
|
34
|
+
markOutgoingAccepted(): void;
|
|
35
|
+
markIncomingAccepted(concurrent: boolean): void;
|
|
36
|
+
markFirstMediaSent(): void;
|
|
37
|
+
markFinished(reason: HangupReason): void;
|
|
38
|
+
markTerminated(): void;
|
|
39
|
+
destroy(): void;
|
|
40
|
+
private _canRecord;
|
|
41
|
+
private _durationSince;
|
|
42
|
+
private _finish;
|
|
43
|
+
private _ensureConversationId;
|
|
44
|
+
private _record;
|
|
45
|
+
private _flushPendingEvents;
|
|
46
|
+
private _logEvent;
|
|
47
|
+
}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import BaseApi from '../../abstract/BaseApi';
|
|
2
2
|
import BaseLogger from '../../abstract/BaseLogger';
|
|
3
|
+
import TransportTopology from '../../enums/TransportTopology';
|
|
3
4
|
import HangupReason from '../HangupReason';
|
|
4
5
|
import StatsLogger from '../StatsLogger';
|
|
5
|
-
import
|
|
6
|
+
import { CallLifecycleStats } from './CallLifecycleStats';
|
|
6
7
|
import { CodecStatsAggregator } from './CodecStatsAggregator';
|
|
7
8
|
import { StatAggregator } from './StatAggregator';
|
|
8
9
|
import { StatPings } from './StatPings';
|
|
9
10
|
import { StatSignalingCommands } from './StatSignalingCommands';
|
|
10
11
|
export declare class ConversationStats {
|
|
11
12
|
readonly logger: StatsLogger;
|
|
13
|
+
readonly lifecycle: CallLifecycleStats;
|
|
12
14
|
readonly statAggregator: StatAggregator;
|
|
13
15
|
readonly codecStatsAggregator: CodecStatsAggregator;
|
|
14
16
|
readonly pings: StatPings;
|
|
15
17
|
readonly signalingCommands: StatSignalingCommands;
|
|
16
18
|
constructor(api: BaseApi, externalLogger: BaseLogger | null, getConversationId: () => string | null, getTopology: () => TransportTopology | undefined);
|
|
17
|
-
logHangup(reason: HangupReason
|
|
18
|
-
flushCallMetrics(
|
|
19
|
+
logHangup(reason: HangupReason): void;
|
|
20
|
+
flushCallMetrics(): void;
|
|
19
21
|
destroy(): void;
|
|
20
|
-
private static correctHangupReason;
|
|
21
22
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class FirstMediaSentProbe {
|
|
2
|
+
private readonly _peerConnection;
|
|
3
|
+
private readonly _onFirstMediaSent;
|
|
4
|
+
private readonly _pollIntervalMs;
|
|
5
|
+
private _timer;
|
|
6
|
+
private _state;
|
|
7
|
+
constructor(peerConnection: RTCPeerConnection, onFirstMediaSent: () => void, pollIntervalMs?: number);
|
|
8
|
+
start(): void;
|
|
9
|
+
destroy(): void;
|
|
10
|
+
private _getStatsReports;
|
|
11
|
+
private _poll;
|
|
12
|
+
private _scheduleNextPoll;
|
|
13
|
+
}
|
|
@@ -4,6 +4,7 @@ import { StatAggregator } from './StatAggregator';
|
|
|
4
4
|
declare enum ECallType {
|
|
5
5
|
DirectOutgoing = "direct_outgoing",
|
|
6
6
|
DirectIncoming = "direct_incoming",
|
|
7
|
+
DirectJoin = "direct_join",
|
|
7
8
|
ServerIncoming = "server_incoming",
|
|
8
9
|
ServerJoinServer = "server_join_server",
|
|
9
10
|
ServerChangeTopology = "server_change_topology"
|
|
@@ -17,8 +18,8 @@ export declare class StatFirstMediaReceived {
|
|
|
17
18
|
constructor(statAggregator: StatAggregator);
|
|
18
19
|
markAcceptCall(topology: TransportTopology): void;
|
|
19
20
|
markAcceptedCall(topology?: TransportTopology): void;
|
|
20
|
-
markParticipantJoined(topology: TransportTopology): void;
|
|
21
21
|
markOnJoin(topology: TransportTopology): void;
|
|
22
|
+
markTopologyChanged(topology: TransportTopology): void;
|
|
22
23
|
private mark;
|
|
23
24
|
measure(): void;
|
|
24
25
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SignalingTransportType } from '../../enums/SignalingTransportStat';
|
|
2
2
|
import StatsLogger from '../StatsLogger';
|
|
3
|
-
import TransportTopology from '../../enums/TransportTopology';
|
|
4
3
|
export declare class StatPings {
|
|
5
4
|
private readonly _logger;
|
|
6
5
|
private trackerByTransport;
|
|
@@ -12,6 +11,6 @@ export declare class StatPings {
|
|
|
12
11
|
*/
|
|
13
12
|
mark(transport: SignalingTransportType): void;
|
|
14
13
|
/** Отправляем данные в стату */
|
|
15
|
-
logMetrics(
|
|
14
|
+
logMetrics(): void;
|
|
16
15
|
destroy(): void;
|
|
17
16
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { SignalingTransportType } from '../../enums/SignalingTransportStat';
|
|
2
2
|
import StatsLogger from '../StatsLogger';
|
|
3
|
-
import TransportTopology from '../../enums/TransportTopology';
|
|
4
3
|
export declare class StatSignalingCommands {
|
|
5
4
|
private readonly _logger;
|
|
6
5
|
private trackerByCommand;
|
|
7
6
|
constructor(logger: StatsLogger);
|
|
8
7
|
mark(command: string, time: number, transport: SignalingTransportType): void;
|
|
9
8
|
/** Отправляем данные в стату */
|
|
10
|
-
logMetrics(
|
|
9
|
+
logMetrics(): void;
|
|
11
10
|
destroy(): void;
|
|
12
11
|
}
|
|
@@ -7,7 +7,13 @@ export default abstract class BaseTransport extends EventEmitter {
|
|
|
7
7
|
protected readonly _mediaSource: MediaSource;
|
|
8
8
|
protected _state: TransportState;
|
|
9
9
|
protected _pc: RTCPeerConnection | null;
|
|
10
|
-
|
|
10
|
+
private readonly _onFirstMediaSent;
|
|
11
|
+
private _firstMediaSentProbe;
|
|
12
|
+
private _firstMediaSentProbeStopped;
|
|
13
|
+
protected constructor(signaling: BaseSignaling, mediaSource: MediaSource, onFirstMediaSent?: (() => void) | null);
|
|
11
14
|
getState(): TransportState;
|
|
15
|
+
stopFirstMediaSentProbe(): void;
|
|
12
16
|
abstract close(error?: Error): void;
|
|
17
|
+
protected _startFirstMediaSentProbe(): void;
|
|
18
|
+
protected _disposeFirstMediaSentProbe(): void;
|
|
13
19
|
}
|
|
@@ -27,6 +27,7 @@ export default class DirectTransport extends BaseTransport {
|
|
|
27
27
|
private _iceRestartTimeout;
|
|
28
28
|
private _reconnectionTimeout;
|
|
29
29
|
private _reconnectionPrevented;
|
|
30
|
+
private _remoteHold;
|
|
30
31
|
private _lastStat;
|
|
31
32
|
private _fingerprint;
|
|
32
33
|
private _neverConnected;
|
|
@@ -42,7 +43,7 @@ export default class DirectTransport extends BaseTransport {
|
|
|
42
43
|
private readonly _logger;
|
|
43
44
|
private readonly _statAggregator;
|
|
44
45
|
private readonly _codecStatsAggregator;
|
|
45
|
-
constructor(participantId: ParticipantId, isMaster: boolean, signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null);
|
|
46
|
+
constructor(participantId: ParticipantId, isMaster: boolean, signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null, onFirstMediaSent?: (() => void) | null);
|
|
46
47
|
get participantId(): ParticipantId;
|
|
47
48
|
updateStatisticsInterval(): void;
|
|
48
49
|
private _isDeadConnection;
|
|
@@ -50,6 +51,10 @@ export default class DirectTransport extends BaseTransport {
|
|
|
50
51
|
updateSettings(settings: ServerSettings): void;
|
|
51
52
|
preventRestart(): void;
|
|
52
53
|
allowRestart(): void;
|
|
54
|
+
setRemoteHold(hold: boolean): void;
|
|
55
|
+
private _recreatePeerConnection;
|
|
56
|
+
private _createPeerConnection;
|
|
57
|
+
private _disposePeerConnection;
|
|
53
58
|
setAnimojiTransport(receiver: AnimojiReceiver, sender: AnimojiSender): void;
|
|
54
59
|
close(error?: Error): void;
|
|
55
60
|
private _setState;
|
|
@@ -47,7 +47,7 @@ export default class ServerTransport extends BaseTransport {
|
|
|
47
47
|
private readonly _logger;
|
|
48
48
|
private readonly _statAggregator;
|
|
49
49
|
private readonly _codecStatsAggregator;
|
|
50
|
-
constructor(signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null);
|
|
50
|
+
constructor(signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null, onFirstMediaSent?: (() => void) | null);
|
|
51
51
|
updateStatisticsInterval(): void;
|
|
52
52
|
open(observer?: boolean): void;
|
|
53
53
|
close(error?: Error): void;
|
|
@@ -48,13 +48,18 @@ export declare class Transport extends EventEmitter {
|
|
|
48
48
|
private readonly _logger;
|
|
49
49
|
private readonly _statAggregator;
|
|
50
50
|
private readonly _codecStatsAggregator;
|
|
51
|
-
|
|
51
|
+
private readonly _onFirstMediaSent;
|
|
52
|
+
private _firstMediaSentProbeStopped;
|
|
53
|
+
constructor(topology: TransportTopology, signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null, onFirstMediaSent?: (() => void) | null);
|
|
52
54
|
updateSettings(settings: ServerSettings): void;
|
|
53
55
|
updateStatisticsInterval(): void;
|
|
54
56
|
allocate(participantId: ParticipantId, isMaster?: boolean): void;
|
|
55
57
|
open(participantIds: ParticipantId[], peerId?: string | null, observer?: boolean, force?: boolean): void;
|
|
56
58
|
close(participantId: ParticipantId): void;
|
|
57
59
|
destroy(): void;
|
|
60
|
+
stopFirstMediaSentProbe(): void;
|
|
61
|
+
holdClose(): void;
|
|
62
|
+
setRemoteHold(hold: boolean): void;
|
|
58
63
|
getTopology(): TransportTopology;
|
|
59
64
|
isAllocated(participantId: ParticipantId): boolean;
|
|
60
65
|
allocated(): string[];
|
|
@@ -67,6 +72,8 @@ export declare class Transport extends EventEmitter {
|
|
|
67
72
|
private _setStates;
|
|
68
73
|
private _setLocalState;
|
|
69
74
|
private _onSignalingNotification;
|
|
75
|
+
private _handleFirstMediaSent;
|
|
76
|
+
private _getFirstMediaSentCallback;
|
|
70
77
|
private _onTopologyChanged;
|
|
71
78
|
private _createDirectTransport;
|
|
72
79
|
private _createServerTransport;
|
package/default/Api.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import BaseApi, {
|
|
1
|
+
import BaseApi, { ClientStats } from '../abstract/BaseApi';
|
|
2
2
|
import CallType from '../enums/CallType';
|
|
3
3
|
import HangupType from '../enums/HangupType';
|
|
4
4
|
import ConversationParams from '../types/ConversationParams';
|
|
5
5
|
import ConversationResponse from '../types/ConversationResponse';
|
|
6
6
|
import { ExternalId, ExternalParticipantId, ExternalUserId } from '../types/ExternalId';
|
|
7
7
|
import { CompositeUserId, OkUserId, ParticipantId } from '../types/Participant';
|
|
8
|
+
import PushData from '../types/PushData';
|
|
8
9
|
export default class Api extends BaseApi {
|
|
9
10
|
private _userId;
|
|
10
11
|
private _uuid;
|
|
@@ -13,8 +14,12 @@ export default class Api extends BaseApi {
|
|
|
13
14
|
protected _call(method: string, data?: any, noSession?: boolean): Promise<any>;
|
|
14
15
|
userId(participantId: ParticipantId): Promise<ExternalParticipantId>;
|
|
15
16
|
authorize(): Promise<void>;
|
|
17
|
+
private _getAnonymLoginCacheKey;
|
|
18
|
+
private _getCachedAnonymLogin;
|
|
19
|
+
private _setCachedAnonymLogin;
|
|
20
|
+
private _removeCachedAnonymLogin;
|
|
21
|
+
private _applyAnonymLogin;
|
|
16
22
|
logClientStats(items: ClientStats[]): void;
|
|
17
|
-
logClientEvents(items: ClientEvent[]): void;
|
|
18
23
|
uploadDebugLogs(conversationId: string, startTime: number, endTime: number, log: string): Promise<void>;
|
|
19
24
|
joinConversation(conversationId: string, isVideo?: boolean, chatId?: string): Promise<ConversationResponse>;
|
|
20
25
|
createConversation(conversationId: string, payload?: string, requireAuthToJoin?: boolean, { onlyAdminCanShareMovie, audienceMode, audioOnly, waitForAdmin, closedConversation, }?: {
|
|
@@ -60,4 +65,5 @@ export default class Api extends BaseApi {
|
|
|
60
65
|
cleanup(): void;
|
|
61
66
|
private _getExternalIdsByOkIds;
|
|
62
67
|
getServerTime(): Promise<number>;
|
|
68
|
+
getInbounds(): Promise<PushData[]>;
|
|
63
69
|
}
|
package/default/Signaling.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ import TransportTopology from '../enums/TransportTopology';
|
|
|
9
9
|
import ConversationFeature from '../enums/ConversationFeature';
|
|
10
10
|
import ConversationOption from '../enums/ConversationOption';
|
|
11
11
|
import MediaOption from '../enums/MediaOption';
|
|
12
|
-
import SignalingCommandType from '../enums/SignalingCommandType';
|
|
13
12
|
import SignalingConnectionType from '../enums/SignalingConnectionType';
|
|
14
13
|
import UserRole from '../enums/UserRole';
|
|
15
14
|
import { type DebugLogger } from '../static/Debug';
|
|
@@ -26,29 +25,24 @@ import ParticipantLayout, { RequestKeyFrame, StopStream } from '../types/Partici
|
|
|
26
25
|
import { ParticipantListChunkParameters } from '../types/ParticipantListChunk';
|
|
27
26
|
import { StreamDescriptionString } from '../types/ParticipantStreamDescription';
|
|
28
27
|
import { PerfStatReport } from '../types/PerfStatReporter';
|
|
29
|
-
import SignalingMessage, { GetParticipantsSignalingResponse, GetRoomsSignalingResponse
|
|
28
|
+
import SignalingMessage, { GetParticipantsSignalingResponse, GetRoomsSignalingResponse } from '../types/SignalingMessage';
|
|
30
29
|
import { IPublishStreamData, IStartStreamData, IStopStreamData } from '../types/Streams';
|
|
31
30
|
export default class Signaling extends BaseSignaling {
|
|
32
|
-
private
|
|
33
|
-
|
|
31
|
+
private transport;
|
|
32
|
+
private sequence;
|
|
34
33
|
private lastStamp;
|
|
35
34
|
private websocketCommandsQueue;
|
|
36
35
|
private datachannelCommandsQueue;
|
|
37
36
|
private incomingCache;
|
|
38
37
|
private responseHandlers;
|
|
39
38
|
private connectionType;
|
|
40
|
-
private
|
|
41
|
-
private
|
|
42
|
-
private wtEndpoint;
|
|
43
|
-
protected conversationResolve: Function | null;
|
|
44
|
-
protected conversationReject: Function | null;
|
|
39
|
+
private conversationResolve;
|
|
40
|
+
private conversationReject;
|
|
45
41
|
private connected;
|
|
46
42
|
private listenersReady;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
private reconnectTimer;
|
|
43
|
+
private peerId;
|
|
44
|
+
private conversationId;
|
|
50
45
|
private connectionMessageWaitTimer;
|
|
51
|
-
private doctorTimer;
|
|
52
46
|
private participantIdRegistry;
|
|
53
47
|
private producerNotificationDataChannel;
|
|
54
48
|
private producerCommandDataChannel;
|
|
@@ -57,16 +51,13 @@ export default class Signaling extends BaseSignaling {
|
|
|
57
51
|
private readonly _debug;
|
|
58
52
|
private readonly _logger;
|
|
59
53
|
private readonly _statAggregator;
|
|
60
|
-
private readonly
|
|
61
|
-
private readonly
|
|
62
|
-
private static get RECONNECT_DELAY();
|
|
63
|
-
private static get RECONNECT_MAX_DELAY();
|
|
64
|
-
private static get RECONNECT_MAX_COUNT();
|
|
54
|
+
private readonly _statPings;
|
|
55
|
+
private readonly _statSignalingCommands;
|
|
65
56
|
private static get WAIT_CONNECTION_DELAY();
|
|
66
57
|
private static get WAIT_RESPONSE_DELAY();
|
|
67
|
-
private static get WAIT_MESSAGE_DELAY();
|
|
68
|
-
constructor(debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, pings?: StatPings | null, signalingCommands?: StatSignalingCommands | null);
|
|
69
58
|
get ready(): boolean;
|
|
59
|
+
constructor(debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, statPings?: StatPings | null, statSignalingCommands?: StatSignalingCommands | null);
|
|
60
|
+
setAbortSignal(signal: AbortSignal | undefined): void;
|
|
70
61
|
setEndpoint(endpoint: string): void;
|
|
71
62
|
setWebTransportEndpoint(endpoint: string | null): void;
|
|
72
63
|
setConversationId(conversationId: string): void;
|
|
@@ -82,15 +73,6 @@ export default class Signaling extends BaseSignaling {
|
|
|
82
73
|
* Open a connection with a signaling server
|
|
83
74
|
*/
|
|
84
75
|
connect(connectionType: SignalingConnectionType): Promise<SignalingMessage.Connection>;
|
|
85
|
-
/**
|
|
86
|
-
* Send a command to a signaling server
|
|
87
|
-
*/
|
|
88
|
-
protected _send<T extends SignalingSuccessResponse>(command: SignalingCommandType, params?: any, needResponse?: boolean, retryCount?: number): Promise<T>;
|
|
89
|
-
/**
|
|
90
|
-
* Send a raw command to a signaling server
|
|
91
|
-
*/
|
|
92
|
-
protected _sendRaw<T extends SignalingSuccessResponse>(command: SignalingCommandType, params?: any, needResponse?: boolean, retryCount?: number): Promise<T>;
|
|
93
|
-
private _isDataChannelCommand;
|
|
94
76
|
getNextCommandSequenceNumber(): number;
|
|
95
77
|
hangup(reason: string): Promise<SignalingMessage | void>;
|
|
96
78
|
sendCandidate(participantId: ParticipantId, candidate: RTCIceCandidate): Promise<SignalingMessage>;
|
|
@@ -173,34 +155,36 @@ export default class Signaling extends BaseSignaling {
|
|
|
173
155
|
startAsr(params: IAsrStartParams): Promise<SignalingMessage>;
|
|
174
156
|
stopAsr(params?: IAsrStopParams): Promise<SignalingMessage>;
|
|
175
157
|
requestAsr(request: boolean): Promise<SignalingMessage>;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
158
|
+
/**
|
|
159
|
+
* Send a command to a signaling server
|
|
160
|
+
*/
|
|
161
|
+
private _send;
|
|
162
|
+
/**
|
|
163
|
+
* Send a raw command to a signaling server
|
|
164
|
+
*/
|
|
165
|
+
private _sendRaw;
|
|
166
|
+
private _isDataChannelCommand;
|
|
179
167
|
private _onOpen;
|
|
180
168
|
private _onMessage;
|
|
181
|
-
|
|
169
|
+
private _handleMessage;
|
|
182
170
|
private _handleErrorMessage;
|
|
183
|
-
|
|
171
|
+
private _handleCachedMessages;
|
|
184
172
|
private _throwError;
|
|
185
173
|
private _onError;
|
|
186
174
|
private _serializeErrorEvent;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
protected _reconnect(): void;
|
|
175
|
+
private _onClose;
|
|
176
|
+
private _closeSocket;
|
|
190
177
|
private _handleCommandResponse;
|
|
191
178
|
private _handleCommandsQueue;
|
|
192
179
|
private _startResponseTimer;
|
|
193
180
|
private _serializeBinary;
|
|
194
181
|
private _serializeJson;
|
|
195
182
|
private _convertDisplayLayout;
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
private _startDoctor;
|
|
202
|
-
private _stopDoctor;
|
|
203
|
-
private isWebTransportAvailable;
|
|
183
|
+
private _waitConnectionMessage;
|
|
184
|
+
private _stopWaitConnectionMessage;
|
|
185
|
+
private _onTransportFailed;
|
|
186
|
+
private _onTransportReconnectScheduled;
|
|
187
|
+
private _onTransportConnectionDead;
|
|
204
188
|
private _getSocketType;
|
|
205
189
|
private _markTransportStat;
|
|
206
190
|
private _logTransportStat;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import SignalingConnectionType from '../enums/SignalingConnectionType';
|
|
2
|
+
import { SignalingTransportType } from '../enums/SignalingTransportStat';
|
|
3
|
+
export declare enum SignalingTransportFailure {
|
|
4
|
+
EMPTY_ENDPOINT = "EMPTY_ENDPOINT",
|
|
5
|
+
NETWORK_ERROR = "NETWORK_ERROR",
|
|
6
|
+
ABORTED = "ABORTED"
|
|
7
|
+
}
|
|
8
|
+
export type SignalingTransportFailedEvent = {
|
|
9
|
+
failure: SignalingTransportFailure;
|
|
10
|
+
message: string;
|
|
11
|
+
remote?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type SignalingTransportReconnectEvent = {
|
|
14
|
+
count: number;
|
|
15
|
+
delay: number;
|
|
16
|
+
};
|
|
17
|
+
export type SignalingTransportHandlers = {
|
|
18
|
+
onOpen: () => void;
|
|
19
|
+
onMessage: (event: MessageEvent) => void;
|
|
20
|
+
onError: (event: Event) => void;
|
|
21
|
+
onClose: (event: CloseEvent) => void;
|
|
22
|
+
onFailed: (event: SignalingTransportFailedEvent) => void;
|
|
23
|
+
onReconnectScheduled: (event: SignalingTransportReconnectEvent) => void;
|
|
24
|
+
onConnectionDead: () => void;
|
|
25
|
+
};
|
|
26
|
+
export default class SignalingTransport {
|
|
27
|
+
private readonly handlers;
|
|
28
|
+
private socket;
|
|
29
|
+
private endpoint;
|
|
30
|
+
private wtEndpoint;
|
|
31
|
+
private peerId;
|
|
32
|
+
private lastStamp;
|
|
33
|
+
private connectionType;
|
|
34
|
+
private reconnectCount;
|
|
35
|
+
private reconnectTimer;
|
|
36
|
+
private doctorTimer;
|
|
37
|
+
private forceWebSocket;
|
|
38
|
+
private abortSignal;
|
|
39
|
+
private manualClose;
|
|
40
|
+
private currentType;
|
|
41
|
+
constructor(handlers: SignalingTransportHandlers);
|
|
42
|
+
get readyState(): number | null;
|
|
43
|
+
get type(): SignalingTransportType;
|
|
44
|
+
setEndpoint(endpoint: string): void;
|
|
45
|
+
setWebTransportEndpoint(endpoint: string | null): void;
|
|
46
|
+
setPeerId(peerId: number | null): void;
|
|
47
|
+
setLastStamp(lastStamp: number): void;
|
|
48
|
+
setAbortSignal(signal?: AbortSignal): void;
|
|
49
|
+
resetReconnectCount(): void;
|
|
50
|
+
connect(connectionType: SignalingConnectionType): void;
|
|
51
|
+
close(code?: number): void;
|
|
52
|
+
send(data: string | ArrayBuffer): void;
|
|
53
|
+
private _connect;
|
|
54
|
+
private _connectWebTransport;
|
|
55
|
+
private _connectWebSocket;
|
|
56
|
+
private _setSocketHandlers;
|
|
57
|
+
private _buildUrl;
|
|
58
|
+
private _canUseWebTransport;
|
|
59
|
+
private _onOpen;
|
|
60
|
+
private _onMessage;
|
|
61
|
+
private _onError;
|
|
62
|
+
private _onClose;
|
|
63
|
+
private _disconnect;
|
|
64
|
+
private _scheduleReconnect;
|
|
65
|
+
private _getReconnectDelay;
|
|
66
|
+
private _startDoctor;
|
|
67
|
+
private _stopDoctor;
|
|
68
|
+
}
|