@pexip/media-control 20.3.4 → 21.0.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.
Files changed (102) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/api-docs/README.mdx +374 -0
  3. package/api-docs/enumerations/MediaDeviceFailure.mdx +23 -0
  4. package/api-docs/enumerations/MediaDeviceKinds.mdx +11 -0
  5. package/api-docs/enumerations/MediaEventType.mdx +22 -0
  6. package/api-docs/functions/applyConstraints.mdx +16 -0
  7. package/api-docs/functions/areMultipleFacingModeSupported.mdx +21 -0
  8. package/api-docs/functions/areTracksEnabled.mdx +16 -0
  9. package/api-docs/functions/compareDevices.mdx +28 -0
  10. package/api-docs/functions/createIndexedDevices.mdx +16 -0
  11. package/api-docs/functions/createStreamTrackEventSubscriptions.mdx +20 -0
  12. package/api-docs/functions/createTrackDevicesChanges.mdx +31 -0
  13. package/api-docs/functions/deviceChanged.mdx +21 -0
  14. package/api-docs/functions/extractConstrainDevice.mdx +14 -0
  15. package/api-docs/functions/extractConstraintsWithKeys.mdx +51 -0
  16. package/api-docs/functions/findCurrentAudioOutputId.mdx +16 -0
  17. package/api-docs/functions/findCurrentVideoInputDeviceIdFromStream.mdx +15 -0
  18. package/api-docs/functions/findDevice.mdx +33 -0
  19. package/api-docs/functions/findDeviceFromConstraints.mdx +24 -0
  20. package/api-docs/functions/findDeviceWithDeviceId.mdx +19 -0
  21. package/api-docs/functions/findDevicesByKind.mdx +27 -0
  22. package/api-docs/functions/findMediaInputFromMediaStreamTrack.mdx +32 -0
  23. package/api-docs/functions/findMediaInputFromStream.mdx +27 -0
  24. package/api-docs/functions/findPermissionGrantedDevices.mdx +15 -0
  25. package/api-docs/functions/getDeviceId.mdx +17 -0
  26. package/api-docs/functions/getDevices.mdx +9 -0
  27. package/api-docs/functions/getFacingModeFromConstraintString.mdx +13 -0
  28. package/api-docs/functions/getInputDevicePermissionState.mdx +21 -0
  29. package/api-docs/functions/getValueFromConstrainNumber.mdx +13 -0
  30. package/api-docs/functions/hasAnyGrantedInput.mdx +15 -0
  31. package/api-docs/functions/hasAnyInputs.mdx +23 -0
  32. package/api-docs/functions/hasAudioInputs.mdx +15 -0
  33. package/api-docs/functions/hasAudioOrVideoInputs.mdx +15 -0
  34. package/api-docs/functions/hasChangedInput.mdx +16 -0
  35. package/api-docs/functions/hasRequestingDevice.mdx +20 -0
  36. package/api-docs/functions/hasVideoInputs.mdx +15 -0
  37. package/api-docs/functions/interpretCurrentFacingMode.mdx +17 -0
  38. package/api-docs/functions/isDeviceGranted.mdx +20 -0
  39. package/api-docs/functions/isExactDeviceConstraint.mdx +15 -0
  40. package/api-docs/functions/isFacingMode.mdx +13 -0
  41. package/api-docs/functions/isIndexedDevices.mdx +13 -0
  42. package/api-docs/functions/isInputConstraintSet.mdx +13 -0
  43. package/api-docs/functions/isMediaDeviceInfo.mdx +15 -0
  44. package/api-docs/functions/isMediaDeviceInfoArray.mdx +13 -0
  45. package/api-docs/functions/isMediaStreamTrack.mdx +15 -0
  46. package/api-docs/functions/isRequestedInputDevice.mdx +14 -0
  47. package/api-docs/functions/isRequestedInputTrack.mdx +16 -0
  48. package/api-docs/functions/isRequestedResolution.mdx +14 -0
  49. package/api-docs/functions/isStreamingRequestedDevices.mdx +28 -0
  50. package/api-docs/functions/isStreamingRequestedDevicesBase.mdx +25 -0
  51. package/api-docs/functions/isStreamingRequestingDevice.mdx +18 -0
  52. package/api-docs/functions/isTrackMutedOrEnded.mdx +15 -0
  53. package/api-docs/functions/limitSharingMonitorInterface.mdx +18 -0
  54. package/api-docs/functions/mergeConstraints.mdx +35 -0
  55. package/api-docs/functions/muteStreamTrack.mdx +28 -0
  56. package/api-docs/functions/relaxInputConstraint.mdx +26 -0
  57. package/api-docs/functions/resolveMediaDeviceConstraints.mdx +19 -0
  58. package/api-docs/functions/reverseDeviceId.mdx +22 -0
  59. package/api-docs/functions/setLogger.mdx +13 -0
  60. package/api-docs/functions/shouldRequestDevice.mdx +21 -0
  61. package/api-docs/functions/stopMediaStream.mdx +20 -0
  62. package/api-docs/functions/toKey.mdx +15 -0
  63. package/api-docs/functions/toMediaDeviceInfo.mdx +20 -0
  64. package/api-docs/functions/toMediaDeviceInfoLike.mdx +18 -0
  65. package/api-docs/functions/toMediaDeviceInputKind.mdx +13 -0
  66. package/api-docs/interfaces/DisplayMediaOptions.mdx +22 -0
  67. package/api-docs/interfaces/IndexedDevices.mdx +102 -0
  68. package/api-docs/interfaces/InputConstraintSet.mdx +58 -0
  69. package/api-docs/interfaces/InputDevicePermission.mdx +6 -0
  70. package/api-docs/interfaces/MediaControl.mdx +14 -0
  71. package/api-docs/interfaces/MediaDeviceRequest.mdx +10 -0
  72. package/api-docs/interfaces/MediaInput.mdx +10 -0
  73. package/api-docs/interfaces/StreamTrackEventHandlers.mdx +9 -0
  74. package/api-docs/type-aliases/CursorCaptureConstraint.mdx +10 -0
  75. package/api-docs/type-aliases/DeviceChangedChanges.mdx +19 -0
  76. package/api-docs/type-aliases/DisplayCaptureSurfaceType.mdx +10 -0
  77. package/api-docs/type-aliases/Events.mdx +51 -0
  78. package/api-docs/type-aliases/FacingMode.mdx +3 -0
  79. package/api-docs/type-aliases/IncludeExcludeConstraint.mdx +3 -0
  80. package/api-docs/type-aliases/InputDeviceConstraint.mdx +6 -0
  81. package/api-docs/type-aliases/MediaDeviceInfoLike.mdx +13 -0
  82. package/api-docs/type-aliases/MediaEvent.mdx +7 -0
  83. package/api-docs/type-aliases/MediaStreamTrackLike.mdx +7 -0
  84. package/api-docs/type-aliases/Unsubscribe.mdx +7 -0
  85. package/api-docs/variables/CURSOR_CAPTURE_CONSTRAINT.mdx +18 -0
  86. package/api-docs/variables/DEVICE_ID_SEPARATOR.mdx +3 -0
  87. package/api-docs/variables/DISPLAY_CAPTURE_SURFACE_TYPE.mdx +18 -0
  88. package/api-docs/variables/INCLUDE_EXCLUDE_CONSTRAINT.mdx +10 -0
  89. package/api-docs/variables/findAudioInputDevices.mdx +19 -0
  90. package/api-docs/variables/findAudioOutputDevices.mdx +19 -0
  91. package/api-docs/variables/findVideoInputDevices.mdx +19 -0
  92. package/api-docs/variables/getUserMedia.mdx +21 -0
  93. package/api-docs/variables/isAudioInput.mdx +13 -0
  94. package/api-docs/variables/isAudioOutput.mdx +13 -0
  95. package/api-docs/variables/isVideoInput.mdx +13 -0
  96. package/api-docs/variables/setDefaultConstraints.mdx +17 -0
  97. package/api-docs/variables/subscribe.mdx +25 -0
  98. package/dist/devices.js +3 -0
  99. package/dist/typeGuards.d.ts +3 -3
  100. package/dist/typeGuards.js +16 -0
  101. package/dist/types.d.ts +85 -1
  102. package/package.json +15 -8
