@pexip/media 22.0.0 → 22.1.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 +20 -0
- package/api-docs/README.mdx +0 -1
- package/api-docs/functions/applyContentHint.mdx +1 -1
- package/api-docs/functions/createAudioMixingProcess.mdx +1 -1
- package/api-docs/functions/createGetDisplayMedia.mdx +3 -3
- package/api-docs/functions/createMediaSignal.mdx +2 -2
- package/api-docs/functions/createMediaSignals.mdx +5 -3
- package/api-docs/functions/deriveInitialPermissionStatus.mdx +4 -2
- package/api-docs/functions/getPermissionStatus.mdx +31 -11
- package/api-docs/functions/toDeniedDevices.mdx +3 -1
- package/api-docs/interfaces/AudioDetectionSignals.mdx +2 -2
- package/api-docs/interfaces/AudioSignalDetectionOptions.mdx +1 -1
- package/api-docs/interfaces/ExtendedMediaTrackSettings.mdx +3 -3
- package/api-docs/interfaces/Media.mdx +4 -4
- package/api-docs/interfaces/MediaAttributes.mdx +2 -2
- package/api-docs/interfaces/MediaChangesSignals.mdx +5 -5
- package/api-docs/interfaces/MediaController.mdx +3 -3
- package/api-docs/interfaces/MediaInit.mdx +1 -1
- package/api-docs/interfaces/MediaOptions.mdx +3 -3
- package/api-docs/interfaces/MediaTrack.mdx +3 -3
- package/api-docs/interfaces/MediaTrackInit.mdx +12 -10
- package/api-docs/interfaces/PreviewEventHandler.mdx +7 -7
- package/api-docs/interfaces/PreviewStreamController.mdx +10 -10
- package/api-docs/interfaces/PreviewStreamParams.mdx +7 -7
- package/api-docs/interfaces/VoiceActivityDetectionOptions.mdx +1 -1
- package/api-docs/type-aliases/GetUserMediaProcess.mdx +4 -2
- package/api-docs/type-aliases/Process.mdx +3 -1
- package/api-docs/variables/internalSignals.mdx +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/logger.d.ts +0 -2
- package/dist/logger.js +0 -24
- package/dist/previewController.js +19 -1
- package/dist/utils.js +11 -2
- package/dist/videoProcessor.js +5 -5
- package/package.json +5 -5
- package/api-docs/functions/proxyWithLog.mdx +0 -33
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @pexip/media
|
|
2
2
|
|
|
3
|
+
## 22.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 44ad859: Move proxyWithLog to utils
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 588b6e1: Fix process stopped track
|
|
12
|
+
- 49e9299: Fix process stopped track issue
|
|
13
|
+
- 136aa70: Fix race on close
|
|
14
|
+
- Updated dependencies [a9456de]
|
|
15
|
+
- Updated dependencies [44ad859]
|
|
16
|
+
- Updated dependencies [136aa70]
|
|
17
|
+
- Updated dependencies [ad47e6a]
|
|
18
|
+
- Updated dependencies [514c523]
|
|
19
|
+
- @pexip/media-control@22.1.0
|
|
20
|
+
- @pexip/utils@17.4.0
|
|
21
|
+
- @pexip/media-processor@22.1.0
|
|
22
|
+
|
|
3
23
|
## 22.0.0
|
|
4
24
|
|
|
5
25
|
### Major Changes
|
package/api-docs/README.mdx
CHANGED
|
@@ -372,7 +372,6 @@ await mediaController.media.applyConstraints({
|
|
|
372
372
|
| [createAudioStreamProcess](functions/createAudioStreamProcess.mdx) | Create an Audio Stream Processor and will own the stream passed-in |
|
|
373
373
|
| [createGetDisplayMedia](functions/createGetDisplayMedia.mdx) | - |
|
|
374
374
|
| [setLogger](functions/setLogger.mdx) | - |
|
|
375
|
-
| [proxyWithLog](functions/proxyWithLog.mdx) | - |
|
|
376
375
|
| [createMedia](functions/createMedia.mdx) | Create an object to interact with the media scream, which is usually used for our main stream. |
|
|
377
376
|
| [createPreviewStreamController](functions/createPreviewStreamController.mdx) | - |
|
|
378
377
|
| [createMediaSignal](functions/createMediaSignal.mdx) | Create a general signal with consistent scoped name |
|
|
@@ -8,7 +8,7 @@ Apply the content hint to the track
|
|
|
8
8
|
|
|
9
9
|
| Type Parameter |
|
|
10
10
|
| ------ |
|
|
11
|
-
| `T
|
|
11
|
+
| `T extends \| "" \| "speech" \| "speech-recognition" \| "music" \| "motion" \| "detail" \| "text"` |
|
|
12
12
|
|
|
13
13
|
## Parameters
|
|
14
14
|
|
|
@@ -11,7 +11,7 @@ Create an Audio Mixing Processor and will own the stream passed-in
|
|
|
11
11
|
|
|
12
12
|
| Parameter | Type | Default value |
|
|
13
13
|
| ------ | ------ | ------ |
|
|
14
|
-
| `getCurrentMedia` | () =>
|
|
14
|
+
| `getCurrentMedia` | `() => MediaStream \| undefined` | `undefined` |
|
|
15
15
|
| `signals?` | [`MediaSignals`](../type-aliases/MediaSignals.mdx) | `undefined` |
|
|
16
16
|
| `label?` | `"AudioMixingProcessor"` | `PROCESSOR_LABELS.AudioMixingProcessor` |
|
|
17
17
|
|
|
@@ -6,8 +6,8 @@ function createGetDisplayMedia(getDefaultConstraints, getDisplayMedia): (constra
|
|
|
6
6
|
|
|
7
7
|
| Parameter | Type |
|
|
8
8
|
| ------ | ------ |
|
|
9
|
-
| `getDefaultConstraints` | () =>
|
|
10
|
-
| `getDisplayMedia` | (
|
|
9
|
+
| `getDefaultConstraints` | `() => DisplayMediaOptions` |
|
|
10
|
+
| `getDisplayMedia` | `(options?) => Promise<MediaStream>` |
|
|
11
11
|
|
|
12
12
|
## Returns
|
|
13
13
|
|
|
@@ -23,4 +23,4 @@ function createGetDisplayMedia(getDefaultConstraints, getDisplayMedia): (constra
|
|
|
23
23
|
|
|
24
24
|
### Returns
|
|
25
25
|
|
|
26
|
-
`Promise
|
|
26
|
+
`Promise<MediaStream | undefined>`
|
|
@@ -19,11 +19,11 @@ Create a general signal with consistent scoped name
|
|
|
19
19
|
| ------ | ------ | ------ | ------ |
|
|
20
20
|
| `name` | `string` | `undefined` | Signal name |
|
|
21
21
|
| `crucial` | `boolean` | `true` | Signify if the signal is unmissable. |
|
|
22
|
-
| `variant` | `"generic"
|
|
22
|
+
| `variant` | `"generic" \| "behavior" \| "replay"` | `'generic'` | The variant of the signal |
|
|
23
23
|
|
|
24
24
|
## Returns
|
|
25
25
|
|
|
26
|
-
`Signal
|
|
26
|
+
`Signal<T, T>`
|
|
27
27
|
|
|
28
28
|
## Default Value
|
|
29
29
|
|
|
@@ -9,18 +9,20 @@ signals for media to work
|
|
|
9
9
|
|
|
10
10
|
| Type Parameter |
|
|
11
11
|
| ------ |
|
|
12
|
-
| `K
|
|
12
|
+
| `K extends \| "onAddTrack" \| "onDevicesChanged" \| "onMediaTrackMuted" \| "onMediaTrackResumed" \| "onMediaTrackStopped" \| "onMediaTrackSuspended" \| "onRemoveTrack" \| "onStatusChanged" \| "onUpdatingAudio" \| "onUpdatingVideo"` |
|
|
13
13
|
|
|
14
14
|
## Parameters
|
|
15
15
|
|
|
16
16
|
| Parameter | Type | Default value | Description |
|
|
17
17
|
| ------ | ------ | ------ | ------ |
|
|
18
|
-
| `more` | `K
|
|
18
|
+
| `more` | `K[]` | `undefined` | Keys from `MediaSignalsOptional`, |
|
|
19
19
|
| `scope` | `string` | `''` | any scope prefix for the generated signal name, |
|
|
20
20
|
|
|
21
21
|
## Returns
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
```ts
|
|
24
|
+
Pick<Required<MediaSignals>, SignalKeys>
|
|
25
|
+
```
|
|
24
26
|
|
|
25
27
|
## See
|
|
26
28
|
|
|
@@ -7,8 +7,10 @@ function deriveInitialPermissionStatus(prevStatus, getPermissionState): Promise<
|
|
|
7
7
|
| Parameter | Type | Default value |
|
|
8
8
|
| ------ | ------ | ------ |
|
|
9
9
|
| `prevStatus` | [`UserMediaStatus`](../enumerations/UserMediaStatus.mdx) | `undefined` |
|
|
10
|
-
| `getPermissionState` | (
|
|
10
|
+
| `getPermissionState` | `(anyActiveAudioTrack?, anyActiveVideoTrack?, getDevices?) => Promise<InputDevicePermission>` | `getInputDevicePermissionState` |
|
|
11
11
|
|
|
12
12
|
## Returns
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
```ts
|
|
15
|
+
Promise<UserMediaStatus>
|
|
16
|
+
```
|
|
@@ -16,19 +16,39 @@ function getPermissionStatus(__namedParameters):
|
|
|
16
16
|
|
|
17
17
|
| Parameter | Type |
|
|
18
18
|
| ------ | ------ |
|
|
19
|
-
| `__namedParameters` |
|
|
19
|
+
| `__namedParameters` | `{ audio: PermissionState; video: PermissionState; }` |
|
|
20
20
|
| `__namedParameters.audio` | `PermissionState` |
|
|
21
21
|
| `__namedParameters.video` | `PermissionState` |
|
|
22
22
|
|
|
23
23
|
## Returns
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
```ts
|
|
26
|
+
| Initial
|
|
27
|
+
```
|
|
28
|
+
```ts
|
|
29
|
+
| InitialPermissionsGranted
|
|
30
|
+
```
|
|
31
|
+
```ts
|
|
32
|
+
| InitialPermissionsNotGranted
|
|
33
|
+
```
|
|
34
|
+
```ts
|
|
35
|
+
| InitialPermissionsVideoInputDenied
|
|
36
|
+
```
|
|
37
|
+
```ts
|
|
38
|
+
| InitialPermissionsAudioInputDenied
|
|
39
|
+
```
|
|
40
|
+
```ts
|
|
41
|
+
| InitialPermissionsVideoInputGranted
|
|
42
|
+
```
|
|
43
|
+
```ts
|
|
44
|
+
| InitialPermissionsAudioInputGranted
|
|
45
|
+
```
|
|
46
|
+
```ts
|
|
47
|
+
| InitialPermissionsGrantedVideoInputDenied
|
|
48
|
+
```
|
|
49
|
+
```ts
|
|
50
|
+
| InitialPermissionsGrantedAudioInputDenied
|
|
51
|
+
```
|
|
52
|
+
```ts
|
|
53
|
+
| PermissionsRejected
|
|
54
|
+
```
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
|
|
3
3
|
| Property | Type |
|
|
4
4
|
| ------ | ------ |
|
|
5
|
-
| <a id="onvad"></a> `onVAD` | `Signal
|
|
6
|
-
| <a id="onsilentdetected"></a> `onSilentDetected` | `Signal
|
|
5
|
+
| <a id="onvad"></a> `onVAD` | `Signal<undefined>` |
|
|
6
|
+
| <a id="onsilentdetected"></a> `onSilentDetected` | `Signal<boolean>` |
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
| Property | Type | Description |
|
|
4
4
|
| ------ | ------ | ------ |
|
|
5
5
|
| <a id="audiosignaldetectionduration"></a> `audioSignalDetectionDuration?` | `number` | Audio Signal Detection Duration in second |
|
|
6
|
-
| <a id="shoulddetectaudio"></a> `shouldDetectAudio` | () =>
|
|
6
|
+
| <a id="shoulddetectaudio"></a> `shouldDetectAudio` | `() => boolean` | Whether or not to detect audio signal for malfunctioning device |
|
|
@@ -16,20 +16,20 @@
|
|
|
16
16
|
| <a id="edgebluramount"></a> `edgeBlurAmount?` | `number` | - | - |
|
|
17
17
|
| <a id="maskcombineratio"></a> `maskCombineRatio?` | `number` | - | - |
|
|
18
18
|
| <a id="foregroundthreshold"></a> `foregroundThreshold?` | `number` | - | - |
|
|
19
|
-
| <a id="videosegmentation"></a> `videoSegmentation?` | `"none"
|
|
19
|
+
| <a id="videosegmentation"></a> `videoSegmentation?` | `"none" \| "blur" \| "overlay"` | - | - |
|
|
20
20
|
| <a id="panenabled"></a> `panEnabled?` | `boolean` | - | - |
|
|
21
21
|
| <a id="tiltenabled"></a> `tiltEnabled?` | `boolean` | - | - |
|
|
22
22
|
| <a id="zoomenabled"></a> `zoomEnabled?` | `boolean` | - | - |
|
|
23
23
|
| <a id="pan"></a> `pan?` | `number` | - | - |
|
|
24
24
|
| <a id="tilt"></a> `tilt?` | `number` | - | - |
|
|
25
25
|
| <a id="zoom"></a> `zoom?` | `number` | `MediaTrackSettings.zoom` | - |
|
|
26
|
-
| <a id="contenthint"></a> `contentHint?` |
|
|
26
|
+
| <a id="contenthint"></a> `contentHint?` | `\| "" \| "speech" \| "speech-recognition" \| "music" \| "motion" \| "detail" \| "text"` | - | - |
|
|
27
27
|
| <a id="aspectratio"></a> `aspectRatio?` | `number` | - | `MediaTrackSettings.aspectRatio` |
|
|
28
28
|
| <a id="autogaincontrol"></a> `autoGainControl?` | `boolean` | - | `MediaTrackSettings.autoGainControl` |
|
|
29
29
|
| <a id="backgroundblur"></a> `backgroundBlur?` | `boolean` | - | `MediaTrackSettings.backgroundBlur` |
|
|
30
30
|
| <a id="deviceid"></a> `deviceId?` | `string` | - | `MediaTrackSettings.deviceId` |
|
|
31
31
|
| <a id="displaysurface"></a> `displaySurface?` | `string` | - | `MediaTrackSettings.displaySurface` |
|
|
32
|
-
| <a id="echocancellation"></a> `echoCancellation?` | `string
|
|
32
|
+
| <a id="echocancellation"></a> `echoCancellation?` | `string \| boolean` | - | `MediaTrackSettings.echoCancellation` |
|
|
33
33
|
| <a id="facingmode"></a> `facingMode?` | `string` | - | `MediaTrackSettings.facingMode` |
|
|
34
34
|
| <a id="framerate"></a> `frameRate?` | `number` | - | `MediaTrackSettings.frameRate` |
|
|
35
35
|
| <a id="groupid"></a> `groupId?` | `string` | - | `MediaTrackSettings.groupId` |
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
| <a id="expectedaudioinput"></a> `expectedAudioInput?` | `public` | `MediaDeviceInfoLike` | The audio input device which is expected to be used for the current stream based on the provided constraints | [`MediaAttributes`](MediaAttributes.mdx).[`expectedAudioInput`](MediaAttributes.mdx#expectedaudioinput) |
|
|
14
14
|
| <a id="expectedvideoinput"></a> `expectedVideoInput?` | `public` | `MediaDeviceInfoLike` | The video input device which is expected to be used for the current stream based on the provided constraints | [`MediaAttributes`](MediaAttributes.mdx).[`expectedVideoInput`](MediaAttributes.mdx#expectedvideoinput) |
|
|
15
15
|
| <a id="status"></a> `status` | `public` | [`UserMediaStatus`](../enumerations/UserMediaStatus.mdx) | The status of the media | [`MediaAttributes`](MediaAttributes.mdx).[`status`](MediaAttributes.mdx#status) |
|
|
16
|
-
| <a id="audiomuted"></a> `audioMuted` | `public` | `boolean
|
|
17
|
-
| <a id="videomuted"></a> `videoMuted` | `public` | `boolean
|
|
16
|
+
| <a id="audiomuted"></a> `audioMuted` | `public` | `boolean \| undefined` | Current mute state of audio track `undefined` means there is no such track from the stream | [`MediaAttributes`](MediaAttributes.mdx).[`audioMuted`](MediaAttributes.mdx#audiomuted) |
|
|
17
|
+
| <a id="videomuted"></a> `videoMuted` | `public` | `boolean \| undefined` | Current mute state of video track `undefined` means there is no such track from the stream | [`MediaAttributes`](MediaAttributes.mdx).[`videoMuted`](MediaAttributes.mdx#videomuted) |
|
|
18
18
|
| <a id="audioinput"></a> `audioInput?` | `public` | `MediaDeviceInfoLike` | Audio input device is used for the audio track from the current stream | [`MediaAttributes`](MediaAttributes.mdx).[`audioInput`](MediaAttributes.mdx#audioinput) |
|
|
19
19
|
| <a id="videoinput"></a> `videoInput?` | `public` | `MediaDeviceInfoLike` | Video input device is used for the video track from the current stream | [`MediaAttributes`](MediaAttributes.mdx).[`videoInput`](MediaAttributes.mdx#videoinput) |
|
|
20
20
|
|
|
@@ -76,7 +76,7 @@ Apply the constraints to the current media
|
|
|
76
76
|
|
|
77
77
|
#### Returns
|
|
78
78
|
|
|
79
|
-
`Promise
|
|
79
|
+
`Promise<void>`
|
|
80
80
|
|
|
81
81
|
***
|
|
82
82
|
|
|
@@ -90,7 +90,7 @@ Release the media resources, e.g. camera/microphone
|
|
|
90
90
|
|
|
91
91
|
#### Returns
|
|
92
92
|
|
|
93
|
-
`Promise
|
|
93
|
+
`Promise<void>`
|
|
94
94
|
|
|
95
95
|
***
|
|
96
96
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
| <a id="expectedaudioinput"></a> `expectedAudioInput?` | `public` | `MediaDeviceInfoLike` | The audio input device which is expected to be used for the current stream based on the provided constraints |
|
|
14
14
|
| <a id="expectedvideoinput"></a> `expectedVideoInput?` | `public` | `MediaDeviceInfoLike` | The video input device which is expected to be used for the current stream based on the provided constraints |
|
|
15
15
|
| <a id="status"></a> `status` | `public` | [`UserMediaStatus`](../enumerations/UserMediaStatus.mdx) | The status of the media |
|
|
16
|
-
| <a id="audiomuted"></a> `audioMuted` | `public` | `boolean
|
|
17
|
-
| <a id="videomuted"></a> `videoMuted` | `public` | `boolean
|
|
16
|
+
| <a id="audiomuted"></a> `audioMuted` | `public` | `boolean \| undefined` | Current mute state of audio track `undefined` means there is no such track from the stream |
|
|
17
|
+
| <a id="videomuted"></a> `videoMuted` | `public` | `boolean \| undefined` | Current mute state of video track `undefined` means there is no such track from the stream |
|
|
18
18
|
| <a id="audioinput"></a> `audioInput?` | `public` | `MediaDeviceInfoLike` | Audio input device is used for the audio track from the current stream |
|
|
19
19
|
| <a id="videoinput"></a> `videoInput?` | `public` | `MediaDeviceInfoLike` | Video input device is used for the video track from the current stream |
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
| Property | Type |
|
|
4
4
|
| ------ | ------ |
|
|
5
|
-
| <a id="onaddtrack"></a> `onAddTrack` | `Signal
|
|
6
|
-
| <a id="ondeviceschanged"></a> `onDevicesChanged` | `Signal
|
|
5
|
+
| <a id="onaddtrack"></a> `onAddTrack` | `Signal<MediaStreamTrack>` |
|
|
6
|
+
| <a id="ondeviceschanged"></a> `onDevicesChanged` | `Signal<IndexedDevices>` |
|
|
7
7
|
| <a id="onmediachanged"></a> `onMediaChanged` | `Signal`\<[`Media`](Media.mdx) \| `undefined`\> |
|
|
8
8
|
| <a id="onmediatrackmuted"></a> `onMediaTrackMuted` | `Signal`\<[`MediaTrack`](MediaTrack.mdx)\> |
|
|
9
9
|
| <a id="onmediatrackresumed"></a> `onMediaTrackResumed` | `Signal`\<[`MediaTrack`](MediaTrack.mdx)\> |
|
|
10
10
|
| <a id="onmediatrackstopped"></a> `onMediaTrackStopped` | `Signal`\<[`MediaTrack`](MediaTrack.mdx)\> |
|
|
11
11
|
| <a id="onmediatracksuspended"></a> `onMediaTrackSuspended` | `Signal`\<[`MediaTrack`](MediaTrack.mdx)\> |
|
|
12
|
-
| <a id="onremovetrack"></a> `onRemoveTrack` | `Signal
|
|
12
|
+
| <a id="onremovetrack"></a> `onRemoveTrack` | `Signal<MediaStreamTrack>` |
|
|
13
13
|
| <a id="onstatuschanged"></a> `onStatusChanged` | `Signal`\<[`UserMediaStatus`](../enumerations/UserMediaStatus.mdx)\> |
|
|
14
|
-
| <a id="onupdatingaudio"></a> `onUpdatingAudio` | `Signal
|
|
15
|
-
| <a id="onupdatingvideo"></a> `onUpdatingVideo` | `Signal
|
|
14
|
+
| <a id="onupdatingaudio"></a> `onUpdatingAudio` | `Signal<boolean>` |
|
|
15
|
+
| <a id="onupdatingvideo"></a> `onUpdatingVideo` | `Signal<boolean>` |
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
| <a id="updatingvideo"></a> `updatingVideo` | `readonly` | `boolean` | - |
|
|
7
7
|
| <a id="media"></a> `media?` | `readonly` | [`Media`](Media.mdx) | Current Media |
|
|
8
8
|
| <a id="devices"></a> `devices` | `readonly` | `IndexedDevices` | Current device list |
|
|
9
|
-
| <a id="getusermedia"></a> `getUserMedia` | `public` | (
|
|
10
|
-
| <a id="getusermediaasync"></a> `getUserMediaAsync` | `public` | (
|
|
11
|
-
| <a id="tryandgetusermedia"></a> `tryAndGetUserMedia` | `public` | (
|
|
9
|
+
| <a id="getusermedia"></a> `getUserMedia` | `public` | `(constraints) => void` | Execute the media pipeline immediately with provided constraints **See** MediaDeviceRequest |
|
|
10
|
+
| <a id="getusermediaasync"></a> `getUserMediaAsync` | `public` | `(constraints) => Promise<void>` | Execute the media pipeline immediately with provided constraints. An explicit version of `getUserMedia` to make it possible to chain other async actions **See** MediaDeviceRequest |
|
|
11
|
+
| <a id="tryandgetusermedia"></a> `tryAndGetUserMedia` | `public` | `(constraints) => void` | Cross-check PermissionState and available devices before requesting user media, the request will be skipped if there is no granted device. |
|
|
@@ -10,5 +10,5 @@
|
|
|
10
10
|
| <a id="tracks"></a> `tracks` | [`MediaTrack`](MediaTrack.mdx)[] |
|
|
11
11
|
| <a id="devices"></a> `devices` | `IndexedDevices` |
|
|
12
12
|
| <a id="status"></a> `status` | [`UserMediaStatus`](../enumerations/UserMediaStatus.mdx) |
|
|
13
|
-
| <a id="stream"></a> `stream` | `MediaStream
|
|
13
|
+
| <a id="stream"></a> `stream` | `MediaStream \| undefined` |
|
|
14
14
|
| <a id="signals"></a> `signals?` | [`MediaSignals`](../type-aliases/MediaSignals.mdx) |
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
| <a id="signals"></a> `signals` | [`MediaSignals`](../type-aliases/MediaSignals.mdx) | Media signals to be used for the module **See** MediaSignals |
|
|
6
6
|
| <a id="audioprocessors"></a> `audioProcessors` | [`TrackProcessor`](../type-aliases/TrackProcessor.mdx)[] | Media Processors |
|
|
7
7
|
| <a id="videoprocessors"></a> `videoProcessors` | [`TrackProcessor`](../type-aliases/TrackProcessor.mdx)[] | - |
|
|
8
|
-
| <a id="stopvideotrackasmute"></a> `stopVideoTrackAsMute?` | () =>
|
|
9
|
-
| <a id="getmutestate"></a> `getMuteState` | () =>
|
|
10
|
-
| <a id="getdefaultconstraints"></a> `getDefaultConstraints?` | () =>
|
|
8
|
+
| <a id="stopvideotrackasmute"></a> `stopVideoTrackAsMute?` | `() => boolean` | - |
|
|
9
|
+
| <a id="getmutestate"></a> `getMuteState` | `() => DeviceMuteState` | A function to get the devices' mute state |
|
|
10
|
+
| <a id="getdefaultconstraints"></a> `getDefaultConstraints?` | `() => object` | Pass default constraints to use with get media wrappers |
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
| <a id="id"></a> `id` | `readonly` | `string` | A unique identifier for the track same as `MediaStreamTrack.id` if `track` is available otherwise it uses the `id` from the construction or the `kind`. **See** MediaTrackInit |
|
|
6
6
|
| <a id="stopped"></a> `stopped?` | `readonly` | `boolean` | It maps to MediaStreamTrack['readyState'] When `true` the track's `readyState` is `ended`, `false` means `live` otherwise the track is not available |
|
|
7
7
|
| <a id="suspended"></a> `suspended?` | `readonly` | `boolean` | Indicate that the media has been suspended by the User Agent, and it could happen at any time. `undefined` means the track is not available |
|
|
8
|
-
| <a id="kind"></a> `kind` | `readonly` | `"audioinput"
|
|
8
|
+
| <a id="kind"></a> `kind` | `readonly` | `"audioinput" \| "videoinput"` | - |
|
|
9
9
|
| <a id="label"></a> `label?` | `readonly` | `string` | - |
|
|
10
10
|
| <a id="previousmediatrack"></a> `previousMediaTrack?` | `readonly` | `MediaTrack` | - |
|
|
11
11
|
| <a id="track"></a> `track?` | `readonly` | `MediaStreamTrack` | The MediaStreamTrack object representing the track **See** https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack |
|
|
@@ -75,7 +75,7 @@ applyConstraints(constraints): Promise<void>;
|
|
|
75
75
|
|
|
76
76
|
#### Returns
|
|
77
77
|
|
|
78
|
-
`Promise
|
|
78
|
+
`Promise<void>`
|
|
79
79
|
|
|
80
80
|
***
|
|
81
81
|
|
|
@@ -87,7 +87,7 @@ release(): Promise<void>;
|
|
|
87
87
|
|
|
88
88
|
#### Returns
|
|
89
89
|
|
|
90
|
-
`Promise
|
|
90
|
+
`Promise<void>`
|
|
91
91
|
|
|
92
92
|
***
|
|
93
93
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
## Extends
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
```ts
|
|
4
|
+
- Partial<Omit<MediaTrack, "mute">>
|
|
5
|
+
```
|
|
4
6
|
|
|
5
7
|
## Properties
|
|
6
8
|
|
|
@@ -14,16 +16,16 @@
|
|
|
14
16
|
| <a id="track"></a> `track?` | `readonly` | `MediaStreamTrack` | The MediaStreamTrack object representing the track **See** https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack | - | [`MediaTrack`](MediaTrack.mdx).[`track`](MediaTrack.mdx#track) |
|
|
15
17
|
| <a id="muted"></a> `muted?` | `public` | `boolean` | The current mute state of the track. `undefined` means the track is not available | - | [`MediaTrack`](MediaTrack.mdx).[`muted`](MediaTrack.mdx#muted) |
|
|
16
18
|
| <a id="source"></a> `source?` | `readonly` | [`MediaTrack`](MediaTrack.mdx) | The source track that it is originated from | - | [`MediaTrack`](MediaTrack.mdx).[`source`](MediaTrack.mdx#source) |
|
|
17
|
-
| <a id="getsettings"></a> `getSettings?` | `public` | ()
|
|
18
|
-
| <a id="getconstraints"></a> `getConstraints?` | `public` | () =>
|
|
19
|
-
| <a id="applyconstraints"></a> `applyConstraints?` | `public` | (
|
|
20
|
-
| <a id="release"></a> `release?` | `public` | () =>
|
|
21
|
-
| <a id="clone"></a> `clone?` | `public` | (`signals?`, `label?`)
|
|
22
|
-
| <a id="tojson"></a> `toJSON?` | `public` | () =>
|
|
23
|
-
| <a id="kind"></a> `kind` | `public` | `"audioinput"
|
|
24
|
-
| <a id="input"></a> `input` | `public` | `MediaDeviceInfoLike
|
|
19
|
+
| <a id="getsettings"></a> `getSettings?` | `public` | () =\> [`ExtendedMediaTrackSettings`](ExtendedMediaTrackSettings.mdx) | - | - | [`MediaTrack`](MediaTrack.mdx).[`getSettings`](MediaTrack.mdx#getsettings) |
|
|
20
|
+
| <a id="getconstraints"></a> `getConstraints?` | `public` | `() => InputDeviceConstraint` | - | - | [`MediaTrack`](MediaTrack.mdx).[`getConstraints`](MediaTrack.mdx#getconstraints) |
|
|
21
|
+
| <a id="applyconstraints"></a> `applyConstraints?` | `public` | `(constraints) => Promise<void>` | - | - | [`MediaTrack`](MediaTrack.mdx).[`applyConstraints`](MediaTrack.mdx#applyconstraints) |
|
|
22
|
+
| <a id="release"></a> `release?` | `public` | `() => Promise<void>` | - | - | [`MediaTrack`](MediaTrack.mdx).[`release`](MediaTrack.mdx#release) |
|
|
23
|
+
| <a id="clone"></a> `clone?` | `public` | (`signals?`, `label?`) =\> [`MediaTrack`](MediaTrack.mdx) | - | - | [`MediaTrack`](MediaTrack.mdx).[`clone`](MediaTrack.mdx#clone) |
|
|
24
|
+
| <a id="tojson"></a> `toJSON?` | `public` | `() => unknown` | - | - | [`MediaTrack`](MediaTrack.mdx).[`toJSON`](MediaTrack.mdx#tojson) |
|
|
25
|
+
| <a id="kind"></a> `kind` | `public` | `"audioinput" \| "videoinput"` | - | [`MediaTrack`](MediaTrack.mdx).[`kind`](MediaTrack.mdx#kind) | - |
|
|
26
|
+
| <a id="input"></a> `input` | `public` | `MediaDeviceInfoLike \| undefined` | The `MediaDeviceInfo` object representing the device that the track is connected to. **See** https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo | [`MediaTrack`](MediaTrack.mdx).[`input`](MediaTrack.mdx#input) | - |
|
|
25
27
|
| <a id="expectedinput"></a> `expectedInput?` | `public` | `MediaDeviceInfoLike` | The `MediaDeviceInfo` object representing the device that the track is expected to be connected to. **See** https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo | [`MediaTrack`](MediaTrack.mdx).[`expectedInput`](MediaTrack.mdx#expectedinput) | - |
|
|
26
28
|
| <a id="constraints"></a> `constraints` | `public` | `InputDeviceConstraint` | - | - | - |
|
|
27
29
|
| <a id="overridemute"></a> `overrideMute?` | `public` | `boolean` | - | - | - |
|
|
28
30
|
| <a id="signals"></a> `signals?` | `public` | [`MediaSignals`](../type-aliases/MediaSignals.mdx) | - | - | - |
|
|
29
|
-
| <a id="mute"></a> `mute?` | `public` | (
|
|
31
|
+
| <a id="mute"></a> `mute?` | `public` | `(toMute, self, soft?) => void` | Overriding Mute the track | - | - |
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
| <a id="audioinputerror"></a> `audioInputError?` | `EventErrorCallback` |
|
|
10
10
|
| <a id="applychangeserror"></a> `applyChangesError?` | `EventErrorCallback` |
|
|
11
11
|
| <a id="revertchangeserror"></a> `revertChangesError?` | `EventErrorCallback` |
|
|
12
|
-
| <a id="audiomuted"></a> `audioMuted?` | `EventCallback
|
|
13
|
-
| <a id="audiosuspended"></a> `audioSuspended?` | `EventCallback
|
|
14
|
-
| <a id="updatingmain"></a> `updatingMain?` | `EventCallback
|
|
15
|
-
| <a id="updatingpreviewaudio"></a> `updatingPreviewAudio?` | `EventCallback
|
|
16
|
-
| <a id="updatingpreviewvideo"></a> `updatingPreviewVideo?` | `EventCallback
|
|
17
|
-
| <a id="videomuted"></a> `videoMuted?` | `EventCallback
|
|
18
|
-
| <a id="videosuspended"></a> `videoSuspended?` | `EventCallback
|
|
12
|
+
| <a id="audiomuted"></a> `audioMuted?` | `EventCallback<boolean \| undefined>` |
|
|
13
|
+
| <a id="audiosuspended"></a> `audioSuspended?` | `EventCallback<boolean \| undefined>` |
|
|
14
|
+
| <a id="updatingmain"></a> `updatingMain?` | `EventCallback<boolean>` |
|
|
15
|
+
| <a id="updatingpreviewaudio"></a> `updatingPreviewAudio?` | `EventCallback<boolean>` |
|
|
16
|
+
| <a id="updatingpreviewvideo"></a> `updatingPreviewVideo?` | `EventCallback<boolean>` |
|
|
17
|
+
| <a id="videomuted"></a> `videoMuted?` | `EventCallback<boolean \| undefined>` |
|
|
18
|
+
| <a id="videosuspended"></a> `videoSuspended?` | `EventCallback<boolean \| undefined>` |
|
|
19
19
|
| <a id="unsubscribemain"></a> `unsubscribeMain?` | [`Unsubscribe`](../type-aliases/Unsubscribe.mdx) |
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
| <a id="updatingmain"></a> `updatingMain` | `boolean` |
|
|
12
12
|
| <a id="updatingpreviewaudio"></a> `updatingPreviewAudio` | `boolean` |
|
|
13
13
|
| <a id="updatingpreviewvideo"></a> `updatingPreviewVideo` | `boolean` |
|
|
14
|
-
| <a id="cleanup"></a> `cleanup` | () =>
|
|
14
|
+
| <a id="cleanup"></a> `cleanup` | `() => Promise<void>` |
|
|
15
15
|
|
|
16
16
|
## Methods
|
|
17
17
|
|
|
@@ -83,7 +83,7 @@ applyChanges(force?): Promise<void>;
|
|
|
83
83
|
|
|
84
84
|
#### Returns
|
|
85
85
|
|
|
86
|
-
`Promise
|
|
86
|
+
`Promise<void>`
|
|
87
87
|
|
|
88
88
|
***
|
|
89
89
|
|
|
@@ -95,7 +95,7 @@ revertChanges(): Promise<void>;
|
|
|
95
95
|
|
|
96
96
|
#### Returns
|
|
97
97
|
|
|
98
|
-
`Promise
|
|
98
|
+
`Promise<void>`
|
|
99
99
|
|
|
100
100
|
***
|
|
101
101
|
|
|
@@ -163,7 +163,7 @@ onUpdatingPreviewAudio(callback): Unsubscribe;
|
|
|
163
163
|
|
|
164
164
|
| Parameter | Type |
|
|
165
165
|
| ------ | ------ |
|
|
166
|
-
| `callback` | `EventCallback
|
|
166
|
+
| `callback` | `EventCallback<boolean>` |
|
|
167
167
|
|
|
168
168
|
#### Returns
|
|
169
169
|
|
|
@@ -181,7 +181,7 @@ onUpdatingPreviewVideo(callback): Unsubscribe;
|
|
|
181
181
|
|
|
182
182
|
| Parameter | Type |
|
|
183
183
|
| ------ | ------ |
|
|
184
|
-
| `callback` | `EventCallback
|
|
184
|
+
| `callback` | `EventCallback<boolean>` |
|
|
185
185
|
|
|
186
186
|
#### Returns
|
|
187
187
|
|
|
@@ -199,7 +199,7 @@ onUpdatingMain(callback): Unsubscribe;
|
|
|
199
199
|
|
|
200
200
|
| Parameter | Type |
|
|
201
201
|
| ------ | ------ |
|
|
202
|
-
| `callback` | `EventCallback
|
|
202
|
+
| `callback` | `EventCallback<boolean>` |
|
|
203
203
|
|
|
204
204
|
#### Returns
|
|
205
205
|
|
|
@@ -289,7 +289,7 @@ onAudioMuted(callback): Unsubscribe;
|
|
|
289
289
|
|
|
290
290
|
| Parameter | Type |
|
|
291
291
|
| ------ | ------ |
|
|
292
|
-
| `callback` | `EventCallback
|
|
292
|
+
| `callback` | `EventCallback<boolean \| undefined>` |
|
|
293
293
|
|
|
294
294
|
#### Returns
|
|
295
295
|
|
|
@@ -307,7 +307,7 @@ onAudioSuspended(callback): Unsubscribe;
|
|
|
307
307
|
|
|
308
308
|
| Parameter | Type |
|
|
309
309
|
| ------ | ------ |
|
|
310
|
-
| `callback` | `EventCallback
|
|
310
|
+
| `callback` | `EventCallback<boolean \| undefined>` |
|
|
311
311
|
|
|
312
312
|
#### Returns
|
|
313
313
|
|
|
@@ -325,7 +325,7 @@ onVideoMuted(callback): Unsubscribe;
|
|
|
325
325
|
|
|
326
326
|
| Parameter | Type |
|
|
327
327
|
| ------ | ------ |
|
|
328
|
-
| `callback` | `EventCallback
|
|
328
|
+
| `callback` | `EventCallback<boolean \| undefined>` |
|
|
329
329
|
|
|
330
330
|
#### Returns
|
|
331
331
|
|
|
@@ -343,7 +343,7 @@ onVideoSuspended(callback): Unsubscribe;
|
|
|
343
343
|
|
|
344
344
|
| Parameter | Type |
|
|
345
345
|
| ------ | ------ |
|
|
346
|
-
| `callback` | `EventCallback
|
|
346
|
+
| `callback` | `EventCallback<boolean \| undefined>` |
|
|
347
347
|
|
|
348
348
|
#### Returns
|
|
349
349
|
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
| Property | Type | Description |
|
|
4
4
|
| ------ | ------ | ------ |
|
|
5
|
-
| <a id="getcurrentdevices"></a> `getCurrentDevices` | () =>
|
|
6
|
-
| <a id="getcurrentmedia"></a> `getCurrentMedia` | ()
|
|
7
|
-
| <a id="updatemainstream"></a> `updateMainStream` | (
|
|
5
|
+
| <a id="getcurrentdevices"></a> `getCurrentDevices` | `() => IndexedDevices` | - |
|
|
6
|
+
| <a id="getcurrentmedia"></a> `getCurrentMedia` | () =\> [`Media`](Media.mdx) \| `undefined` | - |
|
|
7
|
+
| <a id="updatemainstream"></a> `updateMainStream` | `(request) => Promise<void>` | - |
|
|
8
8
|
| <a id="mainmediasignal"></a> `mainMediaSignal` | `Signal`\<[`Media`](Media.mdx) \| `undefined`, [`Media`](Media.mdx) \| `undefined`\> | - |
|
|
9
9
|
| <a id="signals"></a> `signals` | [`MediaSignals`](../type-aliases/MediaSignals.mdx) | - |
|
|
10
|
-
| <a id="onended"></a> `onEnded?` | () =>
|
|
10
|
+
| <a id="onended"></a> `onEnded?` | `() => void` | - |
|
|
11
11
|
| <a id="fftsize"></a> `fftSize?` | `number` | - |
|
|
12
|
-
| <a id="queueoptions"></a> `queueOptions?` | `Partial
|
|
12
|
+
| <a id="queueoptions"></a> `queueOptions?` | `Partial<AsyncQueueOptions>` | - |
|
|
13
13
|
| <a id="audioprocessors"></a> `audioProcessors` | [`TrackProcessor`](../type-aliases/TrackProcessor.mdx)[] | - |
|
|
14
14
|
| <a id="videoprocessors"></a> `videoProcessors` | [`TrackProcessor`](../type-aliases/TrackProcessor.mdx)[] | - |
|
|
15
|
-
| <a id="getdefaultconstraints"></a> `getDefaultConstraints?` | () =>
|
|
16
|
-
| <a id="stopvideotrackasmute"></a> `stopVideoTrackAsMute?` | () =>
|
|
15
|
+
| <a id="getdefaultconstraints"></a> `getDefaultConstraints?` | `() => object` | Pass default constraints to use with get media wrappers |
|
|
16
|
+
| <a id="stopvideotrackasmute"></a> `stopVideoTrackAsMute?` | `() => boolean` | - |
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
| Property | Type | Description |
|
|
4
4
|
| ------ | ------ | ------ |
|
|
5
5
|
| <a id="vadthrottlems"></a> `vadThrottleMS?` | `number` | Voice Activity Detection in millisecond |
|
|
6
|
-
| <a id="shoulddetectvoiceactivity"></a> `shouldDetectVoiceActivity` | () =>
|
|
6
|
+
| <a id="shoulddetectvoiceactivity"></a> `shouldDetectVoiceActivity` | `() => boolean` | Whether or not to detect voice activity |
|
|
@@ -9,11 +9,13 @@ type GetUserMediaProcess = (request) => Promise<Media>;
|
|
|
9
9
|
| `request` | \{ `constraints`: `MediaDeviceRequest`; `originalConstraints`: `MediaDeviceRequest`; `permission`: \{ `audio`: `PermissionState`; `video`: `PermissionState`; \}; `currentMedia`: [`Media`](../interfaces/Media.mdx) \| `undefined`; \} |
|
|
10
10
|
| `request.constraints` | `MediaDeviceRequest` |
|
|
11
11
|
| `request.originalConstraints` | `MediaDeviceRequest` |
|
|
12
|
-
| `request.permission` |
|
|
12
|
+
| `request.permission` | `{ audio: PermissionState; video: PermissionState; }` |
|
|
13
13
|
| `request.permission.audio` | `PermissionState` |
|
|
14
14
|
| `request.permission.video` | `PermissionState` |
|
|
15
15
|
| `request.currentMedia` | [`Media`](../interfaces/Media.mdx) \| `undefined` |
|
|
16
16
|
|
|
17
17
|
## Returns
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
```ts
|
|
20
|
+
Promise<Media>
|
|
21
|
+
```
|
package/dist/index.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export { createAudioMixingProcess } from './audioMixingProcessor';
|
|
|
9
9
|
export { createAudioStreamProcess } from './audioProcessor';
|
|
10
10
|
export { createMedia } from './media';
|
|
11
11
|
export { createVideoStreamProcess } from './videoProcessor';
|
|
12
|
-
export { setLogger
|
|
12
|
+
export { setLogger } from './logger';
|
package/dist/index.js
CHANGED
|
@@ -9,4 +9,4 @@ export { createAudioMixingProcess } from './audioMixingProcessor';
|
|
|
9
9
|
export { createAudioStreamProcess } from './audioProcessor';
|
|
10
10
|
export { createMedia } from './media';
|
|
11
11
|
export { createVideoStreamProcess } from './videoProcessor';
|
|
12
|
-
export { setLogger
|
|
12
|
+
export { setLogger } from './logger';
|
package/dist/logger.d.ts
CHANGED
|
@@ -7,5 +7,3 @@ export declare function setLogger(newLogger: Logger): void;
|
|
|
7
7
|
* @param metaBase - The meta data which will always be included into the log
|
|
8
8
|
*/
|
|
9
9
|
export declare const createModuleLogger: (metaBase: unknown) => Logger;
|
|
10
|
-
export declare const createLogProxyHandler: <T extends object>(logger: Logger, name: string, scope: string) => ProxyHandler<T>;
|
|
11
|
-
export declare const proxyWithLog: (logger: Logger, scope: string) => <T extends object>(obj: T, name: string) => T;
|
package/dist/logger.js
CHANGED
|
@@ -23,27 +23,3 @@ export const createModuleLogger = (metaBase) => {
|
|
|
23
23
|
return log;
|
|
24
24
|
}, {});
|
|
25
25
|
};
|
|
26
|
-
export const createLogProxyHandler = (logger, name, scope) => {
|
|
27
|
-
return {
|
|
28
|
-
get: (target, p, receiver) => {
|
|
29
|
-
const value = Reflect.get(target, p, receiver);
|
|
30
|
-
logger.debug({ scope, name, prop: p, value }, `called get ${name}[${String(p)}]`);
|
|
31
|
-
if (typeof value === 'function') {
|
|
32
|
-
return new Proxy(value, {
|
|
33
|
-
apply: (fn, thisArg, args) => {
|
|
34
|
-
logger.debug({ scope, name, method: String(p), args }, `called ${name}.${String(p)}(...)`);
|
|
35
|
-
return Reflect.apply(fn, thisArg, args);
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
return value;
|
|
40
|
-
},
|
|
41
|
-
set: (target, p, value, receiver) => {
|
|
42
|
-
logger.info({ scope, name, prop: p, value }, `called set ${name}[${String(p)}]`);
|
|
43
|
-
return Reflect.set(target, p, value, receiver);
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
export const proxyWithLog = (logger, scope) => (obj, name) => {
|
|
48
|
-
return new Proxy(obj, createLogProxyHandler(logger, name, scope));
|
|
49
|
-
};
|
|
@@ -365,7 +365,25 @@ export const createPreviewStreamController = ({ getCurrentDevices, getCurrentMed
|
|
|
365
365
|
};
|
|
366
366
|
const cleanup = async () => {
|
|
367
367
|
logger.debug('Cleanup preview controller');
|
|
368
|
-
|
|
368
|
+
// Drop pending jobs, then enqueue release so it runs after any
|
|
369
|
+
// in-flight `processAndUpdateMedia`. Releasing concurrently with an
|
|
370
|
+
// in-flight `videoProcessor.process()` would tear down the worker
|
|
371
|
+
// pipeline mid-flight.
|
|
372
|
+
queue.empty();
|
|
373
|
+
const media = props.media;
|
|
374
|
+
if (media) {
|
|
375
|
+
await new Promise((resolve, reject) => {
|
|
376
|
+
queue.enqueue(async () => {
|
|
377
|
+
try {
|
|
378
|
+
await media.release();
|
|
379
|
+
resolve();
|
|
380
|
+
}
|
|
381
|
+
catch (error) {
|
|
382
|
+
reject(error);
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
});
|
|
386
|
+
}
|
|
369
387
|
cleanUpMainSubscription();
|
|
370
388
|
for (const unsub of subscriptions) {
|
|
371
389
|
unsub?.();
|
package/dist/utils.js
CHANGED
|
@@ -182,9 +182,9 @@ export const createMediaTrack = (trackInit) => {
|
|
|
182
182
|
},
|
|
183
183
|
async release() {
|
|
184
184
|
trackUnsubscribe?.();
|
|
185
|
-
trackInit.track?.stop();
|
|
186
185
|
await trackInit.release?.();
|
|
187
186
|
await trackInit.previousMediaTrack?.release();
|
|
187
|
+
trackInit.track?.stop();
|
|
188
188
|
trackInit.signals?.onMediaTrackStopped?.emit(this);
|
|
189
189
|
},
|
|
190
190
|
toJSON() {
|
|
@@ -783,12 +783,21 @@ export const createMediaProcessor = ({ audioProcessors, videoProcessors, onProce
|
|
|
783
783
|
}
|
|
784
784
|
catch (error) {
|
|
785
785
|
if (error instanceof Error) {
|
|
786
|
+
if (track.stopped) {
|
|
787
|
+
// Ignore the error as track stopped
|
|
788
|
+
return track;
|
|
789
|
+
}
|
|
786
790
|
onProcessingError?.(error, track);
|
|
787
791
|
}
|
|
788
792
|
return track;
|
|
789
793
|
}
|
|
790
794
|
};
|
|
791
795
|
return async (newTracks) => {
|
|
792
|
-
return await Promise.all(newTracks.
|
|
796
|
+
return await Promise.all(newTracks.flatMap(track => {
|
|
797
|
+
if (track.stopped === undefined || track.stopped) {
|
|
798
|
+
return [];
|
|
799
|
+
}
|
|
800
|
+
return [processTrack(track)];
|
|
801
|
+
}));
|
|
793
802
|
};
|
|
794
803
|
};
|
package/dist/videoProcessor.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isRenderEffects } from '@pexip/media-processor';
|
|
2
2
|
import { extractConstraints, getValueFromConstrainNumber, } from '@pexip/media-control';
|
|
3
|
-
import { hasOwn, isEmpty } from '@pexip/utils';
|
|
3
|
+
import { hasOwn, isEmpty, proxyWithLog } from '@pexip/utils';
|
|
4
4
|
import { createMediaTrack, getBlurKernelSize, getTentBlurSize } from './utils';
|
|
5
|
-
import { logger
|
|
5
|
+
import { logger } from './logger';
|
|
6
6
|
import { isVideoContentHint } from './typeGuard';
|
|
7
7
|
import { PROCESSOR_LABELS } from './constants';
|
|
8
8
|
const FEATURE_KEYS = {
|
|
@@ -324,7 +324,7 @@ label = PROCESSOR_LABELS.VideoProcessor, referenceProcessingHeight, maskCombineR
|
|
|
324
324
|
return async (prevMediaTrack) => {
|
|
325
325
|
const features = updateFeatureProps(prevMediaTrack.getConstraints(), props);
|
|
326
326
|
const shouldEnabled = shouldEnable();
|
|
327
|
-
if (!shouldEnabled || !prevMediaTrack.track) {
|
|
327
|
+
if (!shouldEnabled || !prevMediaTrack.track || prevMediaTrack.stopped) {
|
|
328
328
|
logger.debug({
|
|
329
329
|
label,
|
|
330
330
|
features,
|
|
@@ -391,7 +391,7 @@ label = PROCESSOR_LABELS.VideoProcessor, referenceProcessingHeight, maskCombineR
|
|
|
391
391
|
// the last frame is black to avoid frozen frame in a gateway call
|
|
392
392
|
trackReleaseTimeoutID = window.setTimeout(() => {
|
|
393
393
|
track.stop();
|
|
394
|
-
videoProcessor.close();
|
|
394
|
+
void videoProcessor.close();
|
|
395
395
|
void this?.release?.();
|
|
396
396
|
trackReleaseTimeoutID = 0;
|
|
397
397
|
}, 500);
|
|
@@ -407,7 +407,7 @@ label = PROCESSOR_LABELS.VideoProcessor, referenceProcessingHeight, maskCombineR
|
|
|
407
407
|
},
|
|
408
408
|
signals,
|
|
409
409
|
async release() {
|
|
410
|
-
videoProcessor.close();
|
|
410
|
+
await videoProcessor.close();
|
|
411
411
|
await this.previousMediaTrack?.release();
|
|
412
412
|
},
|
|
413
413
|
async applyConstraints(constraints) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pexip/media",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.1.0",
|
|
4
4
|
"description": "Home for media related stuff",
|
|
5
5
|
"homepage": "https://developer.pexip.com",
|
|
6
6
|
"bugs": "https://gitlab.com/pexip/zoo/issues",
|
|
@@ -47,15 +47,15 @@
|
|
|
47
47
|
"docs": "typedoc"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@pexip/media-control": "22.
|
|
51
|
-
"@pexip/media-processor": "22.
|
|
50
|
+
"@pexip/media-control": "22.1.0",
|
|
51
|
+
"@pexip/media-processor": "22.1.0",
|
|
52
52
|
"@pexip/signal": "16.9.5",
|
|
53
|
-
"@pexip/utils": "17.
|
|
53
|
+
"@pexip/utils": "17.4.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@jest/globals": "^29.5.12",
|
|
57
57
|
"@pexip/bundler": "18.2.1",
|
|
58
|
-
"@swc/core": "^1.
|
|
58
|
+
"@swc/core": "^1.15.33",
|
|
59
59
|
"@swc/jest": "^0.2.39",
|
|
60
60
|
"jest": "^29.5.12",
|
|
61
61
|
"jest-junit": "^16.0.0",
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
```ts
|
|
2
|
-
function proxyWithLog(logger, scope): <T>(obj, name) => T;
|
|
3
|
-
```
|
|
4
|
-
|
|
5
|
-
## Parameters
|
|
6
|
-
|
|
7
|
-
| Parameter | Type |
|
|
8
|
-
| ------ | ------ |
|
|
9
|
-
| `logger` | `Logger` |
|
|
10
|
-
| `scope` | `string` |
|
|
11
|
-
|
|
12
|
-
## Returns
|
|
13
|
-
|
|
14
|
-
```ts
|
|
15
|
-
<T>(obj, name): T;
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
### Type Parameters
|
|
19
|
-
|
|
20
|
-
| Type Parameter |
|
|
21
|
-
| ------ |
|
|
22
|
-
| `T` *extends* `object` |
|
|
23
|
-
|
|
24
|
-
### Parameters
|
|
25
|
-
|
|
26
|
-
| Parameter | Type |
|
|
27
|
-
| ------ | ------ |
|
|
28
|
-
| `obj` | `T` |
|
|
29
|
-
| `name` | `string` |
|
|
30
|
-
|
|
31
|
-
### Returns
|
|
32
|
-
|
|
33
|
-
`T`
|