@webex/media-helpers 3.0.0-stream-classes.4 → 3.0.0-stream-classes.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 (2) hide show
  1. package/README.md +17 -25
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -31,20 +31,16 @@ Noise reduction (e.g., background noise removal)
31
31
  The virtual background effect provides a virtual background for video calling. The virtual background may be an image, an mp4 video, or the user's background with blur applied.
32
32
 
33
33
  **Applying the effect**
34
- 1. Create a new camera track instance by using LocalCameraTrack() method.
34
+ 1. Create a new camera stream instance by using createCameraStream() method.
35
35
  2. Create a VirtualBackgroundEffect instance by passing appropriate constraints.
36
- 3. Use addEffect() method on cameraTrack to apply effect on it.
37
- 4. Enable the effect after adding it to cameraTrack using enable() method available on effect. Effect will be enabled on cameraTrack.
36
+ 3. Use addEffect() method on cameraStream to apply effect on it.
37
+ 4. Enable the effect after adding it to cameraStream using enable() method available on effect. Effect will be enabled on cameraStream.
38
38
 
39
39
  ```javascript
40
- import {LocalCameraTrack, VirtualBackgroundEffect} from '@webex/media-helpers';
40
+ import {createCameraStream, VirtualBackgroundEffect} from '@webex/media-helpers';
41
41
 
42
- // Create a new video stream by a getting user's video media.
43
- const stream = await navigator.mediaDevices.getUserMedia({ video: { width, height } });
44
-
45
- const videoTrackFromLocalStream = stream.getVideoTracks()[0];
46
-
47
- const cameraTrack = new LocalCameraTrack(new MediaStream([videoTrackFromLocalStream]));
42
+ // Create a new video stream.
43
+ const cameraStream = createCameraStream(optionalVideoConstraints);
48
44
 
49
45
  // Create the effect.
50
46
  const effect = new VirtualBackgroundEffect({
@@ -54,10 +50,10 @@ const effect = new VirtualBackgroundEffect({
54
50
  quality: `LOW`,
55
51
  });
56
52
 
57
- // add the effect on the input camera track.
58
- await cameraTrack.addEffect("background-blur", effect);
53
+ // add the effect on the input camera stream.
54
+ await cameraStream.addEffect("background-blur", effect);
59
55
 
60
- //enable the effect once it is added to the track
56
+ //enable the effect once it is added to the stream
61
57
  await effect.enable()
62
58
  ```
63
59
 
@@ -65,20 +61,16 @@ await effect.enable()
65
61
  The noise reduction effect removes background noise from an audio stream to provide clear audio for calling.
66
62
 
67
63
  **Applying the effect**
68
- 1. Create a new microphone track instance by using LocalMicrophoneTrack() method.
64
+ 1. Create a new microphone stream instance by using createMicrophoneStream() method.
69
65
  2. Create a NoiseReductionEffect instance by passing appropriate constraints.
70
- 3. Use addEffect() method on microphoneTrack to apply effect on it.
71
- 4. Enable the effect after adding it to microphoneTrack using enable() method available on effect. Effect will be enabled on microphoneTrack.
66
+ 3. Use addEffect() method on microphoneStream to apply effect on it.
67
+ 4. Enable the effect after adding it to microphoneStream using enable() method available on effect. Effect will be enabled on microphoneStream.
72
68
 
73
69
  ```javascript
74
- import {LocalMicrophoneTrack, NoiseReductionEffect} from '@webex/media-helpers';
75
-
76
- // Create a new audio stream by getting a user's audio media.
77
- const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
78
-
79
- const audioTrackFromLocalStream = stream.getAudioTracks()[0];
70
+ import {createMicrophoneStream, NoiseReductionEffect} from '@webex/media-helpers';
80
71
 
81
- const microphoneTrack = new LocalMicrophoneTrack(new MediaStream([audioTrackFromLocalStream]));
72
+ // Create a new audio stream.
73
+ const microphoneStream = createMicrophoneStream(optionalAudioConstraints);
82
74
 
83
75
  // Create the effect.
84
76
  const effect = new NoiseReductionEffect({
@@ -86,8 +78,8 @@ const effect = new NoiseReductionEffect({
86
78
  mode: 'WORKLET', // or 'LEGACY'
87
79
  });
88
80
 
89
- // add the effect on microphone track.
90
- await microphoneTrack.addEffect("background-noise-removal", effect);
81
+ // add the effect on microphone stream.
82
+ await microphoneStream.addEffect("background-noise-removal", effect);
91
83
 
92
84
  //enable the effect once it is added to the track
93
85
  await effect.enable()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/media-helpers",
3
- "version": "3.0.0-stream-classes.4",
3
+ "version": "3.0.0-stream-classes.5",
4
4
  "description": "",
5
5
  "license": "Cisco EULA (https://www.cisco.com/c/en/us/products/end-user-license-agreement.html)",
6
6
  "main": "dist/index.js",
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "@webex/internal-media-core": "2.0.3",
18
18
  "@webex/ts-events": "^1.1.0",
19
- "@webex/web-media-effects": "^2.8.0"
19
+ "@webex/web-media-effects": "^2.13.3"
20
20
  },
21
21
  "browserify": {
22
22
  "transform": [