@vkontakte/calls-sdk 2.8.12-dev.dd6d67c5.0 → 2.8.12-dev.dd833275.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 +36 -7
- package/abstract/BaseApi.d.ts +14 -9
- package/abstract/BaseSignaling.d.ts +10 -5
- package/calls-sdk.cjs.js +7 -13
- package/calls-sdk.esm.js +3235 -1909
- package/classes/AudioFix.d.ts +2 -2
- package/classes/AudioOutput.d.ts +2 -2
- package/classes/CallRegistry.d.ts +5 -1
- package/classes/ExternalIdCache.d.ts +1 -0
- package/classes/MediaSource.d.ts +6 -2
- package/classes/SpecListener.d.ts +2 -2
- package/classes/codec/LibVPxDecoder.d.ts +2 -2
- package/classes/codec/LibVPxEncoder.d.ts +2 -2
- package/classes/codec/WebCodecsDecoder.d.ts +2 -2
- package/classes/codec/WebCodecsEncoder.d.ts +2 -2
- package/classes/codec/WorkerBase.d.ts +3 -3
- package/classes/{Conversation.d.ts → conversation/Conversation.d.ts} +52 -36
- package/classes/conversation/Conversation.testUtils.d.ts +148 -0
- package/classes/{ConversationResponseValidator.d.ts → conversation/ConversationResponseValidator.d.ts} +1 -1
- package/classes/{DisplayLayoutRequester.d.ts → conversation/DisplayLayoutRequester.d.ts} +4 -4
- package/classes/conversation/index.d.ts +1 -0
- package/classes/screenshare/ScreenCaptureReceiver.d.ts +2 -2
- package/classes/screenshare/ScreenCaptureSender.d.ts +2 -2
- package/classes/screenshare/StreamBuilder.d.ts +2 -2
- package/classes/stat/CallFinishClassifier.d.ts +11 -0
- package/classes/stat/CallLifecycleStats.d.ts +3 -8
- package/classes/stat/CodecStatsAggregator.d.ts +2 -2
- package/classes/stat/ConversationStats.d.ts +19 -4
- package/classes/stat/StatAggregator.d.ts +6 -2
- package/classes/stat/StatClock.d.ts +34 -0
- package/classes/stat/StatDrainScheduler.d.ts +121 -0
- package/classes/stat/StatEventCollector.d.ts +54 -0
- package/classes/stat/StatPings.d.ts +2 -2
- package/classes/stat/StatQueue.d.ts +82 -0
- package/classes/stat/StatSignalingCommands.d.ts +2 -2
- package/classes/stat/StatUnloadJournal.d.ts +39 -0
- package/classes/transport/DirectTransport.d.ts +3 -2
- package/classes/transport/PerfStatReporter.d.ts +2 -0
- package/classes/transport/ServerTransport.d.ts +3 -6
- package/classes/transport/SimulcastSender.d.ts +31 -0
- package/classes/transport/Transport.d.ts +5 -2
- package/default/Api.d.ts +28 -4
- package/default/ApiExternal.d.ts +2 -1
- package/default/Signaling.d.ts +14 -16
- package/default/SignalingTransport.d.ts +7 -1
- package/enums/ClientHangupReason.d.ts +7 -0
- package/enums/HangupType.d.ts +0 -1
- package/enums/SessionError.d.ts +15 -0
- package/enums/Stat.d.ts +0 -1
- package/package.json +3 -3
- package/static/ApiTransport.d.ts +7 -0
- package/static/AuthData.d.ts +10 -0
- package/static/External.d.ts +1 -1
- package/static/Params.d.ts +42 -2
- package/static/ParticipantConnectionStatusUtils.d.ts +1 -0
- package/static/Sdp.d.ts +3 -0
- package/static/SessionStore.d.ts +38 -0
- package/static/SignalingCapabilities.d.ts +1 -1
- package/static/SimulcastInfo.d.ts +5 -3
- package/static/Utils.d.ts +1 -2
- package/static/WebRTCUtils.d.ts +13 -12
- package/types/Api.d.ts +9 -0
- package/types/Capabilities.d.ts +1 -0
- package/types/ExternalId.d.ts +1 -2
- package/types/FastHangup.d.ts +66 -0
- package/types/Participant.d.ts +1 -0
- package/types/PerfStatReporter.d.ts +0 -4
- package/types/SignalingCommand.d.ts +2 -0
- package/types/SignalingMessage.d.ts +5 -1
- package/types/WebTransport.d.ts +14 -15
- package/utils/IceServers.d.ts +2 -0
- package/utils/NavigatorPermissions.d.ts +2 -2
- package/utils/SerializeLatest.d.ts +5 -0
- package/classes/StatsLogger.d.ts +0 -41
package/default/Api.d.ts
CHANGED
|
@@ -1,25 +1,49 @@
|
|
|
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
8
|
import { CompositeUserId, 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>;
|
|
14
|
+
protected _call(method: string, data?: any, noSession?: boolean, allowReauthorize?: boolean): Promise<any>;
|
|
15
15
|
userId(participantId: ParticipantId): ExternalParticipantId;
|
|
16
16
|
authorize(): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Запрос auth.anonymLogin без побочных эффектов: ничего не пишет в
|
|
19
|
+
* AuthData и кэш. Пустой токен — анонимный логин версии 2.
|
|
20
|
+
*/
|
|
21
|
+
private _anonymLogin;
|
|
17
22
|
private _getAnonymLoginCacheKey;
|
|
18
23
|
private _getCachedAnonymLogin;
|
|
19
24
|
private _setCachedAnonymLogin;
|
|
20
25
|
private _removeCachedAnonymLogin;
|
|
26
|
+
private _reauthorize;
|
|
21
27
|
private _applyAnonymLogin;
|
|
22
|
-
|
|
28
|
+
private _buildClientStatsData;
|
|
29
|
+
/**
|
|
30
|
+
* Ошибки по отдельным событиям логируются, но не влияют на результат:
|
|
31
|
+
* батч трактуется целиком, иначе одно всегда отвергаемое событие
|
|
32
|
+
* залипило бы очередь навсегда.
|
|
33
|
+
*/
|
|
34
|
+
private _reportClientStatsItemErrors;
|
|
35
|
+
/**
|
|
36
|
+
* noSession = true: _prepareQuery не подставит session_key из AuthData,
|
|
37
|
+
* наш явный ключ останется; application_key добавится как обычно.
|
|
38
|
+
*/
|
|
39
|
+
private _sendClientStatsWith;
|
|
40
|
+
/**
|
|
41
|
+
* Бекенд присылает 200 в любой ситуации, нужно читать тело.
|
|
42
|
+
* В теле есть ошибки если есть проблемы со статой.
|
|
43
|
+
*/
|
|
44
|
+
private _sendClientStats;
|
|
45
|
+
logClientStats(items: ClientStats[]): Promise<void>;
|
|
46
|
+
logClientStatsWith(sessionKey: string, items: ClientStats[]): Promise<void>;
|
|
23
47
|
uploadDebugLogs(conversationId: string, startTime: number, endTime: number, log: string): Promise<void>;
|
|
24
48
|
joinConversation(conversationId: string, isVideo?: boolean, chatId?: string): Promise<ConversationResponse>;
|
|
25
49
|
createConversation(conversationId: string, payload?: string, requireAuthToJoin?: boolean, { onlyAdminCanShareMovie, audienceMode, audioOnly, waitForAdmin, closedConversation, }?: {
|
|
@@ -56,7 +80,7 @@ export default class Api extends BaseApi {
|
|
|
56
80
|
getConversationParams(conversationId?: string): Promise<ConversationParams>;
|
|
57
81
|
getUserId(): OkUserId | null;
|
|
58
82
|
setUserId(userId: OkUserId): void;
|
|
59
|
-
hangupConversation(conversationId: string, reason?: HangupType): void;
|
|
83
|
+
hangupConversation(conversationId: string, reason?: HangupType, params?: Partial<IHangupParams>): void;
|
|
60
84
|
removeHistoryRecords(recordIds: number[]): Promise<void>;
|
|
61
85
|
cleanup(): void;
|
|
62
86
|
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 StatEventCollector from '../classes/stat/StatEventCollector';
|
|
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;
|
|
@@ -56,26 +56,22 @@ export default class Signaling extends BaseSignaling {
|
|
|
56
56
|
private static get WAIT_CONNECTION_DELAY();
|
|
57
57
|
private static get WAIT_RESPONSE_DELAY();
|
|
58
58
|
get ready(): boolean;
|
|
59
|
-
constructor(debug?: DebugLogger, logger?:
|
|
59
|
+
constructor(debug?: DebugLogger, logger?: StatEventCollector | null, statAggregator?: StatAggregator | null, statPings?: StatPings | null, statSignalingCommands?: StatSignalingCommands | null);
|
|
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;
|
|
67
|
+
resetProducerConnection(cause?: Error): void;
|
|
72
68
|
/**
|
|
73
69
|
* Open a connection with a signaling server
|
|
74
70
|
*/
|
|
75
71
|
connect(connectionType: SignalingConnectionType): Promise<SignalingMessage.Connection>;
|
|
76
72
|
getNextCommandSequenceNumber(): number;
|
|
77
|
-
hangup(reason: string): Promise<SignalingMessage
|
|
78
|
-
sendCandidate(participantId: ParticipantId, candidate:
|
|
73
|
+
hangup(reason: string): Promise<SignalingMessage>;
|
|
74
|
+
sendCandidate(participantId: ParticipantId, candidate: RTCIceCandidateInit): Promise<SignalingMessage>;
|
|
79
75
|
requestTestMode(consumerCommand: string, producerCommand: string | null): Promise<SignalingMessage>;
|
|
80
76
|
sendSdp(participantId: ParticipantId, sdp: RTCSessionDescriptionInit, extraPayload?: Record<string, any>): Promise<SignalingMessage>;
|
|
81
77
|
acceptCall(mediaSettings: MediaSettings): Promise<SignalingMessage>;
|
|
@@ -138,10 +134,7 @@ export default class Signaling extends BaseSignaling {
|
|
|
138
134
|
acceptPromotion(reject?: boolean): Promise<SignalingMessage>;
|
|
139
135
|
feedback(key: string): Promise<SignalingMessage>;
|
|
140
136
|
getHandQueue(): Promise<SignalingMessage>;
|
|
141
|
-
|
|
142
|
-
* Close a connection with a signaling server
|
|
143
|
-
*/
|
|
144
|
-
close(): void;
|
|
137
|
+
dispose(cause?: Error): void;
|
|
145
138
|
/**
|
|
146
139
|
* Этот метод нужен т.к. после получения сообщения "connected" устанавливается транспорт
|
|
147
140
|
* и подписывается на сигналинг. Данные приходят очень быстро и транспорт пропускает
|
|
@@ -173,20 +166,25 @@ export default class Signaling extends BaseSignaling {
|
|
|
173
166
|
private _onError;
|
|
174
167
|
private _serializeErrorEvent;
|
|
175
168
|
private _onClose;
|
|
176
|
-
private
|
|
169
|
+
private _terminate;
|
|
170
|
+
private _fail;
|
|
177
171
|
private _isRecordCommand;
|
|
178
172
|
private _resolvePendingRecordCommands;
|
|
179
173
|
private _handleCommandResponse;
|
|
180
174
|
private _handleCommandsQueue;
|
|
181
175
|
private _startResponseTimer;
|
|
176
|
+
private _resolveCommandWithoutResponse;
|
|
182
177
|
private _serializeBinary;
|
|
183
178
|
private _serializeJson;
|
|
184
179
|
private _convertDisplayLayout;
|
|
185
180
|
private _waitConnectionMessage;
|
|
186
181
|
private _stopWaitConnectionMessage;
|
|
182
|
+
private _onTransportConnecting;
|
|
187
183
|
private _onTransportFailed;
|
|
188
184
|
private _onTransportReconnectScheduled;
|
|
189
185
|
private _onTransportConnectionDead;
|
|
186
|
+
private _attachNotificationCallError;
|
|
187
|
+
private _createSignalingCallError;
|
|
190
188
|
private _getSocketType;
|
|
191
189
|
private _markTransportStat;
|
|
192
190
|
private _logTransportStat;
|
|
@@ -9,13 +9,19 @@ export declare enum SignalingTransportFailure {
|
|
|
9
9
|
export type SignalingTransportFailedEvent = {
|
|
10
10
|
failure: SignalingTransportFailure;
|
|
11
11
|
message: string;
|
|
12
|
+
source: SignalingTransportType;
|
|
12
13
|
remote?: boolean;
|
|
13
14
|
};
|
|
14
15
|
export type SignalingTransportReconnectEvent = {
|
|
15
16
|
count: number;
|
|
16
17
|
delay: number;
|
|
17
18
|
};
|
|
19
|
+
export type SignalingTransportConnectingEvent = {
|
|
20
|
+
connectionType: SignalingConnectionType;
|
|
21
|
+
source: SignalingTransportType;
|
|
22
|
+
};
|
|
18
23
|
export type SignalingTransportHandlers = {
|
|
24
|
+
onConnecting: (event: SignalingTransportConnectingEvent) => void;
|
|
19
25
|
onOpen: () => void;
|
|
20
26
|
onMessage: (event: MessageEvent) => void;
|
|
21
27
|
onError: (event: Event) => void;
|
|
@@ -51,7 +57,7 @@ export default class SignalingTransport {
|
|
|
51
57
|
resetReconnectCount(): void;
|
|
52
58
|
connect(connectionType: SignalingConnectionType): void;
|
|
53
59
|
close(code?: number): void;
|
|
54
|
-
send(data: string | ArrayBuffer): void
|
|
60
|
+
send(data: string | ArrayBuffer): Promise<void>;
|
|
55
61
|
private _connect;
|
|
56
62
|
private _connectWebTransport;
|
|
57
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",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Коды ошибок сессии API
|
|
3
|
+
*/
|
|
4
|
+
declare enum SessionError {
|
|
5
|
+
PARAM_SESSION_EXPIRED = 102,
|
|
6
|
+
PARAM_SESSION_KEY = 103,
|
|
7
|
+
PARAM_SIGNATURE = 104,
|
|
8
|
+
AUTH_LOGIN = 401
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Ошибки, после которых имеет смысл переавторизоваться: сессия протухла или
|
|
12
|
+
* подпись не сошлась. 401 сюда не входит — там протух токен хоста.
|
|
13
|
+
*/
|
|
14
|
+
export declare function isSessionErrorCode(code: unknown): boolean;
|
|
15
|
+
export default SessionError;
|
package/enums/Stat.d.ts
CHANGED
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.dd833275.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
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { IAPIBaseUrl, IApiEnv } from '../types/Params';
|
|
2
2
|
export declare function resetApiEndpoint(): void;
|
|
3
|
+
/**
|
|
4
|
+
* Убираем слэш на конце
|
|
5
|
+
*/
|
|
6
|
+
export declare function sanitizeApiBaseUrl(url: IAPIBaseUrl): IAPIBaseUrl;
|
|
3
7
|
export declare function _resolveApiEndpoint(apiBaseUrl?: IAPIBaseUrl, apiEnv?: IApiEnv): Promise<string>;
|
|
4
8
|
export declare function sendBeakon(method: string, params?: {
|
|
5
9
|
[key: string]: any;
|
|
@@ -7,4 +11,7 @@ export declare function sendBeakon(method: string, params?: {
|
|
|
7
11
|
export declare function request(method: string, params?: {
|
|
8
12
|
[key: string]: any;
|
|
9
13
|
}, noSession?: boolean, customEndpoint?: string): Promise<any>;
|
|
14
|
+
export declare function requestKeepalive(method: string, params?: {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}, noSession?: boolean): Promise<any>;
|
|
10
17
|
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/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
|
@@ -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';
|
|
@@ -37,6 +37,18 @@ export type ParamsObject = {
|
|
|
37
37
|
platform: string;
|
|
38
38
|
/** @hidden */
|
|
39
39
|
clientStatsPlatform: string;
|
|
40
|
+
/**
|
|
41
|
+
* Автоматически запускать отправку клиентской статистики при `init()`.
|
|
42
|
+
*
|
|
43
|
+
* Если `false`, события звонков продолжают копиться в IndexedDB, но в сеть
|
|
44
|
+
* не уходят, пока хост не вызовет `startStats()`. Так хост может прогреть
|
|
45
|
+
* приложение, не нагружая сеть. До старта неактивен и fallback прямой
|
|
46
|
+
* отправки при недоступном хранилище. Если `startStats()` не вызвать
|
|
47
|
+
* никогда, очередь дорастёт до лимита и начнёт вытеснять старые звонки.
|
|
48
|
+
*
|
|
49
|
+
* _По умолчанию: `true`_
|
|
50
|
+
*/
|
|
51
|
+
autoStartStats: boolean;
|
|
40
52
|
/** @hidden */
|
|
41
53
|
clientType: string;
|
|
42
54
|
/** @hidden */
|
|
@@ -193,6 +205,14 @@ export type ParamsObject = {
|
|
|
193
205
|
* Можно установить позднее методом `setAudioEffects`
|
|
194
206
|
*/
|
|
195
207
|
audioEffects: EffectVoiceChange | null;
|
|
208
|
+
/**
|
|
209
|
+
* Namespace библиотеки VAD из `@vkontakte/calls-audio-effects`.
|
|
210
|
+
*
|
|
211
|
+
* Можно установить методом `setVad`
|
|
212
|
+
*/
|
|
213
|
+
vad: VadLib | null;
|
|
214
|
+
/** Настройки VAD (threshold, hangoverMs, enabled) */
|
|
215
|
+
vadOptions: VadControllerOptions;
|
|
196
216
|
/**
|
|
197
217
|
* Максимальная ширина видео в пикселях для видео эффекта
|
|
198
218
|
*
|
|
@@ -505,6 +525,16 @@ export type ParamsObject = {
|
|
|
505
525
|
* _По умолчанию: `false`_
|
|
506
526
|
*/
|
|
507
527
|
enableSessionStateUpdates: boolean;
|
|
528
|
+
/**
|
|
529
|
+
* Использовать `<audio>` вместо `<video>` для воспроизведения звука в desktop Safari
|
|
530
|
+
* @hidden
|
|
531
|
+
*/
|
|
532
|
+
safariAudioElement: boolean;
|
|
533
|
+
/**
|
|
534
|
+
* Отправлять пустой ICE candidate (end-of-candidates) удалённому пиру
|
|
535
|
+
* @hidden
|
|
536
|
+
*/
|
|
537
|
+
forwardEmptyIceCandidate: boolean;
|
|
508
538
|
/**
|
|
509
539
|
* Получен локальный стрим с камеры/микрофона
|
|
510
540
|
*/
|
|
@@ -892,7 +922,7 @@ export type ParamsObject = {
|
|
|
892
922
|
/**
|
|
893
923
|
* Собеседник подключился к сигналлингу
|
|
894
924
|
*/
|
|
895
|
-
onPeerRegistered?: (conversationId?: string) => void;
|
|
925
|
+
onPeerRegistered?: (conversationId?: string, externalIds?: ExternalId[]) => void;
|
|
896
926
|
};
|
|
897
927
|
export default abstract class Params {
|
|
898
928
|
private static _params;
|
|
@@ -910,6 +940,7 @@ export default abstract class Params {
|
|
|
910
940
|
static set platform(value: string);
|
|
911
941
|
static get clientStatsPlatform(): string;
|
|
912
942
|
static set clientStatsPlatform(value: string);
|
|
943
|
+
static get autoStartStats(): boolean;
|
|
913
944
|
static get clientType(): string;
|
|
914
945
|
static set clientType(value: string);
|
|
915
946
|
static get externalUserType(): string;
|
|
@@ -960,6 +991,10 @@ export default abstract class Params {
|
|
|
960
991
|
static get displaySurface(): DisplayCaptureSurfaceType;
|
|
961
992
|
static get audioEffects(): EffectVoiceChange | null;
|
|
962
993
|
static set audioEffects(value: EffectVoiceChange | null);
|
|
994
|
+
static get vad(): VadLib | null;
|
|
995
|
+
static set vad(value: VadLib | null);
|
|
996
|
+
static get vadOptions(): VadControllerOptions;
|
|
997
|
+
static set vadOptions(value: VadControllerOptions);
|
|
963
998
|
static get videoEffects(): VideoEffects | null;
|
|
964
999
|
static set videoEffects(value: VideoEffects | null);
|
|
965
1000
|
static get videoEffectMaxWidth(): number;
|
|
@@ -1027,6 +1062,8 @@ export default abstract class Params {
|
|
|
1027
1062
|
static get waitForRecordResponse(): boolean;
|
|
1028
1063
|
static get transparentAudio(): boolean;
|
|
1029
1064
|
static get enableSessionStateUpdates(): boolean;
|
|
1065
|
+
static get safariAudioElement(): boolean;
|
|
1066
|
+
static get forwardEmptyIceCandidate(): boolean;
|
|
1030
1067
|
static toJSON(): {
|
|
1031
1068
|
apiKey: string;
|
|
1032
1069
|
apiEnv: string;
|
|
@@ -1056,6 +1093,7 @@ export default abstract class Params {
|
|
|
1056
1093
|
movieShare: boolean;
|
|
1057
1094
|
clientType: string;
|
|
1058
1095
|
clientStatsPlatform: string;
|
|
1096
|
+
autoStartStats: boolean;
|
|
1059
1097
|
consumerScreenDataChannelPacketSize: number;
|
|
1060
1098
|
switchVideoAtBadNetwork: boolean;
|
|
1061
1099
|
simulcast: boolean;
|
|
@@ -1063,5 +1101,7 @@ export default abstract class Params {
|
|
|
1063
1101
|
waitForRecordResponse: boolean;
|
|
1064
1102
|
transparentAudio: boolean;
|
|
1065
1103
|
enableSessionStateUpdates: boolean;
|
|
1104
|
+
safariAudioElement: boolean;
|
|
1105
|
+
forwardEmptyIceCandidate: boolean;
|
|
1066
1106
|
};
|
|
1067
1107
|
}
|
|
@@ -11,6 +11,7 @@ declare namespace ParticipantConnectionStatusUtils {
|
|
|
11
11
|
function computeEffective(status: ParticipantConnectionStatus): ParticipantStatus;
|
|
12
12
|
function setSessionState(status: ParticipantConnectionStatus, sessionState?: ParticipantSessionState, sessionStateConnectedBySpeaker?: boolean): StatusTransition;
|
|
13
13
|
function setTransport(status: ParticipantConnectionStatus, transport: ParticipantStatus): StatusTransition;
|
|
14
|
+
function setStalled(status: ParticipantConnectionStatus, stalled: boolean): StatusTransition;
|
|
14
15
|
function setSessionStateApplicable(status: ParticipantConnectionStatus, applicable: boolean): StatusTransition;
|
|
15
16
|
}
|
|
16
17
|
export default ParticipantConnectionStatusUtils;
|
package/static/Sdp.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export type StoredSession = {
|
|
2
|
+
sessionKey: string;
|
|
3
|
+
/** Ключ окружения на момент сохранения, см. currentEndpoint(). */
|
|
4
|
+
endpoint: string;
|
|
5
|
+
savedAt: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Снимки сессий по uid на диске. В памяти сессия текущего пользователя —
|
|
9
|
+
* AuthData; здесь — то, что SDK видел раньше.
|
|
10
|
+
*
|
|
11
|
+
* Это снимок: он может быть протухшим, переавторизовать его извне нельзя.
|
|
12
|
+
* Годится только для отложенных best-effort задач (например, досылка
|
|
13
|
+
* статистики). Живые запросы звонка им подписывать нельзя.
|
|
14
|
+
*
|
|
15
|
+
* Хранится только session_key: секрет сессии транспорту не нужен, а токен
|
|
16
|
+
* хоста незачем — протухший снимок не переавторизуется, а выбрасывается.
|
|
17
|
+
*/
|
|
18
|
+
export default abstract class SessionStore {
|
|
19
|
+
static remember(uid: number, session: {
|
|
20
|
+
sessionKey: string;
|
|
21
|
+
endpoint: string;
|
|
22
|
+
}): void;
|
|
23
|
+
static get(uid: number): StoredSession | null;
|
|
24
|
+
static forget(uid: number): void;
|
|
25
|
+
/** Удаляет записи старше MAX_AGE_MS. */
|
|
26
|
+
static prune(now?: number): void;
|
|
27
|
+
/**
|
|
28
|
+
* Ключ окружения: сессия прода не должна улететь на тестовый кластер.
|
|
29
|
+
* Синхронный, в отличие от резолва endpoint в транспорте.
|
|
30
|
+
*
|
|
31
|
+
* Адрес нормализуется так же, как в транспорте: иначе снимок, сделанный
|
|
32
|
+
* при apiBaseUrl со слэшем на конце, не совпал бы сам с собой.
|
|
33
|
+
*/
|
|
34
|
+
static currentEndpoint(): string;
|
|
35
|
+
private static _read;
|
|
36
|
+
private static _write;
|
|
37
|
+
private static _isValid;
|
|
38
|
+
}
|
|
@@ -6,8 +6,10 @@ export declare const SIMULCAST_DEFAULT: {
|
|
|
6
6
|
BITRATE: number;
|
|
7
7
|
};
|
|
8
8
|
export declare const SIMULCAST_SCALABILITY_MODE = "L1T2";
|
|
9
|
-
export declare const MAP_RID_TO_SCALE_RESOLUTION_DOWN_BY: Record<string, number>;
|
|
10
9
|
export declare function isEqualSimulcastInfo(si1: ISimulcastInfo | null, si2: ISimulcastInfo | null): boolean;
|
|
11
10
|
export declare function findBitrateAsc(maxDimension: number, bitrates: VideoBitrateSettings[]): number;
|
|
12
|
-
export declare function calculateSimulcastInfo(width?: number, height?: number, bitrates?: VideoBitrateSettings[]):
|
|
13
|
-
|
|
11
|
+
export declare function calculateSimulcastInfo(width?: number, height?: number, bitrates?: VideoBitrateSettings[], fps?: number): {
|
|
12
|
+
streams: import("../types/SimulcastInfo").SimulcastStreamInfo[];
|
|
13
|
+
};
|
|
14
|
+
export declare function findScaleResolutionDownBy(rid: string | undefined, simulcastInfo: ISimulcastInfo): number;
|
|
15
|
+
export declare function applySimulcastInfoToEncodings(encodings: RTCRtpEncodingParameters[], simulcastInfo: ISimulcastInfo, maxDimension?: number, maxBitrate?: number): void;
|
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<{
|
|
@@ -77,6 +77,5 @@ declare namespace Utils {
|
|
|
77
77
|
function objectReduce<R, T extends object>(obj: T, callback: (acc: R, value: T[keyof T], key: keyof T) => R, initialValue: R): R;
|
|
78
78
|
const setImmediate: (fn: VoidFunction) => VoidFunction;
|
|
79
79
|
function isObject(obj: unknown): obj is object;
|
|
80
|
-
function patchSimulcastAnswerSdp(sdp: string, trans: RTCRtpTransceiver, width: number, height: number): string;
|
|
81
80
|
}
|
|
82
81
|
export default Utils;
|
package/static/WebRTCUtils.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Вспомогательный плагин для работы с WebRTC
|
|
3
3
|
*/
|
|
4
4
|
import { IVideoDimentions } from '../types/MediaSettings';
|
|
5
|
-
import type
|
|
5
|
+
import type StatEventCollector from '../classes/stat/StatEventCollector';
|
|
6
6
|
import { type DebugLogger } from './Debug';
|
|
7
7
|
/**
|
|
8
8
|
* Тип камеры мобильного устройства
|
|
@@ -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
|
* До вызова этого метода бесполезно опрашивать другие публичные методы.
|
|
@@ -85,24 +85,24 @@ declare namespace WebRTCUtils {
|
|
|
85
85
|
* @param needAudio Нужно ли аудио
|
|
86
86
|
* @param needEmptyTracks Добавлять ли в стрим пустые треки для отключенного видео/аудио
|
|
87
87
|
*/
|
|
88
|
-
function getUserMedia(needVideo?: boolean, needAudio?: boolean, needEmptyTracks?: boolean, debug?: DebugLogger, logger?:
|
|
88
|
+
function getUserMedia(needVideo?: boolean, needAudio?: boolean, needEmptyTracks?: boolean, debug?: DebugLogger, logger?: StatEventCollector | null): Promise<MediaStream>;
|
|
89
89
|
/**
|
|
90
90
|
* Запрашивает трансляцию экрана пользователя с опциональным захватом звука
|
|
91
91
|
*/
|
|
92
|
-
function getScreenMedia(fastScreenShare: boolean, withAudioShare: boolean, debug?: DebugLogger, logger?:
|
|
92
|
+
function getScreenMedia(fastScreenShare: boolean, withAudioShare: boolean, debug?: DebugLogger, logger?: StatEventCollector | null): Promise<MediaStream>;
|
|
93
93
|
/**
|
|
94
94
|
* Запрашивает камеру пользователя
|
|
95
95
|
*
|
|
96
96
|
* @param deviceId ID устройства
|
|
97
97
|
* @param resolution Размеры видео
|
|
98
98
|
*/
|
|
99
|
-
function getUserVideo(deviceId?: string, resolution?: IVideoDimentions, debug?: DebugLogger, logger?:
|
|
99
|
+
function getUserVideo(deviceId?: string, resolution?: IVideoDimentions, debug?: DebugLogger, logger?: StatEventCollector | null): Promise<MediaStream>;
|
|
100
100
|
/**
|
|
101
101
|
* Запрашивает микрофон пользователя
|
|
102
102
|
*
|
|
103
103
|
* @param deviceId ID устройства
|
|
104
104
|
*/
|
|
105
|
-
function getUserAudio(deviceId?: string, debug?: DebugLogger, logger?:
|
|
105
|
+
function getUserAudio(deviceId?: string, debug?: DebugLogger, logger?: StatEventCollector | null): Promise<MediaStream>;
|
|
106
106
|
/**
|
|
107
107
|
* Устанавливает размер видео в стриме
|
|
108
108
|
*
|
|
@@ -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/Capabilities.d.ts
CHANGED
package/types/ExternalId.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import MediaOption from '../enums/MediaOption';
|
|
2
|
-
import UserType from '../enums/UserType';
|
|
3
2
|
import UserRole from '../enums/UserRole';
|
|
4
3
|
import { ParticipantStatus } from '../static/External';
|
|
5
4
|
import MediaSettings from './MediaSettings';
|
|
@@ -20,7 +19,7 @@ export declare namespace ExternalIdUtils {
|
|
|
20
19
|
function fromIds(ids: ExternalUserId[] | ExternalId[]): ExternalId[];
|
|
21
20
|
function fromId(id: ExternalUserId, type?: ExternalIdType, deviceIdx?: number): ExternalParticipantId;
|
|
22
21
|
function fromSignalingParticipant(participant: SignalingMessage.Participant, useDecorative?: boolean, fallbackToNonDecorative?: boolean): ExternalParticipantId | undefined;
|
|
23
|
-
function fromSignaling(signalingId: SignalingMessage.ExternalId, deviceIdx?: number
|
|
22
|
+
function fromSignaling(signalingId: SignalingMessage.ExternalId, deviceIdx?: number): ExternalParticipantId;
|
|
24
23
|
function toSignaling(externalId: ExternalId): string;
|
|
25
24
|
function toString(externalId: ExternalId): ExternalIdString;
|
|
26
25
|
function fromIdToString(id: ExternalUserId, type?: ExternalIdType, deviceIdx?: number): ExternalIdString;
|