@vkontakte/calls-sdk 2.8.13-dev.805c82c2.0 → 2.8.13-dev.812b5787.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 +14 -10
- package/calls-sdk.cjs.js +7 -7
- package/calls-sdk.esm.js +5624 -3675
- package/classes/AudioFix.d.ts +2 -2
- package/classes/AudioOutput.d.ts +10 -6
- package/classes/CallRegistry.d.ts +22 -6
- 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/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 +33 -10
- package/classes/conversation/Conversation.testUtils.d.ts +4 -3
- 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/CodecStatsAggregator.d.ts +5 -2
- package/classes/stat/ConversationStats.d.ts +24 -3
- package/classes/stat/MlStats.d.ts +37 -0
- package/classes/stat/NetworkAdaptationStats.d.ts +35 -0
- package/classes/stat/NisqaStats.d.ts +46 -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 +14 -3
- package/classes/stat/StatClock.d.ts +28 -0
- package/classes/stat/StatDrainScheduler.d.ts +113 -0
- package/classes/stat/StatEventCollector.d.ts +45 -0
- package/classes/stat/StatPings.d.ts +6 -2
- package/classes/stat/StatQueue.d.ts +118 -0
- package/classes/stat/StatSignalingCommands.d.ts +4 -2
- package/classes/transport/BaseTransport.d.ts +3 -3
- package/classes/transport/DirectNetworkRating.d.ts +16 -0
- package/classes/transport/DirectTransport.d.ts +16 -5
- package/classes/transport/PerfStatReporter.d.ts +10 -4
- package/classes/transport/RemotePacketLoss.d.ts +15 -0
- package/classes/transport/ServerTransport.d.ts +7 -3
- package/classes/transport/SimulcastSender.d.ts +3 -3
- package/classes/transport/Statistics.d.ts +5 -4
- package/classes/transport/Transport.d.ts +18 -8
- package/classes/transport/VadGate.d.ts +39 -0
- package/default/Api.d.ts +14 -2
- 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 +11 -0
- package/static/Params.d.ts +96 -18
- 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 +30 -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/classes/transport/DirectStatReporter.d.ts +0 -46
- 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,24 +7,29 @@ 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
|
+
private _refreshAudioElement;
|
|
19
|
+
constructor(statFirstMediaReceived: StatFirstMediaReceived, allowMultipleTracks?: boolean, debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
20
|
+
add(trackId: string, track: MediaStreamTrack, replaceAll?: boolean): void;
|
|
21
|
+
remove(trackId: string, track: MediaStreamTrack): void;
|
|
21
22
|
get volume(): number;
|
|
22
23
|
set volume(volume: number);
|
|
23
24
|
destroy(): void;
|
|
24
25
|
/** изменяем устройство для воспроизведения аудио */
|
|
25
26
|
changeOutput(): Promise<void>;
|
|
27
|
+
/** Входящие аудиотреки, которые сейчас играются */
|
|
28
|
+
get tracks(): MediaStreamTrack[];
|
|
26
29
|
protected _getTracks(): MediaStreamTrack[];
|
|
27
30
|
protected _initAudioElement(): void;
|
|
28
31
|
protected _stopAudioElement(): void;
|
|
32
|
+
private _stopAutoplayRecovery;
|
|
29
33
|
private _createAudioElement;
|
|
30
34
|
private _prepareAudioElement;
|
|
31
35
|
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;
|
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 | 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,7 +15,7 @@ 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';
|
|
@@ -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;
|
|
@@ -45,6 +48,7 @@ export default class Conversation extends EventEmitter {
|
|
|
45
48
|
private _participants;
|
|
46
49
|
private _directTransportIsMaster?;
|
|
47
50
|
private _transport;
|
|
51
|
+
private _pendingDirectMessages;
|
|
48
52
|
private _debugInfo;
|
|
49
53
|
private readonly _debug;
|
|
50
54
|
private _volumesDetector;
|
|
@@ -56,15 +60,20 @@ export default class Conversation extends EventEmitter {
|
|
|
56
60
|
private _isRealTimeAsrRequested;
|
|
57
61
|
private _serverSettings;
|
|
58
62
|
private _serverTimeOffset;
|
|
59
|
-
private
|
|
63
|
+
private _serverConversationId;
|
|
60
64
|
private _onFastHangup?;
|
|
61
65
|
private _hangupEmitted;
|
|
62
66
|
private _hangupPromise;
|
|
67
|
+
private _hangupReason;
|
|
63
68
|
private _abortController;
|
|
64
69
|
private _registeredPeerReceived;
|
|
65
70
|
private _calleeUnavailableTimer;
|
|
66
|
-
private
|
|
71
|
+
private _pendingId;
|
|
72
|
+
private _resolveSignalingInitialization;
|
|
73
|
+
private readonly _signalingInitialization;
|
|
67
74
|
private readonly _onUnload;
|
|
75
|
+
private readonly _onRestore;
|
|
76
|
+
private readonly _onVisibilityChange;
|
|
68
77
|
private readonly _audioOutput;
|
|
69
78
|
private readonly _stats;
|
|
70
79
|
private _lastStalled;
|
|
@@ -79,7 +88,6 @@ export default class Conversation extends EventEmitter {
|
|
|
79
88
|
private readonly _statFirstMediaReceived;
|
|
80
89
|
constructor(api: BaseApi, externalLogger: BaseLogger | null);
|
|
81
90
|
static current(): Conversation | null;
|
|
82
|
-
static hangupAfterInit(onFastHangup?: FastHangupHandler): void;
|
|
83
91
|
static id(): string | null;
|
|
84
92
|
get id(): string;
|
|
85
93
|
get externalId(): ExternalParticipantId | undefined;
|
|
@@ -97,6 +105,7 @@ export default class Conversation extends EventEmitter {
|
|
|
97
105
|
* Внешний id звонящего во входящем звонке, либо null, если звонящий не найден.
|
|
98
106
|
*/
|
|
99
107
|
getIncomingCallerExternalId(): ExternalParticipantId | null;
|
|
108
|
+
get oneToOnePeer(): CompositeUserId | null;
|
|
100
109
|
private _buildInternalParams;
|
|
101
110
|
onStart({ opponentIds, opponentType, mediaOptions, payload, joiningAllowed, requireAuthToJoin, onlyAdminCanShareMovie, externalIds, onFastStart, conversationId, }: ConversationOnStartParams): Promise<ConversationData>;
|
|
102
111
|
onJoin(joinArgs: ConversationOnJoinParams): Promise<ConversationData>;
|
|
@@ -115,7 +124,8 @@ export default class Conversation extends EventEmitter {
|
|
|
115
124
|
accept(mediaOptions: MediaOption[]): Promise<ConversationData>;
|
|
116
125
|
decline(params?: HangupParams): Promise<void>;
|
|
117
126
|
hangup(params?: HangupParams): Promise<void>;
|
|
118
|
-
|
|
127
|
+
private _waitForHangup;
|
|
128
|
+
addParticipant(participantIds: ExternalId[], params?: AddParticipantParams): Promise<ExternalParticipant[] | undefined>;
|
|
119
129
|
addParticipantLegacy(participantIds: CompositeUserId[], params?: AddParticipantParams): Promise<void>;
|
|
120
130
|
removeParticipant(participantId: CompositeUserId, ban?: boolean): Promise<void>;
|
|
121
131
|
setVolume(volume: number): void;
|
|
@@ -123,11 +133,15 @@ export default class Conversation extends EventEmitter {
|
|
|
123
133
|
private _openTransport;
|
|
124
134
|
private _allocateParticipantTransport;
|
|
125
135
|
private _closeParticipantTransport;
|
|
136
|
+
private _registerPending;
|
|
126
137
|
private _cleanupRegistry;
|
|
138
|
+
private _applyInitialActiveSelection;
|
|
127
139
|
private _emitHangupOnce;
|
|
128
140
|
private _sendHangupApi;
|
|
129
141
|
private _close;
|
|
130
142
|
private _sendHangup;
|
|
143
|
+
private _throwIfClosed;
|
|
144
|
+
private _applyServerConversation;
|
|
131
145
|
destroy(): void;
|
|
132
146
|
private _destroy;
|
|
133
147
|
private _getConversationParams;
|
|
@@ -151,12 +165,15 @@ export default class Conversation extends EventEmitter {
|
|
|
151
165
|
private _cacheParticipantExternalIds;
|
|
152
166
|
private _setConversation;
|
|
153
167
|
private _updateConversation;
|
|
168
|
+
private _requestLocalMedia;
|
|
154
169
|
private _createMediaSource;
|
|
155
170
|
private _connectSignaling;
|
|
171
|
+
private _completeSignalingInitialization;
|
|
156
172
|
private _processConnection;
|
|
157
173
|
private _onConversationParticipantListChunk;
|
|
158
174
|
private _createParticipantListChunk;
|
|
159
175
|
private _participantListChunkToExternalChunk;
|
|
176
|
+
private _participantsToExternal;
|
|
160
177
|
private _registerConnectionParticipants;
|
|
161
178
|
private _registerParticipants;
|
|
162
179
|
/** Установим состояние локальных мьютов */
|
|
@@ -249,8 +266,8 @@ export default class Conversation extends EventEmitter {
|
|
|
249
266
|
private _isWaitingForPromotion;
|
|
250
267
|
private _getWaitingForPromotionStatus;
|
|
251
268
|
putHandsDown(): Promise<void>;
|
|
252
|
-
requestKeyFrame(participantStreamDescription: ParticipantStreamDescription): Promise<
|
|
253
|
-
requestTestMode(consumerCommand: string, producerCommand: string): Promise<
|
|
269
|
+
requestKeyFrame(participantStreamDescription: ParticipantStreamDescription): Promise<SignalingMessage>;
|
|
270
|
+
requestTestMode(consumerCommand: string, producerCommand: string): Promise<SignalingMessage>;
|
|
254
271
|
updateDisplayLayout(layouts: ParticipantLayout[]): Promise<void>;
|
|
255
272
|
requestDisplayLayout(requests: DisplayLayoutRequest[]): Promise<void>;
|
|
256
273
|
feedback(key: string): Promise<SignalingMessage>;
|
|
@@ -416,6 +433,7 @@ export default class Conversation extends EventEmitter {
|
|
|
416
433
|
private _onVolumesDetected;
|
|
417
434
|
private _onSpeakerChanged;
|
|
418
435
|
private _onTransportStateChanged;
|
|
436
|
+
private _onServerConnected;
|
|
419
437
|
private _onTransportLocalStateChanged;
|
|
420
438
|
private _areTransportParticipantsOnHold;
|
|
421
439
|
private _onRemoteTrackAdded;
|
|
@@ -449,8 +467,15 @@ export default class Conversation extends EventEmitter {
|
|
|
449
467
|
private _onFeedback;
|
|
450
468
|
private _onDecorativeParticipantIdChanged;
|
|
451
469
|
private _onVideoSuspendSuggest;
|
|
470
|
+
private _reconcileParticipantHold;
|
|
452
471
|
private _onParticipantHold;
|
|
472
|
+
private _applyParticipantHold;
|
|
453
473
|
private _isMe;
|
|
474
|
+
/**
|
|
475
|
+
* Сколько человек сейчас в звонке. Считаем только принявших: приглашенные,
|
|
476
|
+
* у которых еще идет вызов, ресурсы не потребляют.
|
|
477
|
+
*/
|
|
478
|
+
private _getParticipantsCount;
|
|
454
479
|
private _getMuteStatesForRoomId;
|
|
455
480
|
private _getMuteStatesForCurrentRoom;
|
|
456
481
|
private _setMuteStatesForRoomId;
|
|
@@ -458,8 +483,6 @@ export default class Conversation extends EventEmitter {
|
|
|
458
483
|
private _registerParticipant;
|
|
459
484
|
private _getParticipant;
|
|
460
485
|
}
|
|
461
|
-
declare function _resetPendingInstance(): void;
|
|
462
|
-
export { _resetPendingInstance };
|
|
463
486
|
export declare class UpdateDisplayLayoutError extends Error {
|
|
464
487
|
readonly participantErrors: {
|
|
465
488
|
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';
|
|
@@ -37,6 +37,7 @@ declare function createParams(): {
|
|
|
37
37
|
onSpeakerChanged: Mock<import("@vitest/spy").Procedure>;
|
|
38
38
|
onAcceptedCall: Mock<import("@vitest/spy").Procedure>;
|
|
39
39
|
onNonFatalError: Mock<import("@vitest/spy").Procedure>;
|
|
40
|
+
onSignalingConnected: Mock<import("@vitest/spy").Procedure>;
|
|
40
41
|
};
|
|
41
42
|
export type ConversationTestParams = ReturnType<typeof createParams>;
|
|
42
43
|
export type ConversationTestTools = {
|
|
@@ -105,7 +106,7 @@ export declare function createWaitingHallConversationData(): {
|
|
|
105
106
|
asrInfoByRoom: Map<any, any>;
|
|
106
107
|
audienceMode: boolean;
|
|
107
108
|
chatId: null;
|
|
108
|
-
compositeUserId:
|
|
109
|
+
compositeUserId: `u${number}` | `g${number}`;
|
|
109
110
|
concurrent: boolean;
|
|
110
111
|
direction: CallDirection;
|
|
111
112
|
externalId: ExternalParticipantId;
|
|
@@ -146,5 +147,5 @@ export declare function createConnectionMessage(data?: Partial<SignalingMessage.
|
|
|
146
147
|
export declare function createParticipant(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
147
148
|
export declare function createParticipantWithMarkers(id: number, data?: Partial<SignalingMessage.Participant>): SignalingMessage.Participant & Required<Pick<SignalingMessage.Participant, 'markers'>>;
|
|
148
149
|
export declare function createMarkers(data?: Partial<ParticipantListMarkers>): ParticipantListMarkers;
|
|
149
|
-
export declare function createMovieShareInfo(initiatorId:
|
|
150
|
+
export declare function createMovieShareInfo(initiatorId: CompositeUserId, data?: Partial<ISharedMovieInfo> | null): ISharedMovieInfo;
|
|
150
151
|
export {};
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import StatEventCollector from './StatEventCollector';
|
|
2
|
+
export interface BatteryClock {
|
|
3
|
+
monotonicNow(): number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Метрика battery_level_change: на каждое изменение уровня заряда отправляется
|
|
7
|
+
* само изменение в процентных пунктах и время, за которое оно произошло.
|
|
8
|
+
* Пока устройство на зарядке, замеры не ведутся: зарядка сбрасывает точку отсчёта,
|
|
9
|
+
* и первое изменение после неё только задаёт новую.
|
|
10
|
+
*
|
|
11
|
+
* Battery Status API есть только в Chromium, в Safari и Firefox его нет —
|
|
12
|
+
* там класс молча ничего не делает.
|
|
13
|
+
*/
|
|
14
|
+
export declare class BatteryStats {
|
|
15
|
+
private readonly _logger;
|
|
16
|
+
private readonly _clock;
|
|
17
|
+
private _battery;
|
|
18
|
+
private _previous;
|
|
19
|
+
private _destroyed;
|
|
20
|
+
constructor(logger: StatEventCollector, clock?: BatteryClock);
|
|
21
|
+
destroy(): void;
|
|
22
|
+
private _subscribe;
|
|
23
|
+
private _handleChargingChange;
|
|
24
|
+
private _handleLevelChange;
|
|
25
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import StatEventCollector from './StatEventCollector';
|
|
2
|
+
import { CallStatTail } from './CallStatTail';
|
|
2
3
|
export type CallLifecycleSource = 'outgoing' | 'incoming' | 'join' | 'anonym_join';
|
|
3
4
|
export interface CallLifecycleInitializationParams {
|
|
4
5
|
source: CallLifecycleSource;
|
|
@@ -11,6 +12,7 @@ export interface CallLifecycleClock {
|
|
|
11
12
|
export declare class CallLifecycleStats {
|
|
12
13
|
private readonly _logger;
|
|
13
14
|
private readonly _clock;
|
|
15
|
+
private readonly _tail;
|
|
14
16
|
private _conversationId;
|
|
15
17
|
private _callStartLabel;
|
|
16
18
|
private _lifecycleStartedAtMonotonic;
|
|
@@ -20,7 +22,7 @@ export declare class CallLifecycleStats {
|
|
|
20
22
|
private _firstMediaSent;
|
|
21
23
|
private _finished;
|
|
22
24
|
private _destroyed;
|
|
23
|
-
constructor(logger:
|
|
25
|
+
constructor(logger: StatEventCollector, clock?: CallLifecycleClock, tail?: CallStatTail | null);
|
|
24
26
|
get firstMediaSentReported(): boolean;
|
|
25
27
|
get terminated(): boolean;
|
|
26
28
|
markInitializationStarted({ source, conversationId }: CallLifecycleInitializationParams): void;
|
|
@@ -34,6 +36,7 @@ export declare class CallLifecycleStats {
|
|
|
34
36
|
destroy(): void;
|
|
35
37
|
private _canRecord;
|
|
36
38
|
private _durationSince;
|
|
39
|
+
private _startTail;
|
|
37
40
|
private _finish;
|
|
38
41
|
private _ensureConversationId;
|
|
39
42
|
private _record;
|