@observertc/observer-js 0.42.0 → 0.42.2

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 (41) hide show
  1. package/lib/ObservedCall.d.ts +5 -10
  2. package/lib/ObservedCall.d.ts.map +1 -1
  3. package/lib/ObservedCall.js +17 -22
  4. package/lib/ObservedClient.d.ts +20 -8
  5. package/lib/ObservedClient.d.ts.map +1 -1
  6. package/lib/ObservedClient.js +96 -27
  7. package/lib/ObservedInboundAudioTrack.d.ts +2 -0
  8. package/lib/ObservedInboundAudioTrack.d.ts.map +1 -1
  9. package/lib/ObservedInboundAudioTrack.js +2 -0
  10. package/lib/ObservedInboundVideoTrack.d.ts +4 -1
  11. package/lib/ObservedInboundVideoTrack.d.ts.map +1 -1
  12. package/lib/ObservedInboundVideoTrack.js +2 -1
  13. package/lib/ObservedOutboundAudioTrack.d.ts +2 -0
  14. package/lib/ObservedOutboundAudioTrack.d.ts.map +1 -1
  15. package/lib/ObservedOutboundAudioTrack.js +2 -12
  16. package/lib/ObservedOutboundVideoTrack.d.ts +4 -1
  17. package/lib/ObservedOutboundVideoTrack.d.ts.map +1 -1
  18. package/lib/ObservedOutboundVideoTrack.js +2 -1
  19. package/lib/ObservedPeerConnection.d.ts +2 -0
  20. package/lib/ObservedPeerConnection.d.ts.map +1 -1
  21. package/lib/Observer.d.ts +0 -1
  22. package/lib/Observer.d.ts.map +1 -1
  23. package/lib/Observer.js +5 -3
  24. package/lib/common/CalculatedScore.js +3 -3
  25. package/lib/common/types.d.ts +1 -0
  26. package/lib/common/types.d.ts.map +1 -1
  27. package/package.json +1 -1
  28. package/src/ObservedCall.ts +35 -41
  29. package/src/ObservedClient.ts +117 -35
  30. package/src/ObservedInboundAudioTrack.ts +8 -0
  31. package/src/ObservedInboundVideoTrack.ts +10 -1
  32. package/src/ObservedOutboundAudioTrack.ts +8 -16
  33. package/src/ObservedOutboundVideoTrack.ts +10 -1
  34. package/src/ObservedPeerConnection.ts +6 -1
  35. package/src/Observer.ts +3 -4
  36. package/src/common/CalculatedScore.ts +1 -1
  37. package/src/common/types.ts +1 -0
  38. package/lib/monitors/ClientQualityMonitor.d.ts +0 -1
  39. package/lib/monitors/ClientQualityMonitor.d.ts.map +0 -1
  40. package/lib/monitors/ClientQualityMonitor.js +0 -1
  41. package/src/monitors/ClientQualityMonitor.ts +0 -0
@@ -5,6 +5,7 @@ import { OutboundAudioTrackReport, OutboundVideoTrackReport } from '@observertc/
5
5
  import { ObservedInboundVideoTrack } from './ObservedInboundVideoTrack';
6
6
  import { calculateBaseVideoScore, CalculatedScore } from './common/CalculatedScore';
7
7
  import { ClientIssue } from './monitors/CallSummary';
8
+ import { SupportedVideoCodecType } from './common/types';
8
9
 
