@vkontakte/calls-sdk 2.8.13-dev.c9243c68.0 → 2.8.13-dev.d1c40237.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 +51 -18
- package/abstract/BaseApi.d.ts +23 -20
- package/calls-sdk.cjs.js +7 -7
- package/calls-sdk.esm.js +5486 -3596
- package/classes/AudioFix.d.ts +2 -2
- package/classes/AudioOutput.d.ts +7 -6
- package/classes/CallRegistry.d.ts +22 -6
- package/classes/ExternalIdCache.d.ts +9 -13
- package/classes/MediaSource.d.ts +16 -2
- package/classes/SignalingErrors.d.ts +6 -0
- package/classes/SpecListener.d.ts +2 -2
- package/classes/StatsLogger.d.ts +1 -1
- package/classes/VolumesDetector.d.ts +0 -1
- 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/Conversation.d.ts +37 -14
- package/classes/conversation/Conversation.testUtils.d.ts +6 -3
- package/classes/conversation/DisplayLayoutRequester.d.ts +3 -1
- package/classes/screenshare/ScreenCaptureReceiver.d.ts +2 -2
- package/classes/screenshare/ScreenCaptureSender.d.ts +3 -3
- package/classes/screenshare/StreamBuilder.d.ts +2 -2
- package/classes/stat/ApiCallStats.d.ts +12 -0
- package/classes/stat/BatteryStats.d.ts +25 -0
- package/classes/stat/CallLifecycleStats.d.ts +5 -2
- package/classes/stat/CallStatTail.d.ts +65 -0
- package/classes/stat/ClientResourceStats.d.ts +41 -0
- package/classes/stat/ClientStatsMeta.d.ts +16 -0
- package/classes/stat/CodecStatsAggregator.d.ts +5 -2
- package/classes/stat/ConversationStats.d.ts +22 -3
- package/classes/stat/MlStats.d.ts +37 -0
- package/classes/stat/NetworkAdaptationStats.d.ts +35 -0
- package/classes/stat/PeerConnectionStats.d.ts +22 -0
- package/classes/stat/SdpStats.d.ts +40 -0
- package/classes/stat/Stat.testUtils.d.ts +17 -0
- package/classes/stat/StatAggregator.d.ts +12 -3
- package/classes/stat/StatClock.d.ts +28 -0
- package/classes/stat/StatDrainScheduler.d.ts +118 -0
- package/classes/stat/StatEventCollector.d.ts +45 -0
- package/classes/stat/StatPings.d.ts +6 -2
- package/classes/stat/StatQueue.d.ts +121 -0
- package/classes/stat/StatSignalingCommands.d.ts +4 -2
- package/classes/transport/BaseTransport.d.ts +3 -3
- package/classes/transport/DirectStatReporter.d.ts +2 -2
- package/classes/transport/DirectTransport.d.ts +14 -3
- package/classes/transport/PerfStatReporter.d.ts +9 -3
- package/classes/transport/ServerTransport.d.ts +7 -3
- package/classes/transport/SimulcastSender.d.ts +3 -3
- package/classes/transport/Statistics.d.ts +2 -2
- package/classes/transport/Transport.d.ts +10 -8
- package/classes/transport/VadGate.d.ts +39 -0
- package/default/Api.d.ts +23 -12
- package/default/Signaling.d.ts +22 -20
- package/default/SignalingSession.d.ts +92 -0
- package/enums/ActiveFeature.d.ts +19 -0
- package/enums/SessionError.d.ts +10 -0
- package/enums/Stat.d.ts +28 -1
- package/package.json +3 -3
- package/static/ApiTransport.d.ts +5 -1
- package/static/AuthData.d.ts +11 -1
- package/static/BrowserEnvironment.d.ts +90 -0
- package/static/External.d.ts +21 -0
- package/static/Params.d.ts +108 -11
- package/static/SessionStore.d.ts +29 -0
- package/static/SimulcastInfo.d.ts +1 -0
- package/static/WebRTCUtils.d.ts +12 -76
- package/types/AddParticipantParams.d.ts +18 -0
- package/types/ClientStatsEvent.d.ts +12 -0
- package/types/DeviceSelection.d.ts +8 -0
- package/types/ExternalId.d.ts +1 -1
- package/types/FastHangup.d.ts +10 -8
- package/types/IEventualStatLog.d.ts +1 -1
- package/types/Params.d.ts +1 -1
- package/types/Participant.d.ts +2 -2
- package/types/PerfStatReporter.d.ts +26 -1
- package/types/SignalingMessage.d.ts +3 -0
- package/types/Statistics.d.ts +22 -7
- package/utils/ErrorText.d.ts +2 -0
- package/abstract/BaseSignaling.d.ts +0 -143
- package/default/SignalingTransport.d.ts +0 -76
package/classes/AudioFix.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DebugLogger } from '../static/Debug';
|
|
2
|
-
import
|
|
2
|
+
import StatEventCollector from './stat/StatEventCollector';
|
|
3
3
|
import { MediaSource } from './MediaSource';
|
|
4
4
|
export default class AudioFix {
|
|
5
5
|
private _fixNoPacketsApplied;
|
|
@@ -15,7 +15,7 @@ export default class AudioFix {
|
|
|
15
15
|
private _lastPacketsSentTime;
|
|
16
16
|
private _toggleAudioPromise;
|
|
17
17
|
private _fixNoPacketsAppliedVideo;
|
|
18
|
-
constructor(mediaSource: MediaSource, debug?: DebugLogger, logger?:
|
|
18
|
+
constructor(mediaSource: MediaSource, debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
19
19
|
private _fixAudioDeviceNoPackets;
|
|
20
20
|
private _fixAudioDeviceTooManyPackets;
|
|
21
21
|
fix(rtps: any[]): void;
|
package/classes/AudioOutput.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type DebugLogger } from '../static/Debug';
|
|
2
|
-
import
|
|
3
|
-
import StatsLogger from './StatsLogger';
|
|
2
|
+
import StatEventCollector from './stat/StatEventCollector';
|
|
4
3
|
import { StatFirstMediaReceived } from './stat/StatFirstMediaReceived';
|
|
5
4
|
/**
|
|
6
5
|
* Единый AudioOutput поддерживающий p2p, audioMix и transparent-audio
|
|
@@ -8,16 +7,17 @@ import { StatFirstMediaReceived } from './stat/StatFirstMediaReceived';
|
|
|
8
7
|
export default class AudioOutput {
|
|
9
8
|
protected _audioElement: HTMLAudioElement | null;
|
|
10
9
|
protected readonly _debug: DebugLogger;
|
|
11
|
-
private
|
|
10
|
+
private _preparedAudioElement;
|
|
12
11
|
private _audioTracks;
|
|
13
12
|
private readonly _allowMultipleTracks;
|
|
14
13
|
private _volume;
|
|
15
14
|
private readonly _features;
|
|
16
15
|
private readonly _statFirstMediaReceived;
|
|
17
16
|
private readonly _logger;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
private _autoplayRecoveryController;
|
|
18
|
+
constructor(statFirstMediaReceived: StatFirstMediaReceived, allowMultipleTracks?: boolean, debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
19
|
+
add(trackId: string, track: MediaStreamTrack): void;
|
|
20
|
+
remove(trackId: string, track: MediaStreamTrack): void;
|
|
21
21
|
get volume(): number;
|
|
22
22
|
set volume(volume: number);
|
|
23
23
|
destroy(): void;
|
|
@@ -26,6 +26,7 @@ export default class AudioOutput {
|
|
|
26
26
|
protected _getTracks(): MediaStreamTrack[];
|
|
27
27
|
protected _initAudioElement(): void;
|
|
28
28
|
protected _stopAudioElement(): void;
|
|
29
|
+
private _stopAutoplayRecovery;
|
|
29
30
|
private _createAudioElement;
|
|
30
31
|
private _prepareAudioElement;
|
|
31
32
|
private _addTrackToAudioElement;
|
|
@@ -1,29 +1,45 @@
|
|
|
1
|
-
import type Conversation from './conversation';
|
|
2
1
|
import MediaSettings from '../types/MediaSettings';
|
|
2
|
+
import type Conversation from './conversation';
|
|
3
3
|
export interface HoldableConversation extends Conversation {
|
|
4
4
|
id: string;
|
|
5
5
|
hold(hold: boolean, lastActiveMediaSettings?: MediaSettings): Promise<void>;
|
|
6
6
|
}
|
|
7
7
|
export declare class CallRegistry {
|
|
8
8
|
private _conversations;
|
|
9
|
-
private
|
|
9
|
+
private _pending;
|
|
10
|
+
private _initialIds;
|
|
11
|
+
private _hangups;
|
|
10
12
|
private _activeId;
|
|
13
|
+
private _selected;
|
|
11
14
|
private _mutex;
|
|
12
15
|
private _pendingRemovals;
|
|
13
|
-
|
|
16
|
+
addPending(conversation: HoldableConversation): void;
|
|
17
|
+
selectPending(conversation: HoldableConversation): HoldableConversation | null;
|
|
18
|
+
isSelected(conversation: HoldableConversation): boolean;
|
|
19
|
+
releaseSelection(conversation: HoldableConversation, previous?: HoldableConversation | null): void;
|
|
20
|
+
selectIfNone(conversation: HoldableConversation): void;
|
|
14
21
|
add(conversation: HoldableConversation): void;
|
|
15
|
-
remove(
|
|
22
|
+
remove(conversation: HoldableConversation): void;
|
|
16
23
|
get(id: string): HoldableConversation | undefined;
|
|
24
|
+
getPending(id?: string): HoldableConversation | null;
|
|
25
|
+
isPending(conversation: HoldableConversation): boolean;
|
|
26
|
+
getLocal(id?: string): HoldableConversation | null;
|
|
27
|
+
trackHangup(conversation: HoldableConversation, promise: Promise<void>): void;
|
|
28
|
+
getHangup(id?: string): Promise<void> | undefined;
|
|
29
|
+
removeHangup(promise: Promise<void>): void;
|
|
17
30
|
getActive(): HoldableConversation | null;
|
|
18
31
|
getFirst(): HoldableConversation | null;
|
|
19
32
|
getActiveId(): string | null;
|
|
20
|
-
has(id: string): boolean;
|
|
33
|
+
has(id: string, except?: HoldableConversation): boolean;
|
|
21
34
|
getAll(): HoldableConversation[];
|
|
35
|
+
getLive(except?: HoldableConversation): HoldableConversation[];
|
|
22
36
|
get callsLength(): number;
|
|
23
|
-
|
|
37
|
+
canAcceptIncoming(next: HoldableConversation): boolean;
|
|
38
|
+
setActive(id: string, acceptingIncoming?: boolean): Promise<void>;
|
|
24
39
|
setHold(id: string): Promise<void>;
|
|
25
40
|
switchCall(id: string): Promise<void>;
|
|
26
41
|
clear(): void;
|
|
42
|
+
private _canReplaceActive;
|
|
27
43
|
private _flushPendingRemovals;
|
|
28
44
|
}
|
|
29
45
|
declare const callRegistry: CallRegistry;
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { ExternalId, ExternalParticipantId } from '../types/ExternalId';
|
|
2
|
-
import {
|
|
2
|
+
import { ParticipantId } from '../types/Participant';
|
|
3
3
|
export declare class ExternalIdCache {
|
|
4
4
|
private static _normalizeType;
|
|
5
|
-
private
|
|
6
|
-
private
|
|
5
|
+
private _participantIdToExternalId;
|
|
6
|
+
private _externalIdToParticipantId;
|
|
7
7
|
private _decorativeIdToInitialId;
|
|
8
8
|
private _initialIdToDecorativeId;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
unmapDecorativeId(initialId: OkUserId | CompositeUserId | ParticipantId): void;
|
|
16
|
-
getDecorativeIdByInitialId(initialId: OkUserId | CompositeUserId | ParticipantId): OkUserId | undefined;
|
|
17
|
-
replaceByInitialIdIdIfExists(id: OkUserId | CompositeUserId | ParticipantId): OkUserId;
|
|
18
|
-
getParticipantIdByExternalId(externalId: ExternalId): ParticipantId | null;
|
|
9
|
+
getExternalId(participantId: ParticipantId): ExternalParticipantId | null;
|
|
10
|
+
getParticipantId(externalId: ExternalId): ParticipantId | null;
|
|
11
|
+
cache(participantId: ParticipantId, externalId: ExternalParticipantId): void;
|
|
12
|
+
mapDecorativeId(decorativeId: ParticipantId, initialId: ParticipantId): void;
|
|
13
|
+
unmapDecorativeId(initialId: ParticipantId): void;
|
|
14
|
+
getDecorativeIdByInitialId(initialId: ParticipantId): ParticipantId | undefined;
|
|
19
15
|
clear(): void;
|
|
20
16
|
}
|
package/classes/MediaSource.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { IEffect } from '@vkontakte/calls-video-effects';
|
|
2
2
|
import EventEmitter from '../classes/EventEmitter';
|
|
3
|
+
import ActiveFeature from '../enums/ActiveFeature';
|
|
3
4
|
import MediaOption from '../enums/MediaOption';
|
|
4
5
|
import { type DebugLogger } from '../static/Debug';
|
|
5
6
|
import MediaSettings, { IVideoDimentions } from '../types/MediaSettings';
|
|
6
7
|
import { ScreenCaptureSettings } from '../types/ScreenCaptureSettings';
|
|
7
|
-
import
|
|
8
|
+
import StatEventCollector from './stat/StatEventCollector';
|
|
8
9
|
export declare const enum MediaSourceEvent {
|
|
9
10
|
SOURCE_CHANGED = "SOURCE_CHANGED",
|
|
10
11
|
SOURCE_READY = "SOURCE_READY",
|
|
@@ -38,6 +39,8 @@ export declare class MediaSource extends EventEmitter {
|
|
|
38
39
|
private _screenTrack;
|
|
39
40
|
private _audioShareTrack;
|
|
40
41
|
private _screenShareTrack;
|
|
42
|
+
private _screenCaptureRequest;
|
|
43
|
+
private _destroyed;
|
|
41
44
|
/** Трек для отправки в медиа-канал. Может отличаться при скриншаринге в дата-канал */
|
|
42
45
|
private _sendVideoTrack;
|
|
43
46
|
/** Трек с камеры. В стриме будет другой трек при включенных видео эффектах */
|
|
@@ -60,7 +63,9 @@ export declare class MediaSource extends EventEmitter {
|
|
|
60
63
|
private readonly _logger;
|
|
61
64
|
private _cameraTrackSetAt;
|
|
62
65
|
private _cameraMuteRecoveredAt;
|
|
63
|
-
|
|
66
|
+
private _micTrackSetAt;
|
|
67
|
+
private _micMuteRecoveredAt;
|
|
68
|
+
constructor(debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
64
69
|
get cameraVideoTrack(): MediaStreamTrack | null;
|
|
65
70
|
set cameraVideoTrack(track: MediaStreamTrack | null);
|
|
66
71
|
request(mediaOptions?: MediaOption[], needEmptyTracks?: boolean): Promise<void>;
|
|
@@ -75,6 +80,8 @@ export declare class MediaSource extends EventEmitter {
|
|
|
75
80
|
*/
|
|
76
81
|
getMediaSettings(): MediaSettings;
|
|
77
82
|
get mediaSettings(): MediaSettings;
|
|
83
|
+
/** Что сейчас включено у пользователя — для метрики active_features */
|
|
84
|
+
get activeFeatures(): ActiveFeature[];
|
|
78
85
|
changeDevice(kind: MediaDeviceKind): Promise<void>;
|
|
79
86
|
/**
|
|
80
87
|
* Установка кастомного стрима для видео, например внешний шаринг экрана
|
|
@@ -83,6 +90,7 @@ export declare class MediaSource extends EventEmitter {
|
|
|
83
90
|
* @hidden
|
|
84
91
|
*/
|
|
85
92
|
setVideoStream(stream: MediaStream, isScreen: boolean): Promise<void>;
|
|
93
|
+
private _setMicAudioTrack;
|
|
86
94
|
private _initDeviceChangeListener;
|
|
87
95
|
private _destroyDeviceChangeListener;
|
|
88
96
|
private _changeVideoInput;
|
|
@@ -109,6 +117,7 @@ export declare class MediaSource extends EventEmitter {
|
|
|
109
117
|
toggleScreenCapturing(settings: ScreenCaptureSettings): Promise<void>;
|
|
110
118
|
disableScreenCapturing(): Promise<void>;
|
|
111
119
|
private videoTrackMuteHandler;
|
|
120
|
+
private micTrackMuteHandler;
|
|
112
121
|
toggleVideo(enabled: boolean): Promise<void>;
|
|
113
122
|
toggleAudio(enabled: boolean): Promise<void>;
|
|
114
123
|
toggleAnimojiCapturing(enabled: boolean): void;
|
|
@@ -121,6 +130,11 @@ export declare class MediaSource extends EventEmitter {
|
|
|
121
130
|
updateNoiseSuppression(): Promise<void>;
|
|
122
131
|
videoEffect(effect: IEffect | null): Promise<void>;
|
|
123
132
|
audioEffect(audioEffectParams: AudioEffectParams | null): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Копия микрофона всегда включена: clone() копирует enabled,
|
|
135
|
+
* а VAD выключает трек микрофона, пока человек молчит
|
|
136
|
+
*/
|
|
137
|
+
private _cloneMicAudioTrack;
|
|
124
138
|
getAudioShareTrack(): MediaStreamTrack | null;
|
|
125
139
|
private handleVideoEffectsLowFps;
|
|
126
140
|
private get _frameRate();
|
|
@@ -2,7 +2,7 @@ import { type DebugLogger } from '../static/Debug';
|
|
|
2
2
|
import MediaSettings from '../types/MediaSettings';
|
|
3
3
|
import { Participant, ParticipantId } from '../types/Participant';
|
|
4
4
|
import EventEmitter from './EventEmitter';
|
|
5
|
-
import
|
|
5
|
+
import StatEventCollector from './stat/StatEventCollector';
|
|
6
6
|
import { Transport } from './transport/Transport';
|
|
7
7
|
import { VolumesDetector } from './VolumesDetector';
|
|
8
8
|
export default class SpecListener extends EventEmitter {
|
|
@@ -14,7 +14,7 @@ export default class SpecListener extends EventEmitter {
|
|
|
14
14
|
private _connectionTimeout;
|
|
15
15
|
private _connectionTimeoutSuppressed;
|
|
16
16
|
private _volumeTimeout;
|
|
17
|
-
constructor(transport: Transport, volumesDetector: VolumesDetector, participants: Record<ParticipantId, Participant>, debug?: DebugLogger, logger?:
|
|
17
|
+
constructor(transport: Transport, volumesDetector: VolumesDetector, participants: Record<ParticipantId, Participant>, debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
18
18
|
destroy(): void;
|
|
19
19
|
onChangeRemoteMediaSettings(participantId: ParticipantId, mediaSettings: MediaSettings): void;
|
|
20
20
|
onParticipantHoldChanged(): void;
|
package/classes/StatsLogger.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import BaseApi from '../abstract/BaseApi';
|
|
|
2
2
|
import BaseLogger from '../abstract/BaseLogger';
|
|
3
3
|
import StatLog from '../enums/StatLog';
|
|
4
4
|
import TransportTopology from '../enums/TransportTopology';
|
|
5
|
-
type ClientStatsPayload = Record<string, string | number | boolean | undefined | null>;
|
|
5
|
+
type ClientStatsPayload = Record<string, string | string[] | number | boolean | undefined | null>;
|
|
6
6
|
export type LogClientStatsOptions = {
|
|
7
7
|
immediately?: boolean;
|
|
8
8
|
occurredAt?: number;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type DebugLogger } from '../../static/Debug';
|
|
2
|
-
import
|
|
2
|
+
import StatEventCollector from '../stat/StatEventCollector';
|
|
3
3
|
import IDecoder from './IDecoder';
|
|
4
4
|
import WorkerBase from './WorkerBase';
|
|
5
5
|
export default class LibVPxDecoder extends WorkerBase implements IDecoder {
|
|
6
|
-
constructor(debug?: DebugLogger, logger?:
|
|
6
|
+
constructor(debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
7
7
|
init(onFrameImage: (image: ImageData) => void, onFrameError: (error: unknown) => void, onKeyFrameRequested: () => void): Promise<void>;
|
|
8
8
|
decodeFrame(timestamp: number, data: Uint8Array, isVP9: boolean, keyFrame?: boolean): void;
|
|
9
9
|
destroy(): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DebugLogger } from '../../static/Debug';
|
|
2
|
-
import
|
|
2
|
+
import StatEventCollector from '../stat/StatEventCollector';
|
|
3
3
|
import IEncoder from './IEncoder';
|
|
4
4
|
import { OnFrameCallback } from './Types';
|
|
5
5
|
import WorkerBase from './WorkerBase';
|
|
@@ -15,7 +15,7 @@ export default class LibVPxEncoder extends WorkerBase implements IEncoder {
|
|
|
15
15
|
private _canvasCtx;
|
|
16
16
|
private _frameReadTimeout;
|
|
17
17
|
private _lastFrame;
|
|
18
|
-
constructor(sourceTrack: MediaStreamTrack, onFrame: OnFrameCallback, useCongestionControl: boolean, maxBitrate: number, debug?: DebugLogger, logger?:
|
|
18
|
+
constructor(sourceTrack: MediaStreamTrack, onFrame: OnFrameCallback, useCongestionControl: boolean, maxBitrate: number, debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
19
19
|
private _createDom;
|
|
20
20
|
private _removeDom;
|
|
21
21
|
private _createStream;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type DebugLogger } from '../../static/Debug';
|
|
2
|
-
import
|
|
2
|
+
import StatEventCollector from '../stat/StatEventCollector';
|
|
3
3
|
import IDecoder from './IDecoder';
|
|
4
4
|
import WorkerBase from './WorkerBase';
|
|
5
5
|
export default class WebCodecsDecoder extends WorkerBase implements IDecoder {
|
|
6
|
-
constructor(debug?: DebugLogger, logger?:
|
|
6
|
+
constructor(debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
7
7
|
init(onFrameImage: (frame: VideoFrame) => void, onFrameError: (error: unknown) => void, onKeyFrameRequested: () => void): Promise<void>;
|
|
8
8
|
decodeFrame(timestamp: number, data: Uint8Array, isVP9: boolean, keyFrame?: boolean): void;
|
|
9
9
|
destroy(): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DebugLogger } from '../../static/Debug';
|
|
2
|
-
import
|
|
2
|
+
import StatEventCollector from '../stat/StatEventCollector';
|
|
3
3
|
import IEncoder from './IEncoder';
|
|
4
4
|
import { OnFrameCallback } from './Types';
|
|
5
5
|
import WorkerBase from './WorkerBase';
|
|
@@ -11,7 +11,7 @@ export default class WebCodecsEncoder extends WorkerBase implements IEncoder {
|
|
|
11
11
|
private readonly _maxBitrate;
|
|
12
12
|
private readonly _useCbr;
|
|
13
13
|
private readonly _frameRate;
|
|
14
|
-
constructor(sourceTrack: MediaStreamTrack, onFrame: OnFrameCallback, useCongestionControl: boolean, maxBitrate: number, useCbr: boolean, frameRate: number, debug?: DebugLogger, logger?:
|
|
14
|
+
constructor(sourceTrack: MediaStreamTrack, onFrame: OnFrameCallback, useCongestionControl: boolean, maxBitrate: number, useCbr: boolean, frameRate: number, debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
15
15
|
init(): Promise<void>;
|
|
16
16
|
requestFrame(keyFrame?: boolean): void;
|
|
17
17
|
setBitrate(bitrate: number, useCbr: boolean, fps: number): void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type DebugLogger } from '../../static/Debug';
|
|
2
|
-
import
|
|
2
|
+
import StatEventCollector from '../stat/StatEventCollector';
|
|
3
3
|
export default abstract class WorkerBase {
|
|
4
4
|
protected _worker: Worker | null;
|
|
5
5
|
protected readonly _debug: DebugLogger;
|
|
6
|
-
protected readonly _logger:
|
|
7
|
-
protected constructor(debug?: DebugLogger, logger?:
|
|
6
|
+
protected readonly _logger: StatEventCollector | null;
|
|
7
|
+
protected constructor(debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
8
8
|
protected _createWorker(workerFunctionData: string, onFrame: (data: any) => void, workerArgs?: any[], initArgs?: {
|
|
9
9
|
[key: string]: any;
|
|
10
10
|
}, transfer?: any[]): Promise<void>;
|
|
@@ -2,7 +2,7 @@ import type { IEffect } from '@vkontakte/calls-video-effects';
|
|
|
2
2
|
import type { RGBTuple } from '@vkontakte/calls-vmoji';
|
|
3
3
|
import BaseApi from '../../abstract/BaseApi';
|
|
4
4
|
import BaseLogger from '../../abstract/BaseLogger';
|
|
5
|
-
import { AddParticipantParams } from '../../
|
|
5
|
+
import type { AddParticipantParams } from '../../types/AddParticipantParams';
|
|
6
6
|
import ConversationFeature from '../../enums/ConversationFeature';
|
|
7
7
|
import ConversationOption from '../../enums/ConversationOption';
|
|
8
8
|
import MediaOption from '../../enums/MediaOption';
|
|
@@ -15,12 +15,12 @@ import { IAsrStartParams, IAsrStopParams } from '../../types/Asr';
|
|
|
15
15
|
import { AudienceModeHandsResponse } from '../../types/AudienceMode';
|
|
16
16
|
import { ConversationData, ConversationOnJoinParams, ConversationOnStartParams } from '../../types/Conversation';
|
|
17
17
|
import { ExternalId, ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk } from '../../types/ExternalId';
|
|
18
|
-
import type {
|
|
18
|
+
import type { HangupParams } from '../../types/FastHangup';
|
|
19
19
|
import MediaModifiers from '../../types/MediaModifiers';
|
|
20
20
|
import MediaSettings, { IVideoDimentions } from '../../types/MediaSettings';
|
|
21
21
|
import { IAddMovieParams, IUpdateMovieData } from '../../types/MovieShare';
|
|
22
22
|
import MuteStates from '../../types/MuteStates';
|
|
23
|
-
import { CompositeUserId, IGetParticipantsParameters,
|
|
23
|
+
import { CompositeUserId, IGetParticipantsParameters, ParticipantId, ParticipantStateData } from '../../types/Participant';
|
|
24
24
|
import { DisplayLayoutRequest, ParticipantLayout } from '../../types/ParticipantLayout';
|
|
25
25
|
import { ParticipantListChunkParameters } from '../../types/ParticipantListChunk';
|
|
26
26
|
import ParticipantPriority from '../../types/ParticipantPriority';
|
|
@@ -35,6 +35,9 @@ export default class Conversation extends EventEmitter {
|
|
|
35
35
|
private readonly _signalingActor;
|
|
36
36
|
private readonly _displayLayoutRequester;
|
|
37
37
|
private _mediaSource;
|
|
38
|
+
private _requestingLocalMedia;
|
|
39
|
+
private _requestedLocalAudio?;
|
|
40
|
+
private _requestedLocalVideo?;
|
|
38
41
|
private _conversation;
|
|
39
42
|
private _myLastRequestedLayouts;
|
|
40
43
|
private _state;
|
|
@@ -56,15 +59,20 @@ export default class Conversation extends EventEmitter {
|
|
|
56
59
|
private _isRealTimeAsrRequested;
|
|
57
60
|
private _serverSettings;
|
|
58
61
|
private _serverTimeOffset;
|
|
59
|
-
private
|
|
62
|
+
private _serverConversationId;
|
|
60
63
|
private _onFastHangup?;
|
|
61
64
|
private _hangupEmitted;
|
|
62
65
|
private _hangupPromise;
|
|
66
|
+
private _hangupReason;
|
|
63
67
|
private _abortController;
|
|
64
68
|
private _registeredPeerReceived;
|
|
65
69
|
private _calleeUnavailableTimer;
|
|
66
|
-
private
|
|
70
|
+
private _pendingId;
|
|
71
|
+
private _resolveSignalingInitialization;
|
|
72
|
+
private readonly _signalingInitialization;
|
|
67
73
|
private readonly _onUnload;
|
|
74
|
+
private readonly _onRestore;
|
|
75
|
+
private readonly _onVisibilityChange;
|
|
68
76
|
private readonly _audioOutput;
|
|
69
77
|
private readonly _stats;
|
|
70
78
|
private _lastStalled;
|
|
@@ -79,7 +87,6 @@ export default class Conversation extends EventEmitter {
|
|
|
79
87
|
private readonly _statFirstMediaReceived;
|
|
80
88
|
constructor(api: BaseApi, externalLogger: BaseLogger | null);
|
|
81
89
|
static current(): Conversation | null;
|
|
82
|
-
static hangupAfterInit(onFastHangup?: FastHangupHandler): void;
|
|
83
90
|
static id(): string | null;
|
|
84
91
|
get id(): string;
|
|
85
92
|
get externalId(): ExternalParticipantId | undefined;
|
|
@@ -91,11 +98,13 @@ export default class Conversation extends EventEmitter {
|
|
|
91
98
|
static debugMessageWithContext(type: DebugMessageType, conversationId: string, ...args: any[]): boolean;
|
|
92
99
|
static getSyncedTime(): number;
|
|
93
100
|
get debugSessionId(): string | null;
|
|
94
|
-
|
|
101
|
+
getCachedParticipantIdByExternalId(externalId: ExternalId): ParticipantId | null;
|
|
102
|
+
private _onNonFatalError;
|
|
95
103
|
/**
|
|
96
104
|
* Внешний id звонящего во входящем звонке, либо null, если звонящий не найден.
|
|
97
105
|
*/
|
|
98
106
|
getIncomingCallerExternalId(): ExternalParticipantId | null;
|
|
107
|
+
get oneToOnePeer(): CompositeUserId | null;
|
|
99
108
|
private _buildInternalParams;
|
|
100
109
|
onStart({ opponentIds, opponentType, mediaOptions, payload, joiningAllowed, requireAuthToJoin, onlyAdminCanShareMovie, externalIds, onFastStart, conversationId, }: ConversationOnStartParams): Promise<ConversationData>;
|
|
101
110
|
onJoin(joinArgs: ConversationOnJoinParams): Promise<ConversationData>;
|
|
@@ -114,7 +123,8 @@ export default class Conversation extends EventEmitter {
|
|
|
114
123
|
accept(mediaOptions: MediaOption[]): Promise<ConversationData>;
|
|
115
124
|
decline(params?: HangupParams): Promise<void>;
|
|
116
125
|
hangup(params?: HangupParams): Promise<void>;
|
|
117
|
-
|
|
126
|
+
private _waitForHangup;
|
|
127
|
+
addParticipant(participantIds: ExternalId[], params?: AddParticipantParams): Promise<ExternalParticipant[] | undefined>;
|
|
118
128
|
addParticipantLegacy(participantIds: CompositeUserId[], params?: AddParticipantParams): Promise<void>;
|
|
119
129
|
removeParticipant(participantId: CompositeUserId, ban?: boolean): Promise<void>;
|
|
120
130
|
setVolume(volume: number): void;
|
|
@@ -122,11 +132,15 @@ export default class Conversation extends EventEmitter {
|
|
|
122
132
|
private _openTransport;
|
|
123
133
|
private _allocateParticipantTransport;
|
|
124
134
|
private _closeParticipantTransport;
|
|
135
|
+
private _registerPending;
|
|
125
136
|
private _cleanupRegistry;
|
|
137
|
+
private _applyInitialActiveSelection;
|
|
126
138
|
private _emitHangupOnce;
|
|
127
139
|
private _sendHangupApi;
|
|
128
140
|
private _close;
|
|
129
141
|
private _sendHangup;
|
|
142
|
+
private _throwIfClosed;
|
|
143
|
+
private _applyServerConversation;
|
|
130
144
|
destroy(): void;
|
|
131
145
|
private _destroy;
|
|
132
146
|
private _getConversationParams;
|
|
@@ -150,12 +164,15 @@ export default class Conversation extends EventEmitter {
|
|
|
150
164
|
private _cacheParticipantExternalIds;
|
|
151
165
|
private _setConversation;
|
|
152
166
|
private _updateConversation;
|
|
167
|
+
private _requestLocalMedia;
|
|
153
168
|
private _createMediaSource;
|
|
154
169
|
private _connectSignaling;
|
|
170
|
+
private _completeSignalingInitialization;
|
|
155
171
|
private _processConnection;
|
|
156
172
|
private _onConversationParticipantListChunk;
|
|
157
173
|
private _createParticipantListChunk;
|
|
158
174
|
private _participantListChunkToExternalChunk;
|
|
175
|
+
private _participantsToExternal;
|
|
159
176
|
private _registerConnectionParticipants;
|
|
160
177
|
private _registerParticipants;
|
|
161
178
|
/** Установим состояние локальных мьютов */
|
|
@@ -169,8 +186,9 @@ export default class Conversation extends EventEmitter {
|
|
|
169
186
|
private _registerParticipantInCache;
|
|
170
187
|
private _getExistedParticipantByIdOrCreate;
|
|
171
188
|
private _getExternalIdByParticipantId;
|
|
172
|
-
private
|
|
173
|
-
private
|
|
189
|
+
private _getExternalIdsByParticipantIds;
|
|
190
|
+
private _reportMissingExternalIds;
|
|
191
|
+
private _reportMissingExternalIdsById;
|
|
174
192
|
private _registerParticipantAndSetMarkersIfChunkEnabled;
|
|
175
193
|
private _warnParticipantNotInConversation;
|
|
176
194
|
private _denormalizeMarkers;
|
|
@@ -247,8 +265,8 @@ export default class Conversation extends EventEmitter {
|
|
|
247
265
|
private _isWaitingForPromotion;
|
|
248
266
|
private _getWaitingForPromotionStatus;
|
|
249
267
|
putHandsDown(): Promise<void>;
|
|
250
|
-
requestKeyFrame(participantStreamDescription: ParticipantStreamDescription): Promise<
|
|
251
|
-
requestTestMode(consumerCommand: string, producerCommand: string): Promise<
|
|
268
|
+
requestKeyFrame(participantStreamDescription: ParticipantStreamDescription): Promise<SignalingMessage>;
|
|
269
|
+
requestTestMode(consumerCommand: string, producerCommand: string): Promise<SignalingMessage>;
|
|
252
270
|
updateDisplayLayout(layouts: ParticipantLayout[]): Promise<void>;
|
|
253
271
|
requestDisplayLayout(requests: DisplayLayoutRequest[]): Promise<void>;
|
|
254
272
|
feedback(key: string): Promise<SignalingMessage>;
|
|
@@ -447,8 +465,15 @@ export default class Conversation extends EventEmitter {
|
|
|
447
465
|
private _onFeedback;
|
|
448
466
|
private _onDecorativeParticipantIdChanged;
|
|
449
467
|
private _onVideoSuspendSuggest;
|
|
468
|
+
private _reconcileParticipantHold;
|
|
450
469
|
private _onParticipantHold;
|
|
470
|
+
private _applyParticipantHold;
|
|
451
471
|
private _isMe;
|
|
472
|
+
/**
|
|
473
|
+
* Сколько человек сейчас в звонке. Считаем только принявших: приглашенные,
|
|
474
|
+
* у которых еще идет вызов, ресурсы не потребляют.
|
|
475
|
+
*/
|
|
476
|
+
private _getParticipantsCount;
|
|
452
477
|
private _getMuteStatesForRoomId;
|
|
453
478
|
private _getMuteStatesForCurrentRoom;
|
|
454
479
|
private _setMuteStatesForRoomId;
|
|
@@ -456,8 +481,6 @@ export default class Conversation extends EventEmitter {
|
|
|
456
481
|
private _registerParticipant;
|
|
457
482
|
private _getParticipant;
|
|
458
483
|
}
|
|
459
|
-
declare function _resetPendingInstance(): void;
|
|
460
|
-
export { _resetPendingInstance };
|
|
461
484
|
export declare class UpdateDisplayLayoutError extends Error {
|
|
462
485
|
readonly participantErrors: {
|
|
463
486
|
externalId: ExternalParticipantId;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FetchMock } from 'vitest-fetch-mock';
|
|
2
2
|
import { Mock } from 'vitest';
|
|
3
3
|
import { Client, Server } from 'mock-socket';
|
|
4
|
-
import { ISharedMovieInfo, OkUserId } from '../../CallsSDK';
|
|
4
|
+
import { CompositeUserId, ISharedMovieInfo, OkUserId } from '../../CallsSDK';
|
|
5
5
|
import Api from '../../default/Api';
|
|
6
6
|
import CallDirection from '../../enums/CallDirection';
|
|
7
7
|
import ConversationOption from '../../enums/ConversationOption';
|
|
@@ -35,6 +35,9 @@ declare function createParams(): {
|
|
|
35
35
|
onChatRoomUpdated: Mock<import("@vitest/spy").Procedure>;
|
|
36
36
|
onRemoteStatus: Mock<import("@vitest/spy").Procedure>;
|
|
37
37
|
onSpeakerChanged: Mock<import("@vitest/spy").Procedure>;
|
|
38
|
+
onAcceptedCall: Mock<import("@vitest/spy").Procedure>;
|
|
39
|
+
onNonFatalError: Mock<import("@vitest/spy").Procedure>;
|
|
40
|
+
onSignalingConnected: Mock<import("@vitest/spy").Procedure>;
|
|
38
41
|
};
|
|
39
42
|
export type ConversationTestParams = ReturnType<typeof createParams>;
|
|
40
43
|
export type ConversationTestTools = {
|
|
@@ -103,7 +106,7 @@ export declare function createWaitingHallConversationData(): {
|
|
|
103
106
|
asrInfoByRoom: Map<any, any>;
|
|
104
107
|
audienceMode: boolean;
|
|
105
108
|
chatId: null;
|
|
106
|
-
compositeUserId:
|
|
109
|
+
compositeUserId: `u${number}` | `g${number}`;
|
|
107
110
|
concurrent: boolean;
|
|
108
111
|
direction: CallDirection;
|
|
109
112
|
externalId: ExternalParticipantId;
|
|
@@ -144,5 +147,5 @@ export declare function createConnectionMessage(data?: Partial<SignalingMessage.
|
|
|
144
147
|
export declare function createParticipant(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
145
148
|
export declare function createParticipantWithMarkers(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
146
149
|
export declare function createMarkers(data?: Partial<ParticipantListMarkers>): ParticipantListMarkers;
|
|
147
|
-
export declare function createMovieShareInfo(initiatorId:
|
|
150
|
+
export declare function createMovieShareInfo(initiatorId: CompositeUserId, data?: Partial<ISharedMovieInfo> | null): ISharedMovieInfo;
|
|
148
151
|
export {};
|
|
@@ -8,6 +8,7 @@ type DisplayLayoutRequesterParams = {
|
|
|
8
8
|
getParticipants: () => Record<ParticipantId, Participant>;
|
|
9
9
|
isMe: (participantId: ParticipantId) => boolean;
|
|
10
10
|
updateDisplayLayout: (layouts: ParticipantLayout[]) => Promise<void>;
|
|
11
|
+
onNonFatalError: (message: string) => void;
|
|
11
12
|
};
|
|
12
13
|
export default class DisplayLayoutRequester {
|
|
13
14
|
private readonly _api;
|
|
@@ -15,6 +16,7 @@ export default class DisplayLayoutRequester {
|
|
|
15
16
|
private readonly _getParticipants;
|
|
16
17
|
private readonly _isMe;
|
|
17
18
|
private readonly _updateDisplayLayout;
|
|
19
|
+
private readonly _onNonFatalError;
|
|
18
20
|
private _requestedLayouts;
|
|
19
21
|
private _uncertainLayouts;
|
|
20
22
|
private _pendingRequests;
|
|
@@ -25,7 +27,7 @@ export default class DisplayLayoutRequester {
|
|
|
25
27
|
private _lastFlushAt;
|
|
26
28
|
private _generation;
|
|
27
29
|
private _forceNextFlush;
|
|
28
|
-
constructor({ api, debug, getParticipants, isMe, updateDisplayLayout }: DisplayLayoutRequesterParams);
|
|
30
|
+
constructor({ api, debug, getParticipants, isMe, updateDisplayLayout, onNonFatalError }: DisplayLayoutRequesterParams);
|
|
29
31
|
request(requests: DisplayLayoutRequest[]): Promise<void>;
|
|
30
32
|
resend(): void;
|
|
31
33
|
cleanupParticipant(participantId: ParticipantId): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type DebugLogger } from '../../static/Debug';
|
|
2
2
|
import { ParticipantId } from '../../types/Participant';
|
|
3
|
-
import
|
|
3
|
+
import StatEventCollector from '../stat/StatEventCollector';
|
|
4
4
|
import { ParticipantIdRegistry } from '../ParticipantIdRegistry';
|
|
5
5
|
import { StatAggregator } from '../stat/StatAggregator';
|
|
6
6
|
import { IOnStat } from './BaseStreamBuilder';
|
|
@@ -14,7 +14,7 @@ export default class ScreenCaptureReceiver {
|
|
|
14
14
|
private readonly _debug;
|
|
15
15
|
private readonly _logger;
|
|
16
16
|
private readonly _statAggregator;
|
|
17
|
-
constructor(datachannel: RTCDataChannel, participantIdRegistry: ParticipantIdRegistry, onStream: (streamId: string, stream: MediaStream) => void, onEos: (streamId: string) => void, onStat: IOnStat, statAggregator?: StatAggregator | null, debug?: DebugLogger, logger?:
|
|
17
|
+
constructor(datachannel: RTCDataChannel, participantIdRegistry: ParticipantIdRegistry, onStream: (streamId: string, stream: MediaStream) => void, onEos: (streamId: string) => void, onStat: IOnStat, statAggregator?: StatAggregator | null, debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
18
18
|
private _onDataChannelMessage;
|
|
19
19
|
/**
|
|
20
20
|
* Отправить запрос ключевого кадра в datachannel.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type Signaling from '../../default/Signaling';
|
|
2
2
|
import { type DebugLogger } from '../../static/Debug';
|
|
3
|
-
import
|
|
3
|
+
import StatEventCollector from '../stat/StatEventCollector';
|
|
4
4
|
export default class ScreenCaptureSender {
|
|
5
5
|
private readonly _encoder;
|
|
6
6
|
private readonly _datachannel;
|
|
@@ -25,7 +25,7 @@ export default class ScreenCaptureSender {
|
|
|
25
25
|
private readonly _maxFrameDelay;
|
|
26
26
|
private readonly _debug;
|
|
27
27
|
private readonly _logger;
|
|
28
|
-
constructor(track: MediaStreamTrack, datachannel: RTCDataChannel, signaling:
|
|
28
|
+
constructor(track: MediaStreamTrack, datachannel: RTCDataChannel, signaling: Signaling, fastSharing: boolean, debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
29
29
|
private _handleQueue;
|
|
30
30
|
/**
|
|
31
31
|
* Очищает очередь до опорного кадра
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type DebugLogger } from '../../static/Debug';
|
|
2
2
|
import { ParticipantId } from '../../types/Participant';
|
|
3
|
-
import
|
|
3
|
+
import StatEventCollector from '../stat/StatEventCollector';
|
|
4
4
|
import { StatAggregator } from '../stat/StatAggregator';
|
|
5
5
|
import { BaseStreamBuilder, FrameData, IOnStat, IOnStream } from './BaseStreamBuilder';
|
|
6
6
|
export default class StreamBuilder extends BaseStreamBuilder {
|
|
@@ -12,7 +12,7 @@ export default class StreamBuilder extends BaseStreamBuilder {
|
|
|
12
12
|
private _webCodecsRetryAttempted;
|
|
13
13
|
private _fpsMeter;
|
|
14
14
|
private readonly _logger;
|
|
15
|
-
constructor(participantId: ParticipantId, onStream: IOnStream, onStat: IOnStat, statAggregator: StatAggregator | null, onKeyFrameRequested: VoidFunction, debug?: DebugLogger, logger?:
|
|
15
|
+
constructor(participantId: ParticipantId, onStream: IOnStream, onStat: IOnStat, statAggregator: StatAggregator | null, onKeyFrameRequested: VoidFunction, debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
16
16
|
protected _processFrame(frame: FrameData): void;
|
|
17
17
|
private _initFpsMeter;
|
|
18
18
|
/**
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StatAggregator } from './StatAggregator';
|
|
2
|
+
/** Отправляет в стату время выполнения запросов к API */
|
|
3
|
+
export declare class ApiCallStats {
|
|
4
|
+
private readonly _statAggregator;
|
|
5
|
+
constructor(statAggregator: StatAggregator | null);
|
|
6
|
+
/**
|
|
7
|
+
* @param method название метода API, например `vchat.getConversationParams`
|
|
8
|
+
* @param duration время от запроса до ответа, мс
|
|
9
|
+
* @param error описание ошибки, если запрос не удался
|
|
10
|
+
*/
|
|
11
|
+
log(method: string, duration: number, error?: string): void;
|
|
12
|
+
}
|