@vkontakte/calls-sdk 2.6.2-beta.11 → 2.6.2-beta.13

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.
@@ -15,6 +15,7 @@ import { JSONObject } from '../static/Json';
15
15
  import { ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk, ExternalUserId } from '../types/ExternalId';
16
16
  import MediaModifiers from '../types/MediaModifiers';
17
17
  import { IVideoDimentions } from '../types/MediaSettings';
18
+ import { IAddMovieParams } from '../types/MovieShare';
18
19
  import MuteStates from '../types/MuteStates';
19
20
  import { CompositeUserId, IGetParticipantsParameters, OkUserId, ParticipantId } from '../types/Participant';
20
21
  import { ParticipantLayout } from '../types/ParticipantLayout';
@@ -157,7 +158,6 @@ export default class Conversation extends EventEmitter {
157
158
  private _registerParticipants;
158
159
  /** Установим состояние локальных мьютов */
159
160
  private _registerParticipantLocalMuteState;
160
- private _getClientType;
161
161
  private _getStatusByTransportState;
162
162
  private _registerParticipantInCache;
163
163
  private _getExistedParticipantByIdOrCreate;
@@ -209,6 +209,9 @@ export default class Conversation extends EventEmitter {
209
209
  private _onParticipantSourcesUpdate;
210
210
  private _onParticipantPromoted;
211
211
  private _onChatRoomUpdated;
212
+ private _onSharedMovieUpdate;
213
+ private _onSharedMovieInfoStarted;
214
+ private _onSharedMovieInfoStopped;
212
215
  private _waitForStreamIfNeeded;
213
216
  private _matchStreamDescription;
214
217
  private _getWaitingTime;
@@ -232,11 +235,11 @@ export default class Conversation extends EventEmitter {
232
235
  customData(data: JSONObject, participantId?: ParticipantId | null): Promise<void>;
233
236
  createJoinLink(): Promise<string>;
234
237
  removeJoinLink(): Promise<never>;
235
- addMovie(movieId: string): Promise<{
238
+ addMovie({ movieId, gain, metadata }: IAddMovieParams): Promise<{
236
239
  movieId: string;
237
240
  streamType: string;
238
241
  }>;
239
- updateMovie(movieId: string, gain?: number, offset?: string, pause?: boolean): Promise<void>;
242
+ updateMovie(movieId: string, gain?: number, offset?: number, pause?: boolean): Promise<void>;
240
243
  removeMovie(movieId: string): Promise<void>;
241
244
  startStream(isRecord?: boolean, name?: string | null, movieId?: string | null, privacy?: 'PUBLIC' | 'FRIENDS' | 'DIRECT_LINK', groupId?: string | null): Promise<SignalingMessage>;
242
245
  stopStream(): Promise<SignalingMessage>;
@@ -11,6 +11,7 @@ import UserRole from '../enums/UserRole';
11
11
  import { JSONObject } from '../static/Json';
12
12
  import MediaModifiers from '../types/MediaModifiers';
13
13
  import MediaSettings from '../types/MediaSettings';
14
+ import { IAddMovieParams, ISharedMovieState } from '../types/MovieShare';
14
15
  import MuteStates from '../types/MuteStates';
15
16
  import { CompositeUserId, ParticipantId } from '../types/Participant';
16
17
  import ParticipantLayout, { RequestKeyFrame, StopStream } from '../types/ParticipantLayout';
@@ -96,8 +97,8 @@ export default class Signaling extends BaseSignaling {
96
97
  updateDisplayLayout(layouts: {
97
98
  [streamDesc: string]: ParticipantLayout | StopStream | RequestKeyFrame;
98
99
  }): Promise<SignalingMessage>;
99
- addMovie(data: any): Promise<SignalingMessage>;
100
- updateMovie(data: any): Promise<SignalingMessage>;
100
+ addMovie(data: IAddMovieParams): Promise<SignalingMessage>;
101
+ updateMovie(data: ISharedMovieState): Promise<SignalingMessage>;
101
102
  removeMovie(data: any): Promise<SignalingMessage>;
102
103
  startStream(data: any): Promise<SignalingMessage>;
103
104
  stopStream(): Promise<SignalingMessage>;
@@ -35,6 +35,10 @@ declare enum SignalingNotification {
35
35
  PROMOTE_PARTICIPANT = "promote-participant",
36
36
  CHAT_ROOM_UPDATED = "chat-room-updated",
37
37
  PROMOTION_APPROVED = "promotion-approved",
38
- JOIN_LINK_CHANGED = "join-link-changed"
38
+ JOIN_LINK_CHANGED = "join-link-changed",
39
+ MOVIE_UPDATE_NOTIFICATION = "movie-update-notification",
40
+ MOVIE_SHARE_INFO = "movie-share-info",
41
+ MOVIE_SHARE_STARTED = "movie-share-started",
42
+ MOVIE_SHARE_STOPPED = "movie-share-stopped"
39
43
  }
40
44
  export default SignalingNotification;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.6.2-beta.11",
3
+ "version": "2.6.2-beta.13",
4
4
  "author": "vk.com",
5
5
  "description": "Library for video calls based on the vk.com platform",
6
6
  "homepage": "https://vk.com",
@@ -10,6 +10,7 @@ import UserRole from '../enums/UserRole';
10
10
  import { ExternalId, ExternalParticipant, ExternalParticipantId, ExternalParticipantListChunk, ExternalParticipantListMarkers } from '../types/ExternalId';
11
11
  import MediaModifiers from '../types/MediaModifiers';
12
12
  import MediaSettings from '../types/MediaSettings';
13
+ import { IOnRemoteMovieData, ISharedMovieInfo, ISharedMovieState, ISharedMovieStoppedInfo } from '../types/MovieShare';
13
14
  import MuteStates from '../types/MuteStates';
14
15
  import { ParticipantStateMapped } from '../types/Participant';
15
16
  import { DebugMessageType } from './Debug';
@@ -72,10 +73,31 @@ declare namespace External {
72
73
  * Если сервер закончил стримить собеседника, вместо стрима будет передан null
73
74
  *
74
75
  * @param userId
75
- * @param streamName
76
- * @param stream
76
+ * @param data
77
+ */
78
+ function onRemoteLive(userId: ExternalParticipantId, data: IOnRemoteMovieData): void;
79
+ /**
80
+ * Получен собственный стрим лайв.
81
+ * Если сервер закончил стримить собеседника, вместо стрима будет передан null
82
+ *
83
+ * @param userId
84
+ * @param data
85
+ */
86
+ function onLocalLive(userId: ExternalParticipantId, data: IOnRemoteMovieData): void;
87
+ /**
88
+ * Получено обновление стрима или лайва от собеседника.
89
+ *
90
+ * @param userId
91
+ * @param data
92
+ */
93
+ function onRemoteLiveUpdate(userId: ExternalParticipantId, data: ISharedMovieState): void;
94
+ /**
95
+ * Получено обновление собственного стрима или лайва.
96
+ *
97
+ * @param userId
98
+ * @param data
77
99
  */
78
- function onRemoteLive(userId: ExternalParticipantId, streamName: string, stream: MediaStream | null): void;
100
+ function onLocalLiveUpdate(userId: ExternalParticipantId, data: ISharedMovieState): void;
79
101
  /**
80
102
  * Получен стрим с экрана собеседника.
81
103
  * Если сервер закончил стримить экран собеседника, вместо стрима будет передан null
@@ -106,6 +128,41 @@ declare namespace External {
106
128
  * @param markers
107
129
  */
108
130
  function onRemoteMediaSettings(userId: ExternalParticipantId, mediaSettings: MediaSettings, markers?: ExternalParticipantListMarkers): void;
131
+ /**
132
+ * Изменились данные собственного стрима
133
+ *
134
+ * @param userId
135
+ * @param mediaSettings
136
+ */
137
+ function onLocalMediaSettings(userId: ExternalParticipantId, mediaSettings: MediaSettings): void;
138
+ /**
139
+ * Полученны данные по стримам (лайв/мувик) от собеседника
140
+ *
141
+ * @param userId
142
+ * @param sharedMovieInfo
143
+ */
144
+ function onRemoteSharedMovieInfo(userId: ExternalParticipantId, sharedMovieInfo: ISharedMovieInfo): void;
145
+ /**
146
+ * Полученны данные по остановленным стримам (лайв/мувик) от собеседника
147
+ *
148
+ * @param userId
149
+ * @param sharedMovieStoppedInfo
150
+ */
151
+ function onRemoteSharedMovieStoppedInfo(userId: ExternalParticipantId, sharedMovieStoppedInfo: ISharedMovieStoppedInfo): void;
152
+ /**
153
+ * Полученны данные по собственным стримам (лайв/мувик)
154
+ *
155
+ * @param userId
156
+ * @param sharedMovieInfo
157
+ */
158
+ function onLocalSharedMovieInfo(userId: ExternalParticipantId, sharedMovieInfo: ISharedMovieInfo): void;
159
+ /**
160
+ * Полученны данные по собственным остановленным стримам (лайв/мувик)
161
+ *
162
+ * @param userId
163
+ * @param sharedMovieStoppedInfo
164
+ */
165
+ function onLocalSharedMovieStoppedInfo(userId: ExternalParticipantId, sharedMovieStoppedInfo: ISharedMovieStoppedInfo): void;
109
166
  /**
110
167
  * Добавили участника
111
168
  *
@@ -11,6 +11,7 @@ import { ExternalId, ExternalParticipant, ExternalParticipantId, ExternalPartici
11
11
  import IceServer from '../types/IceServer';
12
12
  import MediaModifiers from '../types/MediaModifiers';
13
13
  import MediaSettings from '../types/MediaSettings';
14
+ import { IOnRemoteMovieData, ISharedMovieInfo, ISharedMovieState, ISharedMovieStoppedInfo } from '../types/MovieShare';
14
15
  import MuteStates from '../types/MuteStates';
15
16
  import { ParticipantStateMapped } from '../types/Participant';
16
17
  import AuthData from './AuthData';
@@ -24,6 +25,7 @@ import { FacingMode } from './WebRTCUtils';
24
25
  export declare type ParamsObject = {
25
26
  platform: string;
26
27
  clientType: string;
28
+ externalUserType: string;
27
29
  device: string;
28
30
  /**
29
31
  * API ключ приложения
@@ -310,7 +312,20 @@ export declare type ParamsObject = {
310
312
  * Получен стрим трансляция или мувик от собеседника.
311
313
  * Если сервер закончил стримить экран собеседника, вместо стрима будет передан null
312
314
  */
313
- onRemoteLive?: (userId: ExternalParticipantId, streamId: string, stream: MediaStream | null) => void;
315
+ onRemoteLive?: (userId: ExternalParticipantId, data: IOnRemoteMovieData) => void;
316
+ /**
317
+ * Получен собственный стрим трансляция или мувик.
318
+ * Если сервер закончил стримить экран собеседника, вместо стрима будет передан null
319
+ */
320
+ onLocalLive?: (userId: ExternalParticipantId, data: IOnRemoteMovieData) => void;
321
+ /**
322
+ * Получено обновление стрима или лайва от собеседника.
323
+ */
324
+ onRemoteLiveUpdate?: (userId: ExternalParticipantId, data: ISharedMovieState) => void;
325
+ /**
326
+ * Получено обновление собственного стрима или лайва.
327
+ */
328
+ onLocalLiveUpdate?: (userId: ExternalParticipantId, data: ISharedMovieState) => void;
314
329
  /**
315
330
  * Начат звонок
316
331
  */
@@ -323,6 +338,26 @@ export declare type ParamsObject = {
323
338
  * Изменились данные стрима собеседника
324
339
  */
325
340
  onRemoteMediaSettings?: (userId: ExternalParticipantId, mediaSettings: MediaSettings, markers?: ExternalParticipantListMarkers) => void;
341
+ /**
342
+ * Изменились данные стрима собеседника
343
+ */
344
+ onLocalMediaSettings?: (userId: ExternalParticipantId, mediaSettings: MediaSettings) => void;
345
+ /**
346
+ * Полученны данные по стримам (лайв/мувик) от собеседника
347
+ */
348
+ onRemoteSharedMovieInfo?: (userId: ExternalParticipantId, sharedMovieInfo: ISharedMovieInfo) => void;
349
+ /**
350
+ * Полученны данные по остановленным стримам (лайв/мувик) от собеседника
351
+ */
352
+ onRemoteSharedMovieStoppedInfo?: (userId: ExternalParticipantId, sharedMovieStoppedInfo: ISharedMovieStoppedInfo) => void;
353
+ /**
354
+ * Полученны данные по собственным стримам (лайв/мувик)
355
+ */
356
+ onLocalSharedMovieInfo?: (userId: ExternalParticipantId, sharedMovieInfo: ISharedMovieInfo) => void;
357
+ /**
358
+ * Полученны данные по собственным остановленным стримам (лайв/мувик)
359
+ */
360
+ onLocalSharedMovieStoppedInfo?: (userId: ExternalParticipantId, sharedMovieStoppedInfo: ISharedMovieStoppedInfo) => void;
326
361
  /**
327
362
  * Добавили участника
328
363
  */
@@ -504,6 +539,8 @@ export default abstract class Params {
504
539
  static set platform(value: string);
505
540
  static get clientType(): string;
506
541
  static set clientType(value: string);
542
+ static get externalUserType(): string;
543
+ static set externalUserType(value: string);
507
544
  static get device(): string;
508
545
  static get apiKey(): string;
509
546
  static get apiEnv(): string;
@@ -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;
@@ -1,6 +1,7 @@
1
1
  import MediaOption from '../enums/MediaOption';
2
2
  import { ParticipantStatus } from '../static/External';
3
3
  import MediaSettings from './MediaSettings';
4
+ import { ISharedMovieInfo } from './MovieShare';
4
5
  import MuteStates from './MuteStates';
5
6
  import { ParticipantListMarker, ParticipantListType, ParticipantStateMapped } from './Participant';
6
7
  import SignalingMessage from './SignalingMessage';
@@ -94,6 +95,7 @@ export interface ExternalParticipant {
94
95
  */
95
96
  unmuteOptions: MediaOption[];
96
97
  markers?: ExternalParticipantListMarkers;
98
+ movieShareInfos?: ISharedMovieInfo[];
97
99
  }
98
100
  export interface ExternalParticipantListChunk {
99
101
  participants: ExternalParticipant[];
@@ -19,7 +19,7 @@ export declare type MediaSettings = {
19
19
  export declare type VideoStreamInfo = {
20
20
  id: string;
21
21
  source: string;
22
- vkMovieId?: string;
22
+ externalMovieId?: string;
23
23
  };
24
24
  export default MediaSettings;
25
25
  export declare function compareMediaSettings(ms1: MediaSettings, ms2: MediaSettings): boolean;
@@ -0,0 +1,42 @@
1
+ import { OkUserId, CompositeUserId } from './Participant';
2
+ import { MediaType } from './ParticipantStreamDescription';
3
+ export interface IMoviePreview {
4
+ url: string;
5
+ width: number;
6
+ height: number;
7
+ }
8
+ export interface IAddMovieParams {
9
+ movieId: string;
10
+ gain?: number;
11
+ metadata?: {
12
+ title?: string;
13
+ thumbnails?: IMoviePreview[];
14
+ };
15
+ }
16
+ export declare type ISharedMovieStateResponse = [number, number, boolean, number, number];
17
+ export interface ISharedMovieState {
18
+ participantId: CompositeUserId;
19
+ gain?: number;
20
+ pause?: boolean;
21
+ offset?: number;
22
+ duration?: number;
23
+ }
24
+ export interface ISharedMovieInfo {
25
+ movieId: OkUserId;
26
+ initiatorId: CompositeUserId;
27
+ title: string;
28
+ source: MediaType;
29
+ externalMovieId: string;
30
+ duration: number;
31
+ thumbnails: IMoviePreview[];
32
+ }
33
+ export interface ISharedMovieStoppedInfo {
34
+ movieId: OkUserId;
35
+ initiatorId: CompositeUserId;
36
+ source: MediaType;
37
+ }
38
+ export interface IOnRemoteMovieData {
39
+ streamName: string;
40
+ stream: MediaStream | null;
41
+ mediaType: MediaType;
42
+ }
@@ -4,6 +4,7 @@ import UserRole from '../enums/UserRole';
4
4
  import { ParticipantStatus } from '../static/External';
5
5
  import MediaSettings from '../types/MediaSettings';
6
6
  import { ExternalId, ExternalParticipantId, ExternalParticipantListMarkers } from './ExternalId';
7
+ import { ISharedMovieInfo } from './MovieShare';
7
8
  import MuteStates from './MuteStates';
8
9
  import ParticipantLayout from './ParticipantLayout';
9
10
  /**
@@ -55,6 +56,7 @@ export interface Participant {
55
56
  unmuteOptions: MediaOption[];
56
57
  observedIds: CompositeUserId[];
57
58
  markers?: ExternalParticipantListMarkers;
59
+ movieShareInfos?: ISharedMovieInfo[];
58
60
  }
59
61
  export interface IGetParticipantsParameters {
60
62
  externalIds: ExternalId[];
@@ -9,6 +9,7 @@ import UserRole from '../enums/UserRole';
9
9
  import UserType from '../enums/UserType';
10
10
  import MediaModifiers from './MediaModifiers';
11
11
  import MediaSettings from './MediaSettings';
12
+ import { ISharedMovieInfo, ISharedMovieState, ISharedMovieStoppedInfo } from './MovieShare';
12
13
  import MuteStates from './MuteStates';
13
14
  import { CompositeUserId, OkUserId, ParticipantId, ParticipantListMarker as ParticipantParticipantListMarker, ParticipantListMarkers, ParticipantListType as ParticipantParticipantListType } from './Participant';
14
15
  import VideoSettings from './VideoSettings';
@@ -54,6 +55,7 @@ declare namespace SignalingMessage {
54
55
  unmuteOptions?: MediaOption[];
55
56
  markers?: ParticipantListMarkers;
56
57
  observedIds?: CompositeUserId[];
58
+ movieShareInfos?: ISharedMovieInfo[];
57
59
  }
58
60
  export interface ParticipantListChunk extends Notification {
59
61
  participants: (Participant & Required<Pick<Participant, 'markers'>>)[];
@@ -279,6 +281,14 @@ declare namespace SignalingMessage {
279
281
  export interface JoinLinkChanged extends Notification {
280
282
  joinLink: string;
281
283
  }
284
+ export interface SharedMovieState extends Notification {
285
+ data: ISharedMovieState[];
286
+ }
287
+ export interface SharedMovieInfo extends Notification {
288
+ movieShareInfo: ISharedMovieInfo;
289
+ }
290
+ export interface SharedMovieStoppedInfo extends Notification, ISharedMovieStoppedInfo {
291
+ }
282
292
  export {};
283
293
  }
284
294
  export default SignalingMessage;