9
10
  export type ObservedOutboundVideoTrackModel = {
10
11
  trackId: string;
@@ -50,8 +51,13 @@ export class ObservedOutboundVideoTrack extends EventEmitter {
50
51
  public readonly created = Date.now();
51
52
  public visited = false;
52
53
 
54
+ // timestamp of the MEDIA_TRACK_ADDED event
55
+ public added?: number;
56
+ // timestamp of the MEDIA_TRACK_REMOVED event
57
+ public removed?: number;
58
+
53
59
  public contentType: 'lowmotion' | 'standard' | 'highmotion' = 'standard';
54
- public codec: 'vp8' | 'vp9' | 'h264' = 'vp8';
60
+ public codec?: SupportedVideoCodecType;
55
61
  public highestLayer?: ObservedOutboundVideoTrackStats;
56
62
 
57
63
  public bitrate = 0;
@@ -241,6 +247,9 @@ export class ObservedOutboundVideoTrack extends EventEmitter {
241
247
  // setting up sfu connection as it is not always available at the first sample
242
248
 
243
249
  this.visited = true;
250
+ // a peer connection is active if it has at least one active track
251
+ this.peerConnection.visited = true;
252
+
244
253
  this._updated = now;
245
254
  this.emit('update', {
246
255
  elapsedTimeInMs,
@@ -42,7 +42,12 @@ export declare interface ObservedPeerConnection {
42
42
  export class ObservedPeerConnection extends EventEmitter {
43
43
  public readonly created = Date.now();
44
44
  public visited = true;
45
-
45
+
46
+ // timestamp of the PEER_CONNECTION_OPENED event
47
+ public opened?: number;
48
+ // timestamp of the PEER_CONNECTION_CLOSED event
49
+ public closedTimestamp?: number;
50
+
46
51
  private _elapsedTimeSinceLastUpdate?: number;
47
52
  private _statsTimestamp?: number;
48
53
 
package/src/Observer.ts CHANGED
@@ -104,7 +104,7 @@ export class Observer extends EventEmitter {
104
104
  }
105
105
 
106
106
  public createObservedCall<T extends Record<string, unknown> = Record<string, unknown>>(
107
- config: PartialBy<ObservedCallModel, 'serviceId'> & { appData: T, started?: number, reportCallStarted?: boolean, reportCallEnded?: boolean }
107
+ config: PartialBy<ObservedCallModel, 'serviceId'> & { appData: T, reportCallStarted?: boolean, reportCallEnded?: boolean }
108
108
  ): ObservedCall<T> {
109
109
  if (this._closed) {
110
110
  throw new Error('Attempted to create a call source on a closed observer');
@@ -112,7 +112,6 @@ export class Observer extends EventEmitter {
112
112
 
113
113
  const {
114
114
  appData,
115
- started = Date.now(),
116
115
  reportCallEnded = true,
117
116
  reportCallStarted = true,
118
117
  ...model
@@ -131,7 +130,7 @@ export class Observer extends EventEmitter {
131
130
  call.serviceId,
132
131
  call.roomId,
133
132
  call.callId,
134
- Date.now(),
133
+ call.ended ?? Date.now(),
135
134
  ));
136
135
  });
137
136
 
@@ -140,7 +139,7 @@ export class Observer extends EventEmitter {
140
139
  call.serviceId,
141
140
  call.roomId,
142
141
  call.callId,
143
- started,
142
+ call.started ?? Date.now(),
144
143
  ));
145
144
 
146
145
  this.emit('newcall', call);
@@ -82,7 +82,7 @@ export function calculateBaseVideoScore(track: ObservedInboundVideoTrack | Obser
82
82
 
83
83
  const bpp = bitrate / (frameHeight * frameWidth * framesPerSecond);
84
84
  // let's assume vp8 for now
85
- const bppRange = BPP_RANGES[track.contentType][track.codec];
85
+ const bppRange = BPP_RANGES[track.contentType][track.codec ?? 'vp8'];
86
86
 
87
87
  if (bpp / 2 < bppRange.low) {
88
88
  score.score = 1.0;
@@ -20,6 +20,7 @@ import {
20
20
  } from '@observertc/report-schemas-js';
21
21
 
22
22
  export type MediaKind = 'audio' | 'video';
23
+ export type SupportedVideoCodecType = 'vp8' | 'vp9' | 'h264' | 'h265';
23
24
 
24
25
  // export type EvaluatorMiddleware = Middleware<EvaluatorContext>;
25
26
 
@@ -1 +0,0 @@
1
- //# sourceMappingURL=ClientQualityMonitor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ClientQualityMonitor.d.ts","sourceRoot":"","sources":["../../src/monitors/ClientQualityMonitor.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- "use strict";
File without changes