@vkontakte/calls-sdk 2.8.11-dev.7ac19827.0 → 2.8.11-dev.89ba1e7f.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 +15 -13
- package/abstract/BaseApi.d.ts +1 -1
- package/abstract/BaseSignaling.d.ts +3 -4
- package/calls-sdk.cjs.js +16 -13
- package/calls-sdk.esm.js +11326 -13
- package/classes/CallRegistry.d.ts +22 -0
- package/classes/Conversation.d.ts +13 -5
- package/classes/Logger.d.ts +4 -4
- package/classes/MediaSource.d.ts +7 -0
- package/classes/SpecListener.d.ts +2 -0
- package/default/Signaling.d.ts +42 -26
- package/enums/SignalingNotification.d.ts +2 -1
- package/package.json +1 -1
- package/static/Capabilities.d.ts +5 -0
- package/static/Debug.d.ts +4 -4
- package/static/External.d.ts +143 -71
- package/static/Params.d.ts +84 -70
- package/types/Capabilities.d.ts +24 -0
- package/types/PerfStatReporter.d.ts +2 -1
- package/types/SignalingMessage.d.ts +7 -0
- package/types/WebTransport.d.ts +0 -4
- package/classes/ConversationResponseValidator.d.ts +0 -3
- package/default/SignalingTransport.d.ts +0 -68
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Conversation from './Conversation';
|
|
2
|
+
export interface HoldableConversation extends Conversation {
|
|
3
|
+
id: string;
|
|
4
|
+
hold(hold: boolean): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export declare class CallRegistry {
|
|
7
|
+
private _conversations;
|
|
8
|
+
private _activeId;
|
|
9
|
+
private _mutex;
|
|
10
|
+
add(conversation: HoldableConversation): void;
|
|
11
|
+
remove(id: string | null): void;
|
|
12
|
+
get(id: string): HoldableConversation | undefined;
|
|
13
|
+
getActive(): HoldableConversation | null;
|
|
14
|
+
getActiveId(): string | null;
|
|
15
|
+
has(id: string): boolean;
|
|
16
|
+
getAll(): HoldableConversation[];
|
|
17
|
+
get callsLength(): number;
|
|
18
|
+
setActive(id: string): Promise<void>;
|
|
19
|
+
clear(): void;
|
|
20
|
+
}
|
|
21
|
+
declare const callRegistry: CallRegistry;
|
|
22
|
+
export { callRegistry };
|
|
@@ -16,7 +16,7 @@ import { ConversationData, ConversationOnStartParams } from '../types/Conversati
|
|
|
16
16
|
import { ExternalId, ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk, ExternalUserId } from '../types/ExternalId';
|
|
17
17
|
import type { FastJoinHandler } from '../types/FastJoin';
|
|
18
18
|
import MediaModifiers from '../types/MediaModifiers';
|
|
19
|
-
import { IVideoDimentions } from '../types/MediaSettings';
|
|
19
|
+
import MediaSettings, { IVideoDimentions } from '../types/MediaSettings';
|
|
20
20
|
import { IAddMovieParams, IUpdateMovieData } from '../types/MovieShare';
|
|
21
21
|
import MuteStates from '../types/MuteStates';
|
|
22
22
|
import { CompositeUserId, IGetParticipantsParameters, ParticipantId, ParticipantStateData } from '../types/Participant';
|
|
@@ -36,6 +36,7 @@ export default class Conversation extends EventEmitter {
|
|
|
36
36
|
private _conversation;
|
|
37
37
|
private _myLastRequestedLayouts;
|
|
38
38
|
private _state;
|
|
39
|
+
private _previousState;
|
|
39
40
|
private _participantState;
|
|
40
41
|
private _participants;
|
|
41
42
|
private _pendingParticipants;
|
|
@@ -49,10 +50,9 @@ export default class Conversation extends EventEmitter {
|
|
|
49
50
|
private _lastSignalledActiveSpeakerId;
|
|
50
51
|
private _isRealTimeAsrRequested;
|
|
51
52
|
private _serverSettings;
|
|
52
|
-
private
|
|
53
|
-
private
|
|
54
|
-
private
|
|
55
|
-
private static _abortController;
|
|
53
|
+
private _serverTimeOffset;
|
|
54
|
+
private _delayedHangup;
|
|
55
|
+
private _abortController;
|
|
56
56
|
private readonly _onUnload;
|
|
57
57
|
private readonly _audioOutput;
|
|
58
58
|
private _lastStalled;
|
|
@@ -69,6 +69,11 @@ export default class Conversation extends EventEmitter {
|
|
|
69
69
|
static current(): Conversation | null;
|
|
70
70
|
static hangupAfterInit(): void;
|
|
71
71
|
static id(): string | null;
|
|
72
|
+
get id(): string;
|
|
73
|
+
get externalId(): ExternalParticipantId | undefined;
|
|
74
|
+
get mediaSettings(): MediaSettings | undefined;
|
|
75
|
+
get isCallHeld(): boolean;
|
|
76
|
+
static getSyncedTime(): number;
|
|
72
77
|
onStart({ opponentIds, opponentType, mediaOptions, payload, joiningAllowed, requireAuthToJoin, onlyAdminCanShareMovie, externalIds, onFastStart, conversationId, }: ConversationOnStartParams): Promise<ConversationData>;
|
|
73
78
|
onJoin(joinArgs: {
|
|
74
79
|
conversationId?: string;
|
|
@@ -393,6 +398,7 @@ export default class Conversation extends EventEmitter {
|
|
|
393
398
|
private _onFeedback;
|
|
394
399
|
private _onDecorativeParticipantIdChanged;
|
|
395
400
|
private _onVideoSuspendSuggest;
|
|
401
|
+
private _onParticipantHold;
|
|
396
402
|
private _isMe;
|
|
397
403
|
private _getMuteStatesForRoomId;
|
|
398
404
|
private _getMuteStatesForCurrentRoom;
|
|
@@ -402,6 +408,8 @@ export default class Conversation extends EventEmitter {
|
|
|
402
408
|
private _getParticipants;
|
|
403
409
|
private _getParticipant;
|
|
404
410
|
}
|
|
411
|
+
declare function _resetPendingInstance(): void;
|
|
412
|
+
export { _resetPendingInstance };
|
|
405
413
|
export declare class UpdateDisplayLayoutError extends Error {
|
|
406
414
|
readonly participantErrors: {
|
|
407
415
|
externalId: ExternalParticipantId;
|
package/classes/Logger.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ export default class Logger extends BaseLogger {
|
|
|
10
10
|
static setConversationIdProvider(provider: () => string | null): void;
|
|
11
11
|
static create(api: BaseApi, externalLogger: BaseLogger | null): void;
|
|
12
12
|
static log(name: StatLog, value?: string, immediately?: boolean): void;
|
|
13
|
-
static logClientStats(params: Record<string, string | number | undefined | null>, immediately?: boolean): void;
|
|
14
|
-
static logClientEvent(params: Record<string, string | number | undefined | null>, immediately?: boolean): void;
|
|
13
|
+
static logClientStats(params: Record<string, string | number | boolean | undefined | null>, immediately?: boolean): void;
|
|
14
|
+
static logClientEvent(params: Record<string, string | number | boolean | undefined | null>, immediately?: boolean): void;
|
|
15
15
|
static destroy(): void;
|
|
16
16
|
private readonly _externalLogger;
|
|
17
17
|
private readonly _api;
|
|
@@ -22,8 +22,8 @@ export default class Logger extends BaseLogger {
|
|
|
22
22
|
private _serverTimeDelta;
|
|
23
23
|
constructor(api: BaseApi, externalLogger: BaseLogger | null);
|
|
24
24
|
log(name: StatLog, value?: string, immediately?: boolean): void;
|
|
25
|
-
logClientStats(data: Record<string, string | number | undefined | null>, immediately?: boolean): void;
|
|
26
|
-
logClientEvent(data: Record<string, string | number | undefined | null>, immediately?: boolean): void;
|
|
25
|
+
logClientStats(data: Record<string, string | number | boolean | undefined | null>, immediately?: boolean): void;
|
|
26
|
+
logClientEvent(data: Record<string, string | number | boolean | undefined | null>, immediately?: boolean): void;
|
|
27
27
|
destroy(): void;
|
|
28
28
|
private _getConversationId;
|
|
29
29
|
private _sendBatch;
|
package/classes/MediaSource.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export declare class MediaSource extends EventEmitter {
|
|
|
45
45
|
/** Трек аудио эффектов. Не изменяется на протяжении всего времени */
|
|
46
46
|
private _audioEffectsTrack;
|
|
47
47
|
private _mediaSettings;
|
|
48
|
+
private _lastMediaSettings;
|
|
48
49
|
private _videoStatusOnScreenCapturingEnabled;
|
|
49
50
|
private _effect;
|
|
50
51
|
private _audioEffectParams;
|
|
@@ -63,7 +64,11 @@ export declare class MediaSource extends EventEmitter {
|
|
|
63
64
|
getSendAudioTrack(): MediaStreamTrack | null;
|
|
64
65
|
get isAnimojiRequested(): boolean;
|
|
65
66
|
addTrackToPeerConnection(pc: RTCPeerConnection, observer: boolean, noDataChannel: boolean): void;
|
|
67
|
+
/**
|
|
68
|
+
* @deprecated Используйте гетер mediaSettings
|
|
69
|
+
*/
|
|
66
70
|
getMediaSettings(): MediaSettings;
|
|
71
|
+
get mediaSettings(): MediaSettings;
|
|
67
72
|
changeDevice(kind: MediaDeviceKind): Promise<void>;
|
|
68
73
|
/**
|
|
69
74
|
* Установка кастомного стрима для видео, например внешний шаринг экрана
|
|
@@ -91,6 +96,8 @@ export declare class MediaSource extends EventEmitter {
|
|
|
91
96
|
private _setEffect;
|
|
92
97
|
private _stopEffect;
|
|
93
98
|
destroy(): void;
|
|
99
|
+
stopLocalMedia(): Promise<void>;
|
|
100
|
+
resumeLocalMedia(): Promise<void>;
|
|
94
101
|
toggleScreenCapturing(settings: ScreenCaptureSettings): Promise<void>;
|
|
95
102
|
disableScreenCapturing(): Promise<void>;
|
|
96
103
|
private videoTrackMuteHandler;
|
|
@@ -12,6 +12,8 @@ export default class SpecListener extends EventEmitter {
|
|
|
12
12
|
constructor(transport: Transport, volumesDetector: VolumesDetector, participants: Record<ParticipantId, Participant>);
|
|
13
13
|
destroy(): void;
|
|
14
14
|
onChangeRemoteMediaSettings(participantId: ParticipantId, mediaSettings: MediaSettings): void;
|
|
15
|
+
private _getConnectionTimeout;
|
|
16
|
+
private _getVolumeTimeout;
|
|
15
17
|
private _onTransportStateChanged;
|
|
16
18
|
private _onVolumesDetected;
|
|
17
19
|
private _onConnectionTimeout;
|
package/default/Signaling.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { TransportTopology } from '../classes/transport/Transport';
|
|
|
5
5
|
import ConversationFeature from '../enums/ConversationFeature';
|
|
6
6
|
import ConversationOption from '../enums/ConversationOption';
|
|
7
7
|
import MediaOption from '../enums/MediaOption';
|
|
8
|
+
import SignalingCommandType from '../enums/SignalingCommandType';
|
|
8
9
|
import SignalingConnectionType from '../enums/SignalingConnectionType';
|
|
9
10
|
import UserRole from '../enums/UserRole';
|
|
10
11
|
import { JSONObject } from '../static/Json';
|
|
@@ -20,33 +21,41 @@ import ParticipantLayout, { RequestKeyFrame, StopStream } from '../types/Partici
|
|
|
20
21
|
import { ParticipantListChunkParameters } from '../types/ParticipantListChunk';
|
|
21
22
|
import { StreamDescriptionString } from '../types/ParticipantStreamDescription';
|
|
22
23
|
import { PerfStatReport } from '../types/PerfStatReporter';
|
|
23
|
-
import SignalingMessage, { GetParticipantsSignalingResponse, GetRoomsSignalingResponse } from '../types/SignalingMessage';
|
|
24
|
+
import SignalingMessage, { GetParticipantsSignalingResponse, GetRoomsSignalingResponse, SignalingSuccessResponse } from '../types/SignalingMessage';
|
|
24
25
|
import { IPublishStreamData, IRecordConfData, IStartStreamData, IStopStreamData } from '../types/Streams';
|
|
25
26
|
export default class Signaling extends BaseSignaling {
|
|
26
|
-
private
|
|
27
|
-
|
|
27
|
+
private socket;
|
|
28
|
+
protected sequence: number;
|
|
28
29
|
private lastStamp;
|
|
29
30
|
private websocketCommandsQueue;
|
|
30
31
|
private datachannelCommandsQueue;
|
|
31
32
|
private incomingCache;
|
|
32
33
|
private responseHandlers;
|
|
33
34
|
private connectionType;
|
|
34
|
-
private
|
|
35
|
-
private
|
|
35
|
+
private reconnectCount;
|
|
36
|
+
private endpoint;
|
|
37
|
+
private wtEndpoint;
|
|
38
|
+
protected conversationResolve: Function | null;
|
|
39
|
+
protected conversationReject: Function | null;
|
|
36
40
|
private connected;
|
|
37
41
|
private listenersReady;
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
protected peerId: number | null;
|
|
43
|
+
protected conversationId: string | null;
|
|
44
|
+
private reconnectTimer;
|
|
40
45
|
private connectionMessageWaitTimer;
|
|
46
|
+
private doctorTimer;
|
|
41
47
|
private participantIdRegistry;
|
|
42
48
|
private producerNotificationDataChannel;
|
|
43
49
|
private producerCommandDataChannel;
|
|
44
50
|
private producerCommandDataChannelEnabled;
|
|
45
51
|
private producerCommandSerializationService;
|
|
52
|
+
private static get RECONNECT_DELAY();
|
|
53
|
+
private static get RECONNECT_MAX_DELAY();
|
|
54
|
+
private static get RECONNECT_MAX_COUNT();
|
|
46
55
|
private static get WAIT_CONNECTION_DELAY();
|
|
47
56
|
private static get WAIT_RESPONSE_DELAY();
|
|
57
|
+
private static get WAIT_MESSAGE_DELAY();
|
|
48
58
|
get ready(): boolean;
|
|
49
|
-
setAbortSignal(signal: AbortSignal | undefined): void;
|
|
50
59
|
setEndpoint(endpoint: string): void;
|
|
51
60
|
setWebTransportEndpoint(endpoint: string | null): void;
|
|
52
61
|
setConversationId(conversationId: string): void;
|
|
@@ -62,6 +71,15 @@ export default class Signaling extends BaseSignaling {
|
|
|
62
71
|
* Open a connection with a signaling server
|
|
63
72
|
*/
|
|
64
73
|
connect(connectionType: SignalingConnectionType): Promise<SignalingMessage.Connection>;
|
|
74
|
+
/**
|
|
75
|
+
* Send a command to a signaling server
|
|
76
|
+
*/
|
|
77
|
+
protected _send<T extends SignalingSuccessResponse>(command: SignalingCommandType, params?: any, needResponse?: boolean, retryCount?: number): Promise<T>;
|
|
78
|
+
/**
|
|
79
|
+
* Send a raw command to a signaling server
|
|
80
|
+
*/
|
|
81
|
+
protected _sendRaw<T extends SignalingSuccessResponse>(command: SignalingCommandType, params?: any, needResponse?: boolean, retryCount?: number): Promise<T>;
|
|
82
|
+
private _isDataChannelCommand;
|
|
65
83
|
getNextCommandSequenceNumber(): number;
|
|
66
84
|
hangup(reason: string): Promise<SignalingMessage | void>;
|
|
67
85
|
sendCandidate(participantId: ParticipantId, candidate: RTCIceCandidate): Promise<SignalingMessage>;
|
|
@@ -145,36 +163,34 @@ export default class Signaling extends BaseSignaling {
|
|
|
145
163
|
startAsr(params: IAsrStartParams): Promise<SignalingMessage>;
|
|
146
164
|
stopAsr(params?: IAsrStopParams): Promise<SignalingMessage>;
|
|
147
165
|
requestAsr(request: boolean): Promise<SignalingMessage>;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
private _send;
|
|
152
|
-
/**
|
|
153
|
-
* Send a raw command to a signaling server
|
|
154
|
-
*/
|
|
155
|
-
private _sendRaw;
|
|
156
|
-
private _isDataChannelCommand;
|
|
166
|
+
private _buildUrl;
|
|
167
|
+
protected _connect(connectionType: SignalingConnectionType, useWebTransport: boolean): void;
|
|
168
|
+
protected _disconnect(code?: number): void;
|
|
157
169
|
private _onOpen;
|
|
158
170
|
private _onMessage;
|
|
159
|
-
|
|
171
|
+
protected _handleMessage(message: SignalingMessage): void;
|
|
160
172
|
private _handleErrorMessage;
|
|
161
|
-
|
|
173
|
+
protected _handleCachedMessages(): void;
|
|
162
174
|
private _throwError;
|
|
163
175
|
private _onError;
|
|
164
176
|
private _serializeErrorEvent;
|
|
165
|
-
|
|
166
|
-
|
|
177
|
+
protected _onClose(event: CloseEvent): void;
|
|
178
|
+
protected _closeSocket(error?: Error | null): void;
|
|
179
|
+
protected _reconnect(): void;
|
|
167
180
|
private _handleCommandResponse;
|
|
168
181
|
private _handleCommandsQueue;
|
|
169
182
|
private _startResponseTimer;
|
|
170
183
|
private _serializeBinary;
|
|
171
184
|
private _serializeJson;
|
|
172
185
|
private _convertDisplayLayout;
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
186
|
+
protected _waitConnectionMessage(): void;
|
|
187
|
+
protected _stopWaitConnectionMessage(): void;
|
|
188
|
+
/**
|
|
189
|
+
* Отвечает за timeout логику в WebSocket, если неполучаем никаких сообщений в течении WAIT_MESSAGE_DELAY, то запускаем реконнект
|
|
190
|
+
*/
|
|
191
|
+
private _startDoctor;
|
|
192
|
+
private _stopDoctor;
|
|
193
|
+
private isWebTransportAvailable;
|
|
178
194
|
private _getSocketType;
|
|
179
195
|
private _markTransportStat;
|
|
180
196
|
private _logTransportStat;
|
|
@@ -50,6 +50,7 @@ declare enum SignalingNotification {
|
|
|
50
50
|
ASR_STARTED = "asr-started",
|
|
51
51
|
ASR_STOPPED = "asr-stopped",
|
|
52
52
|
DECORATIVE_PARTICIPANT_ID_CHANGED = "decorative-participant-id-changed",
|
|
53
|
-
VIDEO_SUSPEND_SUGGEST = "video-suspend-suggest"
|
|
53
|
+
VIDEO_SUSPEND_SUGGEST = "video-suspend-suggest",
|
|
54
|
+
HOLD = "hold"
|
|
54
55
|
}
|
|
55
56
|
export default SignalingNotification;
|
package/package.json
CHANGED
package/static/Debug.d.ts
CHANGED
|
@@ -8,10 +8,10 @@ export declare enum DebugMessageType {
|
|
|
8
8
|
ERROR = "ERROR"
|
|
9
9
|
}
|
|
10
10
|
declare namespace Debug {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
function debug(...args: any[]): void;
|
|
12
|
+
function log(...args: any[]): void;
|
|
13
|
+
function warn(...args: any[]): void;
|
|
14
|
+
function error(...args: any[]): void;
|
|
15
15
|
function enabled(): boolean;
|
|
16
16
|
function toggle(enable: boolean): void;
|
|
17
17
|
function send(type: DebugMessageType, ...args: any[]): void;
|