@vkontakte/calls-sdk 2.8.11-dev.a9627477.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 +2004 -1512
- package/classes/CallRegistry.d.ts +1 -1
- package/classes/Conversation.d.ts +22 -17
- 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/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/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 +9 -1
|
@@ -12,7 +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
|
-
|
|
15
|
+
getFirst(): HoldableConversation | null;
|
|
16
16
|
getActiveId(): string | null;
|
|
17
17
|
has(id: string): boolean;
|
|
18
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';
|
|
@@ -43,6 +42,7 @@ export default class Conversation extends EventEmitter {
|
|
|
43
42
|
private _participantState;
|
|
44
43
|
private _participants;
|
|
45
44
|
private _pendingParticipants;
|
|
45
|
+
private _directTransportIsMaster?;
|
|
46
46
|
private _transport;
|
|
47
47
|
private _debugInfo;
|
|
48
48
|
private readonly _debug;
|
|
@@ -82,15 +82,7 @@ export default class Conversation extends EventEmitter {
|
|
|
82
82
|
static getSyncedTime(): number;
|
|
83
83
|
get debugSessionId(): string | null;
|
|
84
84
|
onStart({ opponentIds, opponentType, mediaOptions, payload, joiningAllowed, requireAuthToJoin, onlyAdminCanShareMovie, externalIds, onFastStart, conversationId, }: ConversationOnStartParams): Promise<ConversationData>;
|
|
85
|
-
onJoin(joinArgs:
|
|
86
|
-
conversationId?: string;
|
|
87
|
-
mediaOptions: MediaOption[];
|
|
88
|
-
chatId?: string;
|
|
89
|
-
joinLink?: string;
|
|
90
|
-
observedIds?: ExternalUserId[];
|
|
91
|
-
payload?: string;
|
|
92
|
-
onFastJoin?: FastJoinHandler;
|
|
93
|
-
}): Promise<ConversationData>;
|
|
85
|
+
onJoin(joinArgs: ConversationOnJoinParams): Promise<ConversationData>;
|
|
94
86
|
private _onJoinPart2;
|
|
95
87
|
private _extractExternalRooms;
|
|
96
88
|
private _extractExternalRoomsData;
|
|
@@ -103,7 +95,6 @@ export default class Conversation extends EventEmitter {
|
|
|
103
95
|
private _acceptConcurrent;
|
|
104
96
|
private _getMainRoomParticipants;
|
|
105
97
|
private _decodeExternalConversationParams;
|
|
106
|
-
private _logCallStartEvent;
|
|
107
98
|
accept(mediaOptions: MediaOption[]): Promise<ConversationData>;
|
|
108
99
|
decline(): Promise<void>;
|
|
109
100
|
hangup(): Promise<void>;
|
|
@@ -113,11 +104,12 @@ export default class Conversation extends EventEmitter {
|
|
|
113
104
|
setVolume(volume: number): void;
|
|
114
105
|
updateStatisticsInterval(): void;
|
|
115
106
|
private _openTransport;
|
|
107
|
+
private _allocateParticipantTransport;
|
|
116
108
|
private _close;
|
|
117
109
|
destroy(): Promise<void>;
|
|
118
110
|
private _getConversationParams;
|
|
119
111
|
private _setConversationParams;
|
|
120
|
-
private
|
|
112
|
+
private _buildSignalingEndpoint;
|
|
121
113
|
/**
|
|
122
114
|
* @throws ErrorEvent
|
|
123
115
|
*/
|
|
@@ -144,7 +136,12 @@ export default class Conversation extends EventEmitter {
|
|
|
144
136
|
private _registerParticipants;
|
|
145
137
|
/** Установим состояние локальных мьютов */
|
|
146
138
|
private _registerParticipantLocalMuteState;
|
|
147
|
-
private
|
|
139
|
+
private _remoteParticipantSessionState;
|
|
140
|
+
private _buildConnectionStatus;
|
|
141
|
+
private _isParticipantSessionStateApplicable;
|
|
142
|
+
private _setTransportStatus;
|
|
143
|
+
private _setSessionState;
|
|
144
|
+
private _emitParticipantTransition;
|
|
148
145
|
private _registerParticipantInCache;
|
|
149
146
|
private _getExistedParticipantByIdOrCreate;
|
|
150
147
|
private _getExternalIdByParticipantId;
|
|
@@ -184,6 +181,10 @@ export default class Conversation extends EventEmitter {
|
|
|
184
181
|
private _cleanupParticipants;
|
|
185
182
|
private _cleanupParticipantAgnosticStreams;
|
|
186
183
|
private _cleanupTransport;
|
|
184
|
+
private _finishLifecycle;
|
|
185
|
+
private _getFirstMediaSentCallback;
|
|
186
|
+
private _stopFirstMediaSentProbe;
|
|
187
|
+
private _cleanupTransportForHold;
|
|
187
188
|
private _cleanupSpeakerDetector;
|
|
188
189
|
private _cleanupSpecListener;
|
|
189
190
|
private _cleanupSignaling;
|
|
@@ -223,8 +224,6 @@ export default class Conversation extends EventEmitter {
|
|
|
223
224
|
updateDisplayLayout(layouts: ParticipantLayout[]): Promise<void>;
|
|
224
225
|
requestDisplayLayout(requests: DisplayLayoutRequest[]): Promise<void>;
|
|
225
226
|
feedback(key: string): Promise<SignalingMessage>;
|
|
226
|
-
userFeedbackStats(userResponse: number, reason?: string, groupCallUsersCount?: number): void;
|
|
227
|
-
sendClientEvent(eventType: string, eventData?: Record<string, string | number | boolean>, immediately?: boolean): void;
|
|
228
227
|
private _changeMediaSettings;
|
|
229
228
|
private _stopStreaming;
|
|
230
229
|
/**
|
|
@@ -320,11 +319,17 @@ export default class Conversation extends EventEmitter {
|
|
|
320
319
|
private _changeMultipleParticipantState;
|
|
321
320
|
private _invokeRolesChangedCallbackIfNeeded;
|
|
322
321
|
private _onSignalingNotification;
|
|
322
|
+
private _onSignalingTopologyChanged;
|
|
323
323
|
private _onPromotionApproved;
|
|
324
324
|
private _onSignalingReconnect;
|
|
325
325
|
private _onSignalingFailed;
|
|
326
326
|
private _onAcceptedCall;
|
|
327
327
|
private _onHungup;
|
|
328
|
+
private _onSessionState;
|
|
329
|
+
private _reconcileParticipantSessionStates;
|
|
330
|
+
private _updateParticipantExternalId;
|
|
331
|
+
private _updateParticipantSessionState;
|
|
332
|
+
private _emitParticipantEffectiveStatusIfSessionOverridesTransport;
|
|
328
333
|
private _onAddedParticipant;
|
|
329
334
|
private _onJoinedParticipant;
|
|
330
335
|
private _onClosedConversation;
|
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
|
+
}
|
|
@@ -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
|
}
|
|
@@ -24,6 +24,7 @@ declare enum SignalingNotification {
|
|
|
24
24
|
REALLOC_CON = "realloc-con",
|
|
25
25
|
AUDIO_ACTIVITY = "audio-activity",
|
|
26
26
|
SPEAKER_CHANGED = "speaker-changed",
|
|
27
|
+
SESSION_STATE = "session-state",
|
|
27
28
|
STALLED_ACTIVITY = "stalled-activity",
|
|
28
29
|
CHAT_MESSAGE = "chat-message",
|
|
29
30
|
CUSTOM_DATA = "custom-data",
|
package/enums/Stat.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
declare const enum Stat {
|
|
2
|
+
CALL_INIT = "call_init",
|
|
3
|
+
CALL_WARMUP = "call_warmup",
|
|
4
|
+
CALL_START = "call_start",
|
|
5
|
+
CALL_ACCEPTED_OUTGOING = "call_accepted_outgoing",
|
|
6
|
+
CALL_ACCEPTED_INCOMING = "call_accepted_incoming",
|
|
7
|
+
FIRST_MEDIA_SENT = "first_media_sent",
|
|
2
8
|
CALL_FINISH = "call_finish",// событие отправляемое в конце звонка
|
|
3
9
|
CODEC_USAGE = "codec_usage",// событие когда меняется кодек
|
|
4
10
|
SIGNALING_CONNECTED = "signaling_connected",// measure
|
|
@@ -7,7 +13,6 @@ declare const enum Stat {
|
|
|
7
13
|
FIRST_MEDIA_RECEIVED = "first_media_received",
|
|
8
14
|
CALL_DECLINED_OR_HANGED_LOCALLY = "CallDeclinedOrHangedLocally",
|
|
9
15
|
USER_FEEDBACK_RECEIVED = "UserFeedbackReceived",
|
|
10
|
-
CALL_START = "call_start",
|
|
11
16
|
SIGNALING_PING_SUMMARY = "signaling_ping_summary",
|
|
12
17
|
SIGNALING_COMMAND_SUMMARY = "signaling_command_summary",
|
|
13
18
|
WEBSOCKET_CONNECTED = "websocket_connected",
|
package/package.json
CHANGED
package/static/Params.d.ts
CHANGED
|
@@ -256,13 +256,6 @@ export type ParamsObject = {
|
|
|
256
256
|
perfStatReportEnabled: boolean;
|
|
257
257
|
/** @hidden */
|
|
258
258
|
callStatReportEnabled: boolean;
|
|
259
|
-
/**
|
|
260
|
-
* Включает логирование событий продуктовой статистики.
|
|
261
|
-
*
|
|
262
|
-
* _По умолчанию: `false`_
|
|
263
|
-
* @hidden
|
|
264
|
-
*/
|
|
265
|
-
clientEventsLoggingEnabled: boolean;
|
|
266
259
|
/**
|
|
267
260
|
* Отдавать приоритет кодеку H264 для исходящего видео
|
|
268
261
|
*
|
|
@@ -500,6 +493,12 @@ export type ParamsObject = {
|
|
|
500
493
|
* _По умолчанию: `false`_
|
|
501
494
|
*/
|
|
502
495
|
transparentAudio: boolean;
|
|
496
|
+
/**
|
|
497
|
+
* Включить получение обновлений состояния медийной сессии участников
|
|
498
|
+
*
|
|
499
|
+
* _По умолчанию: `false`_
|
|
500
|
+
*/
|
|
501
|
+
enableSessionStateUpdates: boolean;
|
|
503
502
|
/**
|
|
504
503
|
* Получен локальный стрим с камеры/микрофона
|
|
505
504
|
*/
|
|
@@ -977,7 +976,6 @@ export default abstract class Params {
|
|
|
977
976
|
static get networkStatisticsInterval(): number;
|
|
978
977
|
static get perfStatReportEnabled(): boolean;
|
|
979
978
|
static get callStatReportEnabled(): boolean;
|
|
980
|
-
static get clientEventsLoggingEnabled(): boolean;
|
|
981
979
|
static get enableLogPerfStatReport(): boolean;
|
|
982
980
|
static get asrDataChannel(): boolean;
|
|
983
981
|
static get consumerScreenDataChannelPacketSize(): number;
|
|
@@ -1021,6 +1019,7 @@ export default abstract class Params {
|
|
|
1021
1019
|
static get webtransport(): boolean;
|
|
1022
1020
|
static get webtransportFF(): boolean;
|
|
1023
1021
|
static get transparentAudio(): boolean;
|
|
1022
|
+
static get enableSessionStateUpdates(): boolean;
|
|
1024
1023
|
static toJSON(): {
|
|
1025
1024
|
apiKey: string;
|
|
1026
1025
|
apiEnv: string;
|
|
@@ -1056,5 +1055,6 @@ export default abstract class Params {
|
|
|
1056
1055
|
webtransport: boolean;
|
|
1057
1056
|
webtransportFF: boolean;
|
|
1058
1057
|
transparentAudio: boolean;
|
|
1058
|
+
enableSessionStateUpdates: boolean;
|
|
1059
1059
|
};
|
|
1060
1060
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ParticipantConnectionStatus, ParticipantSessionState } from '../types/Participant';
|
|
2
|
+
import { ParticipantStatus } from './External';
|
|
3
|
+
import TransportState from '../enums/TransportState';
|
|
4
|
+
type StatusTransition = {
|
|
5
|
+
status: ParticipantStatus;
|
|
6
|
+
shouldNotify: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare namespace ParticipantConnectionStatusUtils {
|
|
9
|
+
function create(status?: Partial<ParticipantConnectionStatus> | null): ParticipantConnectionStatus;
|
|
10
|
+
function fromTransportState(state?: TransportState): ParticipantStatus | null;
|
|
11
|
+
function computeEffective(status: ParticipantConnectionStatus): ParticipantStatus;
|
|
12
|
+
function setSessionState(status: ParticipantConnectionStatus, sessionState?: ParticipantSessionState, sessionStateConnectedBySpeaker?: boolean): StatusTransition;
|
|
13
|
+
function setTransport(status: ParticipantConnectionStatus, transport: ParticipantStatus): StatusTransition;
|
|
14
|
+
function setSessionStateApplicable(status: ParticipantConnectionStatus, applicable: boolean): StatusTransition;
|
|
15
|
+
}
|
|
16
|
+
export default ParticipantConnectionStatusUtils;
|
package/types/Conversation.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ import MediaOption from '../enums/MediaOption';
|
|
|
7
7
|
import UserRole from '../enums/UserRole';
|
|
8
8
|
import { AsrInfo } from './Asr';
|
|
9
9
|
import { IFeaturesPerRole } from './ConversationFeature';
|
|
10
|
-
import { ExternalId, ExternalParticipantId } from './ExternalId';
|
|
10
|
+
import { ExternalId, ExternalParticipantId, ExternalUserId } from './ExternalId';
|
|
11
|
+
import { FastJoinHandler } from './FastJoin';
|
|
11
12
|
import { FastStartHandler } from './FastStart';
|
|
12
13
|
import MediaModifiers from './MediaModifiers';
|
|
13
14
|
import MuteStates from './MuteStates';
|
|
@@ -84,6 +85,16 @@ export type ConversationOnStartParams = {
|
|
|
84
85
|
onFastStart?: FastStartHandler;
|
|
85
86
|
conversationId?: string;
|
|
86
87
|
};
|
|
88
|
+
export type ConversationOnJoinParams = {
|
|
89
|
+
conversationId?: string;
|
|
90
|
+
mediaOptions: MediaOption[];
|
|
91
|
+
chatId?: string;
|
|
92
|
+
joinLink?: string;
|
|
93
|
+
observedIds?: ExternalUserId[];
|
|
94
|
+
payload?: string;
|
|
95
|
+
onFastJoin?: FastJoinHandler;
|
|
96
|
+
anonymous?: boolean;
|
|
97
|
+
};
|
|
87
98
|
export type StartConversationParams = {
|
|
88
99
|
opponentIds?: OkUserId[];
|
|
89
100
|
opponentType: CallType;
|
|
@@ -94,7 +105,6 @@ export type StartConversationParams = {
|
|
|
94
105
|
requireAuthToJoin?: boolean;
|
|
95
106
|
onlyAdminCanShareMovie?: boolean;
|
|
96
107
|
externalIds?: ExternalId[];
|
|
97
|
-
startedTime: number;
|
|
98
108
|
onFastStart?: FastStartHandler;
|
|
99
109
|
conversationId?: string;
|
|
100
110
|
};
|
package/types/Participant.d.ts
CHANGED
|
@@ -44,6 +44,16 @@ export interface ParticipantStateMapped {
|
|
|
44
44
|
ts: number;
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
+
export interface ParticipantSessionState {
|
|
48
|
+
connected: boolean;
|
|
49
|
+
}
|
|
50
|
+
export interface ParticipantConnectionStatus {
|
|
51
|
+
transport: ParticipantStatus;
|
|
52
|
+
sessionState?: ParticipantSessionState;
|
|
53
|
+
sessionStateApplicable: boolean;
|
|
54
|
+
sessionStateConnectedBySpeaker: boolean;
|
|
55
|
+
lastEffective: ParticipantStatus;
|
|
56
|
+
}
|
|
47
57
|
/**
|
|
48
58
|
* Состояния участников звонка
|
|
49
59
|
*/
|
|
@@ -63,7 +73,6 @@ export interface Participant {
|
|
|
63
73
|
externalId: ExternalParticipantId;
|
|
64
74
|
mediaSettings: MediaSettings;
|
|
65
75
|
state: ParticipantState;
|
|
66
|
-
status: ParticipantStatus;
|
|
67
76
|
remoteStream?: MediaStream | null;
|
|
68
77
|
remoteAudioTrack?: MediaStreamTrack | null;
|
|
69
78
|
secondStream?: MediaStream | null;
|
|
@@ -73,6 +82,7 @@ export interface Participant {
|
|
|
73
82
|
roles: UserRole[];
|
|
74
83
|
participantState: ParticipantStateMapped;
|
|
75
84
|
isOnHold?: boolean;
|
|
85
|
+
connectionStatus: ParticipantConnectionStatus;
|
|
76
86
|
networkRating: number;
|
|
77
87
|
lastRequestedLayouts: {
|
|
78
88
|
[key: StreamDescriptionString]: ParticipantLayout;
|
package/types/PushData.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import IceServer from './IceServer';
|
|
1
2
|
type PushData = {
|
|
2
3
|
caller_id: string;
|
|
3
4
|
caller_client_type?: string;
|
|
4
5
|
conversation_id: string;
|
|
5
6
|
endpoint: string;
|
|
7
|
+
wt_endpoint?: string;
|
|
8
|
+
turn_server?: IceServer;
|
|
6
9
|
is_video: boolean;
|
|
7
10
|
token: string;
|
|
8
11
|
sdp_offer?: string;
|
|
@@ -19,7 +19,7 @@ import MediaModifiers from './MediaModifiers';
|
|
|
19
19
|
import MediaSettings from './MediaSettings';
|
|
20
20
|
import { ISharedMovieInfo, ISharedMovieState, ISharedMovieStoppedInfo } from './MovieShare';
|
|
21
21
|
import MuteStates from './MuteStates';
|
|
22
|
-
import { CompositeUserId, OkUserId, ParticipantId, ParticipantListMarker as ParticipantParticipantListMarker, ParticipantListMarkers, ParticipantListType as ParticipantParticipantListType } from './Participant';
|
|
22
|
+
import { CompositeUserId, OkUserId, ParticipantId, ParticipantListMarker as ParticipantParticipantListMarker, ParticipantListMarkers, ParticipantListType as ParticipantParticipantListType, ParticipantSessionState } from './Participant';
|
|
23
23
|
import { MediaType, ParticipantStreamDescription } from './ParticipantStreamDescription';
|
|
24
24
|
import { IRoomId } from './Room';
|
|
25
25
|
import VideoSettings from './VideoSettings';
|
|
@@ -89,6 +89,7 @@ declare namespace SignalingMessage {
|
|
|
89
89
|
state: Record<string, string>;
|
|
90
90
|
stateUpdateTs: Record<string, number>;
|
|
91
91
|
};
|
|
92
|
+
sessionState?: ParticipantSessionState;
|
|
92
93
|
roles?: UserRole[];
|
|
93
94
|
peerId?: PeerId;
|
|
94
95
|
restricted?: boolean;
|
|
@@ -324,6 +325,13 @@ declare namespace SignalingMessage {
|
|
|
324
325
|
export interface SpeakerChanged extends Notification {
|
|
325
326
|
speaker: ParticipantId;
|
|
326
327
|
}
|
|
328
|
+
export interface SessionState extends Notification {
|
|
329
|
+
connected: boolean;
|
|
330
|
+
participantId: OkUserId;
|
|
331
|
+
participantType: UserType;
|
|
332
|
+
deviceIdx?: number;
|
|
333
|
+
markers?: ParticipantListMarkers;
|
|
334
|
+
}
|
|
327
335
|
export interface OptionsChanged extends Notification {
|
|
328
336
|
options: ConversationOption[];
|
|
329
337
|
}
|