@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,10 @@
1
+ ```ts
2
+ type CursorCaptureConstraint = ExtractObjectValueTypes<typeof CURSOR_CAPTURE_CONSTRAINT>;
3
+ ```
4
+
5
+ The `CursorCaptureConstraint` enumerates the conditions under which the
6
+ cursor is captured.
7
+
8
+ ## See
9
+
10
+ [https://w3c.github.io/mediacapture-screen-share/#cursorcaptureconstraint](https://w3c.github.io/mediacapture-screen-share/#cursorcaptureconstraint)
@@ -0,0 +1,19 @@
1
+ ```ts
2
+ type DeviceChangedChanges = object;
3
+ ```
4
+
5
+ **`Beta`**
6
+
7
+ DeviceChange Event
8
+
9
+ ```
10
+ devices (raw)
11
+ ```
12
+
13
+ ## Properties
14
+
15
+ | Property | Type |
16
+ | ------ | ------ |
17
+ | <a id="found"></a> `found` | [`MediaDeviceInfoLike`](MediaDeviceInfoLike.mdx)[] |
18
+ | <a id="lost"></a> `lost` | [`MediaDeviceInfoLike`](MediaDeviceInfoLike.mdx)[] |
19
+ | <a id="devices"></a> `devices` | [`MediaDeviceInfoLike`](MediaDeviceInfoLike.mdx)[] |
@@ -0,0 +1,10 @@
1
+ ```ts
2
+ type DisplayCaptureSurfaceType = ExtractObjectValueTypes<typeof DISPLAY_CAPTURE_SURFACE_TYPE>;
3
+ ```
4
+
5
+ The `DisplayCaptureSurfaceType` enumeration describes the different types of
6
+ display surface
7
+
8
+ ## See
9
+
10
+ [https://w3c.github.io/mediacapture-screen-share/#displaycapturesurfacetype](https://w3c.github.io/mediacapture-screen-share/#displaycapturesurfacetype)
@@ -0,0 +1,51 @@
1
+ ```ts
2
+ type Events =
3
+ | {
4
+ id: string;
5
+ type: Mute;
6
+ }
7
+ | {
8
+ id: string;
9
+ type: Unmute;
10
+ }
11
+ | {
12
+ id: string;
13
+ type: Ended;
14
+ }
15
+ | {
16
+ devices: MediaDeviceInfoLike[];
17
+ type: DevicesChanged;
18
+ }
19
+ | {
20
+ devices: MediaDeviceInfoLike[];
21
+ devicesFound: MediaDeviceInfoLike[];
22
+ type: DevicesFound;
23
+ }
24
+ | {
25
+ devices: MediaDeviceInfoLike[];
26
+ devicesLost: MediaDeviceInfoLike[];
27
+ type: DevicesLost;
28
+ }
29
+ | {
30
+ devices: MediaDeviceInfoLike[];
31
+ type: NoInputDevices;
32
+ }
33
+ | {
34
+ device: MediaDeviceInfoLike;
35
+ type: DeviceLost;
36
+ }
37
+ | {
38
+ error: Error;
39
+ type: Error;
40
+ }
41
+ | {
42
+ facingMode: boolean;
43
+ stream: MediaStream;
44
+ type: Stream;
45
+ video: boolean;
46
+ };
47
+ ```
48
+
49
+ **`Beta`**
50
+
51
+ Event object by MediaEventType
@@ -0,0 +1,3 @@
1
+ ```ts
2
+ type FacingMode = typeof FACING_MODE[number];
3
+ ```
@@ -0,0 +1,3 @@
1
+ ```ts
2
+ type IncludeExcludeConstraint = ExtractObjectValueTypes<typeof INCLUDE_EXCLUDE_CONSTRAINT>;
3
+ ```
@@ -0,0 +1,6 @@
1
+ ```ts
2
+ type InputDeviceConstraint =
3
+ | DeviceConstraint
4
+ | InputConstraintSet
5
+ | boolean;
6
+ ```
@@ -0,0 +1,13 @@
1
+ ```ts
2
+ type MediaDeviceInfoLike = Omit<MediaDeviceInfo, "toJSON"> & object;
3
+ ```
4
+
5
+ **`Beta`**
6
+
7
+ A striped version of MediaDeviceInfo
8
+
9
+ ## Type Declaration
10
+
11
+ | Name | Type |
12
+ | ------ | ------ |
13
+ | `toJSON?` | `MediaDeviceInfo`\[`"toJSON"`\] |
@@ -0,0 +1,7 @@
1
+ ```ts
2
+ type MediaEvent = CustomEvent<Events>;
3
+ ```
4
+
5
+ **`Beta`**
6
+
7
+ Custom Media Event
@@ -0,0 +1,7 @@
1
+ ```ts
2
+ type MediaStreamTrackLike = Pick<MediaStreamTrack, "id" | "kind" | "label" | "getSettings" | "stop">;
3
+ ```
4
+
5
+ **`Beta`**
6
+
7
+ Lesser strict type of `MediaStreamTrack`
@@ -0,0 +1,7 @@
1
+ ```ts
2
+ type Unsubscribe = () => void;
3
+ ```
4
+
5
+ ## Returns
6
+
7
+ `void`
@@ -0,0 +1,18 @@
1
+ ```ts
2
+ const CURSOR_CAPTURE_CONSTRAINT: object;
3
+ ```
4
+
5
+ The `CursorCaptureConstraint` enumerates the conditions under which the
6
+ cursor is captured.
7
+
8
+ ## Type Declaration
9
+
10
+ | Name | Type | Default value |
11
+ | ------ | ------ | ------ |
12
+ | <a id="never"></a> `Never` | `"never"` | `'never'` |
13
+ | <a id="always"></a> `Always` | `"always"` | `'always'` |
14
+ | <a id="motion"></a> `Motion` | `"motion"` | `'motion'` |
15
+
16
+ ## See
17
+
18
+ [https://w3c.github.io/mediacapture-screen-share/#cursorcaptureconstraint](https://w3c.github.io/mediacapture-screen-share/#cursorcaptureconstraint)
@@ -0,0 +1,3 @@
1
+ ```ts
2
+ const DEVICE_ID_SEPARATOR: ":" = ':';
3
+ ```
@@ -0,0 +1,18 @@
1
+ ```ts
2
+ const DISPLAY_CAPTURE_SURFACE_TYPE: object;
3
+ ```
4
+
5
+ The `DisplayCaptureSurfaceType` enumeration describes the different types of
6
+ display surface
7
+
8
+ ## Type Declaration
9
+
10
+ | Name | Type | Default value |
11
+ | ------ | ------ | ------ |
12
+ | <a id="monitor"></a> `Monitor` | `"monitor"` | `'monitor'` |
13
+ | <a id="window"></a> `Window` | `"window"` | `'window'` |
14
+ | <a id="browser"></a> `Browser` | `"browser"` | `'browser'` |
15
+
16
+ ## See
17
+
18
+ [https://w3c.github.io/mediacapture-screen-share/#displaycapturesurfacetype](https://w3c.github.io/mediacapture-screen-share/#displaycapturesurfacetype)
@@ -0,0 +1,10 @@
1
+ ```ts
2
+ const INCLUDE_EXCLUDE_CONSTRAINT: object;
3
+ ```
4
+
5
+ ## Type Declaration
6
+
7
+ | Name | Type | Default value |
8
+ | ------ | ------ | ------ |
9
+ | <a id="include"></a> `Include` | `"include"` | `'include'` |
10
+ | <a id="exclude"></a> `Exclude` | `"exclude"` | `'exclude'` |
@@ -0,0 +1,19 @@
1
+ ```ts
2
+ const findAudioInputDevices: (devices) => MediaDeviceInfoLike[];
3
+ ```
4
+
5
+ **`Beta`**
6
+
7
+ Find in the list of devices only the audio input ones
8
+
9
+ ## Parameters
10
+
11
+ | Parameter | Type | Description |
12
+ | ------ | ------ | ------ |
13
+ | `devices` | [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)[] | A list of media devices from `navigator.mediaDevices.enumerateDevices()`. Will be used for search target |
14
+
15
+ ## Returns
16
+
17
+ [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)[]
18
+
19
+ List of devices that are audio inputs
@@ -0,0 +1,19 @@
1
+ ```ts
2
+ const findAudioOutputDevices: (devices) => MediaDeviceInfoLike[];
3
+ ```
4
+
5
+ **`Beta`**
6
+
7
+ Find in the list of devices only the audio output ones
8
+
9
+ ## Parameters
10
+
11
+ | Parameter | Type | Description |
12
+ | ------ | ------ | ------ |
13
+ | `devices` | [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)[] | A list of media devices from `navigator.mediaDevices.enumerateDevices()`. Will be used for search target |
14
+
15
+ ## Returns
16
+
17
+ [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)[]
18
+
19
+ List of devices that are audio outputs
@@ -0,0 +1,19 @@
1
+ ```ts
2
+ const findVideoInputDevices: (devices) => MediaDeviceInfoLike[];
3
+ ```
4
+
5
+ **`Beta`**
6
+
7
+ Find in the list of devices only the video input ones
8
+
9
+ ## Parameters
10
+
11
+ | Parameter | Type | Description |
12
+ | ------ | ------ | ------ |
13
+ | `devices` | [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)[] | A list of media devices from `navigator.mediaDevices.enumerateDevices()`. Will be used for search target |
14
+
15
+ ## Returns
16
+
17
+ [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx)[]
18
+
19
+ List of devices that are video inputs
@@ -0,0 +1,21 @@
1
+ ```ts
2
+ getUserMedia: (__namedParameters) => Promise<MediaStream>;
3
+ ```
4
+
5
+ Get MediaStream with provided [input constraints](../interfaces/MediaDeviceRequest.mdx)
6
+
7
+ **`Beta`**
8
+
9
+ Get MediaStream with MediaDeviceRequest
10
+
11
+ ## Parameters
12
+
13
+ | Parameter | Type |
14
+ | ------ | ------ |
15
+ | `__namedParameters` | [`MediaDeviceRequest`](../interfaces/MediaDeviceRequest.mdx) |
16
+
17
+ ## Returns
18
+
19
+ `Promise`\<`MediaStream`\>
20
+
21
+ MediaStream
@@ -0,0 +1,13 @@
1
+ ```ts
2
+ const isAudioInput: (device) => boolean;
3
+ ```
4
+
5
+ ## Parameters
6
+
7
+ | Parameter | Type |
8
+ | ------ | ------ |
9
+ | `device` | [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx) |
10
+
11
+ ## Returns
12
+
13
+ `boolean`
@@ -0,0 +1,13 @@
1
+ ```ts
2
+ const isAudioOutput: (device) => boolean;
3
+ ```
4
+
5
+ ## Parameters
6
+
7
+ | Parameter | Type |
8
+ | ------ | ------ |
9
+ | `device` | [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx) |
10
+
11
+ ## Returns
12
+
13
+ `boolean`
@@ -0,0 +1,13 @@
1
+ ```ts
2
+ const isVideoInput: (device) => boolean;
3
+ ```
4
+
5
+ ## Parameters
6
+
7
+ | Parameter | Type |
8
+ | ------ | ------ |
9
+ | `device` | [`MediaDeviceInfoLike`](../type-aliases/MediaDeviceInfoLike.mdx) |
10
+
11
+ ## Returns
12
+
13
+ `boolean`
@@ -0,0 +1,17 @@
1
+ ```ts
2
+ setDefaultConstraints: (newConstraints) => void;
3
+ ```
4
+
5
+ Set default media stream constraints
6
+
7
+ A [MediaStreamConstraints](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints) object specifying the types of media to request, along with any requirements for each type.
8
+
9
+ ## Parameters
10
+
11
+ | Parameter | Type |
12
+ | ------ | ------ |
13
+ | `newConstraints` | `MediaStreamConstraints` |
14
+
15
+ ## Returns
16
+
17
+ `void`
@@ -0,0 +1,25 @@
1
+ ```ts
2
+ subscribe: (listener) => () => void;
3
+ ```
4
+
5
+ Subscribe media events
6
+
7
+ **`Beta`**
8
+
9
+ Subscription media events
10
+
11
+ ## Parameters
12
+
13
+ | Parameter | Type |
14
+ | ------ | ------ |
15
+ | `listener` | (`event`) => `void` |
16
+
17
+ ## Returns
18
+
19
+ ```ts
20
+ (): void;
21
+ ```
22
+
23
+ ### Returns
24
+
25
+ `void`
package/dist/devices.js CHANGED
@@ -372,6 +372,9 @@ export const resolveInputDevice = (tracksOrDevice, findInput) => {
372
372
  return undefined;
373
373
  };
374
374
  export const isStreamingRequestingDevice = (request, trackOrDevice, devices) => {
375
+ if (request === false) {
376
+ return false;
377
+ }
375
378
  if (request === undefined) {
376
379
  return true;
377
380
  }
@@ -21,11 +21,11 @@ export declare const EXTENDED_CONSTRAIN_STRING_KEYS: readonly ["videoSegmentatio
21
21
  export type ExtendedConstrainStringKeys = (typeof EXTENDED_CONSTRAIN_STRING_KEYS)[number];
22
22
  export type ConstrainStringKeys = (typeof CONSTRAIN_STRING_KEYS)[number];
23
23
  export declare const CONSTRAIN_U_LONG_KEYS: readonly ["width", "height", "sampleRate", "sampleSize", "channelCount"];
24
- export declare const EXTENDED_CONSTRAIN_U_LONG_KEYS: readonly ["backgroundBlurAmount", "edgeBlurAmount"];
24
+ export declare const EXTENDED_CONSTRAIN_U_LONG_KEYS: readonly ["backgroundBlurAmount", "edgeBlurAmount", "morphErodeRadiusPx", "morphPass", "morphDilateRadiusPx", "lightWrapBlurAmount", "downSampleFactor"];
25
25
  export type ExtendedConstrainULongKeys = (typeof EXTENDED_CONSTRAIN_U_LONG_KEYS)[number];
26
26
  export type ConstrainULongKeys = (typeof CONSTRAIN_U_LONG_KEYS)[number];
27
27
  export declare const CONSTRAIN_DOUBLE_KEYS: readonly ["aspectRatio", "frameRate", "latency"];
28
- export declare const EXTENDED_CONSTRAIN_DOUBLE_KEYS: readonly ["foregroundThreshold", "maskCombineRatio"];
28
+ export declare const EXTENDED_CONSTRAIN_DOUBLE_KEYS: readonly ["foregroundThreshold", "backgroundThreshold", "sigmaSpace", "sigmaRangeLo", "sigmaRangeHi", "maskCombineRatio", "personCenterX", "personCenterY", "lightWrapIntensity", "lightWrapTightness", "lightWrapEdgeBand"];
29
29
  export type ExtendedConstrainDoubleKeys = (typeof EXTENDED_CONSTRAIN_DOUBLE_KEYS)[number];
30
30
  export type ConstrainDoubleKeys = (typeof CONSTRAIN_DOUBLE_KEYS)[number];
31
31
  export declare const CONSTRAIN_BOOLEAN_KEYS: readonly ["echoCancellation", "autoGainControl", "noiseSuppression", "pan", "tilt", "zoom"];
@@ -33,7 +33,7 @@ export declare const CONSTRAIN_BOOLEAN_KEYS: readonly ["echoCancellation", "auto
33
33
  * Extends boolean constraint keys for our own implementation of the media
34
34
  * feature
35
35
  */
36
- export declare const EXTENDED_CONSTRAIN_BOOLEAN_KEYS: readonly ["vad", "asd", "mixWithAdditionalMedia", "denoise"];
36
+ export declare const EXTENDED_CONSTRAIN_BOOLEAN_KEYS: readonly ["vad", "asd", "mixWithAdditionalMedia", "denoise", "excludeBystanders"];
37
37
  export type ExtendedConstrainBooleanKeys = (typeof EXTENDED_CONSTRAIN_BOOLEAN_KEYS)[number];
38
38
  export type ConstrainBooleanKeys = (typeof CONSTRAIN_BOOLEAN_KEYS)[number];
39
39
  /**
@@ -39,6 +39,11 @@ export const CONSTRAIN_U_LONG_KEYS = [
39
39
  export const EXTENDED_CONSTRAIN_U_LONG_KEYS = [
40
40
  'backgroundBlurAmount',
41
41
  'edgeBlurAmount',
42
+ 'morphErodeRadiusPx',
43
+ 'morphPass',
44
+ 'morphDilateRadiusPx',
45
+ 'lightWrapBlurAmount',
46
+ 'downSampleFactor',
42
47
  ];
43
48
  export const CONSTRAIN_DOUBLE_KEYS = [
44
49
  'aspectRatio',
@@ -47,7 +52,16 @@ export const CONSTRAIN_DOUBLE_KEYS = [
47
52
  ];
48
53
  export const EXTENDED_CONSTRAIN_DOUBLE_KEYS = [
49
54
  'foregroundThreshold',
55
+ 'backgroundThreshold',
56
+ 'sigmaSpace',
57
+ 'sigmaRangeLo',
58
+ 'sigmaRangeHi',
50
59
  'maskCombineRatio',
60
+ 'personCenterX',
61
+ 'personCenterY',
62
+ 'lightWrapIntensity',
63
+ 'lightWrapTightness',
64
+ 'lightWrapEdgeBand',
51
65
  ];
52
66
  export const CONSTRAIN_BOOLEAN_KEYS = [
53
67
  'echoCancellation',
@@ -70,6 +84,8 @@ export const EXTENDED_CONSTRAIN_BOOLEAN_KEYS = [
70
84
  'mixWithAdditionalMedia',
71
85
  // Noise Suppression using our own impl
72
86
  'denoise',
87
+ // Bystander removal
88
+ 'excludeBystanders',
73
89
  ];
74
90
  /**
75
91
  * The keys from the `MediaTrackConstraintSet`
package/dist/types.d.ts CHANGED
@@ -107,9 +107,93 @@ export interface InputConstraintSet extends MediaTrackConstraints {
107
107
  */
108
108
  backgroundImageUrl?: ConstrainDOMString;
109
109
  /**
110
- * The ratio to be used for smoothing segmentation mask
110
+ * The ratio to be used for smoothing segmentation mask.
111
+ * How much uncertainty enables temporal blend, [0,1].
112
+ * Higher = more frame-to-frame blending, more stability but more trailing ghosts.
113
+ * Typical: 0.6–0.85.
111
114
  */
112
115
  maskCombineRatio?: ConstrainDouble;
116
+ /**
117
+ * [0,1] Lower mask confidence: all mask pixels <= this are considered definite background.
118
+ * Adjust to make mask edges tighter or more permissive for background inclusion.
119
+ * Example: 0.3 ("mask < 0.3 = sure background").
120
+ */
121
+ backgroundThreshold?: ConstrainDouble;
122
+ /**
123
+ * Bilateral filter: sigma in pixel space for mask edge snapping.
124
+ * Controls the neighborhood/pixel distance—higher is larger window (5–10 typical).
125
+ */
126
+ sigmaSpace?: ConstrainDouble;
127
+ /**
128
+ * Bilateral filter: minimum sigma in color/luma (for mask interiors), [0,1].
129
+ * Controls how little color difference is needed to cross-mask regions away from edge.
130
+ * Lower = sharper edge preservation in mask interiors.
131
+ * Example: 0.2
132
+ */
133
+ sigmaRangeLo?: ConstrainDouble;
134
+ /**
135
+ * Bilateral filter: maximum sigma in color/luma (for mask uncertain zones), [0,1].
136
+ * Controls how much color similarity is required at uncertain/edge mask locations.
137
+ * Higher = more mask smoothing at edges.
138
+ * Example: 0.8
139
+ */
140
+ sigmaRangeHi?: ConstrainDouble;
141
+ /**
142
+ * Whether to exclude bystanders/connected people from the output mask.
143
+ * The main person instance (closest to personCenter OR largest blob) is kept in
144
+ * the output mask.
145
+ * All other bystanders/connected people are suppressed (bystander removal).
146
+ */
147
+ excludeBystanders?: ConstrainBoolean;
148
+ /**
149
+ * Person center: normalized in [0,1] image coordinates for main subject selection.
150
+ * Used by the CCL/bias filter to select the main person blob.
151
+ */
152
+ personCenterX?: ConstrainDouble;
153
+ /**
154
+ * Person center: normalized in [0,1] image coordinates for main subject selection.
155
+ * Used by the CCL/bias filter to select the main person blob.
156
+ */
157
+ personCenterY?: ConstrainDouble;
158
+ /**
159
+ * Morphological erosion: radius in pixels [1,12]. Sets kernel size for bridge-breaking.
160
+ * Larger values break thicker bridges but may erode fine details.
161
+ */
162
+ morphErodeRadiusPx?: ConstrainULong;
163
+ /**
164
+ * Morphological pass: number of separable passes [1,10].
165
+ * More passes increase the effective span.
166
+ */
167
+ morphPass?: ConstrainULong;
168
+ /**
169
+ * Geodesic dilation: radius in pixels [1,12]. Must match erosion for good reconstruction.
170
+ */
171
+ morphDilateRadiusPx?: ConstrainULong;
172
+ /**
173
+ * [0,1] Light wrap amount (halo intensity) at mask edge.
174
+ * Wraps blurred background color just outside the subject edge onto the subject boundary for realism.
175
+ */
176
+ lightWrapIntensity?: ConstrainDouble;
177
+ /**
178
+ * [0.5,4.0] Controls power/tightness of the wrap band falloff. Higher = tighter/narrower wrap.
179
+ */
180
+ lightWrapTightness?: ConstrainDouble;
181
+ /**
182
+ * Width of the wrap band (feather size, in normalized mask units) between the backgroundThreshold
183
+ * and foregroundThreshold in [0.0, (foregroundThreshold - backgroundThreshold) / 2]
184
+ * Higher = wider soft halo.
185
+ */
186
+ lightWrapEdgeBand?: ConstrainDouble;
187
+ /**
188
+ * Blur amount used for background color in the wrap band (units=blur passes).
189
+ */
190
+ lightWrapBlurAmount?: ConstrainULong;
191
+ /**
192
+ * Downsampling factor for mask/blurring, must be [2,4].
193
+ * 2 = half resolution, 4 = quarter resolution for faster filtering.
194
+ * Use for performance tuning vs. quality.
195
+ */
196
+ downSampleFactor?: ConstrainULong;
113
197
  /**
114
198
  * Image Url that is being used for video overlay effects
115
199
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pexip/media-control",
3
- "version": "20.3.4",
4
- "homepage": "https://gitlab.com/pexip/zoo",
3
+ "version": "21.0.0",
4
+ "homepage": "https://developer.pexip.com",
5
5
  "bugs": "https://gitlab.com/pexip/zoo/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -27,27 +27,32 @@
27
27
  "import": "./dist/*.js"
28
28
  }
29
29
  },
30
+ "directories": {
31
+ "doc": "api-docs"
32
+ },
30
33
  "files": [
31
- "dist"
34
+ "dist",
35
+ "api-docs"
32
36
  ],
33
37
  "scripts": {
34
38
  "build": "pexip-bundler build",
35
39
  "build:sourcemap": "pexip-bundler build --sourcemap",
36
- "clean": "rm -rf dist",
40
+ "clean": "rm -rf dist api-docs",
37
41
  "dev": "pexip-bundler dev",
38
- "prepack": "yarn clean && yarn build",
42
+ "prepack": "yarn clean && yarn build && yarn docs",
39
43
  "test": "jest",
40
44
  "check-format": "prettier --ignore-path=../../.prettierignore --check .",
41
45
  "format": "prettier --ignore-path=../../.prettierignore --write .",
42
46
  "lint": "yarn run -T biome lint",
43
- "typecheck": "yarn tsc --noEmit -p tsconfig.build.json"
47
+ "typecheck": "yarn tsc --noEmit -p tsconfig.build.json",
48
+ "docs": "typedoc"
44
49
  },
45
50
  "dependencies": {
46
- "@pexip/utils": "17.1.2"
51
+ "@pexip/utils": "17.2.0"
47
52
  },
48
53
  "devDependencies": {
49
54
  "@jest/globals": "^30.2.0",
50
- "@pexip/bundler": "18.1.2",
55
+ "@pexip/bundler": "18.2.0",
51
56
  "@swc/core": "^1.10.12",
52
57
  "@swc/jest": "^0.2.39",
53
58
  "@types/uuid": "^8.3.0",
@@ -55,6 +60,8 @@
55
60
  "jest": "^29.5.12",
56
61
  "jest-junit": "^16.0.0",
57
62
  "prettier": "^3.2.5",
63
+ "typedoc": "^0.28.15",
64
+ "typedoc-plugin-markdown": "^4.9.0",
58
65
  "typescript": "~5.7.3",
59
66
  "uuid": "^11.0.0"
60
67
  },