@vkontakte/calls-sdk 2.6.2-dev.ec4dca1.0 → 2.6.2-dev.ef18584.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.
Files changed (42) hide show
  1. package/CallsSDK.d.ts +26 -12
  2. package/abstract/BaseApi.d.ts +6 -2
  3. package/abstract/BaseSignaling.d.ts +8 -3
  4. package/calls-sdk.cjs.js +8 -8
  5. package/calls-sdk.esm.js +8 -8
  6. package/classes/Conversation.d.ts +21 -8
  7. package/classes/MediaSource.d.ts +7 -2
  8. package/classes/ParticipantIdRegistry.d.ts +2 -0
  9. package/classes/ProducerCommandSerializationService.d.ts +17 -0
  10. package/classes/screenshare/ScreenCaptureSender.d.ts +1 -0
  11. package/classes/screenshare/Utils.d.ts +1 -0
  12. package/classes/transport/ServerTransport.d.ts +2 -0
  13. package/default/Api.d.ts +7 -2
  14. package/default/Api.test.d.ts +1 -0
  15. package/default/Signaling.d.ts +14 -4
  16. package/enums/ConversationFeature.d.ts +2 -1
  17. package/enums/ConversationOption.d.ts +3 -1
  18. package/enums/HangupType.d.ts +3 -1
  19. package/enums/MediaOption.d.ts +3 -1
  20. package/enums/SignalingCommandType.d.ts +3 -1
  21. package/enums/SignalingNotification.d.ts +3 -1
  22. package/package.json +1 -1
  23. package/static/ApiTransport.d.ts +1 -1
  24. package/static/External.d.ts +20 -8
  25. package/static/Params.d.ts +47 -4
  26. package/static/Utils.d.ts +5 -1
  27. package/static/WebRTCUtils.d.ts +2 -1
  28. package/types/Conversation.d.ts +12 -0
  29. package/types/ConversationFeature.d.ts +3 -0
  30. package/types/ConversationParams.d.ts +1 -0
  31. package/types/Feedback.d.ts +22 -0
  32. package/types/LayoutUtils.d.ts +5 -0
  33. package/types/MediaSettings.d.ts +4 -0
  34. package/types/MovieShare.d.ts +30 -7
  35. package/types/ParticipantLayout.d.ts +7 -1
  36. package/types/ParticipantStreamDescription.d.ts +2 -1
  37. package/types/SignalingMessage.d.ts +13 -0
  38. package/types/WaitingHall.d.ts +2 -8
  39. package/utils/ArrayDequeue.d.ts +24 -0
  40. package/utils/ArrayDequeue.spec.d.ts +1 -0
  41. package/utils/Conversation.d.ts +2 -0
  42. package/utils/MsgPackerBufferUtils.d.ts +31 -0
package/static/Utils.d.ts CHANGED
@@ -6,7 +6,7 @@ import VideoSettings from '../types/VideoSettings';
6
6
  export declare const PARAMETERS_SEPARATOR = ":";
7
7
  export declare const DEVICE_IDX_PARAMETER = "d";
