@pexip/media-control 17.2.0 → 17.4.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/CHANGELOG.md +25 -0
- package/dist/baseLogger.d.ts +37 -0
- package/dist/baseLogger.js +29 -0
- package/dist/constants.d.ts +43 -0
- package/dist/constants.js +26 -0
- package/dist/constraints.d.ts +174 -0
- package/dist/constraints.js +653 -0
- package/dist/devices.d.ts +416 -0
- package/dist/devices.js +766 -0
- package/dist/displayMedia.d.ts +10 -0
- package/dist/displayMedia.js +31 -0
- package/dist/errors.d.ts +13 -0
- package/dist/errors.js +105 -0
- package/dist/eventEmitter.d.ts +119 -0
- package/dist/eventEmitter.js +81 -0
- package/dist/getMediaStream.d.ts +11 -0
- package/dist/getMediaStream.js +41 -0
- package/dist/index.d.ts +18 -979
- package/dist/index.js +105 -0
- package/dist/logger.d.ts +3 -0
- package/dist/logger.js +5 -0
- package/dist/streamTrackMap.d.ts +9 -0
- package/dist/streamTrackMap.js +79 -0
- package/dist/streams.d.ts +26 -0
- package/dist/streams.js +99 -0
- package/dist/typeGuards.d.ts +89 -0
- package/dist/typeGuards.js +185 -0
- package/dist/types.d.ts +265 -0
- package/dist/types.js +88 -0
- package/dist/utils.d.ts +37 -0
- package/dist/utils.js +47 -0
- package/package.json +7 -7
- package/dist/index.mjs +0 -1699
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 17.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fec1c90: Format following Prettier update
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [4a1908a]
|
|
12
|
+
- Updated dependencies [ec134d1]
|
|
13
|
+
- Updated dependencies [24fe7e1]
|
|
14
|
+
- @pexip/utils@16.10.0
|
|
15
|
+
|
|
16
|
+
## 17.3.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- 7b29d953: Update babel/traverse related deps
|
|
21
|
+
- 821d9a1ef8: Add toMediaDeviceInfo util function
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [7b29d953]
|
|
26
|
+
- @pexip/utils@16.9.0
|
|
27
|
+
|
|
3
28
|
## 17.2.0
|
|
4
29
|
|
|
5
30
|
### Minor Changes
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Log meta and message with respective log level
|
|
3
|
+
*/
|
|
4
|
+
export type LogMethod = (meta: unknown, message?: string) => void;
|
|
5
|
+
export declare enum LogLevels {
|
|
6
|
+
trace = 10,
|
|
7
|
+
debug = 20,
|
|
8
|
+
info = 30,
|
|
9
|
+
warn = 40,
|
|
10
|
+
error = 50,
|
|
11
|
+
fatal = 60,
|
|
12
|
+
silent
|
|
13
|
+
}
|
|
14
|
+
export type LogLevelsString = keyof typeof LogLevels;
|
|
15
|
+
export type LogMethods = {
|
|
16
|
+
[key in LogLevelsString]: LogMethod;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Log Level from high to low, "fatal" | "error" | "warn" | "info" | "debug" | "trace"
|
|
20
|
+
* Typically, debug and trace logs are only valid for development, and not needed in production
|
|
21
|
+
*/
|
|
22
|
+
export interface Logger extends LogMethods {
|
|
23
|
+
/**
|
|
24
|
+
* Adds a value to the redaction set, which makes it replaced by [REDACTED] when logged to file.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* The redaction set is applied globally, and only applies to the log file, not console logs.
|
|
28
|
+
*
|
|
29
|
+
* @param value - the string to redact
|
|
30
|
+
*/
|
|
31
|
+
redact(value: string): void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create a logger with console API, and map fatal to error, skipping trace
|
|
35
|
+
* and silent, and there is no redaction
|
|
36
|
+
*/
|
|
37
|
+
export declare function createConsoleLogger(): Readonly<Logger>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export var LogLevels;
|
|
2
|
+
(function (LogLevels) {
|
|
3
|
+
LogLevels[LogLevels["trace"] = 10] = "trace";
|
|
4
|
+
LogLevels[LogLevels["debug"] = 20] = "debug";
|
|
5
|
+
LogLevels[LogLevels["info"] = 30] = "info";
|
|
6
|
+
LogLevels[LogLevels["warn"] = 40] = "warn";
|
|
7
|
+
LogLevels[LogLevels["error"] = 50] = "error";
|
|
8
|
+
LogLevels[LogLevels["fatal"] = 60] = "fatal";
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member -- needs infinity
|
|
10
|
+
LogLevels[LogLevels["silent"] = Number.MAX_SAFE_INTEGER] = "silent";
|
|
11
|
+
})(LogLevels || (LogLevels = {}));
|
|
12
|
+
/**
|
|
13
|
+
* Create a logger with console API, and map fatal to error, skipping trace
|
|
14
|
+
* and silent, and there is no redaction
|
|
15
|
+
*/
|
|
16
|
+
export function createConsoleLogger() {
|
|
17
|
+
return Object.freeze({
|
|
18
|
+
/* eslint-disable no-console -- set logger to console */
|
|
19
|
+
fatal: (meta, message) => console.error(message, meta),
|
|
20
|
+
error: (meta, message) => console.error(message, meta),
|
|
21
|
+
warn: (meta, message) => console.warn(message, meta),
|
|
22
|
+
info: (meta, message) => console.info(message, meta),
|
|
23
|
+
debug: (meta, message) => console.debug(message, meta),
|
|
24
|
+
trace() { }, // Noop
|
|
25
|
+
silent() { }, // Noop
|
|
26
|
+
redact() { }, // Noop
|
|
27
|
+
/* eslint-enable no-console -- set logger to console */
|
|
28
|
+
});
|
|
29
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
type ExtractObjectValueTypes<T extends object> = T[keyof T];
|
|
2
|
+
/**
|
|
3
|
+
* The `DisplayCaptureSurfaceType` enumeration describes the different types of
|
|
4
|
+
* display surface
|
|
5
|
+
*
|
|
6
|
+
* @see {@link https://w3c.github.io/mediacapture-screen-share/#displaycapturesurfacetype}
|
|
7
|
+
*/
|
|
8
|
+
export declare const DISPLAY_CAPTURE_SURFACE_TYPE: {
|
|
9
|
+
readonly Monitor: "monitor";
|
|
10
|
+
readonly Window: "window";
|
|
11
|
+
readonly Browser: "browser";
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The `DisplayCaptureSurfaceType` enumeration describes the different types of
|
|
15
|
+
* display surface
|
|
16
|
+
*
|
|
17
|
+
* @see {@link https://w3c.github.io/mediacapture-screen-share/#displaycapturesurfacetype}
|
|
18
|
+
*/
|
|
19
|
+
export type DisplayCaptureSurfaceType = ExtractObjectValueTypes<typeof DISPLAY_CAPTURE_SURFACE_TYPE>;
|
|
20
|
+
/**
|
|
21
|
+
* The `CursorCaptureConstraint` enumerates the conditions under which the
|
|
22
|
+
* cursor is captured.
|
|
23
|
+
*
|
|
24
|
+
* @see {@link https://w3c.github.io/mediacapture-screen-share/#cursorcaptureconstraint}
|
|
25
|
+
*/
|
|
26
|
+
export declare const CURSOR_CAPTURE_CONSTRAINT: {
|
|
27
|
+
readonly Never: "never";
|
|
28
|
+
readonly Always: "always";
|
|
29
|
+
readonly Motion: "motion";
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The `CursorCaptureConstraint` enumerates the conditions under which the
|
|
33
|
+
* cursor is captured.
|
|
34
|
+
*
|
|
35
|
+
* @see {@link https://w3c.github.io/mediacapture-screen-share/#cursorcaptureconstraint}
|
|
36
|
+
*/
|
|
37
|
+
export type CursorCaptureConstraint = ExtractObjectValueTypes<typeof CURSOR_CAPTURE_CONSTRAINT>;
|
|
38
|
+
export declare const INCLUDE_EXCLUDE_CONSTRAINT: {
|
|
39
|
+
readonly Include: "include";
|
|
40
|
+
readonly Exclude: "exclude";
|
|
41
|
+
};
|
|
42
|
+
export type IncludeExcludeConstraint = ExtractObjectValueTypes<typeof INCLUDE_EXCLUDE_CONSTRAINT>;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `DisplayCaptureSurfaceType` enumeration describes the different types of
|
|
3
|
+
* display surface
|
|
4
|
+
*
|
|
5
|
+
* @see {@link https://w3c.github.io/mediacapture-screen-share/#displaycapturesurfacetype}
|
|
6
|
+
*/
|
|
7
|
+
export const DISPLAY_CAPTURE_SURFACE_TYPE = {
|
|
8
|
+
Monitor: 'monitor',
|
|
9
|
+
Window: 'window',
|
|
10
|
+
Browser: 'browser',
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The `CursorCaptureConstraint` enumerates the conditions under which the
|
|
14
|
+
* cursor is captured.
|
|
15
|
+
*
|
|
16
|
+
* @see {@link https://w3c.github.io/mediacapture-screen-share/#cursorcaptureconstraint}
|
|
17
|
+
*/
|
|
18
|
+
export const CURSOR_CAPTURE_CONSTRAINT = {
|
|
19
|
+
Never: 'never',
|
|
20
|
+
Always: 'always',
|
|
21
|
+
Motion: 'motion',
|
|
22
|
+
};
|
|
23
|
+
export const INCLUDE_EXCLUDE_CONSTRAINT = {
|
|
24
|
+
Include: 'include',
|
|
25
|
+
Exclude: 'exclude',
|
|
26
|
+
};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import type { FacingMode, InputConstraintSet, InputDeviceConstraint, MediaConstraintRequirement, MediaDeviceInfoLike, MediaDeviceRequest, NormalizedConstraintDeviceParameters } from './types';
|
|
2
|
+
import type { ConstrainBooleanKeys, ConstrainDoubleKeys, ConstrainParamKeys, ConstrainRangeParamKeys, ConstrainStringKeys, ConstrainULongKeys, ExtendedConstrainBooleanKeys, ExtendedConstrainDoubleKeys, ExtendedConstrainStringKeys, ExtendedConstrainULongKeys } from './typeGuards';
|
|
3
|
+
/**
|
|
4
|
+
* Check if provided constraint is an `exact` device constraint
|
|
5
|
+
*/
|
|
6
|
+
export declare const isExactDeviceConstraint: (constraint: InputDeviceConstraint | undefined) => boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Use navigator.mediaDevices.getSupportedConstraints to remove constraints not supported by agent.
|
|
9
|
+
* Creates a copy of MediaStreamConstraints with only supported properties.
|
|
10
|
+
*/
|
|
11
|
+
export declare const removeUnsupportedConstraints: (constraints: MediaStreamConstraints) => MediaStreamConstraints;
|
|
12
|
+
/**
|
|
13
|
+
* Merge base constraints with provided base constraints and another constraints
|
|
14
|
+
*/
|
|
15
|
+
export declare const mergeConstraints: (baseConstraints: InputConstraintSet | boolean | undefined) => (constraints: InputDeviceConstraint | undefined) => InputConstraintSet | boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Normalize Device
|
|
18
|
+
* Convert any valid `MediaDeviceInfoLike` into `MediaDeviceInfoLike[]`
|
|
19
|
+
*
|
|
20
|
+
* Check test cases for the details
|
|
21
|
+
*/
|
|
22
|
+
export declare const normalizeDevice: (device: InputConstraintSet['device']) => MediaDeviceInfo[] | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Normalize Device Constraint
|
|
25
|
+
* Convert Device Constraints into a form of `ConstraintDeviceParameters`
|
|
26
|
+
* e.g.
|
|
27
|
+
* `{ideal?: MediaDeviceInfoLike[], exact?: MediaDeviceInfoLike[]}`
|
|
28
|
+
*
|
|
29
|
+
* Check test cases for the details
|
|
30
|
+
*
|
|
31
|
+
* @returns
|
|
32
|
+
* `undefined` if nothing is meaningful for the constraint, otherwise,
|
|
33
|
+
* a normalized form of `ConstraintDeviceParameters`
|
|
34
|
+
*/
|
|
35
|
+
export declare const normalizeDeviceConstraint: (constraints: InputConstraintSet['device']) => NormalizedConstraintDeviceParameters | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Convert `InputConstraintSet['device']` into
|
|
38
|
+
* `MediaTrackConstraintSet['deviceId']` in a normalized form
|
|
39
|
+
*/
|
|
40
|
+
export declare const toDeviceIdConstraintSet: (constraint: InputConstraintSet['device']) => MediaTrackConstraints['deviceId'];
|
|
41
|
+
export declare const toArray: <T>(t: T | T[]) => T[];
|
|
42
|
+
export type ConstrainNoneTuple = [undefined, 'ideal'];
|
|
43
|
+
export declare const NONE: ConstrainNoneTuple;
|
|
44
|
+
export type ConstrainStringTuple = [string[], ConstrainParamKeys];
|
|
45
|
+
export declare const extractConstrainString: (key: ConstrainStringKeys | ExtendedConstrainStringKeys) => (constraints: InputConstraintSet) => ConstrainStringTuple | ConstrainNoneTuple;
|
|
46
|
+
export type ConstrainBooleanTuple = [boolean, ConstrainParamKeys];
|
|
47
|
+
export declare const extractConstrainBoolean: (key: ConstrainBooleanKeys | ExtendedConstrainBooleanKeys) => (constraints: InputConstraintSet) => ConstrainBooleanTuple | ConstrainNoneTuple;
|
|
48
|
+
export type ConstrainNumber = number | Partial<Record<ConstrainRangeParamKeys, number>>;
|
|
49
|
+
export type ConstrainNumberTuple = [
|
|
50
|
+
ConstrainNumber,
|
|
51
|
+
ConstrainParamKeys | 'min-max'
|
|
52
|
+
];
|
|
53
|
+
export declare const extractConstrainNumber: (key: ConstrainULongKeys | ConstrainDoubleKeys | ExtendedConstrainULongKeys | ExtendedConstrainDoubleKeys) => (constraints: InputConstraintSet) => ConstrainNumberTuple | ConstrainNoneTuple;
|
|
54
|
+
export type ConstrainDeviceTuple = [MediaDeviceInfoLike[], ConstrainParamKeys];
|
|
55
|
+
export declare const extractConstrainDevice: (constraints: InputDeviceConstraint | undefined) => ConstrainDeviceTuple | ConstrainNoneTuple;
|
|
56
|
+
/**
|
|
57
|
+
* Compare float point number a and b to see if they are closed to be considered
|
|
58
|
+
* as having the same value
|
|
59
|
+
*
|
|
60
|
+
* @param a - Floating point number a
|
|
61
|
+
* @param b - Floating point number b
|
|
62
|
+
* @param numDigits - The number of digits to check after the decimal point @defaultValue 5 digits
|
|
63
|
+
*/
|
|
64
|
+
export declare const closedTo: (a: number, b: number, numDigits?: number) => boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Check if provided num is between min (inclusive) and max (inclusive)
|
|
67
|
+
*
|
|
68
|
+
* @param min - Lower boundary of the checking
|
|
69
|
+
* @param num - The number used for the checking
|
|
70
|
+
* @param max - Upper boundary of the checking
|
|
71
|
+
*/
|
|
72
|
+
export declare const between: (min: number | undefined, num: number, max: number | undefined) => boolean;
|
|
73
|
+
export declare const getValueFromConstrainNumber: (constraint: ConstrainNumber) => number;
|
|
74
|
+
export declare const getFacingModeFromConstraintString: (constraint: string) => FacingMode | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Compare the provided constraint and num and see if the num satisfy the
|
|
77
|
+
* constraint
|
|
78
|
+
*
|
|
79
|
+
* @param constraint - The constraint to be used
|
|
80
|
+
* @param num - The num to be used to check
|
|
81
|
+
*
|
|
82
|
+
* @returns `true` means satisfy otherwise `false`
|
|
83
|
+
*/
|
|
84
|
+
export declare const satisfyConstrainNumber: (constraint: ConstrainNumber | undefined, num: number | undefined) => boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Resolve *constraints* and mediaTrackConstraints by checking the type and
|
|
87
|
+
* try to return the best possible from mediaTrackConstraints.
|
|
88
|
+
*
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
export declare const resolveMediaDeviceConstraints: (constraints?: InputDeviceConstraint, base?: MediaTrackConstraints | boolean) => MediaTrackConstraints | boolean;
|
|
92
|
+
/**
|
|
93
|
+
* @remarks
|
|
94
|
+
* Constraint multiple (exact) devices is not supported
|
|
95
|
+
*
|
|
96
|
+
* @internal
|
|
97
|
+
*/
|
|
98
|
+
export declare const getMediaConstraints: ({ audio, video, defaultConstraints, }: MediaConstraintRequirement) => MediaStreamConstraints;
|
|
99
|
+
/**
|
|
100
|
+
* Call applyConstraints foreach track accordingly
|
|
101
|
+
*
|
|
102
|
+
* @param tracks - Tracks to be applied
|
|
103
|
+
* @param constraints - constraints to be applied
|
|
104
|
+
*/
|
|
105
|
+
export declare const applyConstraints: (tracks: MediaStreamTrack[] | undefined, constraints: MediaDeviceRequest) => Promise<void>;
|
|
106
|
+
export declare const findDeviceFrom: (devicesToFind: MediaDeviceInfoLike[], deviceList: MediaDeviceInfoLike[]) => MediaDeviceInfoLike[] | undefined;
|
|
107
|
+
export declare const findDeviceFromDeviceConstraints: (device: InputConstraintSet['device'], devices: MediaDeviceInfoLike[]) => MediaDeviceInfoLike[] | undefined;
|
|
108
|
+
export declare const relaxDevice: (device: InputConstraintSet['device'], devices: MediaDeviceInfoLike[]) => MediaDeviceInfoLike[] | undefined;
|
|
109
|
+
export declare const resolveOnlyDevice: (devices: MediaDeviceInfoLike[]) => true | MediaDeviceInfoLike | undefined;
|
|
110
|
+
type ConstrainNumberKeys = ConstrainULongKeys | ConstrainDoubleKeys | ExtendedConstrainDoubleKeys | ExtendedConstrainULongKeys;
|
|
111
|
+
type ConstrainTuples = ConstrainDeviceTuple | ConstrainNumberTuple | ConstrainStringTuple | ConstrainBooleanTuple | ConstrainNoneTuple;
|
|
112
|
+
type ExtractConstraintFn<R extends ConstrainTuples> = (constraints: InputDeviceConstraint | undefined) => R;
|
|
113
|
+
export declare function extractConstraints<T extends 'device'>(key: T): ExtractConstraintFn<ConstrainDeviceTuple>;
|
|
114
|
+
export declare function extractConstraints<T extends ConstrainStringKeys | ExtendedConstrainStringKeys>(key: T): ExtractConstraintFn<ConstrainStringTuple>;
|
|
115
|
+
export declare function extractConstraints<T extends ConstrainNumberKeys>(key: T): ExtractConstraintFn<ConstrainNumberTuple>;
|
|
116
|
+
export declare function extractConstraints<T extends ConstrainBooleanKeys | ExtendedConstrainBooleanKeys>(key: T): ExtractConstraintFn<ConstrainBooleanTuple>;
|
|
117
|
+
type ConstrainStrings = Record<ConstrainStringKeys | ExtendedConstrainStringKeys, ConstrainStringTuple | ConstrainNoneTuple>;
|
|
118
|
+
type ConstrainNumbers = Record<ConstrainNumberKeys, ConstrainNumberTuple | ConstrainNoneTuple>;
|
|
119
|
+
type ConstrainBooleans = Record<ConstrainBooleanKeys | ExtendedConstrainBooleanKeys, ConstrainBooleanTuple | ConstrainNoneTuple>;
|
|
120
|
+
type ConstrainDevices = Record<'device', ConstrainDeviceTuple | ConstrainNoneTuple>;
|
|
121
|
+
type Constraints = ConstrainStrings & ConstrainNumbers & ConstrainBooleans & ConstrainDevices;
|
|
122
|
+
/**
|
|
123
|
+
* Extract the constraints with provided keys
|
|
124
|
+
*
|
|
125
|
+
* @param keys - The keys to be used for the extraction
|
|
126
|
+
* @param constraints - The constraints to be used for the extraction
|
|
127
|
+
*
|
|
128
|
+
* @returns an object with the provided key and the value-param tuple
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
*
|
|
132
|
+
* ```typescript
|
|
133
|
+
* const device = {deviceId: 'xxxx', label: 'abc', kind: 'audioinput'};
|
|
134
|
+
* const constraints = { device, noiseSuppression: true };
|
|
135
|
+
* const extract = extractConstraintsWithKeys(['device', 'noiseSuppression']);
|
|
136
|
+
* const {
|
|
137
|
+
* device: [devices, deviceParam],
|
|
138
|
+
* noiseSuppression: [noiseSuppression, noiseSuppressionParam],
|
|
139
|
+
* } = extract(constraints);
|
|
140
|
+
* expect(devices).toEqual([device]);
|
|
141
|
+
* expect(deviceParam).toEqual('ideal');
|
|
142
|
+
* expect(noiseSuppression).toEqual(true);
|
|
143
|
+
* expect(noiseSuppressionParam).toEqual('ideal');
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
export declare const extractConstraintsWithKeys: <T extends "deviceId" | "groupId" | "device" | "videoSegmentation" | "videoSegmentationModel" | "denoise" | "vad" | "asd" | "mixWithAdditionalMedia" | "flipHorizontal" | "bgImageUrl" | "resizeMode" | "pan" | "tilt" | "zoom" | "contentHint" | "facingMode" | "echoCancellation" | "autoGainControl" | "noiseSuppression" | ConstrainNumberKeys>(keys: T[]) => (constraints: InputDeviceConstraint | undefined) => Pick<Constraints, T>;
|
|
147
|
+
/**
|
|
148
|
+
* Extract deviceId from constraints
|
|
149
|
+
*/
|
|
150
|
+
export declare const extractDeviceId: (constraints: InputConstraintSet) => ConstrainStringTuple | ConstrainNoneTuple;
|
|
151
|
+
/**
|
|
152
|
+
* Find device from the device list with provided constraints
|
|
153
|
+
*
|
|
154
|
+
* @param constraints - The constraints to be used for the lookup
|
|
155
|
+
* @param devices - The devices to be used for the lookup
|
|
156
|
+
*
|
|
157
|
+
* @returns `true` means it can be any devices, `undefined` means not found,
|
|
158
|
+
* otherwise, the matched device will be returned
|
|
159
|
+
*/
|
|
160
|
+
export declare const findDeviceFromConstraints: (constraints: InputDeviceConstraint | undefined, devices: MediaDeviceInfoLike[]) => boolean | MediaDeviceInfoLike | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* Relax input constraints to enable looking up the device by `deviceId` as well
|
|
163
|
+
* as `label` as a fallback as a best effort to get a similar device when
|
|
164
|
+
* possible.
|
|
165
|
+
*
|
|
166
|
+
* @param input - The input constraints to be relaxed
|
|
167
|
+
* @param devices - The current device list
|
|
168
|
+
*/
|
|
169
|
+
export declare const relaxInputConstraint: (input: InputDeviceConstraint | undefined, devices: MediaDeviceInfoLike[]) => InputDeviceConstraint | undefined;
|
|
170
|
+
export declare const getConstraintsHandlers: () => {
|
|
171
|
+
getDefaultConstraints: () => MediaStreamConstraints;
|
|
172
|
+
setDefaultConstraints: (newConstraints: MediaStreamConstraints) => void;
|
|
173
|
+
};
|
|
174
|
+
export {};
|