@@ -0,0 +1,21 @@
1
+ ```ts
2
+ function deviceChanged(fn): () => void;
3
+ ```
4
+
5
+ **`Beta`**
6
+
7
+ ## Parameters
8
+
9
+ | Parameter | Type |
10
+ | ------ | ------ |
11
+ | `fn` | (`event`) => `void` |
12
+
13
+ ## Returns
14
+
15
+ ```ts
16
+ (): void;
17
+ ```
18
+
19
+ ### Returns
20
+
21
+ `void`
@@ -0,0 +1,14 @@
1
+ ```ts
2
+ function extractConstrainDevice(constraints, initialParam): ConstrainNoneTuple | ConstrainDeviceTuple;
3
+ ```
4
+
5
+ ## Parameters
6
+
7
+ | Parameter | Type | Default value |
8
+ | ------ | ------ | ------ |
9
+ | `constraints` | \| [`InputDeviceConstraint`](../type-aliases/InputDeviceConstraint.mdx) \| `undefined` | `undefined` |
10
+ | `initialParam` | `"exact"` \| `"ideal"` | `'ideal'` |
11
+
12
+ ## Returns
13
+
14
+ `ConstrainNoneTuple` \| `ConstrainDeviceTuple`
@@ -0,0 +1,51 @@
1
+ ```ts
2
+ function extractConstraintsWithKeys<T>(keys): (constraints) => Pick<Constraints, T>;
3
+ ```
4
+
5
+ Extract the constraints with provided keys
6
+
7
+ ## Type Parameters
8
+
9
+ | Type Parameter |
10
+ | ------ |
11
+ | `T` *extends* \| `"deviceId"` \| `"groupId"` \| `"device"` \| `"videoSegmentation"` \| `"videoSegmentationModel"` \| `"denoise"` \| `"vad"` \| `"asd"` \| `"mixWithAdditionalMedia"` \| `"backgroundImageUrl"` \| `"excludeBystanders"` \| `"resizeMode"` \| `"pan"` \| `"tilt"` \| `"zoom"` \| `"contentHint"` \| `"facingMode"` \| `"echoCancellation"` \| `"autoGainControl"` \| `"noiseSuppression"` \| `ConstrainNumberKeys` |
12
+
13
+ ## Parameters
14
+
15
+ | Parameter | Type | Description |
16
+ | ------ | ------ | ------ |
17
+ | `keys` | readonly `T`[] | The keys to be used for the extraction |
18
+
19
+ ## Returns
20
+
21
+ an object with the provided key and the value-param tuple
22
+
23
+ ```ts
24
+ (constraints): Pick<Constraints, T>;
25
+ ```
26
+
27
+ ### Parameters
28
+
29
+ | Parameter | Type |
30
+ | ------ | ------ |
31
+ | `constraints` | \| [`InputDeviceConstraint`](../type-aliases/InputDeviceConstraint.mdx) \| `undefined` |
32
+
33
+ ### Returns
34
+
35
+ `Pick`\<`Constraints`, `T`\>
36
+
37
+ ## Example
38
+
39
+ ```typescript
40
+ const device = {deviceId: 'xxxx', label: 'abc', kind: 'audioinput'};
41
+ const constraints = { device, noiseSuppression: true };
42
+ const extract = extractConstraintsWithKeys(['device', 'noiseSuppression']);
43
+ const {
44
+ device: [devices, deviceParam],
45
+ noiseSuppression: [noiseSuppression, noiseSuppressionParam],
46
+ } = extract(constraints);
47
+ expect(devices).toEqual([device]);
48
+ expect(deviceParam).toEqual('ideal');
49
+ expect(noiseSuppression).toEqual(true);
50
+ expect(noiseSuppressionParam).toEqual('ideal');
51
+ ```
@@ -0,0 +1,16 @@
1
+ ```ts
2
+ function findCurrentAudioOutputId(audioOutput?, devices?): string;
3
+ ```
4
+
5
+ **`Beta`**
6
+
7
+ ## Parameters
8
+
9
+ | Parameter | Type |
10
+ | ------ | ------ |
11
+ | `audioOutput?` | [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx) |
12
+ | `devices?` | [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)[] |
13
+
14
+ ## Returns
15
+
16
+ `string`
@@ -0,0 +1,15 @@
1
+ ```ts
2
+ function findCurrentVideoInputDeviceIdFromStream(stream): string | undefined;
3
+ ```
4
+
5
+ **`Beta`**
6
+
7
+ ## Parameters
8
+
9
+ | Parameter | Type |
10
+ | ------ | ------ |
11
+ | `stream` | `MediaStream` |
12
+
13
+ ## Returns
14
+
15
+ `string` \| `undefined`
@@ -0,0 +1,33 @@
1
+ ```ts
2
+ function findDevice(deviceToFind, useFallback): (devices) =>
3
+ | MediaDeviceInfoLike
4
+ | undefined;
5
+ ```
6
+
7
+ **`Beta`**
8
+
9
+ ## Parameters
10
+
11
+ | Parameter | Type | Default value |
12
+ | ------ | ------ | ------ |
13
+ | `deviceToFind` | [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx) | `undefined` |
14
+ | `useFallback` | `boolean` | `true` |
15
+
16
+ ## Returns
17
+
18
+ ```ts
19
+ (devices):
20
+ | MediaDeviceInfoLike
21
+ | undefined;
22
+ ```
23
+
24
+ ### Parameters
25
+
26
+ | Parameter | Type |
27
+ | ------ | ------ |
28
+ | `devices` | readonly [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)[] |
29
+
30
+ ### Returns
31
+
32
+ \| [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)
33
+ \| `undefined`
@@ -0,0 +1,24 @@
1
+ ```ts
2
+ function findDeviceFromConstraints(constraints, devices):
3
+ | boolean
4
+ | MediaDeviceInfoLike
5
+ | undefined;
6
+ ```
7
+
8
+ Find device from the device list with provided constraints
9
+
10
+ ## Parameters
11
+
12
+ | Parameter | Type | Description |
13
+ | ------ | ------ | ------ |
14
+ | `constraints` | \| [`InputDeviceConstraint`](../type-aliases/InputDeviceConstraint.mdx) \| `undefined` | The constraints to be used for the lookup |
15
+ | `devices` | [`IndexedDevices`](../interfaces/IndexedDevices.mdx) | The devices to be used for the lookup |
16
+
17
+ ## Returns
18
+
19
+ \| `boolean`
20
+ \| [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)
21
+ \| `undefined`
22
+
23
+ `true` means it can be any devices, `undefined` means not found,
24
+ otherwise, the matched device will be returned
@@ -0,0 +1,19 @@
1
+ ```ts
2
+ function findDeviceWithDeviceId(devices, deviceId):
3
+ | MediaDeviceInfoLike
4
+ | undefined;
5
+ ```
6
+
7
+ **`Beta`**
8
+
9
+ ## Parameters
10
+
11
+ | Parameter | Type |
12
+ | ------ | ------ |
13
+ | `devices` | [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)[] |
14
+ | `deviceId` | `string` |
15
+
16
+ ## Returns
17
+
18
+ \| [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)
19
+ \| `undefined`
@@ -0,0 +1,27 @@
1
+ ```ts
2
+ function findDevicesByKind(kind): (devices) => MediaDeviceInfoLike[];
3
+ ```
4
+
5
+ **`Beta`**
6
+
7
+ ## Parameters
8
+
9
+ | Parameter | Type |
10
+ | ------ | ------ |
11
+ | `kind` | `MediaDeviceKind` |
12
+
13
+ ## Returns
14
+
15
+ ```ts
16
+ (devices): MediaDeviceInfoLike[];
17
+ ```
18
+
19
+ ### Parameters
20
+
21
+ | Parameter | Type |
22
+ | ------ | ------ |
23
+ | `devices` | [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)[] |
24
+
25
+ ### Returns
26
+
27
+ [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)[]
@@ -0,0 +1,32 @@
1
+ ```ts
2
+ function findMediaInputFromMediaStreamTrack(devices): (track?) =>
3
+ | MediaDeviceInfoLike
4
+ | undefined;
5
+ ```
6
+
7
+ **`Beta`**
8
+
9
+ ## Parameters
10
+
11
+ | Parameter | Type |
12
+ | ------ | ------ |
13
+ | `devices` | [`IndexedDevices`](../interfaces/IndexedDevices.mdx) |
14
+
15
+ ## Returns
16
+
17
+ ```ts
18
+ (track?):
19
+ | MediaDeviceInfoLike
20
+ | undefined;
21
+ ```
22
+
23
+ ### Parameters
24
+
25
+ | Parameter | Type |
26
+ | ------ | ------ |
27
+ | `track?` | `MediaStreamTrack` |
28
+
29
+ ### Returns
30
+
31
+ \| [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)
32
+ \| `undefined`
@@ -0,0 +1,27 @@
1
+ ```ts
2
+ function findMediaInputFromStream(devices): (stream) => MediaInput;
3
+ ```
4
+
5
+ **`Beta`**
6
+
7
+ ## Parameters
8
+
9
+ | Parameter | Type |
10
+ | ------ | ------ |
11
+ | `devices` | [`IndexedDevices`](../interfaces/IndexedDevices.mdx) |
12
+
13
+ ## Returns
14
+
15
+ ```ts
16
+ (stream): MediaInput;
17
+ ```
18
+
19
+ ### Parameters
20
+
21
+ | Parameter | Type |
22
+ | ------ | ------ |
23
+ | `stream` | `MediaStream` \| `undefined` |
24
+
25
+ ### Returns
26
+
27
+ [`MediaInput`](../interfaces/MediaInput.mdx)
@@ -0,0 +1,15 @@
1
+ ```ts
2
+ function findPermissionGrantedDevices(devices): MediaDeviceInfoLike[];
3
+ ```
4
+
5
+ **`Beta`**
6
+
7
+ ## Parameters
8
+
9
+ | Parameter | Type |
10
+ | ------ | ------ |
11
+ | `devices` | [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)[] |
12
+
13
+ ## Returns
14
+
15
+ [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)[]
@@ -0,0 +1,17 @@
1
+ ```ts
2
+ function getDeviceId(device, separator): string;
3
+ ```
4
+
5
+ Create a device ID from provided `device`.
6
+ The device ID here is in the format of `deviceId:kind`, be default.
7
+
8
+ ## Parameters
9
+
10
+ | Parameter | Type | Default value | Description |
11
+ | ------ | ------ | ------ | ------ |
12
+ | `device` | `Pick`\<[`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx), `"deviceId"` \| `"kind"`\> | `undefined` | The device to create the ID from |
13
+ | `separator` | `string` | `DEVICE_ID_SEPARATOR` | The separator to use to join the device ID |
14
+
15
+ ## Returns
16
+
17
+ `string`
@@ -0,0 +1,9 @@
1
+ ```ts
2
+ function getDevices(): Promise<MediaDeviceInfo[]>;
3
+ ```
4
+
5
+ **`Beta`**
6
+
7
+ ## Returns
8
+
9
+ `Promise`\<`MediaDeviceInfo`[]\>
@@ -0,0 +1,13 @@
1
+ ```ts
2
+ function getFacingModeFromConstraintString(constraint): "user" | "environment" | "left" | "right" | undefined;
3
+ ```
4
+
5
+ ## Parameters
6
+
7
+ | Parameter | Type |
8
+ | ------ | ------ |
9
+ | `constraint` | `string` |
10
+
11
+ ## Returns
12
+
13
+ `"user"` \| `"environment"` \| `"left"` \| `"right"` \| `undefined`
@@ -0,0 +1,21 @@
1
+ ```ts
2
+ function getInputDevicePermissionState(
3
+ anyActiveAudioTrack,
4
+ anyActiveVideoTrack,
5
+ getDevices): Promise<InputDevicePermission>;
6
+ ```
7
+
8
+ A wrapper for `navigator.permissions.query` with fallback to use
9
+ `navigator.mediaDevices.enumerateDevices` to guess the `PermissionState`
10
+
11
+ ## Parameters
12
+
13
+ | Parameter | Type | Default value | Description |
14
+ | ------ | ------ | ------ | ------ |
15
+ | `anyActiveAudioTrack` | `boolean` | `false` | Has ever got an active audio to help the fallback to guess the state more accurately |
16
+ | `anyActiveVideoTrack` | `boolean` | `false` | Has ever got an active video to help the fallback to guess the state more accurately |
17
+ | `getDevices` | () => `Promise`\<`MediaDeviceInfo`[]\> | `...` | A function to get the list of devices, e.g. navigator.mediaDevices.enumerateDevices |
18
+
19
+ ## Returns
20
+
21
+ `Promise`\<[`InputDevicePermission`](../interfaces/InputDevicePermission.mdx)\>
@@ -0,0 +1,13 @@
1
+ ```ts
2
+ function getValueFromConstrainNumber(constraint): number;
3
+ ```
4
+
5
+ ## Parameters
6
+
7
+ | Parameter | Type |
8
+ | ------ | ------ |
9
+ | `constraint` | `ConstrainNumber` |
10
+
11
+ ## Returns
12
+
13
+ `number`
@@ -0,0 +1,15 @@
1
+ ```ts
2
+ function hasAnyGrantedInput(devices): boolean;
3
+ ```
4
+
5
+ Check if provided devices have any granted input device
6
+
7
+ ## Parameters
8
+
9
+ | Parameter | Type | Description |
10
+ | ------ | ------ | ------ |
11
+ | `devices` | [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)[] | The devices to check |
12
+
13
+ ## Returns
14
+
15
+ `boolean`
@@ -0,0 +1,23 @@
1
+ ```ts
2
+ function hasAnyInputs(devices, grantedOnly): [boolean, boolean];
3
+ ```
4
+
5
+ Check if provided devices have any video and audio inputs
6
+
7
+ ## Parameters
8
+
9
+ | Parameter | Type | Default value | Description |
10
+ | ------ | ------ | ------ | ------ |
11
+ | `devices` | [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)[] | `undefined` | The devices to lookup |
12
+ | `grantedOnly` | `boolean` | `false` | When it is `true`, the device label is also taken into consideration |
13
+
14
+ ## Returns
15
+
16
+ \[`boolean`, `boolean`\]
17
+
18
+ A tuple of `[anyAudioInput, anyVideoInput]`, e.g. `[true, false]`
19
+ means there is audio input but no video input
20
+
21
+ ## Default Value
22
+
23
+ `false`
@@ -0,0 +1,15 @@
1
+ ```ts
2
+ function hasAudioInputs(devices): boolean;
3
+ ```
4
+
5
+ **`Beta`**
6
+
7
+ ## Parameters
8
+
9
+ | Parameter | Type |
10
+ | ------ | ------ |
11
+ | `devices` | [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)[] |
12
+
13
+ ## Returns
14
+
15
+ `boolean`
@@ -0,0 +1,15 @@
1
+ ```ts
2
+ function hasAudioOrVideoInputs(devices): boolean;
3
+ ```
4
+
5
+ **`Beta`**
6
+
7
+ ## Parameters
8
+
9
+ | Parameter | Type |
10
+ | ------ | ------ |
11
+ | `devices` | [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)[] |
12
+
13
+ ## Returns
14
+
15
+ `boolean`
@@ -0,0 +1,16 @@
1
+ ```ts
2
+ function hasChangedInput(oldInput, newInput): boolean;
3
+ ```
4
+
5
+ An utility function to check the input device has been changed
6
+
7
+ ## Parameters
8
+
9
+ | Parameter | Type | Description |
10
+ | ------ | ------ | ------ |
11
+ | `oldInput` | \| [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx) \| `undefined` | The previous input device |
12
+ | `newInput` | \| [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx) \| `undefined` | The current input device |
13
+
14
+ ## Returns
15
+
16
+ `boolean`
@@ -0,0 +1,20 @@
1
+ ```ts
2
+ function hasRequestingDevice(
3
+ request,
4
+ kind,
5
+ currentDevices): boolean;
6
+ ```
7
+
8
+ Check if there is a requesting device with respecting to the current devices
9
+
10
+ ## Parameters
11
+
12
+ | Parameter | Type | Description |
13
+ | ------ | ------ | ------ |
14
+ | `request` | \| [`InputDeviceConstraint`](../type-aliases/InputDeviceConstraint.mdx) \| `undefined` | Requesting input device constraint |
15
+ | `kind` | `MediaDeviceKind` | The kind of the device |
16
+ | `currentDevices` | [`IndexedDevices`](../interfaces/IndexedDevices.mdx) | The current indexed devices |
17
+
18
+ ## Returns
19
+
20
+ `boolean`
@@ -0,0 +1,15 @@
1
+ ```ts
2
+ function hasVideoInputs(devices): boolean;
3
+ ```
4
+
5
+ **`Beta`**
6
+
7
+ ## Parameters
8
+
9
+ | Parameter | Type |
10
+ | ------ | ------ |
11
+ | `devices` | [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)[] |
12
+
13
+ ## Returns
14
+
15
+ `boolean`
@@ -0,0 +1,17 @@
1
+ ```ts
2
+ function interpretCurrentFacingMode(currentTrack): "user" | "environment" | "left" | "right" | undefined;
3
+ ```
4
+
5
+ Interpret the current facing mode from the provided track, and try to get the
6
+ mode from settings, or use the label to guess the facing mode when facingMode
7
+ is not supported from settings
8
+
9
+ ## Parameters
10
+
11
+ | Parameter | Type | Description |
12
+ | ------ | ------ | ------ |
13
+ | `currentTrack` | `MediaStreamTrack` \| `undefined` | The current video input track |
14
+
15
+ ## Returns
16
+
17
+ `"user"` \| `"environment"` \| `"left"` \| `"right"` \| `undefined`
@@ -0,0 +1,20 @@
1
+ ```ts
2
+ function isDeviceGranted(device): boolean;
3
+ ```
4
+
5
+ Check if provided device is a permission-granted device by inspecting the
6
+ device label
7
+
8
+ ## Parameters
9
+
10
+ | Parameter | Type | Description |
11
+ | ------ | ------ | ------ |
12
+ | `device` | [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx) | The device to check |
13
+
14
+ ## Returns
15
+
16
+ `boolean`
17
+
18
+ ## See
19
+
20
+ [https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo/label#value](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo/label#value)
@@ -0,0 +1,15 @@
1
+ ```ts
2
+ function isExactDeviceConstraint(constraint): boolean;
3
+ ```
4
+
5
+ Check if provided constraint is an `exact` device constraint
6
+
7
+ ## Parameters
8
+
9
+ | Parameter | Type |
10
+ | ------ | ------ |
11
+ | `constraint` | \| [`InputDeviceConstraint`](../type-aliases/InputDeviceConstraint.mdx) \| `undefined` |
12
+
13
+ ## Returns
14
+
15
+ `boolean`
@@ -0,0 +1,13 @@
1
+ ```ts
2
+ function isFacingMode(s): s is "user" | "environment" | "left" | "right";
3
+ ```
4
+
5
+ ## Parameters
6
+
7
+ | Parameter | Type |
8
+ | ------ | ------ |
9
+ | `s` | `unknown` |
10
+
11
+ ## Returns
12
+
13
+ s is "user" \| "environment" \| "left" \| "right"
@@ -0,0 +1,13 @@
1
+ ```ts
2
+ function isIndexedDevices(t): t is IndexedDevices;
3
+ ```
4
+
5
+ ## Parameters
6
+
7
+ | Parameter | Type |
8
+ | ------ | ------ |
9
+ | `t` | `unknown` |
10
+
11
+ ## Returns
12
+
13
+ `t is IndexedDevices`
@@ -0,0 +1,13 @@
1
+ ```ts
2
+ function isInputConstraintSet(t): t is InputConstraintSet;
3
+ ```
4
+
5
+ ## Parameters
6
+
7
+ | Parameter | Type |
8
+ | ------ | ------ |
9
+ | `t` | `unknown` |
10
+
11
+ ## Returns
12
+
13
+ `t is InputConstraintSet`
@@ -0,0 +1,15 @@
1
+ ```ts
2
+ function isMediaDeviceInfo(t): t is MediaDeviceInfo;
3
+ ```
4
+
5
+ **`Beta`**
6
+
7
+ ## Parameters
8
+
9
+ | Parameter | Type |
10
+ | ------ | ------ |
11
+ | `t` | `unknown` |
12
+
13
+ ## Returns
14
+
15
+ `t is MediaDeviceInfo`
@@ -0,0 +1,13 @@
1
+ ```ts
2
+ function isMediaDeviceInfoArray(t): t is MediaDeviceInfo[];
3
+ ```
4
+
5
+ ## Parameters
6
+
7
+ | Parameter | Type |
8
+ | ------ | ------ |
9
+ | `t` | `unknown` |
10
+
11
+ ## Returns
12
+
13
+ `t is MediaDeviceInfo[]`
@@ -0,0 +1,15 @@
1
+ ```ts
2
+ function isMediaStreamTrack(m): m is MediaStreamTrack;
3
+ ```
4
+
5
+ **`Beta`**
6
+
7
+ ## Parameters
8
+
9
+ | Parameter | Type |
10
+ | ------ | ------ |
11
+ | `m` | `unknown` |
12
+
13
+ ## Returns
14
+
15
+ `m is MediaStreamTrack`
@@ -0,0 +1,14 @@
1
+ ```ts
2
+ function isRequestedInputDevice(request, response): boolean;
3
+ ```
4
+
5
+ ## Parameters
6
+
7
+ | Parameter | Type |
8
+ | ------ | ------ |
9
+ | `request` | \| [`InputDeviceConstraint`](../type-aliases/InputDeviceConstraint.mdx) \| `undefined` |
10
+ | `response` | \| [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx) \| `MediaDeviceTrackInfo` \| `undefined` |
11
+
12
+ ## Returns
13
+
14
+ `boolean`