8
8
  declare namespace Utils {
9
- function patchSDP(sdp: string, preferH264: boolean, brokenH264: boolean, preferVP9: boolean, isAudioNack?: boolean, preferRed?: boolean): string;
9
+ function patchSDP(sdp: string, preferH264: boolean, brokenH264: boolean, preferVP9: boolean, h264spsPpsIdrInKeyframe: boolean, isAudioNack?: boolean, preferRed?: boolean): string;
10
10
  function getPeerIdString(peerId: SignalingMessage.PeerId): string;
11
11
  function comparePeerId(peerId1: SignalingMessage.PeerId, peerId2: SignalingMessage.PeerId): boolean;
12
12
  function getPeerConnectionHostInfo(pc: RTCPeerConnection): Promise<any>;
@@ -60,5 +60,9 @@ declare namespace Utils {
60
60
  * https://stash.odkl.ru/projects/ODKL/repos/odnoklassniki-webrtc/browse/src/main/java/one/webrtc/domain/conversation/ParticipantIndex.java#67-78
61
61
  */
62
62
  function participantMarkerCompare(marker1: ExternalParticipantListMarker | undefined, marker2: ExternalParticipantListMarker | undefined): number;
63
+ /** убирает все ключи со значением `V` на 1 уровне */
64
+ function objectFilterOutValues<T extends Record<string, V>, V = unknown>(obj: T, value?: V | V[]): Partial<T>;
65
+ function objectReduce<R, T extends Object>(obj: T, callback: (acc: R, value: T[keyof T], key: keyof T) => R, initialValue: R): R;
66
+ const setImmediate: (fn: VoidFunction) => VoidFunction;
63
67
  }
64
68
  export default Utils;
@@ -66,7 +66,7 @@ declare namespace WebRTCUtils {
66
66
  /**
67
67
  * Запрашивает трансляцию экрана пользователя
68
68
  */
69
- function getScreenMedia(): Promise<MediaStream>;
69
+ function getScreenMedia(withAudioShare: boolean): Promise<MediaStream>;
70
70
  /**
71
71
  * Запрашивает камеру пользователя
72
72
  *
@@ -146,5 +146,6 @@ declare namespace WebRTCUtils {
146
146
  * Возвращает подверсию браузера (если она есть)
147
147
  */
148
148
  function browserSubVersion(): string;
149
+ function isAudioShareSupported(): boolean;
149
150
  }
150
151
  export default WebRTCUtils;
@@ -0,0 +1,12 @@
1
+ import MediaOption from '../enums/MediaOption';
2
+ import MediaSettings from './MediaSettings';
3
+ import { Participant } from './Participant';
4
+ export interface IProcessMuteStateParams {
5
+ mediaOptions?: MediaOption[];
6
+ muteAll?: boolean;
7
+ unmute?: boolean;
8
+ serverSettings?: MediaSettings | null;
9
+ admin?: Participant | null;
10
+ stateUpdated?: boolean;
11
+ requestedMedia?: MediaOption[];
12
+ }
@@ -0,0 +1,3 @@
1
+ import ConversationFeature from '../enums/ConversationFeature';
2
+ import UserRole from '../enums/UserRole';
3
+ export declare type IFeaturesPerRole = Partial<Record<ConversationFeature, UserRole[]>>;
@@ -10,5 +10,6 @@ declare type ConversationParams = {
10
10
  isp_as_org?: string;
11
11
  loc_cc?: string;
12
12
  loc_reg?: string;
13
+ external_user_type: string;
13
14
  };
14
15
  export default ConversationParams;
@@ -0,0 +1,22 @@
1
+ import { CompositeUserId } from './Participant';
2
+ import { ExternalParticipantId } from './ExternalId';
3
+ interface IFeedbackItem {
4
+ participantId: CompositeUserId;
5
+ /** event timestamps for this participant, chronologically */
6
+ times: number[];
7
+ }
8
+ export interface IFeedbackItemExternal extends Omit<IFeedbackItem, 'participantId'> {
9
+ participantId: ExternalParticipantId;
10
+ }
11
+ export interface IFeedback {
12
+ /** feedback ID; key values should be negotiated by clients themselves, like in ParticipantState, and have just the same restrictions; on backend the values of these keys are not bound in any way to those in ParticipantState */
13
+ key: string;
14
+ /** total amount of reactions of this type from the start of this call */
15
+ totalCount: number;
16
+ /** list of items containing initiator & all related data, if any */
17
+ items: IFeedbackItem[];
18
+ }
19
+ export interface IFeedbackExternal extends Omit<IFeedback, 'items'> {
20
+ items: IFeedbackItemExternal[];
21
+ }
22
+ export {};
@@ -0,0 +1,5 @@
1
+ import { Layout, RequestKeyFrame, StopStream } from './ParticipantLayout';
2
+ export declare const REQUEST_KEY_FRAME_CODE = "kf";
3
+ export declare function isStopStreaming(layout: Layout | StopStream | RequestKeyFrame): layout is StopStream;
4
+ export declare function isRequestKeyFrame(layout: Layout | StopStream | RequestKeyFrame): layout is RequestKeyFrame;
5
+ export declare function layoutToString(layout: Layout | StopStream | RequestKeyFrame): string;
@@ -14,6 +14,10 @@ export declare type MediaSettings = {
14
14
  * Включена ли трансляция экрана
15
15
  */
16
16
  isScreenSharingEnabled: boolean;
17
+ /**
18
+ * Включена ли трансляция звука
19
+ */
20
+ isAudioSharingEnabled: boolean;
17
21
  videoStreams: VideoStreamInfo[];
18
22
  };
19
23
  export declare type VideoStreamInfo = {
@@ -1,16 +1,38 @@
1
1
  import { OkUserId, CompositeUserId } from './Participant';
2
2
  import { MediaType } from './ParticipantStreamDescription';
3
+ export interface IMoviePreview {
4
+ url: string;
5
+ width: number;
6
+ height: number;
7
+ }
3
8
  export interface IAddMovieParams {
4
9
  movieId: string;
5
10
  gain?: number;
11
+ metadata?: {
12
+ title?: string;
13
+ thumbnails?: IMoviePreview[];
14
+ };
6
15
  }
7
- export declare type ISharedMovieStateResponse = [number, number, boolean, number, number];
16
+ export declare type ISharedMovieStateResponse = [
17
+ number,
18
+ number,
19
+ boolean,
20
+ number,
21
+ boolean
22
+ ];
8
23
  export interface ISharedMovieState {
9
24
  participantId: CompositeUserId;
10
25
  gain?: number;
11
26
  pause?: boolean;
12
27
  offset?: number;
13
- duration?: number;
28
+ mute?: boolean;
29
+ }
30
+ export interface IUpdateMovieData {
31
+ movieId: string;
32
+ gain?: number;
33
+ pause?: boolean;
34
+ offset?: number;
35
+ mute?: boolean;
14
36
  }
15
37
  export interface ISharedMovieInfo {
16
38
  movieId: OkUserId;
@@ -19,14 +41,15 @@ export interface ISharedMovieInfo {
19
41
  source: MediaType;
20
42
  externalMovieId: string;
21
43
  duration: number;
22
- thumbnailNormal: string;
23
- thumbnailMedium: string;
24
- thumbnailBig: string;
25
- thumbnailHigh: string;
26
- thumbnailHd: string;
44
+ thumbnails: IMoviePreview[];
27
45
  }
28
46
  export interface ISharedMovieStoppedInfo {
29
47
  movieId: OkUserId;
30
48
  initiatorId: CompositeUserId;
31
49
  source: MediaType;
32
50
  }
51
+ export interface IOnRemoteMovieData {
52
+ streamName: string;
53
+ stream: MediaStream | null;
54
+ mediaType: MediaType;
55
+ }
@@ -31,10 +31,16 @@ export declare type StopStream = {
31
31
  */
32
32
  stopStream: true;
33
33
  };
34
+ /**
35
+ * Request key frame from source. Should not be called often, negatively impacts video quality.
36
+ */
37
+ export declare type RequestKeyFrame = {
38
+ keyFrameRequested: true;
39
+ };
34
40
  /**
35
41
  * Лейаут собеседника в звонке
36
42
  */
37
- export declare type ParticipantLayout = (Layout | StopStream) & {
43
+ export declare type ParticipantLayout = (Layout | StopStream | RequestKeyFrame) & {
38
44
  /**
39
45
  * Внешний ID пользователя
40
46
  */
@@ -6,7 +6,8 @@ export declare enum MediaType {
6
6
  CAMERA = "CAMERA",
7
7
  SCREEN = "SCREEN",
8
8
  STREAM = "STREAM",
9
- MOVIE = "MOVIE"
9
+ MOVIE = "MOVIE",
10
+ AUDIOSHARE = "AUDIOSHARE"
10
11
  }
11
12
  export declare function serializeParticipantStreamDescription(description: ParticipantStreamDescription): string;
12
13
  export declare function parseParticipantStreamDescription(descriptionString: string): ParticipantStreamDescription;
@@ -7,6 +7,8 @@ import MediaOption from '../enums/MediaOption';
7
7
  import ParticipantState from '../enums/ParticipantState';
8
8
  import UserRole from '../enums/UserRole';
9
9
  import UserType from '../enums/UserType';
10
+ import { IFeaturesPerRole } from './ConversationFeature';
11
+ import { IFeedback } from './Feedback';
10
12
  import MediaModifiers from './MediaModifiers';
11
13
  import MediaSettings from './MediaSettings';
12
14
  import { ISharedMovieInfo, ISharedMovieState, ISharedMovieStoppedInfo } from './MovieShare';
@@ -74,6 +76,7 @@ declare namespace SignalingMessage {
74
76
  multichatId: string | null;
75
77
  tamtamMultichatId: string | null;
76
78
  recordInfo: RecordInfo | null;
79
+ featuresPerRole?: IFeaturesPerRole | null;
77
80
  pinnedParticipantId: ParticipantId | null;
78
81
  options: ConversationOption[];
79
82
  muteStates?: MuteStates;
@@ -150,6 +153,8 @@ declare namespace SignalingMessage {
150
153
  muteStates: MuteStates;
151
154
  unmuteOptions?: MediaOption[];
152
155
  mediaOptions: MediaOption[];
156
+ requestedMedia?: MediaOption[];
157
+ stateUpdated?: boolean;
153
158
  unmute?: boolean;
154
159
  muteAll?: boolean;
155
160
  }
@@ -186,6 +191,7 @@ declare namespace SignalingMessage {
186
191
  }
187
192
  export interface FeatureSetChanged extends Notification {
188
193
  features: ConversationFeature[];
194
+ featuresPerRole?: IFeaturesPerRole | null;
189
195
  }
190
196
  export interface MultipartyChatCreated extends Notification {
191
197
  chatId: string;
@@ -242,6 +248,7 @@ declare namespace SignalingMessage {
242
248
  demote: boolean;
243
249
  mediaModifiers: MediaModifiers;
244
250
  conversation: Conversation;
251
+ participants?: ParticipantListChunk;
245
252
  }
246
253
  export interface ChatRoomUpdated extends Notification {
247
254
  eventType: ChatRoomEventType;
@@ -278,6 +285,9 @@ declare namespace SignalingMessage {
278
285
  export interface JoinLinkChanged extends Notification {
279
286
  joinLink: string;
280
287
  }
288
+ export interface Feedback extends Notification {
289
+ feedback: IFeedback[];
290
+ }
281
291
  export interface SharedMovieState extends Notification {
282
292
  data: ISharedMovieState[];
283
293
  }
@@ -286,6 +296,9 @@ declare namespace SignalingMessage {
286
296
  }
287
297
  export interface SharedMovieStoppedInfo extends Notification, ISharedMovieStoppedInfo {
288
298
  }
299
+ export interface FeaturesPerRoleChanged extends Notification {
300
+ featuresPerRole?: IFeaturesPerRole | null;
301
+ }
289
302
  export {};
290
303
  }
291
304
  export default SignalingMessage;
@@ -1,6 +1,7 @@
1
1
  import { ExternalId } from './ExternalId';
2
2
  import { CompositeUserId } from './Participant';
3
3
  import SignalingMessage from './SignalingMessage';
4
+ import { IFeedback } from './Feedback';
4
5
  export declare type WaitingParticipantId = {
5
6
  addedTs: number;
6
7
  id: CompositeUserId;
@@ -9,18 +10,11 @@ export declare type WaitingParticipant = {
9
10
  id: WaitingParticipantId;
10
11
  externalId?: SignalingMessage.ExternalId;
11
12
  };
12
- export declare type Feedback = {
13
- key: string;
14
- totalCount: number;
15
- currentCount: number;
16
- timeout: number;
17
- participantIds: CompositeUserId[];
18
- };
19
13
  export declare type ChatRoom = {
20
14
  totalCount: number;
21
15
  firstParticipants?: WaitingParticipant[];
22
16
  handCount?: number;
23
- feedback?: Feedback[];
17
+ feedback?: IFeedback[];
24
18
  };
25
19
  /**
26
20
  * Ответ на запрос `getWaitingHall`
@@ -0,0 +1,24 @@
1
+ export declare class ArrayDequeue<T = any> {
2
+ /** очередь */
3
+ private readonly _q;
4
+ /** курсор для чтения */
5
+ private _rc;
6
+ /** курсор для записи */
7
+ private _wc;
8
+ /** подвинуть курсор чтения */
9
+ private _moveRC;
10
+ /** сколько осталось в очереди элементов */
11
+ private _left;
12
+ constructor(length: number);
13
+ /** возвращает длину, переданную в конструктор */
14
+ get length(): number;
15
+ /** возвращает текущую длину очереди */
16
+ get left(): number;
17
+ toArray(): T[];
18
+ /** добавить элемент в очередь */
19
+ add(element: T): void;
20
+ /** вычисляет значение след курсора по кругу */
21
+ private nextCursor;
22
+ /** получить следующий элемент */
23
+ next(): T | null;
24
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { MuteState, MediaOption, MuteStates } from '../CallsSDK';
2
+ export declare const getMediaOptionsByMuteState: (muteStates: MuteStates, value: MuteState) => MediaOption[];
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Fork from messagepack internals.
3
+ * Package messagepack doesn't export createWriteBuffer and createReadBuffer methods.
4
+ */
5
+ export declare function createWriteBuffer(): {
6
+ put(v: BufferSource): void;
7
+ putI8(v: number): void;
8
+ putI16(v: number): void;
9
+ putI32(v: number): void;
10
+ putI64(v: number): void;
11
+ putUi8(v: number): void;
12
+ putUi16(v: number): void;
13
+ putUi32(v: number): void;
14
+ putUi64(v: number): void;
15
+ putF(v: number): void;
16
+ ui8array(): Uint8Array;
17
+ };
18
+ export declare function createReadBuffer(buf: BufferSource): {
19
+ peek(): number;
20
+ get(len: number): ArrayBuffer;
21
+ getI8(): number;
22
+ getI16(): number;
23
+ getI32(): number;
24
+ getI64(): number;
25
+ getUi8(): number;
26
+ getUi16(): number;
27
+ getUi32(): number;
28
+ getUi64(): number;
29
+ getF32(): number;
30
+ getF64(): number;
31
+ };