@vkontakte/calls-sdk 2.8.12-dev.dfea6e89.0 → 2.8.12-dev.e2067192.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 +27 -4
- package/abstract/BaseApi.d.ts +2 -1
- package/abstract/BaseSignaling.d.ts +5 -1
- package/calls-sdk.cjs.js +7 -13
- package/calls-sdk.esm.js +2792 -2536
- package/classes/AudioOutput.d.ts +4 -1
- package/classes/CallRegistry.d.ts +1 -1
- package/classes/MediaSource.d.ts +4 -0
- package/classes/{Conversation.d.ts → conversation/Conversation.d.ts} +42 -33
- 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/stat/CallLifecycleStats.d.ts +0 -4
- package/classes/stat/StatAggregator.d.ts +4 -0
- package/classes/transport/DirectTransport.d.ts +1 -0
- package/classes/transport/PerfStatReporter.d.ts +2 -0
- package/classes/transport/ServerTransport.d.ts +1 -4
- package/classes/transport/SimulcastSender.d.ts +31 -0
- package/classes/transport/Transport.d.ts +3 -0
- package/default/Api.d.ts +4 -1
- package/default/ApiExternal.d.ts +2 -1
- package/default/Signaling.d.ts +4 -1
- package/default/SignalingTransport.d.ts +6 -1
- package/enums/ClientHangupReason.d.ts +7 -0
- package/enums/Stat.d.ts +0 -1
- package/package.json +3 -3
- package/static/ApiTransport.d.ts +3 -0
- package/static/Params.d.ts +27 -1
- package/static/ParticipantConnectionStatusUtils.d.ts +1 -0
- package/static/Sdp.d.ts +3 -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 +4 -7
- package/types/Api.d.ts +9 -0
- package/types/Capabilities.d.ts +1 -0
- 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 +1 -0
- package/utils/IceServers.d.ts +2 -0
- package/utils/NavigatorPermissions.d.ts +2 -2
- package/utils/SerializeLatest.d.ts +5 -0
package/classes/AudioOutput.d.ts
CHANGED
|
@@ -7,12 +7,13 @@ import { StatFirstMediaReceived } from './stat/StatFirstMediaReceived';
|
|
|
7
7
|
*/
|
|
8
8
|
export default class AudioOutput {
|
|
9
9
|
protected _audioElement: HTMLAudioElement | null;
|
|
10
|
+
protected readonly _debug: DebugLogger;
|
|
11
|
+
private readonly _preparedAudioElement;
|
|
10
12
|
private _audioTracks;
|
|
11
13
|
private readonly _allowMultipleTracks;
|
|
12
14
|
private _volume;
|
|
13
15
|
private readonly _features;
|
|
14
16
|
private readonly _statFirstMediaReceived;
|
|
15
|
-
protected readonly _debug: DebugLogger;
|
|
16
17
|
private readonly _logger;
|
|
17
18
|
constructor(statFirstMediaReceived: StatFirstMediaReceived, allowMultipleTracks?: boolean, debug?: DebugLogger, logger?: StatsLogger | null);
|
|
18
19
|
add(participantId: ParticipantId, track: MediaStreamTrack): void;
|
|
@@ -25,6 +26,8 @@ export default class AudioOutput {
|
|
|
25
26
|
protected _getTracks(): MediaStreamTrack[];
|
|
26
27
|
protected _initAudioElement(): void;
|
|
27
28
|
protected _stopAudioElement(): void;
|
|
29
|
+
private _createAudioElement;
|
|
30
|
+
private _prepareAudioElement;
|
|
28
31
|
private _addTrackToAudioElement;
|
|
29
32
|
private _removeTrackFromAudioElement;
|
|
30
33
|
private _clearTracks;
|
package/classes/MediaSource.d.ts
CHANGED
|
@@ -58,6 +58,8 @@ export declare class MediaSource extends EventEmitter {
|
|
|
58
58
|
private readonly _videoEffectsFpsLimiter?;
|
|
59
59
|
private readonly _debug;
|
|
60
60
|
private readonly _logger;
|
|
61
|
+
private _cameraTrackSetAt;
|
|
62
|
+
private _cameraMuteRecoveredAt;
|
|
61
63
|
constructor(debug?: DebugLogger, logger?: StatsLogger | null);
|
|
62
64
|
get cameraVideoTrack(): MediaStreamTrack | null;
|
|
63
65
|
set cameraVideoTrack(track: MediaStreamTrack | null);
|
|
@@ -97,6 +99,8 @@ export declare class MediaSource extends EventEmitter {
|
|
|
97
99
|
protected getSilentAudioShareTrack(): MediaStreamTrack;
|
|
98
100
|
protected getBlackScreenShareTrack(): MediaStreamTrack;
|
|
99
101
|
protected _replaceLocalTrack(newTrack: MediaStreamTrack, sendTrack?: MediaStreamTrack): Promise<void>;
|
|
102
|
+
protected _replaceTrack(oldTrack: MediaStreamTrack, newTrack: MediaStreamTrack, sendTrack?: MediaStreamTrack): Promise<void>;
|
|
103
|
+
protected _addLocalTrack(newTrack: MediaStreamTrack, sendTrack?: MediaStreamTrack): Promise<void>;
|
|
100
104
|
private _setEffect;
|
|
101
105
|
private _stopEffect;
|
|
102
106
|
destroy(): void;
|
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
import type { IEffect } from '@vkontakte/calls-video-effects';
|
|
2
2
|
import type { RGBTuple } from '@vkontakte/calls-vmoji';
|
|
3
|
-
import BaseApi from '
|
|
4
|
-
import BaseLogger from '
|
|
5
|
-
import { AddParticipantParams } from '
|
|
6
|
-
import ConversationFeature from '
|
|
7
|
-
import ConversationOption from '
|
|
8
|
-
import MediaOption from '
|
|
9
|
-
import UpdateDisplayLayoutErrorReason from '
|
|
10
|
-
import UserRole from '
|
|
11
|
-
import UserType from '
|
|
12
|
-
import { DebugMessageType } from '
|
|
13
|
-
import { JSONObject } from '
|
|
14
|
-
import { IAsrStartParams, IAsrStopParams } from '
|
|
15
|
-
import { AudienceModeHandsResponse } from '
|
|
16
|
-
import { ConversationData, ConversationOnJoinParams, ConversationOnStartParams } from '
|
|
17
|
-
import { ExternalId, ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk } from '
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import {
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
3
|
+
import BaseApi from '../../abstract/BaseApi';
|
|
4
|
+
import BaseLogger from '../../abstract/BaseLogger';
|
|
5
|
+
import { AddParticipantParams } from '../../abstract/BaseSignaling';
|
|
6
|
+
import ConversationFeature from '../../enums/ConversationFeature';
|
|
7
|
+
import ConversationOption from '../../enums/ConversationOption';
|
|
8
|
+
import MediaOption from '../../enums/MediaOption';
|
|
9
|
+
import UpdateDisplayLayoutErrorReason from '../../enums/UpdateDisplayLayoutErrorReason';
|
|
10
|
+
import UserRole from '../../enums/UserRole';
|
|
11
|
+
import UserType from '../../enums/UserType';
|
|
12
|
+
import { DebugMessageType } from '../../static/Debug';
|
|
13
|
+
import { JSONObject } from '../../static/Json';
|
|
14
|
+
import { IAsrStartParams, IAsrStopParams } from '../../types/Asr';
|
|
15
|
+
import { AudienceModeHandsResponse } from '../../types/AudienceMode';
|
|
16
|
+
import { ConversationData, ConversationOnJoinParams, ConversationOnStartParams } from '../../types/Conversation';
|
|
17
|
+
import { ExternalId, ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk } from '../../types/ExternalId';
|
|
18
|
+
import type { FastHangupHandler, HangupParams } from '../../types/FastHangup';
|
|
19
|
+
import MediaModifiers from '../../types/MediaModifiers';
|
|
20
|
+
import MediaSettings, { IVideoDimentions } from '../../types/MediaSettings';
|
|
21
|
+
import { IAddMovieParams, IUpdateMovieData } from '../../types/MovieShare';
|
|
22
|
+
import MuteStates from '../../types/MuteStates';
|
|
23
|
+
import { CompositeUserId, IGetParticipantsParameters, OkUserId, ParticipantId, ParticipantStateData } from '../../types/Participant';
|
|
24
|
+
import { DisplayLayoutRequest, ParticipantLayout } from '../../types/ParticipantLayout';
|
|
25
|
+
import { ParticipantListChunkParameters } from '../../types/ParticipantListChunk';
|
|
26
|
+
import ParticipantPriority from '../../types/ParticipantPriority';
|
|
27
|
+
import { ParticipantStreamDescription } from '../../types/ParticipantStreamDescription';
|
|
28
|
+
import { ScreenCaptureSettings } from '../../types/ScreenCaptureSettings';
|
|
29
|
+
import SignalingMessage from '../../types/SignalingMessage';
|
|
30
|
+
import { WaitingHallResponse } from '../../types/WaitingHall';
|
|
31
|
+
import EventEmitter from '../EventEmitter';
|
|
31
32
|
export default class Conversation extends EventEmitter {
|
|
32
33
|
private readonly _api;
|
|
33
34
|
private readonly _signaling;
|
|
@@ -42,7 +43,6 @@ export default class Conversation extends EventEmitter {
|
|
|
42
43
|
private _waitingHallHoldPending;
|
|
43
44
|
private _participantState;
|
|
44
45
|
private _participants;
|
|
45
|
-
private _pendingParticipants;
|
|
46
46
|
private _directTransportIsMaster?;
|
|
47
47
|
private _transport;
|
|
48
48
|
private _debugInfo;
|
|
@@ -57,6 +57,7 @@ export default class Conversation extends EventEmitter {
|
|
|
57
57
|
private _serverSettings;
|
|
58
58
|
private _serverTimeOffset;
|
|
59
59
|
private _delayedHangup;
|
|
60
|
+
private _onFastHangup?;
|
|
60
61
|
private _hangupEmitted;
|
|
61
62
|
private _hangupPromise;
|
|
62
63
|
private _abortController;
|
|
@@ -78,7 +79,7 @@ export default class Conversation extends EventEmitter {
|
|
|
78
79
|
private readonly _statFirstMediaReceived;
|
|
79
80
|
constructor(api: BaseApi, externalLogger: BaseLogger | null);
|
|
80
81
|
static current(): Conversation | null;
|
|
81
|
-
static hangupAfterInit(): void;
|
|
82
|
+
static hangupAfterInit(onFastHangup?: FastHangupHandler): void;
|
|
82
83
|
static id(): string | null;
|
|
83
84
|
get id(): string;
|
|
84
85
|
get externalId(): ExternalParticipantId | undefined;
|
|
@@ -90,6 +91,7 @@ export default class Conversation extends EventEmitter {
|
|
|
90
91
|
static getSyncedTime(): number;
|
|
91
92
|
get debugSessionId(): string | null;
|
|
92
93
|
getCachedRawOkIdByExternalId(externalId: ExternalId): OkUserId | null;
|
|
94
|
+
private _buildInternalParams;
|
|
93
95
|
onStart({ opponentIds, opponentType, mediaOptions, payload, joiningAllowed, requireAuthToJoin, onlyAdminCanShareMovie, externalIds, onFastStart, conversationId, }: ConversationOnStartParams): Promise<ConversationData>;
|
|
94
96
|
onJoin(joinArgs: ConversationOnJoinParams): Promise<ConversationData>;
|
|
95
97
|
private _onJoinPart2;
|
|
@@ -105,8 +107,8 @@ export default class Conversation extends EventEmitter {
|
|
|
105
107
|
private _getMainRoomParticipants;
|
|
106
108
|
private _decodeExternalConversationParams;
|
|
107
109
|
accept(mediaOptions: MediaOption[]): Promise<ConversationData>;
|
|
108
|
-
decline(): Promise<void>;
|
|
109
|
-
hangup(): Promise<void>;
|
|
110
|
+
decline(params?: HangupParams): Promise<void>;
|
|
111
|
+
hangup(params?: HangupParams): Promise<void>;
|
|
110
112
|
addParticipant(participantIds: ExternalId[], params?: AddParticipantParams): Promise<void>;
|
|
111
113
|
addParticipantLegacy(participantIds: CompositeUserId[], params?: AddParticipantParams): Promise<void>;
|
|
112
114
|
removeParticipant(participantId: CompositeUserId, ban?: boolean): Promise<void>;
|
|
@@ -114,10 +116,14 @@ export default class Conversation extends EventEmitter {
|
|
|
114
116
|
updateStatisticsInterval(): void;
|
|
115
117
|
private _openTransport;
|
|
116
118
|
private _allocateParticipantTransport;
|
|
119
|
+
private _closeParticipantTransport;
|
|
117
120
|
private _cleanupRegistry;
|
|
118
121
|
private _emitHangupOnce;
|
|
122
|
+
private _sendHangupApi;
|
|
119
123
|
private _close;
|
|
124
|
+
private _sendHangup;
|
|
120
125
|
destroy(): void;
|
|
126
|
+
private _destroy;
|
|
121
127
|
private _getConversationParams;
|
|
122
128
|
private _setConversationParams;
|
|
123
129
|
private _buildSignalingEndpoint;
|
|
@@ -220,6 +226,8 @@ export default class Conversation extends EventEmitter {
|
|
|
220
226
|
setAnimojiFill(fill: RGBTuple | string): void;
|
|
221
227
|
setVideoStream(stream: MediaStream, isScreen?: boolean): Promise<void>;
|
|
222
228
|
setAudioStream(stream: MediaStream): Promise<void>;
|
|
229
|
+
private readonly _toggleLocalVideo;
|
|
230
|
+
private readonly _toggleLocalAudio;
|
|
223
231
|
toggleLocalVideo(enabled: boolean): Promise<void>;
|
|
224
232
|
toggleLocalAudio(enabled: boolean): Promise<void>;
|
|
225
233
|
/**
|
|
@@ -416,6 +424,8 @@ export default class Conversation extends EventEmitter {
|
|
|
416
424
|
private _toggleJoinAvailability;
|
|
417
425
|
private _updateDisplayLayoutFromCache;
|
|
418
426
|
private _setParticipantsStatus;
|
|
427
|
+
private _setParticipantsStalled;
|
|
428
|
+
private _updateParticipantsStatus;
|
|
419
429
|
private _onJoinLinkChanged;
|
|
420
430
|
private _onRoomsUpdated;
|
|
421
431
|
private _onRoomUpdated;
|
|
@@ -439,7 +449,6 @@ export default class Conversation extends EventEmitter {
|
|
|
439
449
|
private _setMuteStatesForRoomId;
|
|
440
450
|
private _forceOpenTransportForAloneInCall;
|
|
441
451
|
private _registerParticipant;
|
|
442
|
-
private _getParticipants;
|
|
443
452
|
private _getParticipant;
|
|
444
453
|
}
|
|
445
454
|
declare function _resetPendingInstance(): void;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { FetchMock } from 'vitest-fetch-mock';
|
|
2
|
+
import { Mock } from 'vitest';
|
|
3
|
+
import { Client, Server } from 'mock-socket';
|
|
4
|
+
import { ISharedMovieInfo, OkUserId } from '../../CallsSDK';
|
|
5
|
+
import Api from '../../default/Api';
|
|
6
|
+
import CallDirection from '../../enums/CallDirection';
|
|
7
|
+
import ConversationOption from '../../enums/ConversationOption';
|
|
8
|
+
import TransportState from '../../enums/TransportState';
|
|
9
|
+
import TransportTopology from '../../enums/TransportTopology';
|
|
10
|
+
import { ParticipantStatus } from '../../static/External';
|
|
11
|
+
import { ExternalParticipantId } from '../../types/ExternalId';
|
|
12
|
+
import { ParticipantListMarkers } from '../../types/Participant';
|
|
13
|
+
import SignalingMessage from '../../types/SignalingMessage';
|
|
14
|
+
import Conversation from './Conversation';
|
|
15
|
+
declare function createParams(): {
|
|
16
|
+
apiKey: string;
|
|
17
|
+
apiEnv: string;
|
|
18
|
+
onLocalStream: Mock<import("@vitest/spy").Procedure>;
|
|
19
|
+
onLocalStatus: Mock<import("@vitest/spy").Procedure>;
|
|
20
|
+
onConversation: Mock<import("@vitest/spy").Procedure>;
|
|
21
|
+
onLocalSharedMovieInfo: Mock<import("@vitest/spy").Procedure>;
|
|
22
|
+
onRemoteSharedMovieInfo: Mock<import("@vitest/spy").Procedure>;
|
|
23
|
+
onRemoteSharedUrl: Mock<import("@vitest/spy").Procedure>;
|
|
24
|
+
onCallState: Mock<import("@vitest/spy").Procedure>;
|
|
25
|
+
onOptionsChanged: Mock<import("@vitest/spy").Procedure>;
|
|
26
|
+
onPinnedParticipant: Mock<import("@vitest/spy").Procedure>;
|
|
27
|
+
onRemoteMediaSettings: Mock<import("@vitest/spy").Procedure>;
|
|
28
|
+
onRemoteParticipantState: Mock<import("@vitest/spy").Procedure>;
|
|
29
|
+
onLocalPin: Mock<import("@vitest/spy").Procedure>;
|
|
30
|
+
onDebugMessage: Mock<import("@vitest/spy").Procedure>;
|
|
31
|
+
onHangup: Mock<import("@vitest/spy").Procedure>;
|
|
32
|
+
onRemoteRemoved: Mock<import("@vitest/spy").Procedure>;
|
|
33
|
+
onConversationParticipantListChunk: Mock<import("@vitest/spy").Procedure>;
|
|
34
|
+
onRoomParticipantsUpdated: Mock<import("@vitest/spy").Procedure>;
|
|
35
|
+
onChatRoomUpdated: Mock<import("@vitest/spy").Procedure>;
|
|
36
|
+
onRemoteStatus: Mock<import("@vitest/spy").Procedure>;
|
|
37
|
+
onSpeakerChanged: Mock<import("@vitest/spy").Procedure>;
|
|
38
|
+
};
|
|
39
|
+
export type ConversationTestParams = ReturnType<typeof createParams>;
|
|
40
|
+
export type ConversationTestTools = {
|
|
41
|
+
readonly endpointURL: string;
|
|
42
|
+
readonly fetchMocker: FetchMock;
|
|
43
|
+
readonly params: ConversationTestParams;
|
|
44
|
+
readonly server: Server;
|
|
45
|
+
readonly wsBaseURL: string;
|
|
46
|
+
createConnectionMessage(data?: Partial<SignalingMessage.Connection>): SignalingMessage.Connection;
|
|
47
|
+
createConversation(options?: {
|
|
48
|
+
api?: Api;
|
|
49
|
+
}): Conversation;
|
|
50
|
+
createExternalIdMock(id: string, data?: Partial<ExternalParticipantId>): ExternalParticipantId;
|
|
51
|
+
createMarkers(data?: Partial<ParticipantListMarkers>): ParticipantListMarkers;
|
|
52
|
+
createMovieShareInfo(initiatorId: string, data?: Partial<ISharedMovieInfo> | null): ISharedMovieInfo;
|
|
53
|
+
createParticipant(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
54
|
+
createParticipantWithMarkers(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
55
|
+
createPromoteParticipantMessage(): SignalingMessage.PromoteParticipant;
|
|
56
|
+
createSignallingConversation(okUserId: OkUserId, peerId: SignalingMessage.PeerId, data?: Partial<SignalingMessage.Conversation>): SignalingMessage.Conversation;
|
|
57
|
+
createWaitingHallConversationData(): ReturnType<typeof createWaitingHallConversationData>;
|
|
58
|
+
emitMessageOnConnection(wsServer: Server, message?: SignalingMessage.Connection): void;
|
|
59
|
+
enableParticipantListChunk(): void;
|
|
60
|
+
expectRemoteStatus(status: ParticipantStatus, participantId?: string): Promise<void>;
|
|
61
|
+
expectRemoteStatusCall(status: ParticipantStatus, participantId?: string): void;
|
|
62
|
+
forgetConversation(conversation: Conversation): void;
|
|
63
|
+
getActiveSocket(wsServer: Server): Client;
|
|
64
|
+
hasRemoteStatusCall(status: ParticipantStatus, participantId?: string): boolean;
|
|
65
|
+
isCapabilityEnabled(predicateIndex: number, wsServer: Server): boolean;
|
|
66
|
+
parseUrlSearch(search: string): Record<string, string>;
|
|
67
|
+
resetRemoteStatusCallbacks(): void;
|
|
68
|
+
respondOnGetParticipantListChunkWith(data: Partial<SignalingMessage.ParticipantListChunk>): void;
|
|
69
|
+
sendAcceptedCall(participant: SignalingMessage.Participant): void;
|
|
70
|
+
sendHungup(participant: SignalingMessage.Participant): void;
|
|
71
|
+
sendSessionState(participant: SignalingMessage.Participant | number, connected: boolean, data?: Partial<SignalingMessage.SessionState>): void;
|
|
72
|
+
setApiAuth(data?: {
|
|
73
|
+
sessionKey?: string;
|
|
74
|
+
sessionSecretKey?: string;
|
|
75
|
+
}): void;
|
|
76
|
+
setTransportState(conversation: Conversation, state: TransportState): void;
|
|
77
|
+
socketRespondWith(socket: Client, command: string, response: SignalingMessage): void;
|
|
78
|
+
socketSendNotification(socket: Client, notification: string, response?: SignalingMessage): void;
|
|
79
|
+
startConversation(message?: SignalingMessage.Connection): Promise<Conversation>;
|
|
80
|
+
startConversationWithParticipants(participants: SignalingMessage.Participant[], peerId?: SignalingMessage.PeerId): Promise<Conversation>;
|
|
81
|
+
startConversationWithRemoteParticipant(remoteParticipantData?: Partial<SignalingMessage.Participant>): Promise<{
|
|
82
|
+
conversation: Conversation;
|
|
83
|
+
meParticipant: SignalingMessage.Participant;
|
|
84
|
+
remoteParticipant: SignalingMessage.Participant;
|
|
85
|
+
}>;
|
|
86
|
+
stubApiRequest(endpoint: string, method: string, data: object): void;
|
|
87
|
+
waitFor(fn: () => Promise<boolean> | boolean, message?: string, timeout?: number): Promise<true>;
|
|
88
|
+
flushSdkCallbacks(): Promise<null>;
|
|
89
|
+
};
|
|
90
|
+
export declare function defineConversationTests(name: string, defineTests: (tools: ConversationTestTools) => void): void;
|
|
91
|
+
export declare function createExternalIdMock(id: string, data?: Partial<ExternalParticipantId>): ExternalParticipantId;
|
|
92
|
+
export declare function enableParticipantListChunk(): void;
|
|
93
|
+
export declare function setApiAuth(data?: {
|
|
94
|
+
sessionKey?: string;
|
|
95
|
+
sessionSecretKey?: string;
|
|
96
|
+
}): void;
|
|
97
|
+
export declare function setTransportState(conversation: Conversation, state: TransportState): void;
|
|
98
|
+
export declare function socketRespondWith(socket: Client, command: string, response: SignalingMessage): void;
|
|
99
|
+
export declare function socketSendNotification(socket: Client, notification: string, response?: SignalingMessage): void;
|
|
100
|
+
export declare function createWaitingHallConversationData(): {
|
|
101
|
+
acceptTime: null;
|
|
102
|
+
asrInfo: null;
|
|
103
|
+
asrInfoByRoom: Map<any, any>;
|
|
104
|
+
audienceMode: boolean;
|
|
105
|
+
chatId: null;
|
|
106
|
+
compositeUserId: string;
|
|
107
|
+
concurrent: boolean;
|
|
108
|
+
direction: CallDirection;
|
|
109
|
+
externalId: ExternalParticipantId;
|
|
110
|
+
features: never[];
|
|
111
|
+
featuresPerRole: null;
|
|
112
|
+
id: string;
|
|
113
|
+
mediaModifiers: {
|
|
114
|
+
denoise: boolean;
|
|
115
|
+
denoiseAnn: boolean;
|
|
116
|
+
};
|
|
117
|
+
muteStates: Map<any, any>;
|
|
118
|
+
muteStatesPersonal: {};
|
|
119
|
+
needRate: boolean;
|
|
120
|
+
networkRating: number;
|
|
121
|
+
observer: boolean;
|
|
122
|
+
options: ConversationOption[];
|
|
123
|
+
participantsLimit: number;
|
|
124
|
+
pinnedParticipantIdByRoom: Map<any, any>;
|
|
125
|
+
recordsInfoByRoom: Map<any, any>;
|
|
126
|
+
restricted: boolean;
|
|
127
|
+
roles: never[];
|
|
128
|
+
roomId: number | null;
|
|
129
|
+
topology: TransportTopology;
|
|
130
|
+
urlSharingInfoByRoom: Map<any, any>;
|
|
131
|
+
userId: number;
|
|
132
|
+
waitForAdmin: boolean;
|
|
133
|
+
waitingHall: boolean;
|
|
134
|
+
};
|
|
135
|
+
export declare function createPromoteParticipantMessage(): SignalingMessage.PromoteParticipant;
|
|
136
|
+
export declare function emitMessageOnConnection(wsServer: Server, message?: SignalingMessage.Connection): void;
|
|
137
|
+
export declare function getActiveSocket(wsServer: Server): Client;
|
|
138
|
+
export declare function isCapabilityEnabled(predicateIndex: number, wsServer: Server): boolean;
|
|
139
|
+
export declare function parseUrlSearch(search: string): Record<string, string>;
|
|
140
|
+
export declare function flushSdkCallbacks(): Promise<null>;
|
|
141
|
+
export declare function waitFor(fn: () => Promise<boolean> | boolean, message?: string, timeout?: number): Promise<true>;
|
|
142
|
+
export declare function createSignallingConversation(okUserId: OkUserId, peerId: SignalingMessage.PeerId, data?: Partial<SignalingMessage.Conversation>): SignalingMessage.Conversation;
|
|
143
|
+
export declare function createConnectionMessage(data?: Partial<SignalingMessage.Connection>): SignalingMessage.Connection;
|
|
144
|
+
export declare function createParticipant(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
145
|
+
export declare function createParticipantWithMarkers(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
146
|
+
export declare function createMarkers(data?: Partial<ParticipantListMarkers>): ParticipantListMarkers;
|
|
147
|
+
export declare function createMovieShareInfo(initiatorId: string, data?: Partial<ISharedMovieInfo> | null): ISharedMovieInfo;
|
|
148
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import ConversationResponse from '
|
|
1
|
+
import ConversationResponse from '../../types/ConversationResponse';
|
|
2
2
|
export type ConversationResponseSource = 'startConversation' | 'joinConversation' | 'joinConversationByLink' | 'fastStart' | 'fastJoin';
|
|
3
3
|
export declare function assertValidConversationResponse(response: ConversationResponse | null | undefined, source: ConversationResponseSource): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import BaseApi from '
|
|
2
|
-
import type { DebugLogger } from '
|
|
3
|
-
import { DisplayLayoutRequest, ParticipantLayout } from '
|
|
4
|
-
import { Participant, ParticipantId } from '
|
|
1
|
+
import BaseApi from '../../abstract/BaseApi';
|
|
2
|
+
import type { DebugLogger } from '../../static/Debug';
|
|
3
|
+
import { DisplayLayoutRequest, ParticipantLayout } from '../../types/ParticipantLayout';
|
|
4
|
+
import { Participant, ParticipantId } from '../../types/Participant';
|
|
5
5
|
type DisplayLayoutRequesterParams = {
|
|
6
6
|
api: BaseApi;
|
|
7
7
|
debug: DebugLogger;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Conversation';
|
|
@@ -14,9 +14,7 @@ export declare class CallLifecycleStats {
|
|
|
14
14
|
private _conversationId;
|
|
15
15
|
private _callStartLabel;
|
|
16
16
|
private _lifecycleStartedAtMonotonic;
|
|
17
|
-
private _warmupStartedAtMonotonic;
|
|
18
17
|
private _pendingEvents;
|
|
19
|
-
private _warmupCompleted;
|
|
20
18
|
private _callStarted;
|
|
21
19
|
private _accepted;
|
|
22
20
|
private _firstMediaSent;
|
|
@@ -27,8 +25,6 @@ export declare class CallLifecycleStats {
|
|
|
27
25
|
get terminated(): boolean;
|
|
28
26
|
markInitializationStarted({ source, conversationId }: CallLifecycleInitializationParams): void;
|
|
29
27
|
bindConversationId(conversationId: string): void;
|
|
30
|
-
markWarmupStarted(): void;
|
|
31
|
-
markWarmupCompleted(): void;
|
|
32
28
|
markCallStarted(): void;
|
|
33
29
|
markOutgoingAccepted(): void;
|
|
34
30
|
markIncomingAccepted(concurrent: boolean): void;
|
|
@@ -4,9 +4,13 @@ import StatsLogger from '../StatsLogger';
|
|
|
4
4
|
export declare class StatAggregator {
|
|
5
5
|
private readonly _logger;
|
|
6
6
|
private readonly _eventualLogs;
|
|
7
|
+
private _lastCallStatContext;
|
|
7
8
|
constructor(logger: StatsLogger);
|
|
8
9
|
logCallStat(params: ICallStatLog): void;
|
|
9
10
|
/** @link https://wiki.odkl.ru/pages/viewpage.action?pageId=100892588 */
|
|
10
11
|
logEventualStat(params: IEventualStatLog): void;
|
|
11
12
|
destroy(): void;
|
|
13
|
+
private _getCallStatContext;
|
|
14
|
+
private _flushEventualStats;
|
|
15
|
+
private _logEventualStat;
|
|
12
16
|
}
|
|
@@ -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;
|
|
@@ -9,6 +9,7 @@ export default class PerfStatReporter extends EventEmitter {
|
|
|
9
9
|
private _previousNetworkStatReportTimestamp;
|
|
10
10
|
private _previousCallStatReportTimestamp;
|
|
11
11
|
private _previousCallStatReport;
|
|
12
|
+
private _previousRemoteInboundRtps;
|
|
12
13
|
private _screenShareStats;
|
|
13
14
|
private _signaling;
|
|
14
15
|
private readonly _directTopology;
|
|
@@ -21,6 +22,7 @@ export default class PerfStatReporter extends EventEmitter {
|
|
|
21
22
|
private reportPerfStats;
|
|
22
23
|
private reportNetworkStats;
|
|
23
24
|
private _reportCallStats;
|
|
25
|
+
private _calculatePacketLoss;
|
|
24
26
|
private _handleScreenSharingStat;
|
|
25
27
|
private _handleTransportStateChanged;
|
|
26
28
|
}
|
|
@@ -42,11 +42,11 @@ export default class ServerTransport extends BaseTransport {
|
|
|
42
42
|
private _rtpReceiversByStreamId;
|
|
43
43
|
private _producerSessionId;
|
|
44
44
|
private _newAudioShareTrack;
|
|
45
|
-
private _simulcastInfo;
|
|
46
45
|
private readonly _debug;
|
|
47
46
|
private readonly _logger;
|
|
48
47
|
private readonly _statAggregator;
|
|
49
48
|
private readonly _codecStatsAggregator;
|
|
49
|
+
private readonly _simulcast;
|
|
50
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;
|
|
@@ -85,8 +85,6 @@ export default class ServerTransport extends BaseTransport {
|
|
|
85
85
|
private _detectStaleTracks;
|
|
86
86
|
private _allocateConsumer;
|
|
87
87
|
private _processOffer;
|
|
88
|
-
private _findFirstSimTransceiver;
|
|
89
|
-
private _setupSimulcastTransceiver;
|
|
90
88
|
private _acceptProducer;
|
|
91
89
|
private _replaceScreenShareTrack;
|
|
92
90
|
private _handleTracks;
|
|
@@ -101,7 +99,6 @@ export default class ServerTransport extends BaseTransport {
|
|
|
101
99
|
private _onReplacedTrack;
|
|
102
100
|
private _onSourcesChanged;
|
|
103
101
|
getStreamWaitingTimeMs(streamId: string, targetRtpTimestamp: number): number;
|
|
104
|
-
private _changeSimulcastInfo;
|
|
105
102
|
private _monitorRtpShare;
|
|
106
103
|
private _startMonitorRtpShareInterval;
|
|
107
104
|
private _stopMonitorRtpShareInterval;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import BaseSignaling from '../../abstract/BaseSignaling';
|
|
2
|
+
import { type DebugLogger } from '../../static/Debug';
|
|
3
|
+
import type VideoSettings from '../../types/VideoSettings';
|
|
4
|
+
import { MediaSource } from '../MediaSource';
|
|
5
|
+
import StatsLogger from '../StatsLogger';
|
|
6
|
+
export default class SimulcastSender {
|
|
7
|
+
private _pc;
|
|
8
|
+
private _transceiver;
|
|
9
|
+
private _currentSimulcastInfo;
|
|
10
|
+
private readonly _signaling;
|
|
11
|
+
private readonly _mediaSource;
|
|
12
|
+
private readonly _getCameraSettings;
|
|
13
|
+
private readonly _debug;
|
|
14
|
+
private readonly _logger;
|
|
15
|
+
constructor(signaling: BaseSignaling, mediaSource: MediaSource, getCameraSettings: () => VideoSettings | null, debug?: DebugLogger, logger?: StatsLogger | null);
|
|
16
|
+
configureFromRemoteOffer(pc: RTCPeerConnection): Promise<void>;
|
|
17
|
+
finalizeAnswer(sdp: string): string;
|
|
18
|
+
sync({ force }?: {
|
|
19
|
+
force?: boolean;
|
|
20
|
+
}): Promise<void>;
|
|
21
|
+
replaceTrack(track: MediaStreamTrack): boolean;
|
|
22
|
+
reset(): void;
|
|
23
|
+
private _findTransceiver;
|
|
24
|
+
private _findMediaSection;
|
|
25
|
+
private _getConfig;
|
|
26
|
+
private _getTrackConfig;
|
|
27
|
+
private _applyConfig;
|
|
28
|
+
private _applyCurrentMediaState;
|
|
29
|
+
private _syncReplacedTrack;
|
|
30
|
+
private _changeSimulcast;
|
|
31
|
+
}
|
|
@@ -50,6 +50,7 @@ export declare class Transport extends EventEmitter {
|
|
|
50
50
|
private readonly _codecStatsAggregator;
|
|
51
51
|
private readonly _onFirstMediaSent;
|
|
52
52
|
private _firstMediaSentProbeStopped;
|
|
53
|
+
private _vadController;
|
|
53
54
|
constructor(topology: TransportTopology, signaling: BaseSignaling, mediaSource: MediaSource, serverSettings: ServerSettings, debug?: DebugLogger, logger?: StatsLogger | null, statAggregator?: StatAggregator | null, codecStatsAggregator?: CodecStatsAggregator | null, onFirstMediaSent?: (() => void) | null);
|
|
54
55
|
updateSettings(settings: ServerSettings): void;
|
|
55
56
|
updateStatisticsInterval(): void;
|
|
@@ -96,6 +97,8 @@ export declare class Transport extends EventEmitter {
|
|
|
96
97
|
private _onAnimojiStream;
|
|
97
98
|
/** Обработчик, досылающий MediaSourceEvent.SOURCE_CHANGED событие до аллокации транспортов */
|
|
98
99
|
private _onAnimojiStatus;
|
|
100
|
+
private _createVad;
|
|
101
|
+
private _updateVadTrack;
|
|
99
102
|
private _createAnimojiTransport;
|
|
100
103
|
private _removeAnimojiTransport;
|
|
101
104
|
getStreamWaitingTimeMs(streamId: string, targetRtpTimestamp: number): number;
|
package/default/Api.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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';
|
|
@@ -17,7 +18,9 @@ export default class Api extends BaseApi {
|
|
|
17
18
|
private _getCachedAnonymLogin;
|
|
18
19
|
private _setCachedAnonymLogin;
|
|
19
20
|
private _removeCachedAnonymLogin;
|
|
21
|
+
private _reauthorize;
|
|
20
22
|
private _applyAnonymLogin;
|
|
23
|
+
private _sendClientStats;
|
|
21
24
|
logClientStats(items: ClientStats[]): void;
|
|
22
25
|
uploadDebugLogs(conversationId: string, startTime: number, endTime: number, log: string): Promise<void>;
|
|
23
26
|
joinConversation(conversationId: string, isVideo?: boolean, chatId?: string): Promise<ConversationResponse>;
|
|
@@ -55,7 +58,7 @@ export default class Api extends BaseApi {
|
|
|
55
58
|
getConversationParams(conversationId?: string): Promise<ConversationParams>;
|
|
56
59
|
getUserId(): OkUserId | null;
|
|
57
60
|
setUserId(userId: OkUserId): void;
|
|
58
|
-
hangupConversation(conversationId: string, reason?: HangupType): void;
|
|
61
|
+
hangupConversation(conversationId: string, reason?: HangupType, params?: Partial<IHangupParams>): void;
|
|
59
62
|
removeHistoryRecords(recordIds: number[]): Promise<void>;
|
|
60
63
|
cleanup(): void;
|
|
61
64
|
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
|
@@ -64,13 +64,14 @@ export default class Signaling extends BaseSignaling {
|
|
|
64
64
|
setProducerNotificationDataChannel(dataChannel: RTCDataChannel): void;
|
|
65
65
|
setProducerCommandDataChannel(dataChannel: RTCDataChannel): void;
|
|
66
66
|
useCommandDataChannel(status: boolean): void;
|
|
67
|
+
resetProducerConnection(cause?: Error): void;
|
|
67
68
|
/**
|
|
68
69
|
* Open a connection with a signaling server
|
|
69
70
|
*/
|
|
70
71
|
connect(connectionType: SignalingConnectionType): Promise<SignalingMessage.Connection>;
|
|
71
72
|
getNextCommandSequenceNumber(): number;
|
|
72
73
|
hangup(reason: string): Promise<SignalingMessage>;
|
|
73
|
-
sendCandidate(participantId: ParticipantId, candidate:
|
|
74
|
+
sendCandidate(participantId: ParticipantId, candidate: RTCIceCandidateInit): Promise<SignalingMessage>;
|
|
74
75
|
requestTestMode(consumerCommand: string, producerCommand: string | null): Promise<SignalingMessage>;
|
|
75
76
|
sendSdp(participantId: ParticipantId, sdp: RTCSessionDescriptionInit, extraPayload?: Record<string, any>): Promise<SignalingMessage>;
|
|
76
77
|
acceptCall(mediaSettings: MediaSettings): Promise<SignalingMessage>;
|
|
@@ -172,11 +173,13 @@ export default class Signaling extends BaseSignaling {
|
|
|
172
173
|
private _handleCommandResponse;
|
|
173
174
|
private _handleCommandsQueue;
|
|
174
175
|
private _startResponseTimer;
|
|
176
|
+
private _resolveCommandWithoutResponse;
|
|
175
177
|
private _serializeBinary;
|
|
176
178
|
private _serializeJson;
|
|
177
179
|
private _convertDisplayLayout;
|
|
178
180
|
private _waitConnectionMessage;
|
|
179
181
|
private _stopWaitConnectionMessage;
|
|
182
|
+
private _onTransportConnecting;
|
|
180
183
|
private _onTransportFailed;
|
|
181
184
|
private _onTransportReconnectScheduled;
|
|
182
185
|
private _onTransportConnectionDead;
|
|
@@ -16,7 +16,12 @@ export type SignalingTransportReconnectEvent = {
|
|
|
16
16
|
count: number;
|
|
17
17
|
delay: number;
|
|
18
18
|
};
|
|
19
|
+
export type SignalingTransportConnectingEvent = {
|
|
20
|
+
connectionType: SignalingConnectionType;
|
|
21
|
+
source: SignalingTransportType;
|
|
22
|
+
};
|
|
19
23
|
export type SignalingTransportHandlers = {
|
|
24
|
+
onConnecting: (event: SignalingTransportConnectingEvent) => void;
|
|
20
25
|
onOpen: () => void;
|
|
21
26
|
onMessage: (event: MessageEvent) => void;
|
|
22
27
|
onError: (event: Event) => void;
|
|
@@ -52,7 +57,7 @@ export default class SignalingTransport {
|
|
|
52
57
|
resetReconnectCount(): void;
|
|
53
58
|
connect(connectionType: SignalingConnectionType): void;
|
|
54
59
|
close(code?: number): void;
|
|
55
|
-
send(data: string | ArrayBuffer): void
|
|
60
|
+
send(data: string | ArrayBuffer): Promise<void>;
|
|
56
61
|
private _connect;
|
|
57
62
|
private _connectWebTransport;
|
|
58
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/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.e2067192.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
|
}
|