mediasoup-client 3.7.16 → 3.7.17
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/Device.d.ts +2 -7
- package/lib/Device.d.ts.map +1 -1
- package/lib/Device.js +11 -19
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/test/test.js +2 -8
- package/lib/test/uaTestCases.d.ts.map +1 -1
- package/lib/test/uaTestCases.js +11 -0
- package/package.json +12 -12
package/lib/Device.d.ts
CHANGED
|
@@ -14,13 +14,8 @@ export type DeviceOptions = {
|
|
|
14
14
|
* Custom handler factory.
|
|
15
15
|
*/
|
|
16
16
|
handlerFactory?: HandlerFactory;
|
|
17
|
-
/**
|
|
18
|
-
* DEPRECATED!
|
|
19
|
-
* The name of one of the builtin handlers.
|
|
20
|
-
*/
|
|
21
|
-
Handler?: string;
|
|
22
17
|
};
|
|
23
|
-
export declare function detectDevice(): BuiltinHandlerName | undefined;
|
|
18
|
+
export declare function detectDevice(userAgent?: string): BuiltinHandlerName | undefined;
|
|
24
19
|
export type DeviceObserver = EnhancedEventEmitter<DeviceObserverEvents>;
|
|
25
20
|
export type DeviceObserverEvents = {
|
|
26
21
|
newtransport: [Transport];
|
|
@@ -39,7 +34,7 @@ export declare class Device {
|
|
|
39
34
|
*
|
|
40
35
|
* @throws {UnsupportedError} if device is not supported.
|
|
41
36
|
*/
|
|
42
|
-
constructor({ handlerName, handlerFactory
|
|
37
|
+
constructor({ handlerName, handlerFactory }?: DeviceOptions);
|
|
43
38
|
/**
|
|
44
39
|
* The RTC handler name.
|
|
45
40
|
*/
|
package/lib/Device.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Device.d.ts","sourceRoot":"","sources":["../src/Device.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAIxD,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAoB,M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b,aAAa,EACb,cAAc,EACd,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,OAAO,GACP,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAAC,gBAAgB,CAAC;IAkBnE;;;;;OAKG;IACH,mBAAmB,CAAC,gBAAgB,SAAS,OAAO,GAAG,OAAO,EAAE,EAC/D,EAAE,EACF,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,OAAO,GACP,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAAC,gBAAgB,CAAC;IAkBnE,OAAO,CAAC,eAAe;CAsDvB"}
|
package/lib/Device.js
CHANGED
|
@@ -45,11 +45,13 @@ const Edge11_1 = require("./handlers/Edge11");
|
|
|
45
45
|
const ReactNativeUnifiedPlan_1 = require("./handlers/ReactNativeUnifiedPlan");
|
|
46
46
|
const ReactNative_1 = require("./handlers/ReactNative");
|
|
47
47
|
const logger = new Logger_1.Logger('Device');
|
|
48
|
-
function detectDevice() {
|
|
48
|
+
function detectDevice(userAgent) {
|
|
49
49
|
// React-Native.
|
|
50
50
|
// NOTE: react-native-webrtc >= 1.75.0 is required.
|
|
51
51
|
// NOTE: react-native-webrtc with Unified Plan requires version >= 106.0.0.
|
|
52
|
-
if (
|
|
52
|
+
if (!userAgent &&
|
|
53
|
+
typeof navigator === 'object' &&
|
|
54
|
+
navigator.product === 'ReactNative') {
|
|
53
55
|
logger.debug('detectDevice() | React-Native detected');
|
|
54
56
|
if (typeof RTCPeerConnection === 'undefined') {
|
|
55
57
|
logger.warn('detectDevice() | unsupported react-native-webrtc without RTCPeerConnection, forgot to call registerGlobals()?');
|
|
@@ -65,11 +67,11 @@ function detectDevice() {
|
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
// Browser.
|
|
68
|
-
else if (
|
|
69
|
-
typeof navigator.userAgent === 'string') {
|
|
70
|
-
|
|
71
|
-
const uaParser = new ua_parser_js_1.UAParser(
|
|
72
|
-
logger.debug('detectDevice() | browser detected [
|
|
70
|
+
else if (userAgent ||
|
|
71
|
+
(typeof navigator === 'object' && typeof navigator.userAgent === 'string')) {
|
|
72
|
+
userAgent ?? (userAgent = navigator.userAgent);
|
|
73
|
+
const uaParser = new ua_parser_js_1.UAParser(userAgent);
|
|
74
|
+
logger.debug('detectDevice() | browser detected [userAgent:%s, parsed:%o]', userAgent, uaParser.getResult());
|
|
73
75
|
const browser = uaParser.getBrowser();
|
|
74
76
|
const browserName = browser.name?.toLowerCase();
|
|
75
77
|
const browserVersion = parseInt(browser.major ?? '0');
|
|
@@ -146,7 +148,7 @@ function detectDevice() {
|
|
|
146
148
|
// Best effort for Chromium based browsers.
|
|
147
149
|
else if (engineName === 'blink') {
|
|
148
150
|
// eslint-disable-next-line @typescript-eslint/prefer-regexp-exec
|
|
149
|
-
const match =
|
|
151
|
+
const match = userAgent.match(/(?:(?:Chrome|Chromium))[ /](\w+)/i);
|
|
150
152
|
if (match) {
|
|
151
153
|
const version = Number(match[1]);
|
|
152
154
|
if (version >= 111) {
|
|
@@ -187,22 +189,12 @@ class Device {
|
|
|
187
189
|
*
|
|
188
190
|
* @throws {UnsupportedError} if device is not supported.
|
|
189
191
|
*/
|
|
190
|
-
constructor({ handlerName, handlerFactory
|
|
192
|
+
constructor({ handlerName, handlerFactory } = {}) {
|
|
191
193
|
// Loaded flag.
|
|
192
194
|
this._loaded = false;
|
|
193
195
|
// Observer instance.
|
|
194
196
|
this._observer = new enhancedEvents_1.EnhancedEventEmitter();
|
|
195
197
|
logger.debug('constructor()');
|
|
196
|
-
// Handle deprecated option.
|
|
197
|
-
if (Handler) {
|
|
198
|
-
logger.warn('constructor() | Handler option is DEPRECATED, use handlerName or handlerFactory instead');
|
|
199
|
-
if (typeof Handler === 'string') {
|
|
200
|
-
handlerName = Handler;
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
throw new TypeError('non string Handler option no longer supported, use handlerFactory instead');
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
198
|
if (handlerName && handlerFactory) {
|
|
207
199
|
throw new TypeError('just one of handlerName or handlerInterface can be given');
|
|
208
200
|
}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/lib/test/test.js
CHANGED
|
@@ -1268,26 +1268,20 @@ test('parseScalabilityMode() works', () => {
|
|
|
1268
1268
|
});
|
|
1269
1269
|
});
|
|
1270
1270
|
describe('detectDevice() assigns proper handler based on UserAgent', () => {
|
|
1271
|
-
const originalNavigator = global.navigator;
|
|
1272
1271
|
for (const uaTestCase of uaTestCases_1.uaTestCases) {
|
|
1273
1272
|
test(
|
|
1274
1273
|
// eslint-disable-next-line jest/valid-title --- Jest is not that smart.
|
|
1275
1274
|
uaTestCase.desc, () => {
|
|
1276
|
-
// @ts-expect-error --- On purpose.
|
|
1277
|
-
global.navigator = {
|
|
1278
|
-
userAgent: uaTestCase.ua,
|
|
1279
|
-
};
|
|
1280
1275
|
const originalRTCRtpTransceiver = global.RTCRtpTransceiver;
|
|
1276
|
+
// We need to force presence of RTCRtpTransceiver to test Safari 12.
|
|
1281
1277
|
if (uaTestCase.expect === 'Safari12') {
|
|
1282
1278
|
global.RTCRtpTransceiver = class Dummy {
|
|
1283
1279
|
currentDirection() { }
|
|
1284
1280
|
};
|
|
1285
1281
|
}
|
|
1286
|
-
expect(detectDevice()).toBe(uaTestCase.expect);
|
|
1282
|
+
expect(detectDevice(uaTestCase.ua)).toBe(uaTestCase.expect);
|
|
1287
1283
|
// Cleanup.
|
|
1288
1284
|
global.RTCRtpTransceiver = originalRTCRtpTransceiver;
|
|
1289
1285
|
}, 100);
|
|
1290
1286
|
}
|
|
1291
|
-
// Cleanup.
|
|
1292
|
-
global.navigator = originalNavigator;
|
|
1293
1287
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uaTestCases.d.ts","sourceRoot":"","sources":["../../src/test/uaTestCases.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,KAAK,UAAU,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,kBAAkB,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"uaTestCases.d.ts","sourceRoot":"","sources":["../../src/test/uaTestCases.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,KAAK,UAAU,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,kBAAkB,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,UAAU,EA4FnC,CAAC"}
|
package/lib/test/uaTestCases.js
CHANGED
|
@@ -82,4 +82,15 @@ exports.uaTestCases = [
|
|
|
82
82
|
ua: 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/114.0.5735.124 Mobile/15E148 Safari/604.1',
|
|
83
83
|
expect: 'Safari12',
|
|
84
84
|
},
|
|
85
|
+
{
|
|
86
|
+
desc: 'Fake Foo Invalid Browser',
|
|
87
|
+
ua: 'Fake/5.0 (Foo; Bar Lalala OS_19.5) Foo/22.2',
|
|
88
|
+
expect: undefined,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
// Zoom App Marketplace browser.
|
|
92
|
+
desc: 'Zoom App Marketplace browser',
|
|
93
|
+
ua: 'Mozilla/5.0 ZoomWebKit/537.36 (KHTML, like Gecko) ZoomApps/1.0',
|
|
94
|
+
expect: undefined,
|
|
95
|
+
},
|
|
85
96
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mediasoup-client",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.17",
|
|
4
4
|
"description": "mediasoup client side TypeScript library",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
|
|
@@ -67,34 +67,34 @@
|
|
|
67
67
|
"@types/debug": "^4.1.12",
|
|
68
68
|
"@types/npm-events-package": "npm:@types/events@^3.0.3",
|
|
69
69
|
"awaitqueue": "^3.0.2",
|
|
70
|
-
"debug": "^4.3.
|
|
70
|
+
"debug": "^4.3.7",
|
|
71
71
|
"npm-events-package": "npm:events@^3.3.0",
|
|
72
72
|
"fake-mediastreamtrack": "^1.2.0",
|
|
73
73
|
"h264-profile-level-id": "^2.0.0",
|
|
74
74
|
"queue-microtask": "^1.2.3",
|
|
75
75
|
"sdp-transform": "^2.14.2",
|
|
76
76
|
"supports-color": "^9.4.0",
|
|
77
|
-
"ua-parser-js": "^1.0.
|
|
77
|
+
"ua-parser-js": "^1.0.39"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@eslint/js": "^9.
|
|
81
|
-
"@types/jest": "^29.5.
|
|
80
|
+
"@eslint/js": "^9.11.1",
|
|
81
|
+
"@types/jest": "^29.5.13",
|
|
82
82
|
"@types/node": "22",
|
|
83
83
|
"@types/sdp-transform": "^2.4.9",
|
|
84
84
|
"@types/ua-parser-js": "^0.7.39",
|
|
85
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
86
|
-
"@typescript-eslint/parser": "^8.
|
|
85
|
+
"@typescript-eslint/eslint-plugin": "^8.8.0",
|
|
86
|
+
"@typescript-eslint/parser": "^8.8.0",
|
|
87
87
|
"eslint": "^8.57.0",
|
|
88
|
-
"eslint": "^9.
|
|
88
|
+
"eslint": "^9.11.1",
|
|
89
89
|
"eslint-config-prettier": "^9.1.0",
|
|
90
|
-
"eslint-plugin-jest": "^28.8.
|
|
90
|
+
"eslint-plugin-jest": "^28.8.3",
|
|
91
91
|
"eslint-plugin-prettier": "^5.2.1",
|
|
92
92
|
"globals": "^15.9.0",
|
|
93
93
|
"jest": "^29.7.0",
|
|
94
94
|
"open-cli": "^8.0.0",
|
|
95
95
|
"prettier": "^3.3.3",
|
|
96
|
-
"ts-jest": "^29.2.
|
|
97
|
-
"typescript": "^5.
|
|
98
|
-
"typescript-eslint": "^8.
|
|
96
|
+
"ts-jest": "^29.2.5",
|
|
97
|
+
"typescript": "^5.6.2",
|
|
98
|
+
"typescript-eslint": "^8.8.0"
|
|
99
99
|
}
|
|
100
100
|
}
|