@techsee/techsee-media-service 4.0.0 → 5.0.1

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.
@@ -0,0 +1,503 @@
1
+ declare namespace OT {
2
+ export type OTError = {
3
+ name: string;
4
+ message: string;
5
+ };
6
+
7
+ export type Dimensions = {
8
+ width: number;
9
+ height: number;
10
+ }
11
+
12
+ export type ScreenSharingCapabilityResponse = {
13
+ extensionInstalled?: boolean;
14
+ supported: boolean;
15
+ supportedSources: {
16
+ application?: boolean;
17
+ screen?: boolean;
18
+ window?: boolean;
19
+ };
20
+ extensionRequired?: string;
21
+ extensionRegistered?: boolean;
22
+ };
23
+
24
+ export function checkScreenSharingCapability(
25
+ callback: (response: ScreenSharingCapabilityResponse) => void
26
+ ): void;
27
+
28
+ export function checkSystemRequirements(): number;
29
+
30
+ export type Device = {
31
+ kind: 'audioInput' | 'videoInput';
32
+ deviceId: string;
33
+ label: string;
34
+ };
35
+
36
+ export function getDevices(
37
+ callback: (error: OTError | undefined, devices?: Device[]) => void
38
+ ): void;
39
+
40
+ export function setProxyUrl(proxyUrl: string): void;
41
+
42
+ export function getSupportedCodecs(): Promise<{ videoEncoders: ('H264' | 'VP8')[], videoDecoders: ('H264' | 'VP8')[] }>;
43
+
44
+ export type WidgetStyle = {
45
+ audioLevelDisplayMode: 'auto' | 'on' | 'off';
46
+ backgroundImageURI: string;
47
+ buttonDisplayMode: 'auto' | 'on' | 'off';
48
+ nameDisplayMode: 'auto' | 'on' | 'off';
49
+ };
50
+
51
+ export type WidgetProperties = {
52
+ fitMode?: 'cover' | 'contain';
53
+ insertDefaultUI?: boolean;
54
+ insertMode?: 'replace' | 'after' | 'before' | 'append';
55
+ showControls?: boolean;
56
+ width?: string | number;
57
+ height?: string | number;
58
+ };
59
+
60
+ export type PublisherStyle = WidgetStyle & {
61
+ archiveStatusDisplayMode: 'auto' | 'off';
62
+ };
63
+
64
+ export type GetUserMediaProperties = {
65
+ audioSource?: string | null | boolean | MediaStreamTrack;
66
+ disableAudioProcessing?: boolean;
67
+ echoCancellation?: boolean;
68
+ noiseSuppression?: boolean;
69
+ autoGainControl?: boolean;
70
+ facingMode?: 'user' | 'environment' | 'left' | 'right';
71
+ frameRate?: 30 | 15 | 7 | 1;
72
+ maxResolution?: Dimensions;
73
+ resolution?: (
74
+ '1280x960' |
75
+ '1280x720' |
76
+ '640x480' |
77
+ '640x360' |
78
+ '320x240' |
79
+ '320x180'
80
+ );
81
+ videoSource?: string | null | boolean | MediaStreamTrack;
82
+ };
83
+
84
+ export type PublisherProperties = WidgetProperties & GetUserMediaProperties & {
85
+ audioBitrate?: number;
86
+ audioFallbackEnabled?: boolean;
87
+ mirror?: boolean;
88
+ name?: string;
89
+ publishAudio?: boolean;
90
+ publishVideo?: boolean;
91
+ style?: Partial<PublisherStyle>;
92
+ };
93
+
94
+ export type SubscriberStyle = WidgetStyle & {
95
+ videoDisabledDisplayMode: 'auto' | 'on' | 'off';
96
+ audioBlockedDisplayMode: 'auto' | 'on' | 'off';
97
+ };
98
+
99
+ export type SubscriberProperties = WidgetProperties & {
100
+ audioVolume?: number;
101
+ preferredFrameRate?: number;
102
+ preferredResolution?: Dimensions;
103
+ style?: Partial<SubscriberStyle>;
104
+ subscribeToAudio?: boolean;
105
+ subscribeToVideo?: boolean;
106
+ testNetwork?: boolean;
107
+ };
108
+
109
+ export class Connection {
110
+ connectionId: string;
111
+ creationTime: number;
112
+ data: string;
113
+ }
114
+
115
+ export class Stream {
116
+ connection: Connection;
117
+ creationTime: number;
118
+ frameRate: number;
119
+ hasAudio: boolean;
120
+ hasVideo: boolean;
121
+ name: string;
122
+ streamId: string;
123
+ videoDimensions: {
124
+ width: number;
125
+ height: number;
126
+ };
127
+ videoType: 'camera' | 'screen';
128
+ }
129
+
130
+ export type Event<Type, Target> = {
131
+ type: Type;
132
+ cancelable: boolean;
133
+ target: Target;
134
+
135
+ isDefaultPrevented(): boolean;
136
+ preventDefault(): void;
137
+ };
138
+
139
+ export type ExceptionEvent = Event<'exception', {}> & {
140
+ code: number;
141
+ message: string;
142
+ title: string;
143
+ };
144
+
145
+ export type VideoDimensionsChangedEvent<Target> = Event<'videoDimensionsChanged', Target> & {
146
+ oldValue: Dimensions;
147
+ newValue: Dimensions;
148
+ };
149
+
150
+ class OTEventEmitter<EventMap> {
151
+ on<EventName extends keyof EventMap>(
152
+ eventName: EventName,
153
+ callback: (event: EventMap[EventName]) => void,
154
+ context?: object
155
+ ): void;
156
+
157
+ on(
158
+ eventName: string,
159
+ callback: (event: Event<string, any>) => void,
160
+ context?: object
161
+ ): void;
162
+
163
+ on(
164
+ eventMap: object,
165
+ context?: object
166
+ ): void;
167
+
168
+ once<EventName extends keyof EventMap>(
169
+ eventName: EventName,
170
+ callback: (event: EventMap[EventName]) => void,
171
+ context?: object
172
+ ): void;
173
+
174
+ once(
175
+ eventName: string,
176
+ callback: (event: Event<string, any>) => void,
177
+ context?: object
178
+ ): void;
179
+
180
+ once(
181
+ eventMap: object,
182
+ context?: object
183
+ ): void;
184
+
185
+ off<EventName extends keyof EventMap>(
186
+ eventName?: EventName,
187
+ callback?: (event: EventMap[EventName]) => void,
188
+ context?: object
189
+ ): void;
190
+
191
+ off(
192
+ eventName?: string,
193
+ callback?: (event: Event<string, any>) => void,
194
+ context?: object
195
+ ): void;
196
+
197
+ off(
198
+ eventMap: object,
199
+ context?: object
200
+ ): void;
201
+ }
202
+
203
+ export class Publisher extends OTEventEmitter<{
204
+ accessAllowed: Event<'accessAllowed', Publisher>;
205
+ accessDenied: Event<'accessDenied', Publisher>;
206
+ accessDialogClosed: Event<'accessDialogClosed', Publisher>;
207
+ accessDialogOpened: Event<'accessDialogOpened', Publisher>;
208
+
209
+ audioLevelUpdated: Event<'audioLevelUpdated', Publisher> & {
210
+ audioLevel: number
211
+ };
212
+
213
+ destroyed: Event<'destroyed', Publisher>;
214
+
215
+ mediaStopped: Event<'mediaStopped', Publisher> & {
216
+ track: MediaStreamTrack | undefined
217
+ };
218
+
219
+ streamCreated: Event<'streamCreated', Publisher> & {
220
+ stream: Stream;
221
+ };
222
+
223
+ streamDestroyed: Event<'streamDestroyed', Publisher> & {
224
+ stream: Stream;
225
+ reason: string;
226
+ };
227
+
228
+ videoDimensionsChanged: VideoDimensionsChangedEvent<Publisher>;
229
+
230
+ videoElementCreated: Event<'videoElementCreated', Publisher> & {
231
+ element: HTMLVideoElement | HTMLObjectElement;
232
+ };
233
+ }> {
234
+ accessAllowed: boolean;
235
+ element?: HTMLElement | undefined;
236
+ id?: string;
237
+ stream?: Stream;
238
+ session?: Session;
239
+
240
+ destroy(): void;
241
+ getImgData(): string | null;
242
+ getStats(callback: (error?: OTError, stats?: PublisherStatsArr) => void): void;
243
+ getRtcStatsReport(): Promise<PublisherRtcStatsReportArr>;
244
+ getStyle(): PublisherProperties;
245
+ publishAudio(value: boolean): void;
246
+ publishVideo(value: boolean): void;
247
+ cycleVideo(): Promise<{ deviceId: string }>;
248
+ setAudioSource(audioSource:string | MediaStreamTrack): Promise<undefined>;
249
+ getAudioSource(): MediaStreamTrack;
250
+ setVideoSource(videoSourceId: string): Promise<undefined>;
251
+ getVideoSource(): {deviceId: string | null, type: string | null, track: MediaStreamTrack | null};
252
+ setStyle<Style extends keyof PublisherStyle>(style: Style, value: PublisherStyle[Style]): void;
253
+ videoWidth(): number | undefined;
254
+ videoHeight(): number | undefined;
255
+ }
256
+
257
+ export function getUserMedia(
258
+ properties?: GetUserMediaProperties
259
+ ): Promise<MediaStream>;
260
+
261
+ export function initPublisher(
262
+ targetElement?: HTMLElement | string,
263
+ properties?: PublisherProperties,
264
+ callback?: (error?: OTError) => void
265
+ ): Publisher;
266
+
267
+ export function log(message: string): void;
268
+
269
+ export function off(
270
+ eventName?: 'exception',
271
+ callback?: (event: ExceptionEvent) => void,
272
+ context?: object
273
+ ): void;
274
+
275
+ export function on(
276
+ eventName: 'exception',
277
+ callback: (event: ExceptionEvent) => void,
278
+ context?: object
279
+ ): void;
280
+
281
+ export function once(
282
+ eventName: 'exception',
283
+ callback: (event: ExceptionEvent) => void,
284
+ context?: object
285
+ ): void;
286
+
287
+ export class Session extends OTEventEmitter<{
288
+ archiveStarted: Event<'archiveStarted', Session> & {
289
+ id: string;
290
+ name: string;
291
+ };
292
+
293
+ archiveStopped: Event<'archiveStopped', Session> & {
294
+ id: string;
295
+ name: string;
296
+ };
297
+
298
+ connectionCreated: Event<'connectionCreated', Session> & {
299
+ connection: Connection;
300
+ };
301
+
302
+ connectionDestroyed: Event<'connectionDestroyed', Session> & {
303
+ connection: Connection;
304
+ reason: string;
305
+ };
306
+
307
+ sessionConnected: Event<'sessionConnected', Session>;
308
+
309
+ sessionDisconnected: Event<'sessionDisconnected', Session> & {
310
+ reason: string;
311
+ };
312
+
313
+ sessionReconnected: Event<'sessionReconnected', Session>;
314
+ sessionReconnecting: Event<'sessionReconnecting', Session>;
315
+
316
+ signal: Event<'signal', Session> & {
317
+ type?: string;
318
+ data?: string;
319
+ from: Connection;
320
+ };
321
+
322
+ streamCreated: Event<'streamCreated', Session> & {
323
+ stream: Stream;
324
+ };
325
+
326
+ streamDestroyed: Event<'streamDestroyed', Session> & {
327
+ stream: Stream;
328
+ reason: string;
329
+ };
330
+
331
+ streamPropertyChanged: (
332
+ Event<'streamPropertyChanged', Session> & {
333
+ stream: Stream;
334
+ } & (
335
+ { changedProperty: 'hasAudio'; oldValue: boolean; newValue: boolean; } |
336
+ { changedProperty: 'hasVideo'; oldValue: boolean; newValue: boolean; } |
337
+ { changedProperty: 'videoDimensions'; oldValue: Dimensions; newValue: Dimensions; }
338
+ )
339
+ );
340
+ }> {
341
+ capabilities: {
342
+ forceDisconnect: number;
343
+ forceUnpublish: number;
344
+ publish: number;
345
+ subscribe: number;
346
+ };
347
+
348
+ connection?: Connection;
349
+ sessionId: string;
350
+
351
+ connect(token: string, callback: (error?: OTError) => void): void;
352
+ disconnect(): void;
353
+ forceDisconnect(connection: Connection, callback: (error?: OTError) => void): void;
354
+ forceUnpublish(stream: Stream, callback: (error?: OTError) => void): void;
355
+ getPublisherForStream(stream: Stream): Publisher | undefined;
356
+ getSubscribersForStream(stream: Stream): [Subscriber];
357
+ publish(publisher: Publisher, callback?: (error?: OTError) => void): Publisher;
358
+ publish(targetElement: string | HTMLElement, properties?: PublisherProperties, callback?: (error?: OTError) => void): Publisher;
359
+
360
+ signal(
361
+ signal: { type?: string, data?: string, to?: Connection },
362
+ callback: (error?: OTError) => void
363
+ ): void;
364
+
365
+ subscribe(
366
+ stream: Stream,
367
+ targetElement?: HTMLElement | string,
368
+ properties?: SubscriberProperties,
369
+ callback?: (error?: OTError) => void
370
+ ): Subscriber;
371
+
372
+ unpublish(publisher: Publisher): void;
373
+ unsubscribe(subscriber: Subscriber): void;
374
+ }
375
+
376
+ export function initSession(
377
+ partnerId: string,
378
+ sessionId: string,
379
+ options?: {
380
+ connectionEventsSuppressed?: boolean;
381
+ iceConfig?: {
382
+ includeServers: 'all' | 'custom';
383
+ transportPolicy: 'all' | 'relay';
384
+ customServers: {
385
+ urls: string | string[];
386
+ username?: string;
387
+ credential?: string;
388
+ }[];
389
+ };
390
+ ipWhitelist?: boolean;
391
+ }
392
+ ): Session;
393
+
394
+ export type IncomingTrackStats = {
395
+ bytesReceived: number;
396
+ packetsLost: number;
397
+ packetsReceived: number;
398
+ };
399
+
400
+ export type OutgoingTrackStats = {
401
+ bytesSent: number;
402
+ packetsLost: number;
403
+ packetsSent: number;
404
+ }
405
+
406
+ export type SubscriberStats = {
407
+ audio: IncomingTrackStats;
408
+ video: IncomingTrackStats & { frameRate: number; };
409
+ timestamp: number;
410
+ }
411
+
412
+ export type PublisherStats = {
413
+ audio: OutgoingTrackStats;
414
+ video: OutgoingTrackStats & { frameRate: number; };
415
+ timestamp: number;
416
+ }
417
+
418
+ export type PublisherStatContainer = {
419
+ subscriberId?: string,
420
+ connectionId?: string,
421
+ stats: PublisherStats
422
+ }
423
+
424
+ export type PublisherStatsArr = PublisherStatContainer[];
425
+
426
+ export type PublisherRtcStatsReportContainer = {
427
+ subscriberId?: string,
428
+ connectionId?: string,
429
+ rtcStatsReport: RTCStatsReport
430
+ }
431
+
432
+ export type PublisherRtcStatsReportArr = PublisherRtcStatsReportContainer[];
433
+
434
+ export class Subscriber extends OTEventEmitter<{
435
+ audioLevelUpdated: Event<'audioLevelUpdated', Subscriber> & {
436
+ audioLevel: number
437
+ };
438
+
439
+ connected: Event<'connected', Subscriber>;
440
+
441
+ destroyed: Event<'destroyed', Subscriber> & {
442
+ reason: string;
443
+ };
444
+
445
+ videoDimensionsChanged: VideoDimensionsChangedEvent<Subscriber>;
446
+
447
+ videoDisabled: Event<'videoDisabled', Subscriber> & {
448
+ reason: string;
449
+ };
450
+
451
+ videoDisableWarning: Event<'videoDisableWarning', Subscriber>;
452
+ videoDisableWarningLifted: Event<'videoDisableWarningLifted', Subscriber>;
453
+
454
+ videoElementCreated: Event<'videoElementCreated', Subscriber> & {
455
+ element: HTMLVideoElement | HTMLObjectElement;
456
+ };
457
+
458
+ videoEnabled: Event<'videoEnabled', Subscriber> & {
459
+ reason: string;
460
+ };
461
+ }> {
462
+ element?: HTMLElement;
463
+ id?: string;
464
+ stream?: Stream;
465
+
466
+ getAudioVolume(): number;
467
+ getImgData(): string | null;
468
+ getStats(callback: (error?: OTError, stats?: SubscriberStats) => void): void;
469
+ getRtcStatsReport(): Promise<RTCStatsReport>;
470
+ restrictFrameRate(value: boolean): void;
471
+ setAudioVolume(volume: number): void;
472
+ setPreferredFrameRate(frameRate: number): void;
473
+ setPreferredResolution(resolution: Dimensions): void;
474
+ subscribeToAudio(value: boolean): void;
475
+ subscribeToVideo(value: boolean): void;
476
+
477
+ setStyle<Style extends keyof SubscriberStyle>(
478
+ style: Style,
479
+ value: SubscriberStyle[Style]
480
+ ): void;
481
+
482
+ videoHeight(): number | undefined;
483
+ videoWidth(): number | undefined;
484
+ }
485
+
486
+ export function registerScreenSharingExtension(
487
+ kind: string,
488
+ id: string,
489
+ version: number
490
+ ): void;
491
+
492
+ export function reportIssue(callback: (error?: OTError, reportId?: string) => void): void;
493
+
494
+ export function setLogLevel(level: number): void;
495
+
496
+ export function upgradeSystemRequirements(): void;
497
+
498
+ export function unblockAudio(): Promise<undefined>;
499
+ }
500
+
501
+ declare module '@opentok/client' {
502
+ export = OT;
503
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@techsee/techsee-media-service",
3
- "version": "4.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "Techsee Media Service",
5
5
  "author": "TechSee",
6
6
  "main": "lib/index.js",
@@ -20,7 +20,7 @@
20
20
  "dependencies": {
21
21
  "@techsee/kurento-utils-temasys-mod": "6.6.3-dev-3",
22
22
  "@techsee/openvidu-browser": "~12.15.6",
23
- "@techsee/techsee-common": "^2.14.0",
23
+ "@techsee/techsee-common": "^2.23.1",
24
24
  "bluebird": "~3.7.2",
25
25
  "kurento-utils": "6.6.2",
26
26
  "lodash": "4.17.20",