@vkontakte/calls-sdk 2.8.12-dev.26c45af4.0 → 2.8.12-dev.2e0e572e.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 +31 -7
- package/abstract/BaseApi.d.ts +10 -10
- package/abstract/BaseSignaling.d.ts +6 -5
- package/calls-sdk.cjs.js +10 -10
- package/calls-sdk.esm.js +3318 -2383
- package/classes/CallRegistry.d.ts +5 -1
- package/classes/ExternalIdCache.d.ts +11 -12
- package/classes/MediaSource.d.ts +4 -0
- package/classes/StatsLogger.d.ts +17 -2
- package/classes/{Conversation.d.ts → conversation/Conversation.d.ts} +57 -48
- package/classes/conversation/Conversation.testUtils.d.ts +150 -0
- package/classes/{ConversationResponseValidator.d.ts → conversation/ConversationResponseValidator.d.ts} +1 -1
- package/classes/{DisplayLayoutRequester.d.ts → conversation/DisplayLayoutRequester.d.ts} +7 -5
- package/classes/conversation/index.d.ts +1 -0
- package/classes/stat/CallFinishClassifier.d.ts +11 -0
- package/classes/stat/CallLifecycleStats.d.ts +42 -0
- package/classes/stat/ConversationStats.d.ts +5 -4
- package/classes/stat/FirstMediaSentProbe.d.ts +13 -0
- package/classes/stat/StatAggregator.d.ts +4 -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 +2 -1
- package/classes/transport/ServerTransport.d.ts +2 -1
- package/classes/transport/Transport.d.ts +9 -1
- package/default/Api.d.ts +12 -12
- package/default/ApiExternal.d.ts +2 -1
- package/default/Signaling.d.ts +12 -15
- package/default/SignalingTransport.d.ts +10 -2
- package/enums/ClientHangupReason.d.ts +7 -0
- package/enums/HangupType.d.ts +0 -1
- package/enums/Stat.d.ts +5 -1
- package/package.json +3 -3
- package/static/ApiTransport.d.ts +3 -0
- package/static/AuthData.d.ts +10 -0
- package/static/Debug.d.ts +1 -0
- package/static/External.d.ts +11 -1
- package/static/Params.d.ts +35 -11
- package/static/Utils.d.ts +1 -1
- package/static/WebRTCUtils.d.ts +8 -7
- package/types/Api.d.ts +9 -0
- package/types/Conversation.d.ts +12 -2
- package/types/FastHangup.d.ts +66 -0
- package/types/SignalingMessage.d.ts +5 -1
- package/types/WebTransport.d.ts +17 -16
- package/utils/IceServers.d.ts +2 -0
- package/utils/NavigatorPermissions.d.ts +2 -2
|
@@ -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;
|
|
@@ -57,6 +57,7 @@ export default class DirectTransport extends BaseTransport {
|
|
|
57
57
|
private _disposePeerConnection;
|
|
58
58
|
setAnimojiTransport(receiver: AnimojiReceiver, sender: AnimojiSender): void;
|
|
59
59
|
close(error?: Error): void;
|
|
60
|
+
private _finishClose;
|
|
60
61
|
private _setState;
|
|
61
62
|
private _onSignalingNotification;
|
|
62
63
|
private _handleTransmittedData;
|
|
@@ -43,11 +43,12 @@ export default class ServerTransport extends BaseTransport {
|
|
|
43
43
|
private _producerSessionId;
|
|
44
44
|
private _newAudioShareTrack;
|
|
45
45
|
private _simulcastInfo;
|
|
46
|
+
private _isSimulcastNegotiated;
|
|
46
47
|
private readonly _debug;
|
|
47
48
|
private readonly _logger;
|
|
48
49
|
private readonly _statAggregator;
|
|
49
50
|
private readonly _codecStatsAggregator;
|
|
50
|
-
constructor(signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null);
|
|
51
|
+
constructor(signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null, onFirstMediaSent?: (() => void) | null);
|
|
51
52
|
updateStatisticsInterval(): void;
|
|
52
53
|
open(observer?: boolean): void;
|
|
53
54
|
close(error?: Error): void;
|
|
@@ -48,13 +48,17 @@ 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
|
+
private _vadController;
|
|
54
|
+
constructor(topology: TransportTopology, signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null, onFirstMediaSent?: (() => void) | null);
|
|
52
55
|
updateSettings(settings: ServerSettings): void;
|
|
53
56
|
updateStatisticsInterval(): void;
|
|
54
57
|
allocate(participantId: ParticipantId, isMaster?: boolean): void;
|
|
55
58
|
open(participantIds: ParticipantId[], peerId?: string | null, observer?: boolean, force?: boolean): void;
|
|
56
59
|
close(participantId: ParticipantId): void;
|
|
57
60
|
destroy(): void;
|
|
61
|
+
stopFirstMediaSentProbe(): void;
|
|
58
62
|
holdClose(): void;
|
|
59
63
|
setRemoteHold(hold: boolean): void;
|
|
60
64
|
getTopology(): TransportTopology;
|
|
@@ -69,6 +73,8 @@ export declare class Transport extends EventEmitter {
|
|
|
69
73
|
private _setStates;
|
|
70
74
|
private _setLocalState;
|
|
71
75
|
private _onSignalingNotification;
|
|
76
|
+
private _handleFirstMediaSent;
|
|
77
|
+
private _getFirstMediaSentCallback;
|
|
72
78
|
private _onTopologyChanged;
|
|
73
79
|
private _createDirectTransport;
|
|
74
80
|
private _createServerTransport;
|
|
@@ -91,6 +97,8 @@ export declare class Transport extends EventEmitter {
|
|
|
91
97
|
private _onAnimojiStream;
|
|
92
98
|
/** Обработчик, досылающий MediaSourceEvent.SOURCE_CHANGED событие до аллокации транспортов */
|
|
93
99
|
private _onAnimojiStatus;
|
|
100
|
+
private _createVad;
|
|
101
|
+
private _updateVadTrack;
|
|
94
102
|
private _createAnimojiTransport;
|
|
95
103
|
private _removeAnimojiTransport;
|
|
96
104
|
getStreamWaitingTimeMs(streamId: string, targetRtpTimestamp: number): number;
|
package/default/Api.d.ts
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import BaseApi, { ClientStats } from '../abstract/BaseApi';
|
|
2
2
|
import CallType from '../enums/CallType';
|
|
3
3
|
import HangupType from '../enums/HangupType';
|
|
4
|
+
import { IHangupParams } from '../types/Api';
|
|
4
5
|
import ConversationParams from '../types/ConversationParams';
|
|
5
6
|
import ConversationResponse from '../types/ConversationResponse';
|
|
6
7
|
import { ExternalId, ExternalParticipantId, ExternalUserId } from '../types/ExternalId';
|
|
7
|
-
import {
|
|
8
|
+
import { OkUserId, ParticipantId } from '../types/Participant';
|
|
8
9
|
import PushData from '../types/PushData';
|
|
9
10
|
export default class Api extends BaseApi {
|
|
10
|
-
private _userId;
|
|
11
11
|
private _uuid;
|
|
12
12
|
private _idCache;
|
|
13
13
|
private _callUnsafe;
|
|
14
|
-
protected _call(method: string, data?: any, noSession?: boolean): Promise<any>;
|
|
15
|
-
userId(participantId: ParticipantId): ExternalParticipantId;
|
|
14
|
+
protected _call(method: string, data?: any, noSession?: boolean, allowReauthorize?: boolean): Promise<any>;
|
|
15
|
+
userId(participantId: ParticipantId): ExternalParticipantId | null;
|
|
16
16
|
authorize(): Promise<void>;
|
|
17
17
|
private _getAnonymLoginCacheKey;
|
|
18
18
|
private _getCachedAnonymLogin;
|
|
19
19
|
private _setCachedAnonymLogin;
|
|
20
20
|
private _removeCachedAnonymLogin;
|
|
21
|
+
private _reauthorize;
|
|
21
22
|
private _applyAnonymLogin;
|
|
23
|
+
private _sendClientStats;
|
|
22
24
|
logClientStats(items: ClientStats[]): void;
|
|
23
25
|
uploadDebugLogs(conversationId: string, startTime: number, endTime: number, log: string): Promise<void>;
|
|
24
26
|
joinConversation(conversationId: string, isVideo?: boolean, chatId?: string): Promise<ConversationResponse>;
|
|
@@ -46,17 +48,15 @@ export default class Api extends BaseApi {
|
|
|
46
48
|
getAnonymTokenByLink(joinLink: string, username?: string): Promise<string>;
|
|
47
49
|
joinConversationByLink(joinLink: string, isVideo?: boolean, observedIds?: ExternalUserId[], payload?: string): Promise<ConversationResponse>;
|
|
48
50
|
getCachedOkIdByExternalId(externalId: ExternalId): ParticipantId | null;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
getDecorativeIdByInitialId(initialId: OkUserId | CompositeUserId | ParticipantId): OkUserId | undefined;
|
|
55
|
-
replaceByInitialIdIdIfExists(id: OkUserId | CompositeUserId | ParticipantId): OkUserId;
|
|
51
|
+
getCachedExternalIdByParticipantId(participantId: ParticipantId): ExternalParticipantId | null;
|
|
52
|
+
cacheExternalId(participantId: ParticipantId, externalId: ExternalParticipantId): void;
|
|
53
|
+
mapDecorativeId(decorativeId: ParticipantId, initialId: ParticipantId): void;
|
|
54
|
+
unmapDecorativeId(initialId: ParticipantId): void;
|
|
55
|
+
getDecorativeIdByInitialId(initialId: ParticipantId): ParticipantId | undefined;
|
|
56
56
|
getConversationParams(conversationId?: string): Promise<ConversationParams>;
|
|
57
57
|
getUserId(): OkUserId | null;
|
|
58
58
|
setUserId(userId: OkUserId): void;
|
|
59
|
-
hangupConversation(conversationId: string, reason?: HangupType): void;
|
|
59
|
+
hangupConversation(conversationId: string, reason?: HangupType, params?: Partial<IHangupParams>): void;
|
|
60
60
|
removeHistoryRecords(recordIds: number[]): Promise<void>;
|
|
61
61
|
cleanup(): void;
|
|
62
62
|
getServerTime(): Promise<number>;
|
package/default/ApiExternal.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IHangupParams } from '../types/Api';
|
|
1
2
|
import { IAPIBaseUrl, IApiEnv } from '../types/Params';
|
|
2
3
|
export declare class ApiExternal {
|
|
3
4
|
private readonly _uuid;
|
|
@@ -8,5 +9,5 @@ export declare class ApiExternal {
|
|
|
8
9
|
private _sessionKey;
|
|
9
10
|
constructor(apiEvn: IApiEnv, apiKey: string, callToken: string, baseApiUrl?: IAPIBaseUrl);
|
|
10
11
|
authorize(): Promise<boolean>;
|
|
11
|
-
hangupConversation(conversationId: string): Promise<void>;
|
|
12
|
+
hangupConversation(conversationId: string, params?: Partial<IHangupParams>): Promise<void>;
|
|
12
13
|
}
|
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';
|
|
@@ -35,13 +35,13 @@ export default class Signaling extends BaseSignaling {
|
|
|
35
35
|
private datachannelCommandsQueue;
|
|
36
36
|
private incomingCache;
|
|
37
37
|
private responseHandlers;
|
|
38
|
+
private disposed;
|
|
38
39
|
private connectionType;
|
|
39
40
|
private conversationResolve;
|
|
40
41
|
private conversationReject;
|
|
41
42
|
private connected;
|
|
42
43
|
private listenersReady;
|
|
43
44
|
private peerId;
|
|
44
|
-
private conversationId;
|
|
45
45
|
private connectionMessageWaitTimer;
|
|
46
46
|
private participantIdRegistry;
|
|
47
47
|
private producerNotificationDataChannel;
|
|
@@ -60,22 +60,17 @@ export default class Signaling extends BaseSignaling {
|
|
|
60
60
|
setAbortSignal(signal: AbortSignal | undefined): void;
|
|
61
61
|
setEndpoint(endpoint: string): void;
|
|
62
62
|
setWebTransportEndpoint(endpoint: string | null): void;
|
|
63
|
-
setConversationId(conversationId: string): void;
|
|
64
63
|
setParticipantIdRegistry(participantIdRegistry: ParticipantIdRegistry): void;
|
|
65
64
|
setProducerNotificationDataChannel(dataChannel: RTCDataChannel): void;
|
|
66
65
|
setProducerCommandDataChannel(dataChannel: RTCDataChannel): void;
|
|
67
66
|
useCommandDataChannel(status: boolean): void;
|
|
68
|
-
/**
|
|
69
|
-
* Free used resources
|
|
70
|
-
*/
|
|
71
|
-
cleanup(): void;
|
|
72
67
|
/**
|
|
73
68
|
* Open a connection with a signaling server
|
|
74
69
|
*/
|
|
75
70
|
connect(connectionType: SignalingConnectionType): Promise<SignalingMessage.Connection>;
|
|
76
71
|
getNextCommandSequenceNumber(): number;
|
|
77
|
-
hangup(reason: string): Promise<SignalingMessage
|
|
78
|
-
sendCandidate(participantId: ParticipantId, candidate:
|
|
72
|
+
hangup(reason: string): Promise<SignalingMessage>;
|
|
73
|
+
sendCandidate(participantId: ParticipantId, candidate: RTCIceCandidateInit): Promise<SignalingMessage>;
|
|
79
74
|
requestTestMode(consumerCommand: string, producerCommand: string | null): Promise<SignalingMessage>;
|
|
80
75
|
sendSdp(participantId: ParticipantId, sdp: RTCSessionDescriptionInit, extraPayload?: Record<string, any>): Promise<SignalingMessage>;
|
|
81
76
|
acceptCall(mediaSettings: MediaSettings): Promise<SignalingMessage>;
|
|
@@ -138,10 +133,7 @@ export default class Signaling extends BaseSignaling {
|
|
|
138
133
|
acceptPromotion(reject?: boolean): Promise<SignalingMessage>;
|
|
139
134
|
feedback(key: string): Promise<SignalingMessage>;
|
|
140
135
|
getHandQueue(): Promise<SignalingMessage>;
|
|
141
|
-
|
|
142
|
-
* Close a connection with a signaling server
|
|
143
|
-
*/
|
|
144
|
-
close(): void;
|
|
136
|
+
dispose(cause?: Error): void;
|
|
145
137
|
/**
|
|
146
138
|
* Этот метод нужен т.к. после получения сообщения "connected" устанавливается транспорт
|
|
147
139
|
* и подписывается на сигналинг. Данные приходят очень быстро и транспорт пропускает
|
|
@@ -173,20 +165,25 @@ export default class Signaling extends BaseSignaling {
|
|
|
173
165
|
private _onError;
|
|
174
166
|
private _serializeErrorEvent;
|
|
175
167
|
private _onClose;
|
|
176
|
-
private
|
|
168
|
+
private _terminate;
|
|
169
|
+
private _fail;
|
|
177
170
|
private _isRecordCommand;
|
|
178
171
|
private _resolvePendingRecordCommands;
|
|
179
172
|
private _handleCommandResponse;
|
|
180
173
|
private _handleCommandsQueue;
|
|
181
174
|
private _startResponseTimer;
|
|
175
|
+
private _resolveCommandWithoutResponse;
|
|
182
176
|
private _serializeBinary;
|
|
183
177
|
private _serializeJson;
|
|
184
178
|
private _convertDisplayLayout;
|
|
185
179
|
private _waitConnectionMessage;
|
|
186
180
|
private _stopWaitConnectionMessage;
|
|
181
|
+
private _onTransportConnecting;
|
|
187
182
|
private _onTransportFailed;
|
|
188
183
|
private _onTransportReconnectScheduled;
|
|
189
184
|
private _onTransportConnectionDead;
|
|
185
|
+
private _attachNotificationCallError;
|
|
186
|
+
private _createSignalingCallError;
|
|
190
187
|
private _getSocketType;
|
|
191
188
|
private _markTransportStat;
|
|
192
189
|
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,13 +9,19 @@ 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 = {
|
|
14
16
|
count: number;
|
|
15
17
|
delay: number;
|
|
16
18
|
};
|
|
19
|
+
export type SignalingTransportConnectingEvent = {
|
|
20
|
+
connectionType: SignalingConnectionType;
|
|
21
|
+
source: SignalingTransportType;
|
|
22
|
+
};
|
|
17
23
|
export type SignalingTransportHandlers = {
|
|
24
|
+
onConnecting: (event: SignalingTransportConnectingEvent) => void;
|
|
18
25
|
onOpen: () => void;
|
|
19
26
|
onMessage: (event: MessageEvent) => void;
|
|
20
27
|
onError: (event: Event) => void;
|
|
@@ -38,7 +45,8 @@ export default class SignalingTransport {
|
|
|
38
45
|
private abortSignal;
|
|
39
46
|
private manualClose;
|
|
40
47
|
private currentType;
|
|
41
|
-
|
|
48
|
+
private readonly _debug;
|
|
49
|
+
constructor(debug: DebugLogger | undefined, handlers: SignalingTransportHandlers);
|
|
42
50
|
get readyState(): number | null;
|
|
43
51
|
get type(): SignalingTransportType;
|
|
44
52
|
setEndpoint(endpoint: string): void;
|
|
@@ -49,7 +57,7 @@ export default class SignalingTransport {
|
|
|
49
57
|
resetReconnectCount(): void;
|
|
50
58
|
connect(connectionType: SignalingConnectionType): void;
|
|
51
59
|
close(code?: number): void;
|
|
52
|
-
send(data: string | ArrayBuffer): void
|
|
60
|
+
send(data: string | ArrayBuffer): Promise<void>;
|
|
53
61
|
private _connect;
|
|
54
62
|
private _connectWebTransport;
|
|
55
63
|
private _connectWebSocket;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import HangupType from './HangupType';
|
|
2
|
+
/**
|
|
3
|
+
* Причины завершения звонка, которые клиент может передать в {@link hangup}/{@link declineCall}
|
|
4
|
+
* и пробросить в сигналинг без маппинга.
|
|
5
|
+
*/
|
|
6
|
+
export type ClientHangupReason = HangupType.HUNGUP | HangupType.CANCELED | HangupType.REJECTED | HangupType.BUSY | HangupType.MISSED | HangupType.CALL_TIMEOUT;
|
|
7
|
+
export default ClientHangupReason;
|
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,9 @@
|
|
|
1
1
|
declare const enum Stat {
|
|
2
|
+
CALL_INIT = "call_init",
|
|
3
|
+
CALL_START = "call_start",
|
|
4
|
+
CALL_ACCEPTED_OUTGOING = "call_accepted_outgoing",
|
|
5
|
+
CALL_ACCEPTED_INCOMING = "call_accepted_incoming",
|
|
6
|
+
FIRST_MEDIA_SENT = "first_media_sent",
|
|
2
7
|
CALL_FINISH = "call_finish",// событие отправляемое в конце звонка
|
|
3
8
|
CODEC_USAGE = "codec_usage",// событие когда меняется кодек
|
|
4
9
|
SIGNALING_CONNECTED = "signaling_connected",// measure
|
|
@@ -7,7 +12,6 @@ declare const enum Stat {
|
|
|
7
12
|
FIRST_MEDIA_RECEIVED = "first_media_received",
|
|
8
13
|
CALL_DECLINED_OR_HANGED_LOCALLY = "CallDeclinedOrHangedLocally",
|
|
9
14
|
USER_FEEDBACK_RECEIVED = "UserFeedbackReceived",
|
|
10
|
-
CALL_START = "call_start",
|
|
11
15
|
SIGNALING_PING_SUMMARY = "signaling_ping_summary",
|
|
12
16
|
SIGNALING_COMMAND_SUMMARY = "signaling_command_summary",
|
|
13
17
|
WEBSOCKET_CONNECTED = "websocket_connected",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/calls-sdk",
|
|
3
|
-
"version": "2.8.12-dev.
|
|
3
|
+
"version": "2.8.12-dev.2e0e572e.0",
|
|
4
4
|
"author": "vk.com",
|
|
5
5
|
"description": "Library for video calls based on the vk.com platform",
|
|
6
6
|
"homepage": "https://vk.com",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"**/*.d.ts"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@vkontakte/calls-audio-effects": "1.
|
|
17
|
+
"@vkontakte/calls-audio-effects": "1.4.1",
|
|
18
18
|
"@vkontakte/calls-video-effects": "2.2.3-beta.7",
|
|
19
19
|
"@vkontakte/calls-vmoji": "1.0.10-beta.17",
|
|
20
20
|
"@vkontakte/libvpx": "2.0.9",
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
"fflate": "^0.8.2",
|
|
23
23
|
"messagepack": "1.1.12",
|
|
24
24
|
"simple-ebml-builder": "0.2.2",
|
|
25
|
-
"webrtc-adapter": "
|
|
25
|
+
"webrtc-adapter": "9.0.5"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/static/ApiTransport.d.ts
CHANGED
|
@@ -7,4 +7,7 @@ export declare function sendBeakon(method: string, params?: {
|
|
|
7
7
|
export declare function request(method: string, params?: {
|
|
8
8
|
[key: string]: any;
|
|
9
9
|
}, noSession?: boolean, customEndpoint?: string): Promise<any>;
|
|
10
|
+
export declare function requestKeepalive(method: string, params?: {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}, noSession?: boolean): Promise<any>;
|
|
10
13
|
export declare function sendFormData(url: string, data: FormData): Promise<void>;
|
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,16 @@ declare namespace External {
|
|
|
637
637
|
/**
|
|
638
638
|
* Собеседник подключился к сигналлингу
|
|
639
639
|
*/
|
|
640
|
-
function onPeerRegistered(conversationId?: string): void;
|
|
640
|
+
function onPeerRegistered(conversationId?: string, externalIds?: ExternalId[]): void;
|
|
641
|
+
/**
|
|
642
|
+
* SDK обнаружил ошибку, после которой звонок может продолжаться.
|
|
643
|
+
*
|
|
644
|
+
* Callback предназначен для отправки ошибки в клиентский мониторинг.
|
|
645
|
+
* Его вызов не означает завершение звонка.
|
|
646
|
+
*
|
|
647
|
+
* @param error
|
|
648
|
+
* @param conversationId ID звонка
|
|
649
|
+
*/
|
|
650
|
+
function onNonFatalError(error: Error, conversationId: string | null): void;
|
|
641
651
|
}
|
|
642
652
|
export default External;
|
package/static/Params.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { VideoEffects } from '@vkontakte/calls-video-effects';
|
|
2
|
-
import type { EffectVoiceChange } from '@vkontakte/calls-audio-effects';
|
|
2
|
+
import type { EffectVoiceChange, VadControllerOptions, VadLib } from '@vkontakte/calls-audio-effects';
|
|
3
3
|
import type * as Vmoji from '@vkontakte/calls-vmoji';
|
|
4
4
|
import { IAsrData } from '../types/Asr';
|
|
5
5
|
import { ConversationData } from '../types/Conversation';
|
|
@@ -193,6 +193,14 @@ export type ParamsObject = {
|
|
|
193
193
|
* Можно установить позднее методом `setAudioEffects`
|
|
194
194
|
*/
|
|
195
195
|
audioEffects: EffectVoiceChange | null;
|
|
196
|
+
/**
|
|
197
|
+
* Namespace библиотеки VAD из `@vkontakte/calls-audio-effects`.
|
|
198
|
+
*
|
|
199
|
+
* Можно установить методом `setVad`
|
|
200
|
+
*/
|
|
201
|
+
vad: VadLib | null;
|
|
202
|
+
/** Настройки VAD (threshold, hangoverMs, enabled) */
|
|
203
|
+
vadOptions: VadControllerOptions;
|
|
196
204
|
/**
|
|
197
205
|
* Максимальная ширина видео в пикселях для видео эффекта
|
|
198
206
|
*
|
|
@@ -485,13 +493,6 @@ export type ParamsObject = {
|
|
|
485
493
|
* _По умолчанию: `false`_
|
|
486
494
|
*/
|
|
487
495
|
webtransport: boolean;
|
|
488
|
-
/**
|
|
489
|
-
* Включить поддержку webtransport для сигналинга в FireFox
|
|
490
|
-
* Отдельная ручка, так как есть проблемы сейчас с FF
|
|
491
|
-
*
|
|
492
|
-
* _По умолчанию: `false`_
|
|
493
|
-
*/
|
|
494
|
-
webtransportFF: boolean;
|
|
495
496
|
/**
|
|
496
497
|
* Ждать подтверждения от бэкенда для команд startStream/stopStream.
|
|
497
498
|
* При включении: reject без соединения, resolve/reject по ответу бэкенда,
|
|
@@ -512,6 +513,16 @@ export type ParamsObject = {
|
|
|
512
513
|
* _По умолчанию: `false`_
|
|
513
514
|
*/
|
|
514
515
|
enableSessionStateUpdates: boolean;
|
|
516
|
+
/**
|
|
517
|
+
* Использовать `<audio>` вместо `<video>` для воспроизведения звука в desktop Safari
|
|
518
|
+
* @hidden
|
|
519
|
+
*/
|
|
520
|
+
safariAudioElement: boolean;
|
|
521
|
+
/**
|
|
522
|
+
* Отправлять пустой ICE candidate (end-of-candidates) удалённому пиру
|
|
523
|
+
* @hidden
|
|
524
|
+
*/
|
|
525
|
+
forwardEmptyIceCandidate: boolean;
|
|
515
526
|
/**
|
|
516
527
|
* Получен локальный стрим с камеры/микрофона
|
|
517
528
|
*/
|
|
@@ -899,7 +910,14 @@ export type ParamsObject = {
|
|
|
899
910
|
/**
|
|
900
911
|
* Собеседник подключился к сигналлингу
|
|
901
912
|
*/
|
|
902
|
-
onPeerRegistered?: (conversationId?: string) => void;
|
|
913
|
+
onPeerRegistered?: (conversationId?: string, externalIds?: ExternalId[]) => void;
|
|
914
|
+
/**
|
|
915
|
+
* SDK обнаружил ошибку, после которой звонок может продолжаться.
|
|
916
|
+
*
|
|
917
|
+
* Callback предназначен для отправки ошибки в клиентский мониторинг.
|
|
918
|
+
* Его вызов не означает завершение звонка.
|
|
919
|
+
*/
|
|
920
|
+
onNonFatalError?: (error: Error, conversationId: string | null) => void;
|
|
903
921
|
};
|
|
904
922
|
export default abstract class Params {
|
|
905
923
|
private static _params;
|
|
@@ -967,6 +985,10 @@ export default abstract class Params {
|
|
|
967
985
|
static get displaySurface(): DisplayCaptureSurfaceType;
|
|
968
986
|
static get audioEffects(): EffectVoiceChange | null;
|
|
969
987
|
static set audioEffects(value: EffectVoiceChange | null);
|
|
988
|
+
static get vad(): VadLib | null;
|
|
989
|
+
static set vad(value: VadLib | null);
|
|
990
|
+
static get vadOptions(): VadControllerOptions;
|
|
991
|
+
static set vadOptions(value: VadControllerOptions);
|
|
970
992
|
static get videoEffects(): VideoEffects | null;
|
|
971
993
|
static set videoEffects(value: VideoEffects | null);
|
|
972
994
|
static get videoEffectMaxWidth(): number;
|
|
@@ -1031,10 +1053,11 @@ export default abstract class Params {
|
|
|
1031
1053
|
static get enableVideoEffectsFpsDegradation(): boolean;
|
|
1032
1054
|
static get simulcast(): boolean;
|
|
1033
1055
|
static get webtransport(): boolean;
|
|
1034
|
-
static get webtransportFF(): boolean;
|
|
1035
1056
|
static get waitForRecordResponse(): boolean;
|
|
1036
1057
|
static get transparentAudio(): boolean;
|
|
1037
1058
|
static get enableSessionStateUpdates(): boolean;
|
|
1059
|
+
static get safariAudioElement(): boolean;
|
|
1060
|
+
static get forwardEmptyIceCandidate(): boolean;
|
|
1038
1061
|
static toJSON(): {
|
|
1039
1062
|
apiKey: string;
|
|
1040
1063
|
apiEnv: string;
|
|
@@ -1068,9 +1091,10 @@ export default abstract class Params {
|
|
|
1068
1091
|
switchVideoAtBadNetwork: boolean;
|
|
1069
1092
|
simulcast: boolean;
|
|
1070
1093
|
webtransport: boolean;
|
|
1071
|
-
webtransportFF: boolean;
|
|
1072
1094
|
waitForRecordResponse: boolean;
|
|
1073
1095
|
transparentAudio: boolean;
|
|
1074
1096
|
enableSessionStateUpdates: boolean;
|
|
1097
|
+
safariAudioElement: boolean;
|
|
1098
|
+
forwardEmptyIceCandidate: boolean;
|
|
1075
1099
|
};
|
|
1076
1100
|
}
|
package/static/Utils.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const DEVICE_IDX_PARAMETER = "d";
|
|
|
9
9
|
/** @hidden */
|
|
10
10
|
declare namespace Utils {
|
|
11
11
|
function patchLocalSDP(sdp: string, preferH264: boolean, brokenH264Decoder: boolean, preferVP9: boolean, isAudioNack?: boolean): string;
|
|
12
|
-
function patchRemoteSDP(sdp: string,
|
|
12
|
+
function patchRemoteSDP(sdp: string, preferH264: boolean, brokenH264: boolean, preferVP9: boolean, brokenVP9Encoder: boolean, brokenVP9Decoder: boolean): string;
|
|
13
13
|
function getPeerIdString(peerId: SignalingMessage.PeerId): string;
|
|
14
14
|
function comparePeerId(peerId1: SignalingMessage.PeerId, peerId2: SignalingMessage.PeerId): boolean;
|
|
15
15
|
function getPeerConnectionHostInfo(pc: RTCPeerConnection): Promise<{
|
package/static/WebRTCUtils.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare enum FacingMode {
|
|
|
20
20
|
/**
|
|
21
21
|
* Известные браузеры
|
|
22
22
|
*/
|
|
23
|
-
export type BrowserName = '
|
|
23
|
+
export type BrowserName = 'Edge' | 'Chrome' | 'Firefox' | 'Yandex' | 'Opera' | 'Sferum';
|
|
24
24
|
declare namespace WebRTCUtils {
|
|
25
25
|
/**
|
|
26
26
|
* До вызова этого метода бесполезно опрашивать другие публичные методы.
|
|
@@ -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
|
*/
|
|
@@ -139,17 +143,14 @@ declare namespace WebRTCUtils {
|
|
|
139
143
|
* В некоторых браузерах VP9 decoder сломан
|
|
140
144
|
*/
|
|
141
145
|
function isBrokenVP9Decoder(): boolean;
|
|
142
|
-
/**
|
|
143
|
-
* Изменился формат описания датаканала в SDP
|
|
144
|
-
* @link https://blog.mozilla.org/webrtc/how-to-avoid-data-channel-breaking/
|
|
145
|
-
*/
|
|
146
|
-
function isOldDataChannelDescription(): boolean;
|
|
147
146
|
/**
|
|
148
147
|
* Может ли браузер делать H264 приоритетным
|
|
149
148
|
*/
|
|
150
149
|
function canPreferH264(): boolean;
|
|
151
150
|
/**
|
|
152
|
-
*
|
|
151
|
+
* Поддержка simulcast браузером.
|
|
152
|
+
* Safari корректно поддерживает simulcast начиная с версии 18.
|
|
153
|
+
* Firefox поддерживает simulcast с VP8 начиная с версии 134.
|
|
153
154
|
*/
|
|
154
155
|
function isSimulcastSupportedByBrowser(): boolean;
|
|
155
156
|
/**
|
package/types/Api.d.ts
ADDED
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
|
};
|