@pexip/media 17.0.0 → 17.1.1

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 CHANGED
@@ -1,5 +1,28 @@
1
1
  # @pexip/media
2
2
 
3
+ ## 17.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 51b06b3c: Fix initial media status derive
8
+ - @pexip/media-control@17.1.1
9
+ - @pexip/media-processor@17.1.1
10
+
11
+ ## 17.1.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 4298b039: Allow setting default constraints to `false` Fix Audio mixing
16
+ processor to return immediately when no main tracks
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [4298b039]
21
+ - Updated dependencies [9fa7884d]
22
+ - @pexip/media-control@17.1.0
23
+ - @pexip/utils@16.7.0
24
+ - @pexip/media-processor@17.1.0
25
+
3
26
  ## 17.0.0
4
27
 
5
28
  ### Patch Changes
package/README.md CHANGED
@@ -3,21 +3,25 @@
3
3
  A package to connect `@pexip/media-control` and `@pexip/media-processor` to
4
4
  create a streamlined media process
5
5
 
6
+ ## Install
7
+
8
+ `npm install @pexip/media`
9
+
6
10
  ## Overview
7
11
 
8
12
  ### `createMedia`
9
13
 
10
- It create an object to interact with the media stream, which is usually used for
11
- our main stream.
14
+ It create's an object to interact with the media stream, which is usually used
15
+ for our main stream.
12
16
 
13
- Its majority features:
17
+ Its major features:
14
18
 
15
19
  - Create a media pipeline to get and process the `MediaStream`, see
16
20
  `createMediaPipeline`. It also provides some media features including:
17
21
 
18
22
  - Video Processing - background blur
19
23
  - Audio Processing - Noise Suppression
20
- - Audio Signal Detection - To detect if the active audio input device capturing any audio
24
+ - Audio Signal Detection - To detect if the active audio input device is capturing any audio
21
25
  - Voice Activity Detection - To detect if there is any voice activity
22
26
 
23
27
  - Provide media input related information
@@ -36,8 +40,8 @@ A processor to process video from the stream to be used together with
36
40
 
37
41
  ### `createPreviewController`
38
42
 
39
- It create an object to control the provided media stream, e.g. change the
40
- audio/video input device and apply changes to main stream when necessary.
43
+ It create's an object to control the provided media stream, e.g. change the
44
+ audio/video input device and apply changes to the main stream when necessary.
41
45
 
42
46
  ## Usage
43
47
 
@@ -259,7 +263,7 @@ signals.onStreamTrackEnabled.add(track => {
259
263
  console.log(track);
260
264
  });
261
265
 
