@vkontakte/calls-sdk 2.8.12-dev.26c45af4.0 → 2.8.12-dev.35600965.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 +4 -3
- package/abstract/BaseApi.d.ts +1 -0
- package/abstract/BaseSignaling.d.ts +1 -1
- package/calls-sdk.cjs.js +9 -9
- package/calls-sdk.esm.js +2688 -1900
- package/classes/CallRegistry.d.ts +4 -0
- package/classes/Conversation.d.ts +14 -15
- package/classes/ExternalIdCache.d.ts +1 -0
- package/classes/StatsLogger.d.ts +17 -2
- package/classes/stat/CallFinishClassifier.d.ts +11 -0
- package/classes/stat/CallLifecycleStats.d.ts +46 -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 +1 -1
- package/classes/transport/ServerTransport.d.ts +1 -1
- package/classes/transport/Transport.d.ts +6 -1
- package/default/Api.d.ts +1 -2
- package/default/Signaling.d.ts +5 -3
- package/default/SignalingTransport.d.ts +4 -1
- package/enums/HangupType.d.ts +0 -1
- package/enums/Stat.d.ts +6 -1
- package/package.json +1 -1
- package/static/AuthData.d.ts +10 -0
- package/static/Debug.d.ts +1 -0
- package/static/External.d.ts +1 -1
- package/static/Params.d.ts +15 -10
- package/static/WebRTCUtils.d.ts +7 -1
- package/types/Conversation.d.ts +12 -2
- package/types/SignalingMessage.d.ts +4 -1
- package/types/WebTransport.d.ts +17 -16
|
@@ -6,8 +6,11 @@ export interface HoldableConversation extends Conversation {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class CallRegistry {
|
|
8
8
|
private _conversations;
|
|
9
|
+
private _reserved;
|
|
9
10
|
private _activeId;
|
|
10
11
|
private _mutex;
|
|
12
|
+
private _pendingRemovals;
|
|
13
|
+
reserve(id: string): void;
|
|
11
14
|
add(conversation: HoldableConversation): void;
|
|
12
15
|
remove(id: string | null): void;
|
|
13
16
|
get(id: string): HoldableConversation | undefined;
|
|
@@ -21,6 +24,7 @@ export declare class CallRegistry {
|
|
|
21
24
|
setHold(id: string): Promise<void>;
|
|
22
25
|
switchCall(id: string): Promise<void>;
|
|
23
26
|
clear(): void;
|
|
27
|
+
private _flushPendingRemovals;
|
|
24
28
|
}
|
|
25
29
|
declare const callRegistry: CallRegistry;
|
|
26
30
|
export { callRegistry };
|
|
@@ -9,17 +9,17 @@ import MediaOption from '../enums/MediaOption';
|
|
|
9
9
|
import UpdateDisplayLayoutErrorReason from '../enums/UpdateDisplayLayoutErrorReason';
|
|
10
10
|
import UserRole from '../enums/UserRole';
|
|
11
11
|
import UserType from '../enums/UserType';
|
|
12
|
+
import { DebugMessageType } from '../static/Debug';
|
|
12
13
|
import { JSONObject } from '../static/Json';
|
|
13
14
|
import { IAsrStartParams, IAsrStopParams } from '../types/Asr';
|
|
14
15
|
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';
|
|
16
|
+
import { ConversationData, ConversationOnJoinParams, ConversationOnStartParams } from '../types/Conversation';
|
|
17
|
+
import { ExternalId, ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk } from '../types/ExternalId';
|
|
18
18
|
import MediaModifiers from '../types/MediaModifiers';
|
|
19
19
|
import MediaSettings, { IVideoDimentions } from '../types/MediaSettings';
|
|
20
20
|
import { IAddMovieParams, IUpdateMovieData } from '../types/MovieShare';
|
|
21
21
|
import MuteStates from '../types/MuteStates';
|
|
22
|
-
import { CompositeUserId, IGetParticipantsParameters, ParticipantId, ParticipantStateData } from '../types/Participant';
|
|
22
|
+
import { CompositeUserId, IGetParticipantsParameters, OkUserId, ParticipantId, ParticipantStateData } from '../types/Participant';
|
|
23
23
|
import { DisplayLayoutRequest, ParticipantLayout } from '../types/ParticipantLayout';
|
|
24
24
|
import { ParticipantListChunkParameters } from '../types/ParticipantListChunk';
|
|
25
25
|
import ParticipantPriority from '../types/ParticipantPriority';
|
|
@@ -60,6 +60,7 @@ export default class Conversation extends EventEmitter {
|
|
|
60
60
|
private _abortController;
|
|
61
61
|
private _registeredPeerReceived;
|
|
62
62
|
private _calleeUnavailableTimer;
|
|
63
|
+
private _reservedId;
|
|
63
64
|
private readonly _onUnload;
|
|
64
65
|
private readonly _audioOutput;
|
|
65
66
|
private readonly _stats;
|
|
@@ -82,22 +83,17 @@ export default class Conversation extends EventEmitter {
|
|
|
82
83
|
get mediaSettings(): MediaSettings | undefined;
|
|
83
84
|
get isCallHeld(): boolean;
|
|
84
85
|
static debugSessionId(): string | null;
|
|
86
|
+
static debugMessage(type: DebugMessageType, ...args: any[]): boolean;
|
|
87
|
+
static debugMessageWithContext(type: DebugMessageType, conversationId: string, ...args: any[]): boolean;
|
|
85
88
|
static getSyncedTime(): number;
|
|
86
89
|
get debugSessionId(): string | null;
|
|
90
|
+
getCachedRawOkIdByExternalId(externalId: ExternalId): OkUserId | null;
|
|
87
91
|
onStart({ opponentIds, opponentType, mediaOptions, payload, joiningAllowed, requireAuthToJoin, onlyAdminCanShareMovie, externalIds, onFastStart, conversationId, }: ConversationOnStartParams): Promise<ConversationData>;
|
|
88
|
-
onJoin(joinArgs:
|
|
89
|
-
conversationId?: string;
|
|
90
|
-
mediaOptions: MediaOption[];
|
|
91
|
-
chatId?: string;
|
|
92
|
-
joinLink?: string;
|
|
93
|
-
observedIds?: ExternalUserId[];
|
|
94
|
-
payload?: string;
|
|
95
|
-
onFastJoin?: FastJoinHandler;
|
|
96
|
-
}): Promise<ConversationData>;
|
|
92
|
+
onJoin(joinArgs: ConversationOnJoinParams): Promise<ConversationData>;
|
|
97
93
|
private _onJoinPart2;
|
|
98
94
|
private _extractExternalRooms;
|
|
99
95
|
private _extractExternalRoomsData;
|
|
100
|
-
onPush(conversationId: string, type?: UserType, peerId?: number, conversationParams?: string, wsEndpoint?: string): Promise<void>;
|
|
96
|
+
onPush(conversationId: string, type?: UserType, peerId?: number, conversationParams?: string, wsEndpoint?: string, userId?: number): Promise<void>;
|
|
101
97
|
private _isInWaitingHall;
|
|
102
98
|
private _isWaitForAdmin;
|
|
103
99
|
private _isRestricted;
|
|
@@ -106,7 +102,6 @@ export default class Conversation extends EventEmitter {
|
|
|
106
102
|
private _acceptConcurrent;
|
|
107
103
|
private _getMainRoomParticipants;
|
|
108
104
|
private _decodeExternalConversationParams;
|
|
109
|
-
private _logCallStartEvent;
|
|
110
105
|
accept(mediaOptions: MediaOption[]): Promise<ConversationData>;
|
|
111
106
|
decline(): Promise<void>;
|
|
112
107
|
hangup(): Promise<void>;
|
|
@@ -117,6 +112,7 @@ export default class Conversation extends EventEmitter {
|
|
|
117
112
|
updateStatisticsInterval(): void;
|
|
118
113
|
private _openTransport;
|
|
119
114
|
private _allocateParticipantTransport;
|
|
115
|
+
private _cleanupRegistry;
|
|
120
116
|
private _close;
|
|
121
117
|
destroy(): void;
|
|
122
118
|
private _getConversationParams;
|
|
@@ -197,6 +193,9 @@ export default class Conversation extends EventEmitter {
|
|
|
197
193
|
private _cleanupParticipants;
|
|
198
194
|
private _cleanupParticipantAgnosticStreams;
|
|
199
195
|
private _cleanupTransport;
|
|
196
|
+
private _finishLifecycle;
|
|
197
|
+
private _getFirstMediaSentCallback;
|
|
198
|
+
private _stopFirstMediaSentProbe;
|
|
200
199
|
private _cleanupTransportForHold;
|
|
201
200
|
private _cleanupSpeakerDetector;
|
|
202
201
|
private _cleanupSpecListener;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ExternalId, ExternalParticipantId } from '../types/ExternalId';
|
|
2
2
|
import { CompositeUserId, OkUserId, ParticipantId } from '../types/Participant';
|
|
3
3
|
export declare class ExternalIdCache {
|
|
4
|
+
private static _normalizeType;
|
|
4
5
|
private _okIdToExternalId;
|
|
5
6
|
private _externalIdToOkId;
|
|
6
7
|
private _decorativeIdToInitialId;
|
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,19 +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
22
|
private _batchTimeout;
|
|
14
23
|
private _serverTimeDelta;
|
|
15
|
-
|
|
24
|
+
private _waitingForServerTime;
|
|
25
|
+
private _deferredClientStats;
|
|
26
|
+
constructor(api: BaseApi, externalLogger: BaseLogger | null, conversationIdProvider: () => string | null, topologyProvider?: () => TransportTopology | undefined);
|
|
16
27
|
log(name: StatLog, value?: string, immediately?: boolean): void;
|
|
17
|
-
logClientStats(data:
|
|
28
|
+
logClientStats(data: ClientStatsPayload, immediatelyOrOptions?: boolean | LogClientStatsOptions): void;
|
|
18
29
|
destroy(): void;
|
|
30
|
+
private _logClientStats;
|
|
19
31
|
private _getConversationId;
|
|
32
|
+
private _getCallTopology;
|
|
20
33
|
private _sendBatch;
|
|
21
34
|
private _startTimeout;
|
|
22
35
|
private _stopTimeout;
|
|
23
36
|
private _sendClientStats;
|
|
24
37
|
private _calculateServerTimeDelta;
|
|
38
|
+
private _flushDeferredClientStats;
|
|
25
39
|
private _now;
|
|
26
40
|
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type SemanticCallFinishReason = 'hangup' | 'canceled' | 'rejected' | 'busy' | 'missed' | 'timeout' | 'another_device' | 'removed' | 'banned' | 'initially_closed' | 'call_timeout' | 'socket_closed' | 'killed' | 'killed_without_delete' | 'obsolete_client' | 'unavailable';
|
|
2
|
+
export type ClassifiedCallFinish = {
|
|
3
|
+
reason: SemanticCallFinishReason;
|
|
4
|
+
string_value?: string;
|
|
5
|
+
} | {
|
|
6
|
+
reason: 'error';
|
|
7
|
+
string_value: string;
|
|
8
|
+
} | {
|
|
9
|
+
reason: 'failed';
|
|
10
|
+
};
|
|
11
|
+
export declare function classifyCallFinish(error: unknown): ClassifiedCallFinish;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import StatsLogger from '../StatsLogger';
|
|
2
|
+
export type CallLifecycleSource = 'outgoing' | 'incoming' | 'join' | 'anonym_join';
|
|
3
|
+
export interface CallLifecycleInitializationParams {
|
|
4
|
+
source: CallLifecycleSource;
|
|
5
|
+
conversationId?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CallLifecycleClock {
|
|
8
|
+
wallNow(): number;
|
|
9
|
+
monotonicNow(): number;
|
|
10
|
+
}
|
|
11
|
+
export declare class CallLifecycleStats {
|
|
12
|
+
private readonly _logger;
|
|
13
|
+
private readonly _clock;
|
|
14
|
+
private _conversationId;
|
|
15
|
+
private _callStartLabel;
|
|
16
|
+
private _lifecycleStartedAtMonotonic;
|
|
17
|
+
private _warmupStartedAtMonotonic;
|
|
18
|
+
private _pendingEvents;
|
|
19
|
+
private _warmupCompleted;
|
|
20
|
+
private _callStarted;
|
|
21
|
+
private _accepted;
|
|
22
|
+
private _firstMediaSent;
|
|
23
|
+
private _finished;
|
|
24
|
+
private _destroyed;
|
|
25
|
+
constructor(logger: StatsLogger, clock?: CallLifecycleClock);
|
|
26
|
+
get firstMediaSentReported(): boolean;
|
|
27
|
+
get terminated(): boolean;
|
|
28
|
+
markInitializationStarted({ source, conversationId }: CallLifecycleInitializationParams): void;
|
|
29
|
+
bindConversationId(conversationId: string): void;
|
|
30
|
+
markWarmupStarted(): void;
|
|
31
|
+
markWarmupCompleted(): void;
|
|
32
|
+
markCallStarted(): void;
|
|
33
|
+
markOutgoingAccepted(): void;
|
|
34
|
+
markIncomingAccepted(concurrent: boolean): void;
|
|
35
|
+
markFirstMediaSent(): void;
|
|
36
|
+
markFinished(reason: unknown): void;
|
|
37
|
+
markTerminated(): void;
|
|
38
|
+
destroy(): void;
|
|
39
|
+
private _canRecord;
|
|
40
|
+
private _durationSince;
|
|
41
|
+
private _finish;
|
|
42
|
+
private _ensureConversationId;
|
|
43
|
+
private _record;
|
|
44
|
+
private _flushPendingEvents;
|
|
45
|
+
private _logEvent;
|
|
46
|
+
}
|
|
@@ -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
|
}
|
|
@@ -43,7 +43,7 @@ export default class DirectTransport extends BaseTransport {
|
|
|
43
43
|
private readonly _logger;
|
|
44
44
|
private readonly _statAggregator;
|
|
45
45
|
private readonly _codecStatsAggregator;
|
|
46
|
-
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);
|
|
47
47
|
get participantId(): ParticipantId;
|
|
48
48
|
updateStatisticsInterval(): void;
|
|
49
49
|
private _isDeadConnection;
|
|
@@ -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,16 @@ 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;
|
|
58
61
|
holdClose(): void;
|
|
59
62
|
setRemoteHold(hold: boolean): void;
|
|
60
63
|
getTopology(): TransportTopology;
|
|
@@ -69,6 +72,8 @@ export declare class Transport extends EventEmitter {
|
|
|
69
72
|
private _setStates;
|
|
70
73
|
private _setLocalState;
|
|
71
74
|
private _onSignalingNotification;
|
|
75
|
+
private _handleFirstMediaSent;
|
|
76
|
+
private _getFirstMediaSentCallback;
|
|
72
77
|
private _onTopologyChanged;
|
|
73
78
|
private _createDirectTransport;
|
|
74
79
|
private _createServerTransport;
|
package/default/Api.d.ts
CHANGED
|
@@ -7,11 +7,10 @@ import { ExternalId, ExternalParticipantId, ExternalUserId } from '../types/Exte
|
|
|
7
7
|
import { CompositeUserId, OkUserId, ParticipantId } from '../types/Participant';
|
|
8
8
|
import PushData from '../types/PushData';
|
|
9
9
|
export default class Api extends BaseApi {
|
|
10
|
-
private _userId;
|
|
11
10
|
private _uuid;
|
|
12
11
|
private _idCache;
|
|
13
12
|
private _callUnsafe;
|
|
14
|
-
protected _call(method: string, data?: any, noSession?: boolean): Promise<any>;
|
|
13
|
+
protected _call(method: string, data?: any, noSession?: boolean, allowReauthorize?: boolean): Promise<any>;
|
|
15
14
|
userId(participantId: ParticipantId): ExternalParticipantId;
|
|
16
15
|
authorize(): Promise<void>;
|
|
17
16
|
private _getAnonymLoginCacheKey;
|
package/default/Signaling.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import BaseSignaling, { AddParticipantParams } from '../abstract/BaseSignaling';
|
|
2
|
-
import StatsLogger from '../classes/StatsLogger';
|
|
3
2
|
import { ParticipantIdRegistry } from '../classes/ParticipantIdRegistry';
|
|
4
3
|
import { SharingStatReport } from '../classes/screenshare/SharingStatReport';
|
|
5
4
|
import { StatAggregator } from '../classes/stat/StatAggregator';
|
|
6
5
|
import { StatPings } from '../classes/stat/StatPings';
|
|
7
6
|
import { StatSignalingCommands } from '../classes/stat/StatSignalingCommands';
|
|
8
|
-
import
|
|
7
|
+
import StatsLogger from '../classes/StatsLogger';
|
|
9
8
|
import ConversationFeature from '../enums/ConversationFeature';
|
|
10
9
|
import ConversationOption from '../enums/ConversationOption';
|
|
11
10
|
import MediaOption from '../enums/MediaOption';
|
|
12
11
|
import SignalingConnectionType from '../enums/SignalingConnectionType';
|
|
12
|
+
import TransportTopology from '../enums/TransportTopology';
|
|
13
13
|
import UserRole from '../enums/UserRole';
|
|
14
14
|
import { type DebugLogger } from '../static/Debug';
|
|
15
15
|
import { JSONObject } from '../static/Json';
|
|
@@ -75,7 +75,7 @@ export default class Signaling extends BaseSignaling {
|
|
|
75
75
|
connect(connectionType: SignalingConnectionType): Promise<SignalingMessage.Connection>;
|
|
76
76
|
getNextCommandSequenceNumber(): number;
|
|
77
77
|
hangup(reason: string): Promise<SignalingMessage | void>;
|
|
78
|
-
sendCandidate(participantId: ParticipantId, candidate:
|
|
78
|
+
sendCandidate(participantId: ParticipantId, candidate: RTCIceCandidateInit): Promise<SignalingMessage>;
|
|
79
79
|
requestTestMode(consumerCommand: string, producerCommand: string | null): Promise<SignalingMessage>;
|
|
80
80
|
sendSdp(participantId: ParticipantId, sdp: RTCSessionDescriptionInit, extraPayload?: Record<string, any>): Promise<SignalingMessage>;
|
|
81
81
|
acceptCall(mediaSettings: MediaSettings): Promise<SignalingMessage>;
|
|
@@ -187,6 +187,8 @@ export default class Signaling extends BaseSignaling {
|
|
|
187
187
|
private _onTransportFailed;
|
|
188
188
|
private _onTransportReconnectScheduled;
|
|
189
189
|
private _onTransportConnectionDead;
|
|
190
|
+
private _attachNotificationCallError;
|
|
191
|
+
private _createSignalingCallError;
|
|
190
192
|
private _getSocketType;
|
|
191
193
|
private _markTransportStat;
|
|
192
194
|
private _logTransportStat;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import SignalingConnectionType from '../enums/SignalingConnectionType';
|
|
2
2
|
import { SignalingTransportType } from '../enums/SignalingTransportStat';
|
|
3
|
+
import { DebugLogger } from '../static/Debug';
|
|
3
4
|
export declare enum SignalingTransportFailure {
|
|
4
5
|
EMPTY_ENDPOINT = "EMPTY_ENDPOINT",
|
|
5
6
|
NETWORK_ERROR = "NETWORK_ERROR",
|
|
@@ -8,6 +9,7 @@ export declare enum SignalingTransportFailure {
|
|
|
8
9
|
export type SignalingTransportFailedEvent = {
|
|
9
10
|
failure: SignalingTransportFailure;
|
|
10
11
|
message: string;
|
|
12
|
+
source: SignalingTransportType;
|
|
11
13
|
remote?: boolean;
|
|
12
14
|
};
|
|
13
15
|
export type SignalingTransportReconnectEvent = {
|
|
@@ -38,7 +40,8 @@ export default class SignalingTransport {
|
|
|
38
40
|
private abortSignal;
|
|
39
41
|
private manualClose;
|
|
40
42
|
private currentType;
|
|
41
|
-
|
|
43
|
+
private readonly _debug;
|
|
44
|
+
constructor(debug: DebugLogger | undefined, handlers: SignalingTransportHandlers);
|
|
42
45
|
get readyState(): number | null;
|
|
43
46
|
get type(): SignalingTransportType;
|
|
44
47
|
setEndpoint(endpoint: string): void;
|
package/enums/HangupType.d.ts
CHANGED
|
@@ -20,7 +20,6 @@ declare enum HangupType {
|
|
|
20
20
|
CALLER_IS_REJECTED = "CALLER_IS_REJECTED",
|
|
21
21
|
UNKNOWN_ERROR = "UNKNOWN_ERROR",
|
|
22
22
|
UNSUPPORTED = "UNSUPPORTED",
|
|
23
|
-
OLD_VERSION = "OLD_VERSION",
|
|
24
23
|
SERVICE_DISABLED = "SERVICE_DISABLED",
|
|
25
24
|
SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
|
|
26
25
|
EXTERNAL_API_ERROR = "EXTERNAL_API_ERROR",
|
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/AuthData.d.ts
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
|
+
import type { OkUserId } from '../types/Participant';
|
|
1
2
|
export default abstract class AuthData {
|
|
2
3
|
private static _sessionKey;
|
|
3
4
|
private static _sessionSecretKey;
|
|
4
5
|
private static _accessToken;
|
|
6
|
+
private static _userId;
|
|
7
|
+
private static _reauthorizePromise;
|
|
5
8
|
static get sessionKey(): string | undefined;
|
|
6
9
|
static set sessionKey(value: string | undefined);
|
|
7
10
|
static get sessionSecretKey(): string | undefined;
|
|
8
11
|
static set sessionSecretKey(value: string | undefined);
|
|
9
12
|
static get accessToken(): string | undefined;
|
|
10
13
|
static set accessToken(value: string | undefined);
|
|
14
|
+
static get userId(): OkUserId | null;
|
|
15
|
+
static set userId(value: OkUserId | null);
|
|
11
16
|
static isEmpty(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Дедуплицирует одновременные попытки реавторизации из разных инстансов Api.
|
|
19
|
+
* Первый вызов выполняет authorizeFn, остальные ждут того же промиса.
|
|
20
|
+
*/
|
|
21
|
+
static reauthorize(authorizeFn: () => Promise<void>): Promise<void>;
|
|
12
22
|
}
|
package/static/Debug.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export type DebugSessionLogger = DebugLogger & {
|
|
|
21
21
|
readonly sessionId: string | null;
|
|
22
22
|
readonly conversationId: string | null;
|
|
23
23
|
setConversationId(conversationId: string | null): void;
|
|
24
|
+
send(type: DebugMessageType, ...args: any[]): void;
|
|
24
25
|
};
|
|
25
26
|
declare namespace Debug {
|
|
26
27
|
type ContextProvider = () => DebugMessageContext;
|
package/static/External.d.ts
CHANGED
|
@@ -637,6 +637,6 @@ declare namespace External {
|
|
|
637
637
|
/**
|
|
638
638
|
* Собеседник подключился к сигналлингу
|
|
639
639
|
*/
|
|
640
|
-
function onPeerRegistered(conversationId?: string): void;
|
|
640
|
+
function onPeerRegistered(conversationId?: string, externalIds?: ExternalId[]): void;
|
|
641
641
|
}
|
|
642
642
|
export default External;
|
package/static/Params.d.ts
CHANGED
|
@@ -485,13 +485,6 @@ export type ParamsObject = {
|
|
|
485
485
|
* _По умолчанию: `false`_
|
|
486
486
|
*/
|
|
487
487
|
webtransport: boolean;
|
|
488
|
-
/**
|
|
489
|
-
* Включить поддержку webtransport для сигналинга в FireFox
|
|
490
|
-
* Отдельная ручка, так как есть проблемы сейчас с FF
|
|
491
|
-
*
|
|
492
|
-
* _По умолчанию: `false`_
|
|
493
|
-
*/
|
|
494
|
-
webtransportFF: boolean;
|
|
495
488
|
/**
|
|
496
489
|
* Ждать подтверждения от бэкенда для команд startStream/stopStream.
|
|
497
490
|
* При включении: reject без соединения, resolve/reject по ответу бэкенда,
|
|
@@ -512,6 +505,16 @@ export type ParamsObject = {
|
|
|
512
505
|
* _По умолчанию: `false`_
|
|
513
506
|
*/
|
|
514
507
|
enableSessionStateUpdates: boolean;
|
|
508
|
+
/**
|
|
509
|
+
* Использовать `<audio>` вместо `<video>` для воспроизведения звука в desktop Safari
|
|
510
|
+
* @hidden
|
|
511
|
+
*/
|
|
512
|
+
safariAudioElement: boolean;
|
|
513
|
+
/**
|
|
514
|
+
* Отправлять пустой ICE candidate (end-of-candidates) удалённому пиру
|
|
515
|
+
* @hidden
|
|
516
|
+
*/
|
|
517
|
+
forwardEmptyIceCandidate: boolean;
|
|
515
518
|
/**
|
|
516
519
|
* Получен локальный стрим с камеры/микрофона
|
|
517
520
|
*/
|
|
@@ -899,7 +902,7 @@ export type ParamsObject = {
|
|
|
899
902
|
/**
|
|
900
903
|
* Собеседник подключился к сигналлингу
|
|
901
904
|
*/
|
|
902
|
-
onPeerRegistered?: (conversationId?: string) => void;
|
|
905
|
+
onPeerRegistered?: (conversationId?: string, externalIds?: ExternalId[]) => void;
|
|
903
906
|
};
|
|
904
907
|
export default abstract class Params {
|
|
905
908
|
private static _params;
|
|
@@ -1031,10 +1034,11 @@ export default abstract class Params {
|
|
|
1031
1034
|
static get enableVideoEffectsFpsDegradation(): boolean;
|
|
1032
1035
|
static get simulcast(): boolean;
|
|
1033
1036
|
static get webtransport(): boolean;
|
|
1034
|
-
static get webtransportFF(): boolean;
|
|
1035
1037
|
static get waitForRecordResponse(): boolean;
|
|
1036
1038
|
static get transparentAudio(): boolean;
|
|
1037
1039
|
static get enableSessionStateUpdates(): boolean;
|
|
1040
|
+
static get safariAudioElement(): boolean;
|
|
1041
|
+
static get forwardEmptyIceCandidate(): boolean;
|
|
1038
1042
|
static toJSON(): {
|
|
1039
1043
|
apiKey: string;
|
|
1040
1044
|
apiEnv: string;
|
|
@@ -1068,9 +1072,10 @@ export default abstract class Params {
|
|
|
1068
1072
|
switchVideoAtBadNetwork: boolean;
|
|
1069
1073
|
simulcast: boolean;
|
|
1070
1074
|
webtransport: boolean;
|
|
1071
|
-
webtransportFF: boolean;
|
|
1072
1075
|
waitForRecordResponse: boolean;
|
|
1073
1076
|
transparentAudio: boolean;
|
|
1074
1077
|
enableSessionStateUpdates: boolean;
|
|
1078
|
+
safariAudioElement: boolean;
|
|
1079
|
+
forwardEmptyIceCandidate: boolean;
|
|
1075
1080
|
};
|
|
1076
1081
|
}
|
package/static/WebRTCUtils.d.ts
CHANGED
|
@@ -122,6 +122,10 @@ declare namespace WebRTCUtils {
|
|
|
122
122
|
* Проверяет поддержку WebRTC браузером
|
|
123
123
|
*/
|
|
124
124
|
function isBrowserSupported(): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Возвращает первую отсутствующую capability в стабильном порядке.
|
|
127
|
+
*/
|
|
128
|
+
function getBrowserSupportFailure(): BrowserSupportFailure | null;
|
|
125
129
|
/**
|
|
126
130
|
* Проверяет поддержку шаринга экрана браузером
|
|
127
131
|
*/
|
|
@@ -149,7 +153,9 @@ declare namespace WebRTCUtils {
|
|
|
149
153
|
*/
|
|
150
154
|
function canPreferH264(): boolean;
|
|
151
155
|
/**
|
|
152
|
-
*
|
|
156
|
+
* Поддержка simulcast браузером.
|
|
157
|
+
* Safari корректно поддерживает simulcast начиная с версии 18.
|
|
158
|
+
* Firefox поддерживает simulcast с VP8 начиная с версии 134.
|
|
153
159
|
*/
|
|
154
160
|
function isSimulcastSupportedByBrowser(): boolean;
|
|
155
161
|
/**
|
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
|
};
|
|
@@ -34,8 +34,11 @@ export type RecordInfo = {
|
|
|
34
34
|
recordExternalOwnerId?: string;
|
|
35
35
|
};
|
|
36
36
|
export interface SignalingResponse extends SignalingMessage {
|
|
37
|
-
response?: SignalingCommandType;
|
|
38
37
|
error?: string;
|
|
38
|
+
errorCode?: string;
|
|
39
|
+
errorMessage?: string;
|
|
40
|
+
message?: string;
|
|
41
|
+
response?: SignalingCommandType;
|
|
39
42
|
reason?: HangupType | FatalError;
|
|
40
43
|
sequence?: number;
|
|
41
44
|
type: 'response' | 'error' | 'timeout';
|