@pexip/media-control 20.3.4 → 20.3.5

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 (98) hide show
  1. package/CHANGELOG.md +8 -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 +43 -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/package.json +15 -8
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pexip/media-control",
3
- "version": "20.3.4",
3
+ "version": "20.3.5",
4
4
  "homepage": "https://gitlab.com/pexip/zoo",
5
5
  "bugs": "https://gitlab.com/pexip/zoo/issues",
6
6
  "repository": {
@@ -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
- "build": "pexip-bundler build",
35
- "build:sourcemap": "pexip-bundler build --sourcemap",
36
- "clean": "rm -rf dist",
38
+ "build": "pexip-bundler build && yarn docs",
39
+ "build:sourcemap": "pexip-bundler build --sourcemap && yarn docs",
40
+ "clean": "rm -rf dist api-docs",
37
41
  "dev": "pexip-bundler dev",
38
42
  "prepack": "yarn clean && yarn build",
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.1.3"
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
  },