@observertc/client-monitor-js 2.0.1 → 2.1.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/lib/Accumulator.d.ts +1 -1
- package/lib/Accumulator.d.ts.map +1 -1
- package/lib/Accumulator.js +7 -3
- package/lib/ClientDevices.d.ts +1 -1
- package/lib/ClientDevices.d.ts.map +1 -1
- package/lib/ClientDevices.js +36 -9
- package/lib/ClientMonitor.d.ts +1 -1
- package/lib/ClientMonitor.d.ts.map +1 -1
- package/lib/ClientMonitor.js +2 -1
- package/lib/ClientMonitorImpl.d.ts +1 -1
- package/lib/ClientMonitorImpl.d.ts.map +1 -1
- package/lib/ClientMonitorImpl.js +64 -34
- package/lib/Collectors.js +15 -11
- package/lib/Metrics.js +5 -1
- package/lib/Sampler.d.ts +1 -1
- package/lib/Sampler.d.ts.map +1 -1
- package/lib/Sampler.js +9 -5
- package/lib/adapters/Adapter.js +52 -24
- package/lib/adapters/Chrome86Adapter.js +11 -7
- package/lib/adapters/DefaultAdapter.js +9 -5
- package/lib/adapters/Firefox94Adapter.js +9 -5
- package/lib/adapters/Safari14Adapter.js +11 -7
- package/lib/collectors/MediasoupStatsCollector.d.ts.map +1 -1
- package/lib/collectors/MediasoupStatsCollector.js +43 -16
- package/lib/collectors/MediasoupSurrogates.d.ts +1 -1
- package/lib/collectors/MediasoupSurrogates.d.ts.map +1 -1
- package/lib/collectors/MediasoupSurrogates.js +2 -1
- package/lib/collectors/PeerConnectionStatsCollector.js +9 -5
- package/lib/collectors/StatsCollector.js +2 -1
- package/lib/entries/PeerConnectionEntryImpl.d.ts +1 -1
- package/lib/entries/PeerConnectionEntryImpl.d.ts.map +1 -1
- package/lib/entries/PeerConnectionEntryImpl.js +14 -10
- package/lib/entries/StatsEntryInterfaces.d.ts +1 -1
- package/lib/entries/StatsEntryInterfaces.d.ts.map +1 -1
- package/lib/entries/StatsEntryInterfaces.js +2 -1
- package/lib/entries/StatsStorage.js +9 -5
- package/lib/entries/UpdateFields.d.ts +1 -1
- package/lib/entries/UpdateFields.d.ts.map +1 -1
- package/lib/entries/UpdateFields.js +9 -3
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +35 -6
- package/lib/schema/Samples.d.ts +573 -0
- package/lib/schema/Samples.d.ts.map +1 -0
- package/lib/schema/Samples.js +4 -0
- package/lib/schema/W3cStatsIdentifiers.d.ts +319 -0
- package/lib/schema/W3cStatsIdentifiers.d.ts.map +1 -0
- package/lib/schema/W3cStatsIdentifiers.js +36 -0
- package/lib/utils/MediaDevices.d.ts +1 -1
- package/lib/utils/MediaDevices.d.ts.map +1 -1
- package/lib/utils/MediaDevices.js +5 -1
- package/lib/utils/StatsVisitor.d.ts +1 -1
- package/lib/utils/StatsVisitor.d.ts.map +1 -1
- package/lib/utils/StatsVisitor.js +31 -4
- package/lib/utils/Timer.js +9 -5
- package/lib/utils/callEvents.js +5 -2
- package/lib/utils/common.js +17 -8
- package/lib/utils/logger.js +13 -6
- package/lib/utils/makeStamp.js +5 -1
- package/lib/utils/reverseEnums.js +5 -1
- package/lib/utils/validators.js +9 -3
- package/package.json +1 -2
- package/src/Accumulator.ts +1 -1
- package/src/ClientDevices.ts +1 -1
- package/src/ClientMonitor.ts +1 -1
- package/src/ClientMonitorImpl.ts +2 -2
- package/src/Sampler.ts +2 -2
- package/src/adapters/Adapter.ts +1 -1
- package/src/collectors/MediasoupStatsCollector.ts +2 -3
- package/src/collectors/MediasoupSurrogates.ts +1 -1
- package/src/entries/PeerConnectionEntryImpl.ts +1 -1
- package/src/entries/StatsEntryInterfaces.ts +1 -1
- package/src/entries/UpdateFields.ts +1 -1
- package/src/index.ts +2 -2
- package/src/schema/Samples.ts +606 -0
- package/src/schema/W3cStatsIdentifiers.ts +507 -0
- package/src/utils/MediaDevices.ts +1 -1
- package/src/utils/StatsVisitor.ts +1 -1
- package/tsconfig.json +4 -3
package/lib/Accumulator.d.ts
CHANGED
package/lib/Accumulator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accumulator.d.ts","sourceRoot":"","sources":["../src/Accumulator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"Accumulator.d.ts","sourceRoot":"","sources":["../src/Accumulator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAKzD,MAAM,MAAM,iBAAiB,GAAG;IAC5B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAWF,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;AAE1D,qBAAa,WAAW;WACN,MAAM,CAAC,MAAM,CAAC,EAAE,iBAAiB;IAM/C,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,OAAO,CAAoB;gBAChB,MAAM,EAAE,iBAAiB;IAI5C,IAAW,OAAO,IAAI,OAAO,CAE5B;IAEM,OAAO,CAAC,QAAQ,EAAE,eAAe;IAejC,eAAe,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;IAaxD,OAAO,CAAC,UAAU;CAYrB"}
|
package/lib/Accumulator.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Accumulator = void 0;
|
|
4
|
+
const logger_1 = require("./utils/logger");
|
|
5
|
+
const logger = (0, logger_1.createLogger)("Accumulator");
|
|
3
6
|
const supplyDefaultConfig = () => {
|
|
4
7
|
const defaultConfig = {
|
|
5
8
|
maxClientSamples: 100,
|
|
@@ -8,7 +11,7 @@ const supplyDefaultConfig = () => {
|
|
|
8
11
|
};
|
|
9
12
|
return defaultConfig;
|
|
10
13
|
};
|
|
11
|
-
|
|
14
|
+
class Accumulator {
|
|
12
15
|
static create(config) {
|
|
13
16
|
const appliedConfig = Object.assign(supplyDefaultConfig(), config);
|
|
14
17
|
return new Accumulator(appliedConfig);
|
|
@@ -62,3 +65,4 @@ export class Accumulator {
|
|
|
62
65
|
this._empty = true;
|
|
63
66
|
}
|
|
64
67
|
}
|
|
68
|
+
exports.Accumulator = Accumulator;
|
package/lib/ClientDevices.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientDevices.d.ts","sourceRoot":"","sources":["../src/ClientDevices.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"ClientDevices.d.ts","sourceRoot":"","sources":["../src/ClientDevices.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAkC9E,qBAAa,aAAa;IACtB,OAAO,CAAC,GAAG,CAA+B;IAC1C,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,OAAO,CAA0B;IACzC,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,aAAa,CAAC,CAAS;IAC/B,OAAO,CAAC,YAAY,CAAC,CAAS;;IAMvB,OAAO;IAyBd,IAAW,EAAE,IAAI,eAAe,CAE/B;IAED,IAAW,OAAO,IAAI,OAAO,CAE5B;IAED,IAAW,QAAQ,IAAI,QAAQ,CAE9B;IAED,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED,IAAW,WAAW,IAAI,OAAO,CAEhC;IAED,IAAW,gBAAgB,IAAI,OAAO,CAErC;IAED,IAAW,iBAAiB,IAAI,OAAO,CAEtC;IAED,IAAW,eAAe,IAAI,OAAO,CAEpC;IAED,IAAW,OAAO,IAAI,OAAO,CAE5B;IAEM,KAAK,IAAI,IAAI;CAKvB"}
|
package/lib/ClientDevices.js
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ClientDevices = void 0;
|
|
27
|
+
const Bowser = __importStar(require("bowser"));
|
|
28
|
+
const logger_1 = require("./utils/logger");
|
|
29
|
+
const makeStamp_1 = require("./utils/makeStamp");
|
|
4
30
|
// import * as proto from "./ProtobufSamples"
|
|
5
|
-
const logger = createLogger("ClientDevices");
|
|
31
|
+
const logger = (0, logger_1.createLogger)("ClientDevices");
|
|
6
32
|
const UNKNOWN_OS = {
|
|
7
33
|
name: "Unkown",
|
|
8
34
|
version: undefined,
|
|
@@ -21,7 +47,7 @@ const UNKNOWN_ENGINE = {
|
|
|
21
47
|
name: "Unknown",
|
|
22
48
|
version: undefined,
|
|
23
49
|
};
|
|
24
|
-
|
|
50
|
+
class ClientDevices {
|
|
25
51
|
constructor() {
|
|
26
52
|
this._os = UNKNOWN_OS;
|
|
27
53
|
this._browser = UNKNOWN_BROWSER;
|
|
@@ -52,10 +78,10 @@ export class ClientDevices {
|
|
|
52
78
|
}
|
|
53
79
|
}
|
|
54
80
|
this._actualStamps = {
|
|
55
|
-
os: makeStamp(this._os),
|
|
56
|
-
browser: makeStamp(this._browser),
|
|
57
|
-
platform: makeStamp(this._platform),
|
|
58
|
-
engine: makeStamp(this._engine),
|
|
81
|
+
os: (0, makeStamp_1.makeStamp)(this._os),
|
|
82
|
+
browser: (0, makeStamp_1.makeStamp)(this._browser),
|
|
83
|
+
platform: (0, makeStamp_1.makeStamp)(this._platform),
|
|
84
|
+
engine: (0, makeStamp_1.makeStamp)(this._engine),
|
|
59
85
|
};
|
|
60
86
|
}
|
|
61
87
|
get os() {
|
|
@@ -95,3 +121,4 @@ export class ClientDevices {
|
|
|
95
121
|
};
|
|
96
122
|
}
|
|
97
123
|
}
|
|
124
|
+
exports.ClientDevices = ClientDevices;
|
package/lib/ClientMonitor.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OperationSystem, Browser, Platform, Engine, MediaDevice, CustomCallEvent, ExtensionStat, ClientSample, Samples } from
|
|
1
|
+
import { OperationSystem, Browser, Platform, Engine, MediaDevice, CustomCallEvent, ExtensionStat, ClientSample, Samples } from './schema/Samples';
|
|
2
2
|
import { AccumulatorConfig } from "./Accumulator";
|
|
3
3
|
import { Collectors, CollectorsConfig } from "./Collectors";
|
|
4
4
|
import { StatsReader } from "./entries/StatsStorage";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientMonitor.d.ts","sourceRoot":"","sources":["../src/ClientMonitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"ClientMonitor.d.ts","sourceRoot":"","sources":["../src/ClientMonitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClJ,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,MAAM,mBAAmB,GAAG;IAC9B;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,iBAA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gC,CAAC,gBAAgB,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAErF;;;;OAIG;IACH,gCAAgC,CAAC,gBAAgB,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAErF;;;;;OAKG;IACH,qCAAqC,CAAC,gBAAgB,EAAE,MAAM,EAAE,eAAe,EAAE,sBAAsB,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEnI;;;OAGG;IACH,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IAEjD;;;;;;;OAOG;IACH,iBAAiB,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAE9C;;;;;;;OAOG;IACH,eAAe,CAAC,GAAG,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;IAEjD;;;;;;OAMG;IACH,mBAAmB,CAAC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IAExD;;;;;;OAMG;IACH,iBAAiB,CAAC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpD;;;;;;OAMG;IACH,gBAAgB,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAElD;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzB;;OAEG;IACH,MAAM,IAAI,IAAI,CAAC;IAEf;;;OAGG;IACH,IAAI,IAAI,IAAI,CAAC;IAEb;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;CACjB"}
|
package/lib/ClientMonitor.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -3,7 +3,7 @@ import { StatsReader } from "./entries/StatsStorage";
|
|
|
3
3
|
import { ClientMonitor, ClientMonitorConfig, ClientMonitorEvents } from "./ClientMonitor";
|
|
4
4
|
import { MetricsReader } from "./Metrics";
|
|
5
5
|
import { Collectors } from "./Collectors";
|
|
6
|
-
import { OperationSystem, Browser, Platform, Engine, MediaDevice, ExtensionStat, CustomCallEvent } from
|
|
6
|
+
import { OperationSystem, Browser, Platform, Engine, MediaDevice, ExtensionStat, CustomCallEvent } from './schema/Samples';
|
|
7
7
|
type ConstructorConfig = ClientMonitorConfig;
|
|
8
8
|
export declare class ClientMonitorImpl implements ClientMonitor {
|
|
9
9
|
readonly config: ConstructorConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientMonitorImpl.d.ts","sourceRoot":"","sources":["../src/ClientMonitorImpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,aAAa,EAAE,MAAM,WAAW,CAAC;AAKnD,OAAO,EAAE,WAAW,EAAgB,MAAM,wBAAwB,CAAC;AAGnE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC1F,OAAO,EAAW,aAAa,EAAE,MAAM,WAAW,CAAC;AAGnD,OAAO,EAAE,UAAU,EAAoC,MAAM,cAAc,CAAC;AAC5E,OAAO,EACH,eAAe,EACf,OAAO,EACP,QAAQ,EACR,MAAM,EACN,WAAW,EACX,aAAa,EAGb,eAAe,EAClB,MAAM
|
|
1
|
+
{"version":3,"file":"ClientMonitorImpl.d.ts","sourceRoot":"","sources":["../src/ClientMonitorImpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,aAAa,EAAE,MAAM,WAAW,CAAC;AAKnD,OAAO,EAAE,WAAW,EAAgB,MAAM,wBAAwB,CAAC;AAGnE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC1F,OAAO,EAAW,aAAa,EAAE,MAAM,WAAW,CAAC;AAGnD,OAAO,EAAE,UAAU,EAAoC,MAAM,cAAc,CAAC;AAC5E,OAAO,EACH,eAAe,EACf,OAAO,EACP,QAAQ,EACR,MA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C,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI;IAK3G,GAAG,CAAC,CAAC,SAAS,MAAM,mBAAmB,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI;IAK1G,KAAK,CAAC,CAAC,SAAS,MAAM,mBAAmB,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,OAAO;IAIlG,OAAO,CAAC,qBAAqB;IAiB7B,OAAO,CAAC,cAAc;IAgBtB,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,YAAY;CAgBvB"}
|
package/lib/ClientMonitorImpl.js
CHANGED
|
@@ -1,17 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.ClientMonitorImpl = void 0;
|
|
30
|
+
const Sampler_1 = require("./Sampler");
|
|
31
|
+
const ClientDevices_1 = require("./ClientDevices");
|
|
32
|
+
const MediaDevices_1 = require("./utils/MediaDevices");
|
|
33
|
+
const Timer_1 = require("./utils/Timer");
|
|
34
|
+
const StatsStorage_1 = require("./entries/StatsStorage");
|
|
35
|
+
const Accumulator_1 = require("./Accumulator");
|
|
36
|
+
const logger_1 = require("./utils/logger");
|
|
37
|
+
const Metrics_1 = require("./Metrics");
|
|
38
|
+
const validators = __importStar(require("./utils/validators"));
|
|
39
|
+
const events_1 = __importDefault(require("events"));
|
|
40
|
+
const Collectors_1 = require("./Collectors");
|
|
41
|
+
const Samples_1 = require("./schema/Samples");
|
|
42
|
+
const callEvents_1 = require("./utils/callEvents");
|
|
43
|
+
const logger = (0, logger_1.createLogger)("ClientMonitor");
|
|
15
44
|
const supplyDefaultConfig = () => {
|
|
16
45
|
const defaultConfig = {
|
|
17
46
|
logLevel: 'warn',
|
|
@@ -22,15 +51,15 @@ const supplyDefaultConfig = () => {
|
|
|
22
51
|
};
|
|
23
52
|
return defaultConfig;
|
|
24
53
|
};
|
|
25
|
-
logger.debug("Version of the loaded schema:", schemaVersion);
|
|
26
|
-
|
|
54
|
+
logger.debug("Version of the loaded schema:", Samples_1.schemaVersion);
|
|
55
|
+
class ClientMonitorImpl {
|
|
27
56
|
static create(config) {
|
|
28
57
|
if ((config === null || config === void 0 ? void 0 : config.maxListeners) !== undefined) {
|
|
29
|
-
|
|
58
|
+
events_1.default.setMaxListeners(config.maxListeners);
|
|
30
59
|
}
|
|
31
60
|
const appliedConfig = config ? Object.assign(supplyDefaultConfig(), config) : supplyDefaultConfig();
|
|
32
61
|
if (appliedConfig.logLevel) {
|
|
33
|
-
setLogLevel(appliedConfig.logLevel);
|
|
62
|
+
(0, logger_1.setLogLevel)(appliedConfig.logLevel);
|
|
34
63
|
}
|
|
35
64
|
const result = new ClientMonitorImpl(appliedConfig);
|
|
36
65
|
logger.debug("Created", appliedConfig);
|
|
@@ -39,12 +68,12 @@ export class ClientMonitorImpl {
|
|
|
39
68
|
constructor(config) {
|
|
40
69
|
this.config = config;
|
|
41
70
|
this._closed = false;
|
|
42
|
-
this._emitter = new
|
|
43
|
-
this._clientDevices = new ClientDevices();
|
|
44
|
-
this._mediaDevices = new MediaDevices();
|
|
45
|
-
this._statsStorage = new StatsStorage(this);
|
|
46
|
-
this._metrics = new Metrics();
|
|
47
|
-
this._accumulator = Accumulator.create(config.accumulator);
|
|
71
|
+
this._emitter = new events_1.default();
|
|
72
|
+
this._clientDevices = new ClientDevices_1.ClientDevices();
|
|
73
|
+
this._mediaDevices = new MediaDevices_1.MediaDevices();
|
|
74
|
+
this._statsStorage = new StatsStorage_1.StatsStorage(this);
|
|
75
|
+
this._metrics = new Metrics_1.Metrics();
|
|
76
|
+
this._accumulator = Accumulator_1.Accumulator.create(config.accumulator);
|
|
48
77
|
this._collectors = this._makeCollector();
|
|
49
78
|
this._sampler = this._makeSampler();
|
|
50
79
|
this._createTimer();
|
|
@@ -107,7 +136,7 @@ export class ClientMonitorImpl {
|
|
|
107
136
|
}
|
|
108
137
|
addMediaTrackAddedCallEvent(peerConnectionId, mediaTrackId, timestamp) {
|
|
109
138
|
const callEvent = {
|
|
110
|
-
name: CallEventType.MEDIA_TRACK_ADDED,
|
|
139
|
+
name: callEvents_1.CallEventType.MEDIA_TRACK_ADDED,
|
|
111
140
|
peerConnectionId,
|
|
112
141
|
mediaTrackId,
|
|
113
142
|
timestamp: timestamp !== null && timestamp !== void 0 ? timestamp : Date.now(),
|
|
@@ -116,7 +145,7 @@ export class ClientMonitorImpl {
|
|
|
116
145
|
}
|
|
117
146
|
addMediaTrackRemovedCallEvent(peerConnectionId, mediaTrackId, timestamp) {
|
|
118
147
|
const callEvent = {
|
|
119
|
-
name: CallEventType.MEDIA_TRACK_REMOVED,
|
|
148
|
+
name: callEvents_1.CallEventType.MEDIA_TRACK_REMOVED,
|
|
120
149
|
peerConnectionId,
|
|
121
150
|
mediaTrackId,
|
|
122
151
|
timestamp: timestamp !== null && timestamp !== void 0 ? timestamp : Date.now(),
|
|
@@ -125,7 +154,7 @@ export class ClientMonitorImpl {
|
|
|
125
154
|
}
|
|
126
155
|
addPeerConnectionOpenedCallEvent(peerConnectionId, timestamp) {
|
|
127
156
|
const callEvent = {
|
|
128
|
-
name: CallEventType.PEER_CONNECTION_OPENED,
|
|
157
|
+
name: callEvents_1.CallEventType.PEER_CONNECTION_OPENED,
|
|
129
158
|
peerConnectionId,
|
|
130
159
|
timestamp: timestamp !== null && timestamp !== void 0 ? timestamp : Date.now(),
|
|
131
160
|
};
|
|
@@ -133,7 +162,7 @@ export class ClientMonitorImpl {
|
|
|
133
162
|
}
|
|
134
163
|
addPeerConnectionClosedCallEvent(peerConnectionId, timestamp) {
|
|
135
164
|
const callEvent = {
|
|
136
|
-
name: CallEventType.PEER_CONNECTION_CLOSED,
|
|
165
|
+
name: callEvents_1.CallEventType.PEER_CONNECTION_CLOSED,
|
|
137
166
|
peerConnectionId,
|
|
138
167
|
timestamp: timestamp !== null && timestamp !== void 0 ? timestamp : Date.now(),
|
|
139
168
|
};
|
|
@@ -141,7 +170,7 @@ export class ClientMonitorImpl {
|
|
|
141
170
|
}
|
|
142
171
|
addIceConnectionStateChangedCallEvent(peerConnectionId, connectionState, timestamp) {
|
|
143
172
|
const callEvent = {
|
|
144
|
-
name: CallEventType.ICE_CONNECTION_STATE_CHANGED,
|
|
173
|
+
name: callEvents_1.CallEventType.ICE_CONNECTION_STATE_CHANGED,
|
|
145
174
|
peerConnectionId,
|
|
146
175
|
value: connectionState,
|
|
147
176
|
timestamp: timestamp !== null && timestamp !== void 0 ? timestamp : Date.now(),
|
|
@@ -232,7 +261,7 @@ export class ClientMonitorImpl {
|
|
|
232
261
|
return;
|
|
233
262
|
}
|
|
234
263
|
if (!this._timer) {
|
|
235
|
-
this._timer = new Timer(this.config.tickingTimeInMs);
|
|
264
|
+
this._timer = new Timer_1.Timer(this.config.tickingTimeInMs);
|
|
236
265
|
}
|
|
237
266
|
if (this._timer.hasListener("collect")) {
|
|
238
267
|
this._timer.clear("collect");
|
|
@@ -251,7 +280,7 @@ export class ClientMonitorImpl {
|
|
|
251
280
|
return;
|
|
252
281
|
}
|
|
253
282
|
if (!this._timer) {
|
|
254
|
-
this._timer = new Timer(this.config.tickingTimeInMs);
|
|
283
|
+
this._timer = new Timer_1.Timer(this.config.tickingTimeInMs);
|
|
255
284
|
}
|
|
256
285
|
if (this._timer.hasListener("sample")) {
|
|
257
286
|
this._timer.clear("sample");
|
|
@@ -271,7 +300,7 @@ export class ClientMonitorImpl {
|
|
|
271
300
|
return;
|
|
272
301
|
}
|
|
273
302
|
if (!this._timer) {
|
|
274
|
-
this._timer = new Timer(this.config.tickingTimeInMs);
|
|
303
|
+
this._timer = new Timer_1.Timer(this.config.tickingTimeInMs);
|
|
275
304
|
}
|
|
276
305
|
if (this._timer.hasListener("send")) {
|
|
277
306
|
this._timer.clear("send");
|
|
@@ -323,13 +352,13 @@ export class ClientMonitorImpl {
|
|
|
323
352
|
browserVersion: (_b = this._clientDevices.browser) === null || _b === void 0 ? void 0 : _b.version,
|
|
324
353
|
};
|
|
325
354
|
const appliedCollectorsConfig = Object.assign({ adapter: createdAdapterConfig }, collectorsConfig);
|
|
326
|
-
const result = CollectorsImpl.create(appliedCollectorsConfig);
|
|
355
|
+
const result = Collectors_1.CollectorsImpl.create(appliedCollectorsConfig);
|
|
327
356
|
result.statsAcceptor = this._statsStorage;
|
|
328
357
|
result.clientMonitor = this;
|
|
329
358
|
return result;
|
|
330
359
|
}
|
|
331
360
|
_makeSampler() {
|
|
332
|
-
const result = new Sampler(this._statsStorage);
|
|
361
|
+
const result = new Sampler_1.Sampler(this._statsStorage);
|
|
333
362
|
return result;
|
|
334
363
|
}
|
|
335
364
|
_createTimer() {
|
|
@@ -349,3 +378,4 @@ export class ClientMonitorImpl {
|
|
|
349
378
|
}
|
|
350
379
|
}
|
|
351
380
|
}
|
|
381
|
+
exports.ClientMonitorImpl = ClientMonitorImpl;
|
package/lib/Collectors.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CollectorsImpl = void 0;
|
|
4
|
+
const Adapter_1 = require("./adapters/Adapter");
|
|
5
|
+
const PeerConnectionStatsCollector_1 = require("./collectors/PeerConnectionStatsCollector");
|
|
6
|
+
const logger_1 = require("./utils/logger");
|
|
7
|
+
const uuid_1 = require("uuid");
|
|
8
|
+
const MediasoupStatsCollector_1 = require("./collectors/MediasoupStatsCollector");
|
|
9
|
+
const logger = (0, logger_1.createLogger)("Collector");
|
|
7
10
|
const supplyDefaultConfig = () => {
|
|
8
11
|
const defaultConfig = {};
|
|
9
12
|
return defaultConfig;
|
|
10
13
|
};
|
|
11
|
-
|
|
14
|
+
class CollectorsImpl {
|
|
12
15
|
static create(config) {
|
|
13
16
|
const appliedConfig = Object.assign(supplyDefaultConfig(), config);
|
|
14
17
|
return new CollectorsImpl(appliedConfig);
|
|
@@ -18,7 +21,7 @@ export class CollectorsImpl {
|
|
|
18
21
|
this._lastScrappedStats = new Map();
|
|
19
22
|
this._closed = false;
|
|
20
23
|
this._config = config;
|
|
21
|
-
this._adapter = createAdapter(this._config.adapter);
|
|
24
|
+
this._adapter = (0, Adapter_1.createAdapter)(this._config.adapter);
|
|
22
25
|
}
|
|
23
26
|
/*eslint-disable @typescript-eslint/no-explicit-any*/
|
|
24
27
|
[Symbol.iterator]() {
|
|
@@ -35,7 +38,7 @@ export class CollectorsImpl {
|
|
|
35
38
|
}
|
|
36
39
|
addGetStats(getStats, label) {
|
|
37
40
|
return this.addStatsProvider({
|
|
38
|
-
peerConnectionId:
|
|
41
|
+
peerConnectionId: (0, uuid_1.v4)(),
|
|
39
42
|
label,
|
|
40
43
|
getStats
|
|
41
44
|
});
|
|
@@ -72,7 +75,7 @@ export class CollectorsImpl {
|
|
|
72
75
|
}
|
|
73
76
|
/* eslint-disable @typescript-eslint/no-this-alias */
|
|
74
77
|
const collectors = this;
|
|
75
|
-
const pcStatsCollector = new class extends PeerConnectionStatsCollector {
|
|
78
|
+
const pcStatsCollector = new class extends PeerConnectionStatsCollector_1.PeerConnectionStatsCollector {
|
|
76
79
|
_close() {
|
|
77
80
|
collectors._removeStatsCollector(pcStatsCollector.id);
|
|
78
81
|
}
|
|
@@ -98,7 +101,7 @@ export class CollectorsImpl {
|
|
|
98
101
|
}
|
|
99
102
|
/* eslint-disable @typescript-eslint/no-this-alias */
|
|
100
103
|
const collectors = this;
|
|
101
|
-
const mediasoupStatsCollector = new class extends MediasoupStatsCollector {
|
|
104
|
+
const mediasoupStatsCollector = new class extends MediasoupStatsCollector_1.MediasoupStatsCollector {
|
|
102
105
|
get statsProviders() {
|
|
103
106
|
return mediasoupStatsCollector.getStatsProviders();
|
|
104
107
|
}
|
|
@@ -231,3 +234,4 @@ export class CollectorsImpl {
|
|
|
231
234
|
return true;
|
|
232
235
|
}
|
|
233
236
|
}
|
|
237
|
+
exports.CollectorsImpl = CollectorsImpl;
|
package/lib/Metrics.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Metrics = void 0;
|
|
4
|
+
class Metrics {
|
|
2
5
|
setCollectingTimeInMs(value) {
|
|
3
6
|
this._collectingTimeInMs = value;
|
|
4
7
|
}
|
|
@@ -24,3 +27,4 @@ export class Metrics {
|
|
|
24
27
|
return this._lastSent;
|
|
25
28
|
}
|
|
26
29
|
}
|
|
30
|
+
exports.Metrics = Metrics;
|
package/lib/Sampler.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Browser, ClientSample, Engine, ExtensionStat, MediaDevice, OperationSystem, Platform, CustomCallEvent, CustomObserverEvent } from '
|
|
1
|
+
import { Browser, ClientSample, Engine, ExtensionStat, MediaDevice, OperationSystem, Platform, CustomCallEvent, CustomObserverEvent } from './schema/Samples';
|
|
2
2
|
import { StatsReader } from "./entries/StatsStorage";
|
|
3
3
|
export type TrackRelation = {
|
|
4
4
|
trackId: string;
|
package/lib/Sampler.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sampler.d.ts","sourceRoot":"","sources":["../src/Sampler.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Sampler.d.ts","sourceRoot":"","sources":["../src/Sampler.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,OAAO,EAEP,YAAY,EAGZ,MAAM,EACN,aAAa,EAKb,WAAW,EAEX,eAAe,EAIf,QAAQ,EAER,eAAe,EACf,mBAAmB,EACtB,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAMrD,MAAM,MAAM,aAAa,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC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AE,GAAG,IAAI;IAKrC,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAK9C,KAAK,IAAI,IAAI;IASb,IAAI,IAAI,YAAY,GAAG,SAAS;IA2IvC,OAAO,CAAE,kBAAkB;IAyD3B,OAAO,CAAE,iBAAiB;IAyC1B,OAAO,CAAE,qBAAqB;IAa9B,OAAO,CAAE,gBAAgB;IAgBzB,OAAO,CAAE,gBAAgB;IAezB,OAAO,CAAE,UAAU;IAenB,OAAO,CAAE,gBAAgB;IAezB,OAAO,CAAE,sBAAsB;IAkB/B,OAAO,CAAE,uBAAuB;IAiBhC,OAAO,CAAE,gBAAgB;IAUzB,OAAO,CAAE,cAAc;CAW1B"}
|
package/lib/Sampler.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Sampler = void 0;
|
|
4
|
+
const common_1 = require("./utils/common");
|
|
5
|
+
const logger_1 = require("./utils/logger");
|
|
6
|
+
const logger = (0, logger_1.createLogger)("Sampler");
|
|
7
|
+
class Sampler {
|
|
5
8
|
constructor(_statsReader) {
|
|
6
9
|
this._statsReader = _statsReader;
|
|
7
10
|
// private _statsReader?: StatsReader;
|
|
@@ -403,7 +406,7 @@ export class Sampler {
|
|
|
403
406
|
const stats = dataChannel.stats;
|
|
404
407
|
yield {
|
|
405
408
|
...stats,
|
|
406
|
-
peerConnectionId: (_a = peerConnection.id) !== null && _a !== void 0 ? _a : NULL_UUID,
|
|
409
|
+
peerConnectionId: (_a = peerConnection.id) !== null && _a !== void 0 ? _a : common_1.NULL_UUID,
|
|
407
410
|
};
|
|
408
411
|
}
|
|
409
412
|
}
|
|
@@ -418,3 +421,4 @@ export class Sampler {
|
|
|
418
421
|
}
|
|
419
422
|
}
|
|
420
423
|
}
|
|
424
|
+
exports.Sampler = Sampler;
|
package/lib/adapters/Adapter.js
CHANGED
|
@@ -1,70 +1,96 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.castStats = exports.createAdapter = void 0;
|
|
27
|
+
const Chrome86Adapter_1 = require("./Chrome86Adapter");
|
|
28
|
+
const DefaultAdapter_1 = require("./DefaultAdapter");
|
|
29
|
+
const W3CStats = __importStar(require("../schema/W3cStatsIdentifiers"));
|
|
30
|
+
const Firefox94Adapter_1 = require("./Firefox94Adapter");
|
|
31
|
+
const Safari14Adapter_1 = require("./Safari14Adapter");
|
|
32
|
+
const logger_1 = require("../utils/logger");
|
|
33
|
+
const logger = (0, logger_1.createLogger)(`Adapter`);
|
|
8
34
|
const supplyDefaultConfig = () => {
|
|
9
35
|
const defaultConfig = {};
|
|
10
36
|
return defaultConfig;
|
|
11
37
|
};
|
|
12
38
|
function createChromeAdapter(version) {
|
|
13
39
|
if (!version) {
|
|
14
|
-
return new DefaultAdapter();
|
|
40
|
+
return new DefaultAdapter_1.DefaultAdapter();
|
|
15
41
|
}
|
|
16
42
|
const majorVersion = version.split(".")[0];
|
|
17
43
|
if (!majorVersion) {
|
|
18
44
|
logger.warn(`Cannot recognize chrome version ${version}`);
|
|
19
|
-
return new DefaultAdapter();
|
|
45
|
+
return new DefaultAdapter_1.DefaultAdapter();
|
|
20
46
|
}
|
|
21
47
|
const majorVersionNumber = Number.parseInt(majorVersion);
|
|
22
48
|
if (!Number.isInteger(majorVersionNumber)) {
|
|
23
49
|
logger.warn(`Cannot recognize chrome version major number ${majorVersion}`);
|
|
24
|
-
return new DefaultAdapter();
|
|
50
|
+
return new DefaultAdapter_1.DefaultAdapter();
|
|
25
51
|
}
|
|
26
52
|
if (majorVersionNumber < 86) {
|
|
27
53
|
logger.info(`There is no adapter for chrome before version 86`);
|
|
28
|
-
return new DefaultAdapter();
|
|
54
|
+
return new DefaultAdapter_1.DefaultAdapter();
|
|
29
55
|
}
|
|
30
|
-
return new Chrome86Adapter();
|
|
56
|
+
return new Chrome86Adapter_1.Chrome86Adapter();
|
|
31
57
|
}
|
|
32
58
|
function createFirefoxAdapter(version) {
|
|
33
59
|
if (!version) {
|
|
34
|
-
return new DefaultAdapter();
|
|
60
|
+
return new DefaultAdapter_1.DefaultAdapter();
|
|
35
61
|
}
|
|
36
62
|
const majorVersion = version.split(".")[0];
|
|
37
63
|
if (!majorVersion) {
|
|
38
64
|
logger.warn(`Cannot recognize firefox version ${version}`);
|
|
39
|
-
return new DefaultAdapter();
|
|
65
|
+
return new DefaultAdapter_1.DefaultAdapter();
|
|
40
66
|
}
|
|
41
67
|
const majorVersionNumber = Number.parseInt(majorVersion);
|
|
42
68
|
if (!Number.isInteger(majorVersionNumber)) {
|
|
43
69
|
logger.warn(`Cannot recognize firefox version major number ${majorVersion}`);
|
|
44
|
-
return new DefaultAdapter();
|
|
70
|
+
return new DefaultAdapter_1.DefaultAdapter();
|
|
45
71
|
}
|
|
46
|
-
return new Firefox94Adapter();
|
|
72
|
+
return new Firefox94Adapter_1.Firefox94Adapter();
|
|
47
73
|
}
|
|
48
74
|
function createSafariAdapter(version) {
|
|
49
75
|
if (!version) {
|
|
50
|
-
return new DefaultAdapter();
|
|
76
|
+
return new DefaultAdapter_1.DefaultAdapter();
|
|
51
77
|
}
|
|
52
78
|
const majorVersion = version.split(".")[0];
|
|
53
79
|
if (!majorVersion) {
|
|
54
80
|
logger.warn(`Cannot recognize safari version ${version}`);
|
|
55
|
-
return new DefaultAdapter();
|
|
81
|
+
return new DefaultAdapter_1.DefaultAdapter();
|
|
56
82
|
}
|
|
57
83
|
const majorVersionNumber = Number.parseInt(majorVersion);
|
|
58
84
|
if (!Number.isInteger(majorVersionNumber)) {
|
|
59
85
|
logger.warn(`Cannot recognize safari version major number ${majorVersion}`);
|
|
60
|
-
return new DefaultAdapter();
|
|
86
|
+
return new DefaultAdapter_1.DefaultAdapter();
|
|
61
87
|
}
|
|
62
|
-
return new Safari14Adapter();
|
|
88
|
+
return new Safari14Adapter_1.Safari14Adapter();
|
|
63
89
|
}
|
|
64
|
-
|
|
90
|
+
function createAdapter(providedConfig) {
|
|
65
91
|
const config = Object.assign(supplyDefaultConfig(), providedConfig);
|
|
66
92
|
if (!config || !config.browserType) {
|
|
67
|
-
return new DefaultAdapter();
|
|
93
|
+
return new DefaultAdapter_1.DefaultAdapter();
|
|
68
94
|
}
|
|
69
95
|
switch (config.browserType.toLowerCase()) {
|
|
70
96
|
case "chrome":
|
|
@@ -75,11 +101,12 @@ export function createAdapter(providedConfig) {
|
|
|
75
101
|
return createSafariAdapter(config.browserVersion);
|
|
76
102
|
default:
|
|
77
103
|
// logger.info(`Browser type ${config.browserType} is not recognized`);
|
|
78
|
-
return new DefaultAdapter();
|
|
104
|
+
return new DefaultAdapter_1.DefaultAdapter();
|
|
79
105
|
}
|
|
80
106
|
}
|
|
107
|
+
exports.createAdapter = createAdapter;
|
|
81
108
|
/*eslint-disable @typescript-eslint/no-explicit-any */
|
|
82
|
-
|
|
109
|
+
function castStats(rtcStatType, rtcStatValue) {
|
|
83
110
|
switch (rtcStatType.toLowerCase()) {
|
|
84
111
|
case W3CStats.StatsType.codec:
|
|
85
112
|
return [W3CStats.StatsType.codec, rtcStatValue];
|
|
@@ -129,3 +156,4 @@ export function castStats(rtcStatType, rtcStatValue) {
|
|
|
129
156
|
return undefined;
|
|
130
157
|
}
|
|
131
158
|
}
|
|
159
|
+
exports.castStats = castStats;
|