262
- // Later we can initial a gUM to get a MediaStream
266
+ // Later we can initialize a gUM to get a MediaStream
263
267
  mediaController.getUserMedia({
264
268
  audio: {
265
269
  sampleRate: 48000, // Ideal sample rate for our own noise suppression implementation
@@ -291,7 +295,7 @@ mediaController.media.status = UserMediaStatus.Initial;
291
295
  // Stop the `MediaStream`
292
296
  await mediaController.media.release();
293
297
 
294
- // Later we can make changes to the media on-demand without initiate a new gUM call
298
+ // Later we can make changes to the media on-demand without initiating a new gUM call
295
299
 
296
300
  // Turn off background blur
297
301
  await mediaController.media.applyConstraints({
@@ -305,7 +309,7 @@ await mediaController.media.applyConstraints({
305
309
  await mediaController.media.applyConstraints({
306
310
  audio: {denoise: true, noiseSuppression: false},
307
311
  });
308
- // Use build-in noise suppression
312
+ // Use built-in noise suppression
309
313
  await mediaController.media.applyConstraints({
310
314
  audio: {denoise: false, noiseSuppression: true},
311
315
  });
@@ -345,6 +349,4 @@ const controller = createPreviewController({
345
349
  },
346
350
  psySegScriptLoaded: true,
347
351
  });
348
-
349
- // Want to learn more? Please checkout the `@pexip/media-demo` sample app to try
350
352
  ```
package/dist/index.d.ts CHANGED
@@ -369,8 +369,8 @@ interface MediaOptions {
369
369
  * Pass default constraints to use with get media wrappers
370
370
  */
371
371
  getDefaultConstraints?: () => {
372
- audio?: InputConstraintSet;
373
- video?: InputConstraintSet;
372
+ audio?: InputConstraintSet | false;
373
+ video?: InputConstraintSet | false;
374
374
  };
375
375
  }
376
376
  interface MediaProps {
package/dist/index.mjs CHANGED
@@ -234,7 +234,8 @@ var deriveInitialPermissionStatus = async (prevStatus, getPermissionState = getI
234
234
  if (isInitialPermissions(prevStatus) || isRejected(prevStatus)) {
235
235
  return prevStatus;
236
236
  }
237
- if (areBothGranted(prevStatus)) {
237
+ const { audio, video } = await getPermissionState();
238
+ if (areBothGranted(prevStatus) || audio === "granted" && video === "granted") {
238
239
  return "initial-permissions-granted" /* InitialPermissionsGranted */;
239
240
  }
240
241
  if (isGrantedAudio(prevStatus)) {
@@ -1825,7 +1826,7 @@ var createAudioMixingProcess = (getCurrrentMedia, scope = "mixer") => {
1825
1826
  }
1826
1827
  return Promise.resolve();
1827
1828
  });
1828
- if (!media.stream) {
1829
+ if (!media.stream || !mainTrack && !displayTrack) {
1829
1830
  return media;
1830
1831
  }
1831
1832
  if (!mainTrack && displayTrack) {
@@ -2148,16 +2149,18 @@ var createMedia = ({
2148
2149
  });
2149
2150
  }
2150
2151
  };
2151
- const mergeMediaConstraints = (constraints) => ({
2152
- audio: mergeConstraints(getDefaultConstraints().audio)(
2153
- constraints.audio
2154
- ),
2155
- video: mergeConstraints(getDefaultConstraints().video)(
2156
- constraints.video
2157
- )
2158
- });
2152
+ const mergeMediaConstraints = (constraints) => {
2153
+ const { audio, video } = getDefaultConstraints();
2154
+ return {
2155
+ audio: audio === false ? false : mergeConstraints(audio)(constraints.audio),
2156
+ video: video === false ? false : mergeConstraints(video)(constraints.video)
2157
+ };
2158
+ };
2159
2159
  const getUserMediaAsync = async (constraints) => {
2160
- queue.enqueue(async () => await updateMedia(constraints), false);
2160
+ queue.enqueue(
2161
+ async () => await updateMedia(mergeMediaConstraints(constraints)),
2162
+ false
2163
+ );
2161
2164
  await queue.execute();
2162
2165
  };
2163
2166
  const getUserMedia3 = (constraints) => {
@@ -2172,11 +2175,14 @@ var createMedia = ({
2172
2175
  { status: props.media.status },
2173
2176
  "Current Permission State"
2174
2177
  );
2178
+ const mergedConstraints = mergeMediaConstraints(constraints);
2179
+ props.media.constraints = mergedConstraints;
2175
2180
  props.devices = await getDevices2();
2181
+ if (!mergedConstraints.audio && !mergedConstraints.video) {
2182
+ return;
2183
+ }
2176
2184
  if (isInitialPermissionsGranted(props.media.status)) {
2177
- return await updateMedia(
2178
- mergeMediaConstraints(constraints)
2179
- );
2185
+ return await updateMedia(mergedConstraints);
2180
2186
  }
2181
2187
  });
2182
2188
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pexip/media",
3
- "version": "17.0.0",
3
+ "version": "17.1.1",
4
4
  "description": "Home for media related stuff",
5
5
  "homepage": "https://gitlab.com/pexip/zoo",
6
6
  "bugs": "https://gitlab.com/pexip/zoo/issues",
@@ -32,10 +32,10 @@
32
32
  "typecheck": "yarn tsc --noEmit -p ."
33
33
  },
34
34
  "dependencies": {
35
- "@pexip/media-control": "17.0.0",
36
- "@pexip/media-processor": "17.0.0",
35
+ "@pexip/media-control": "17.1.1",
36
+ "@pexip/media-processor": "17.1.1",
37
37
  "@pexip/signal": "16.5.0",
38
- "@pexip/utils": "16.6.0"
38
+ "@pexip/utils": "16.7.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@jest/globals": "^29.5.0",