New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mediasoup-client

Package Overview
Dependencies
Maintainers
0
Versions
244
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mediasoup-client - npm Package Compare versions

Comparing version 3.7.16 to 3.7.17

9

lib/Device.d.ts

@@ -17,9 +17,4 @@ import { EnhancedEventEmitter } from './enhancedEvents';

handlerFactory?: HandlerFactory;
/**
* DEPRECATED!
* The name of one of the builtin handlers.
*/
Handler?: string;
};
export declare function detectDevice(): BuiltinHandlerName | undefined;
export declare function detectDevice(userAgent?: string): BuiltinHandlerName | undefined;
export type DeviceObserver = EnhancedEventEmitter<DeviceObserverEvents>;

@@ -43,3 +38,3 @@ export type DeviceObserverEvents = {

*/
constructor({ handlerName, handlerFactory, Handler }?: DeviceOptions);
constructor({ handlerName, handlerFactory }?: DeviceOptions);
/**

@@ -46,0 +41,0 @@ * The RTC handler name.

@@ -48,7 +48,9 @@ "use strict";

const logger = new Logger_1.Logger('Device');
function detectDevice() {
function detectDevice(userAgent) {
// React-Native.
// NOTE: react-native-webrtc >= 1.75.0 is required.
// NOTE: react-native-webrtc with Unified Plan requires version >= 106.0.0.
if (typeof navigator === 'object' && navigator.product === 'ReactNative') {
if (!userAgent &&
typeof navigator === 'object' &&
navigator.product === 'ReactNative') {
logger.debug('detectDevice() | React-Native detected');

@@ -69,7 +71,7 @@ if (typeof RTCPeerConnection === 'undefined') {

// Browser.
else if (typeof navigator === 'object' &&
typeof navigator.userAgent === 'string') {
const ua = navigator.userAgent;
const uaParser = new ua_parser_js_1.UAParser(ua);
logger.debug('detectDevice() | browser detected [ua:%s, parsed:%o]', ua, uaParser.getResult());
else if (userAgent ||
(typeof navigator === 'object' && typeof navigator.userAgent === 'string')) {
userAgent ?? (userAgent = navigator.userAgent);
const uaParser = new ua_parser_js_1.UAParser(userAgent);
logger.debug('detectDevice() | browser detected [userAgent:%s, parsed:%o]', userAgent, uaParser.getResult());
const browser = uaParser.getBrowser();

@@ -151,3 +153,3 @@ const browserName = browser.name?.toLowerCase();

// eslint-disable-next-line @typescript-eslint/prefer-regexp-exec
const match = ua.match(/(?:(?:Chrome|Chromium))[ /](\w+)/i);
const match = userAgent.match(/(?:(?:Chrome|Chromium))[ /](\w+)/i);
if (match) {

@@ -193,3 +195,3 @@ const version = Number(match[1]);

*/
constructor({ handlerName, handlerFactory, Handler } = {}) {
constructor({ handlerName, handlerFactory } = {}) {
// Loaded flag.

@@ -200,12 +202,2 @@ this._loaded = false;

logger.debug('constructor()');
// Handle deprecated option.
if (Handler) {
logger.warn('constructor() | Handler option is DEPRECATED, use handlerName or handlerFactory instead');
if (typeof Handler === 'string') {
handlerName = Handler;
}
else {
throw new TypeError('non string Handler option no longer supported, use handlerFactory instead');
}
}
if (handlerName && handlerFactory) {

@@ -212,0 +204,0 @@ throw new TypeError('just one of handlerName or handlerInterface can be given');

@@ -11,3 +11,3 @@ import debug from 'debug';

*/
export declare const version = "3.7.16";
export declare const version = "3.7.17";
/**

@@ -14,0 +14,0 @@ * Expose Device class and detectDevice() helper.

@@ -40,3 +40,3 @@ "use strict";

*/
exports.version = '3.7.16';
exports.version = '3.7.17';
/**

@@ -43,0 +43,0 @@ * Expose parseScalabilityMode() function.

@@ -1271,3 +1271,2 @@ "use strict";

describe('detectDevice() assigns proper handler based on UserAgent', () => {
const originalNavigator = global.navigator;
for (const uaTestCase of uaTestCases_1.uaTestCases) {

@@ -1277,7 +1276,4 @@ test(

uaTestCase.desc, () => {
// @ts-expect-error --- On purpose.
global.navigator = {
userAgent: uaTestCase.ua,
};
const originalRTCRtpTransceiver = global.RTCRtpTransceiver;
// We need to force presence of RTCRtpTransceiver to test Safari 12.
if (uaTestCase.expect === 'Safari12') {

@@ -1288,3 +1284,3 @@ global.RTCRtpTransceiver = class Dummy {

}
expect(detectDevice()).toBe(uaTestCase.expect);
expect(detectDevice(uaTestCase.ua)).toBe(uaTestCase.expect);
// Cleanup.

@@ -1294,4 +1290,2 @@ global.RTCRtpTransceiver = originalRTCRtpTransceiver;

}
// Cleanup.
global.navigator = originalNavigator;
});

@@ -85,2 +85,13 @@ "use strict";

},
{
desc: 'Fake Foo Invalid Browser',
ua: 'Fake/5.0 (Foo; Bar Lalala OS_19.5) Foo/22.2',
expect: undefined,
},
{
// Zoom App Marketplace browser.
desc: 'Zoom App Marketplace browser',
ua: 'Mozilla/5.0 ZoomWebKit/537.36 (KHTML, like Gecko) ZoomApps/1.0',
expect: undefined,
},
];
{
"name": "mediasoup-client",
"version": "3.7.16",
"version": "3.7.17",
"description": "mediasoup client side TypeScript library",

@@ -70,3 +70,3 @@ "contributors": [

"awaitqueue": "^3.0.2",
"debug": "^4.3.6",
"debug": "^4.3.7",
"npm-events-package": "npm:events@^3.3.0",

@@ -78,16 +78,16 @@ "fake-mediastreamtrack": "^1.2.0",

"supports-color": "^9.4.0",
"ua-parser-js": "^1.0.38"
"ua-parser-js": "^1.0.39"
},
"devDependencies": {
"@eslint/js": "^9.9.0",
"@types/jest": "^29.5.12",
"@eslint/js": "^9.11.1",
"@types/jest": "^29.5.13",
"@types/node": "22",
"@types/sdp-transform": "^2.4.9",
"@types/ua-parser-js": "^0.7.39",
"@typescript-eslint/eslint-plugin": "^8.1.0",
"@typescript-eslint/parser": "^8.1.0",
"@typescript-eslint/eslint-plugin": "^8.8.0",
"@typescript-eslint/parser": "^8.8.0",
"eslint": "^8.57.0",
"eslint": "^9.9.0",
"eslint": "^9.11.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^28.8.0",
"eslint-plugin-jest": "^28.8.3",
"eslint-plugin-prettier": "^5.2.1",

@@ -98,6 +98,6 @@ "globals": "^15.9.0",

"prettier": "^3.3.3",
"ts-jest": "^29.2.4",
"typescript": "^5.5.4",
"typescript-eslint": "^8.1.0"
"ts-jest": "^29.2.5",
"typescript": "^5.6.2",
"typescript-eslint": "^8.8.0"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc