@webex/media-helpers 3.0.0-next.3 → 3.0.0-next.4

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/LICENSE CHANGED
@@ -1,2 +1,2 @@
1
- All contents are licensed under the Cisco EULA
1
+ All contents are licensed under the Cisco EULA
2
2
  (https://www.cisco.com/c/en/us/products/end-user-license-agreement.html)
package/README.md CHANGED
@@ -1,106 +1,106 @@
1
- # @webex/media-helpers
2
-
3
- [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
4
-
5
- > Media helpers
6
-
7
- This is an internal Cisco Webex plugin. As such, it does not strictly adhere to semantic versioning. Use at your own risk. If you're not working on one of our first party clients, please look at our [developer api](https://developer.webex.com/) and stick to our public plugins.
8
-
9
- - [@webex/media-helpers](#webexmedia-helpers)
10
- - [Install](#install)
11
- - [Usage](#usage)
12
- - [Maintainers](#maintainers)
13
- - [Contribute](#contribute)
14
- - [License](#license)
15
-
16
- ## Install
17
-
18
- ```bash
19
- npm install --save @webex/media-helpers
20
- ```
21
-
22
- ## Usage
23
-
24
- ### Effects
25
- There are two effects included in this package:
26
-
27
- Virtual background (e.g., blur, image replacement, video replacement)
28
- Noise reduction (e.g., background noise removal)
29
-
30
- #### Virtual background
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
-
33
- **Applying the effect**
34
- 1. Create a new camera track instance by using LocalCameraTrack() method.
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.
38
-
39
- ```javascript
40
- import {LocalCameraTrack, VirtualBackgroundEffect} from '@webex/media-helpers';
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]));
48
-
49
- // Create the effect.
50
- const effect = new VirtualBackgroundEffect({
51
- authToken: '<encoded-string>',
52
- mode: `BLUR`,
53
- blurStrength: `STRONG`,
54
- quality: `LOW`,
55
- });
56
-
57
- // add the effect on the input camera track.
58
- await cameraTrack.addEffect("background-blur", effect);
59
-
60
- //enable the effect once it is added to the track
61
- await effect.enable()
62
- ```
63
-
64
- #### Noise reduction
65
- The noise reduction effect removes background noise from an audio stream to provide clear audio for calling.
66
-
67
- **Applying the effect**
68
- 1. Create a new microphone track instance by using LocalMicrophoneTrack() method.
69
- 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.
72
-
73
- ```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];
80
-
81
- const microphoneTrack = new LocalMicrophoneTrack(new MediaStream([audioTrackFromLocalStream]));
82
-
83
- // Create the effect.
84
- const effect = new NoiseReductionEffect({
85
- authToken: '<encoded-string>',
86
- mode: 'WORKLET', // or 'LEGACY'
87
- });
88
-
89
- // add the effect on microphone track.
90
- await microphoneTrack.addEffect("background-noise-removal", effect);
91
-
92
- //enable the effect once it is added to the track
93
- await effect.enable()
94
- ```
95
-
96
- ## Maintainers
97
-
98
- This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
99
-
100
- ## Contribute
101
-
102
- Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
103
-
104
- ## License
105
-
106
- © 2016-2022 Cisco and/or its affiliates. All Rights Reserved.
1
+ # @webex/media-helpers
2
+
3
+ [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
4
+
5
+ > Media helpers
6
+
7
+ This is an internal Cisco Webex plugin. As such, it does not strictly adhere to semantic versioning. Use at your own risk. If you're not working on one of our first party clients, please look at our [developer api](https://developer.webex.com/) and stick to our public plugins.
8
+
9
+ - [@webex/media-helpers](#webexmedia-helpers)
10
+ - [Install](#install)
11
+ - [Usage](#usage)
12
+ - [Maintainers](#maintainers)
13
+ - [Contribute](#contribute)
14
+ - [License](#license)
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ npm install --save @webex/media-helpers
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ### Effects
25
+ There are two effects included in this package:
26
+
27
+ Virtual background (e.g., blur, image replacement, video replacement)
28
+ Noise reduction (e.g., background noise removal)
29
+
30
+ #### Virtual background
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
+
33
+ **Applying the effect**
34
+ 1. Create a new camera track instance by using LocalCameraTrack() method.
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.
38
+
39
+ ```javascript
40
+ import {LocalCameraTrack, VirtualBackgroundEffect} from '@webex/media-helpers';
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]));
48
+
49
+ // Create the effect.
50
+ const effect = new VirtualBackgroundEffect({
51
+ authToken: '<encoded-string>',
52
+ mode: `BLUR`,
53
+ blurStrength: `STRONG`,
54
+ quality: `LOW`,
55
+ });
56
+
57
+ // add the effect on the input camera track.
58
+ await cameraTrack.addEffect("background-blur", effect);
59
+
60
+ //enable the effect once it is added to the track
61
+ await effect.enable()
62
+ ```
63
+
64
+ #### Noise reduction
65
+ The noise reduction effect removes background noise from an audio stream to provide clear audio for calling.
66
+
67
+ **Applying the effect**
68
+ 1. Create a new microphone track instance by using LocalMicrophoneTrack() method.
69
+ 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.
72
+
73
+ ```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];
80
+
81
+ const microphoneTrack = new LocalMicrophoneTrack(new MediaStream([audioTrackFromLocalStream]));
82
+
83
+ // Create the effect.
84
+ const effect = new NoiseReductionEffect({
85
+ authToken: '<encoded-string>',
86
+ mode: 'WORKLET', // or 'LEGACY'
87
+ });
88
+
89
+ // add the effect on microphone track.
90
+ await microphoneTrack.addEffect("background-noise-removal", effect);
91
+
92
+ //enable the effect once it is added to the track
93
+ await effect.enable()
94
+ ```
95
+
96
+ ## Maintainers
97
+
98
+ This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
99
+
100
+ ## Contribute
101
+
102
+ Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
103
+
104
+ ## License
105
+
106
+ © 2016-2022 Cisco and/or its affiliates. All Rights Reserved.
package/babel.config.json CHANGED
@@ -1,13 +1,13 @@
1
- {
2
- "presets": [
3
- [
4
- "@babel/preset-env",
5
- {
6
- "targets": {
7
- "node": "current"
8
- }
9
- }
10
- ],
11
- "@babel/preset-typescript"
12
- ],
1
+ {
2
+ "presets": [
3
+ [
4
+ "@babel/preset-env",
5
+ {
6
+ "targets": {
7
+ "node": "current"
8
+ }
9
+ }
10
+ ],
11
+ "@babel/preset-typescript"
12
+ ],
13
13
  }
@@ -1,13 +1,13 @@
1
- import { VideoDeviceConstraints } from '@webex/internal-media-core';
2
- export declare enum FacingMode {
3
- user = "user",
4
- environment = "environment"
5
- }
6
- export declare enum DisplaySurface {
7
- browser = "browser",
8
- monitor = "monitor",
9
- window = "window"
10
- }
11
- export declare const PresetCameraConstraints: {
12
- [key: string]: VideoDeviceConstraints;
13
- };
1
+ import { VideoDeviceConstraints } from '@webex/internal-media-core';
2
+ export declare enum FacingMode {
3
+ user = "user",
4
+ environment = "environment"
5
+ }
6
+ export declare enum DisplaySurface {
7
+ browser = "browser",
8
+ monitor = "monitor",
9
+ window = "window"
10
+ }
11
+ export declare const PresetCameraConstraints: {
12
+ [key: string]: VideoDeviceConstraints;
13
+ };
@@ -1 +1 @@
1
- {"version":3,"names":["FacingMode","exports","DisplaySurface","PresetCameraConstraints","frameRate","width","height"],"sources":["constants.ts"],"sourcesContent":["import {VideoDeviceConstraints} from '@webex/internal-media-core';\n\nexport enum FacingMode {\n user = 'user',\n environment = 'environment',\n}\n\n// can be used later on when we add constraints in create display track\nexport enum DisplaySurface {\n browser = 'browser',\n monitor = 'monitor',\n window = 'window',\n}\n\nexport const PresetCameraConstraints: {[key: string]: VideoDeviceConstraints} = {\n '1080p': {frameRate: 30, width: 1920, height: 1080},\n\n '720p': {frameRate: 30, width: 1280, height: 720},\n\n '480p': {frameRate: 30, width: 640, height: 480},\n\n '360p': {frameRate: 30, width: 640, height: 360},\n\n '240p': {frameRate: 30, width: 320, height: 240},\n\n '180p': {frameRate: 30, width: 320, height: 180},\n\n '120p': {frameRate: 30, width: 160, height: 120},\n};\n"],"mappings":";;;;;;;IAEYA,UAAU,EAKtB;AAAAC,OAAA,CAAAD,UAAA,GAAAA,UAAA;AAAA,WALYA,UAAU;EAAVA,UAAU;EAAVA,UAAU;AAAA,GAAVA,UAAU,KAAAC,OAAA,CAAAD,UAAA,GAAVA,UAAU;AAAA,IAMVE,cAAc;AAAAD,OAAA,CAAAC,cAAA,GAAAA,cAAA;AAAA,WAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;AAAA,GAAdA,cAAc,KAAAD,OAAA,CAAAC,cAAA,GAAdA,cAAc;AAMnB,IAAMC,uBAAgE,GAAG;EAC9E,OAAO,EAAE;IAACC,SAAS,EAAE,EAAE;IAAEC,KAAK,EAAE,IAAI;IAAEC,MAAM,EAAE;EAAI,CAAC;EAEnD,MAAM,EAAE;IAACF,SAAS,EAAE,EAAE;IAAEC,KAAK,EAAE,IAAI;IAAEC,MAAM,EAAE;EAAG,CAAC;EAEjD,MAAM,EAAE;IAACF,SAAS,EAAE,EAAE;IAAEC,KAAK,EAAE,GAAG;IAAEC,MAAM,EAAE;EAAG,CAAC;EAEhD,MAAM,EAAE;IAACF,SAAS,EAAE,EAAE;IAAEC,KAAK,EAAE,GAAG;IAAEC,MAAM,EAAE;EAAG,CAAC;EAEhD,MAAM,EAAE;IAACF,SAAS,EAAE,EAAE;IAAEC,KAAK,EAAE,GAAG;IAAEC,MAAM,EAAE;EAAG,CAAC;EAEhD,MAAM,EAAE;IAACF,SAAS,EAAE,EAAE;IAAEC,KAAK,EAAE,GAAG;IAAEC,MAAM,EAAE;EAAG,CAAC;EAEhD,MAAM,EAAE;IAACF,SAAS,EAAE,EAAE;IAAEC,KAAK,EAAE,GAAG;IAAEC,MAAM,EAAE;EAAG;AACjD,CAAC;AAACL,OAAA,CAAAE,uBAAA,GAAAA,uBAAA"}
1
+ {"version":3,"names":["FacingMode","exports","DisplaySurface","PresetCameraConstraints","frameRate","width","height"],"sources":["constants.ts"],"sourcesContent":["import {VideoDeviceConstraints} from '@webex/internal-media-core';\r\n\r\nexport enum FacingMode {\r\n user = 'user',\r\n environment = 'environment',\r\n}\r\n\r\n// can be used later on when we add constraints in create display track\r\nexport enum DisplaySurface {\r\n browser = 'browser',\r\n monitor = 'monitor',\r\n window = 'window',\r\n}\r\n\r\nexport const PresetCameraConstraints: {[key: string]: VideoDeviceConstraints} = {\r\n '1080p': {frameRate: 30, width: 1920, height: 1080},\r\n\r\n '720p': {frameRate: 30, width: 1280, height: 720},\r\n\r\n '480p': {frameRate: 30, width: 640, height: 480},\r\n\r\n '360p': {frameRate: 30, width: 640, height: 360},\r\n\r\n '240p': {frameRate: 30, width: 320, height: 240},\r\n\r\n '180p': {frameRate: 30, width: 320, height: 180},\r\n\r\n '120p': {frameRate: 30, width: 160, height: 120},\r\n};\r\n"],"mappings":";;;;;;;IAEYA,UAAU,EAKtB;AAAAC,OAAA,CAAAD,UAAA,GAAAA,UAAA;AAAA,WALYA,UAAU;EAAVA,UAAU;EAAVA,UAAU;AAAA,GAAVA,UAAU,KAAAC,OAAA,CAAAD,UAAA,GAAVA,UAAU;AAAA,IAMVE,cAAc;AAAAD,OAAA,CAAAC,cAAA,GAAAA,cAAA;AAAA,WAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;AAAA,GAAdA,cAAc,KAAAD,OAAA,CAAAC,cAAA,GAAdA,cAAc;AAMnB,IAAMC,uBAAgE,GAAG;EAC9E,OAAO,EAAE;IAACC,SAAS,EAAE,EAAE;IAAEC,KAAK,EAAE,IAAI;IAAEC,MAAM,EAAE;EAAI,CAAC;EAEnD,MAAM,EAAE;IAACF,SAAS,EAAE,EAAE;IAAEC,KAAK,EAAE,IAAI;IAAEC,MAAM,EAAE;EAAG,CAAC;EAEjD,MAAM,EAAE;IAACF,SAAS,EAAE,EAAE;IAAEC,KAAK,EAAE,GAAG;IAAEC,MAAM,EAAE;EAAG,CAAC;EAEhD,MAAM,EAAE;IAACF,SAAS,EAAE,EAAE;IAAEC,KAAK,EAAE,GAAG;IAAEC,MAAM,EAAE;EAAG,CAAC;EAEhD,MAAM,EAAE;IAACF,SAAS,EAAE,EAAE;IAAEC,KAAK,EAAE,GAAG;IAAEC,MAAM,EAAE;EAAG,CAAC;EAEhD,MAAM,EAAE;IAACF,SAAS,EAAE,EAAE;IAAEC,KAAK,EAAE,GAAG;IAAEC,MAAM,EAAE;EAAG,CAAC;EAEhD,MAAM,EAAE;IAACF,SAAS,EAAE,EAAE;IAAEC,KAAK,EAAE,GAAG;IAAEC,MAAM,EAAE;EAAG;AACjD,CAAC;AAACL,OAAA,CAAAE,uBAAA,GAAAA,uBAAA"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { getDevices, LocalStream, LocalDisplayStream, LocalSystemAudioStream, LocalStreamEventNames, StreamEventNames, type ServerMuteReason, LocalMicrophoneStreamEventNames, LocalCameraStreamEventNames, LocalMicrophoneStream, LocalCameraStream, createMicrophoneStream, createCameraStream, createDisplayStream, createDisplayStreamWithAudio, } from './webrtc-core';
2
- export { NoiseReductionEffect, VirtualBackgroundEffect } from '@webex/web-media-effects';
3
- export type { NoiseReductionEffectOptions, VirtualBackgroundEffectOptions, } from '@webex/web-media-effects';
4
- export { FacingMode, DisplaySurface, PresetCameraConstraints } from './constants';
1
+ export { getDevices, LocalStream, LocalDisplayStream, LocalSystemAudioStream, LocalStreamEventNames, StreamEventNames, type ServerMuteReason, LocalMicrophoneStreamEventNames, LocalCameraStreamEventNames, LocalMicrophoneStream, LocalCameraStream, createMicrophoneStream, createCameraStream, createDisplayStream, createDisplayStreamWithAudio, } from './webrtc-core';
2
+ export { NoiseReductionEffect, VirtualBackgroundEffect } from '@webex/web-media-effects';
3
+ export type { NoiseReductionEffectOptions, VirtualBackgroundEffectOptions, } from '@webex/web-media-effects';
4
+ export { FacingMode, DisplaySurface, PresetCameraConstraints } from './constants';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_webrtcCore","require","_webMediaEffects","_constants"],"sources":["index.ts"],"sourcesContent":["export {\n getDevices,\n LocalStream,\n LocalDisplayStream,\n LocalSystemAudioStream,\n LocalStreamEventNames,\n StreamEventNames,\n type ServerMuteReason,\n LocalMicrophoneStreamEventNames,\n LocalCameraStreamEventNames,\n LocalMicrophoneStream,\n LocalCameraStream,\n createMicrophoneStream,\n createCameraStream,\n createDisplayStream,\n createDisplayStreamWithAudio,\n} from './webrtc-core';\n\nexport {NoiseReductionEffect, VirtualBackgroundEffect} from '@webex/web-media-effects';\nexport type {\n NoiseReductionEffectOptions,\n VirtualBackgroundEffectOptions,\n} from '@webex/web-media-effects';\n\nexport {FacingMode, DisplaySurface, PresetCameraConstraints} from './constants';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAkBA,IAAAC,gBAAA,GAAAD,OAAA;AAMA,IAAAE,UAAA,GAAAF,OAAA"}
1
+ {"version":3,"names":["_webrtcCore","require","_webMediaEffects","_constants"],"sources":["index.ts"],"sourcesContent":["export {\r\n getDevices,\r\n LocalStream,\r\n LocalDisplayStream,\r\n LocalSystemAudioStream,\r\n LocalStreamEventNames,\r\n StreamEventNames,\r\n type ServerMuteReason,\r\n LocalMicrophoneStreamEventNames,\r\n LocalCameraStreamEventNames,\r\n LocalMicrophoneStream,\r\n LocalCameraStream,\r\n createMicrophoneStream,\r\n createCameraStream,\r\n createDisplayStream,\r\n createDisplayStreamWithAudio,\r\n} from './webrtc-core';\r\n\r\nexport {NoiseReductionEffect, VirtualBackgroundEffect} from '@webex/web-media-effects';\r\nexport type {\r\n NoiseReductionEffectOptions,\r\n VirtualBackgroundEffectOptions,\r\n} from '@webex/web-media-effects';\r\n\r\nexport {FacingMode, DisplaySurface, PresetCameraConstraints} from './constants';\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAkBA,IAAAC,gBAAA,GAAAD,OAAA;AAMA,IAAAE,UAAA,GAAAF,OAAA"}
@@ -1,48 +1,48 @@
1
- import { AudioDeviceConstraints, LocalDisplayStream, LocalSystemAudioStream, LocalMicrophoneStream as WcmeLocalMicrophoneStream, LocalCameraStream as WcmeLocalCameraStream, VideoDeviceConstraints } from '@webex/internal-media-core';
2
- import { TypedEvent } from '@webex/ts-events';
3
- export { getDevices, LocalStream, LocalDisplayStream, LocalSystemAudioStream, LocalStreamEventNames, StreamEventNames, RemoteStream, } from '@webex/internal-media-core';
4
- export type ServerMuteReason = 'remotelyMuted' | 'clientRequestFailed' | 'localUnmuteRequired';
5
- export declare enum LocalMicrophoneStreamEventNames {
6
- ServerMuted = "muted:byServer"
7
- }
8
- export declare enum LocalCameraStreamEventNames {
9
- ServerMuted = "muted:byServer"
10
- }
11
- export declare class LocalMicrophoneStream extends WcmeLocalMicrophoneStream {
12
- private unmuteAllowed;
13
- [LocalMicrophoneStreamEventNames.ServerMuted]: TypedEvent<(muted: boolean, reason: ServerMuteReason) => void>;
14
- /**
15
- * @internal
16
- */
17
- setUnmuteAllowed(allowed: any): void;
18
- /**
19
- * @returns true if user is allowed to unmute the Stream, false otherwise
20
- */
21
- isUnmuteAllowed(): boolean;
22
- setMuted(muted: boolean): void;
23
- /**
24
- * @internal
25
- */
26
- setServerMuted(muted: boolean, reason: ServerMuteReason): void;
27
- }
28
- export declare class LocalCameraStream extends WcmeLocalCameraStream {
29
- private unmuteAllowed;
30
- [LocalCameraStreamEventNames.ServerMuted]: TypedEvent<(muted: boolean, reason: ServerMuteReason) => void>;
31
- /**
32
- * @internal
33
- */
34
- setUnmuteAllowed(allowed: any): void;
35
- /**
36
- * @returns true if user is allowed to unmute the Stream, false otherwise
37
- */
38
- isUnmuteAllowed(): boolean;
39
- setMuted(muted: boolean): void;
40
- /**
41
- * @internal
42
- */
43
- setServerMuted(muted: boolean, reason: ServerMuteReason): void;
44
- }
45
- export declare const createMicrophoneStream: (constraints?: AudioDeviceConstraints) => Promise<LocalMicrophoneStream>;
46
- export declare const createCameraStream: (constraints?: VideoDeviceConstraints) => Promise<LocalCameraStream>;
47
- export declare const createDisplayStream: () => Promise<LocalDisplayStream>;
48
- export declare const createDisplayStreamWithAudio: () => Promise<[LocalDisplayStream, LocalSystemAudioStream]>;
1
+ import { AudioDeviceConstraints, LocalDisplayStream, LocalSystemAudioStream, LocalMicrophoneStream as WcmeLocalMicrophoneStream, LocalCameraStream as WcmeLocalCameraStream, VideoDeviceConstraints } from '@webex/internal-media-core';
2
+ import { TypedEvent } from '@webex/ts-events';
3
+ export { getDevices, LocalStream, LocalDisplayStream, LocalSystemAudioStream, LocalStreamEventNames, StreamEventNames, RemoteStream, } from '@webex/internal-media-core';
4
+ export type ServerMuteReason = 'remotelyMuted' | 'clientRequestFailed' | 'localUnmuteRequired';
5
+ export declare enum LocalMicrophoneStreamEventNames {
6
+ ServerMuted = "muted:byServer"
7
+ }
8
+ export declare enum LocalCameraStreamEventNames {
9
+ ServerMuted = "muted:byServer"
10
+ }
11
+ export declare class LocalMicrophoneStream extends WcmeLocalMicrophoneStream {
12
+ private unmuteAllowed;
13
+ [LocalMicrophoneStreamEventNames.ServerMuted]: TypedEvent<(muted: boolean, reason: ServerMuteReason) => void>;
14
+ /**
15
+ * @internal
16
+ */
17
+ setUnmuteAllowed(allowed: any): void;
18
+ /**
19
+ * @returns true if user is allowed to unmute the Stream, false otherwise
20
+ */
21
+ isUnmuteAllowed(): boolean;
22
+ setMuted(muted: boolean): void;
23
+ /**
24
+ * @internal
25
+ */
26
+ setServerMuted(muted: boolean, reason: ServerMuteReason): void;
27
+ }
28
+ export declare class LocalCameraStream extends WcmeLocalCameraStream {
29
+ private unmuteAllowed;
30
+ [LocalCameraStreamEventNames.ServerMuted]: TypedEvent<(muted: boolean, reason: ServerMuteReason) => void>;
31
+ /**
32
+ * @internal
33
+ */
34
+ setUnmuteAllowed(allowed: any): void;
35
+ /**
36
+ * @returns true if user is allowed to unmute the Stream, false otherwise
37
+ */
38
+ isUnmuteAllowed(): boolean;
39
+ setMuted(muted: boolean): void;
40
+ /**
41
+ * @internal
42
+ */
43
+ setServerMuted(muted: boolean, reason: ServerMuteReason): void;
44
+ }
45
+ export declare const createMicrophoneStream: (constraints?: AudioDeviceConstraints) => Promise<LocalMicrophoneStream>;
46
+ export declare const createCameraStream: (constraints?: VideoDeviceConstraints) => Promise<LocalCameraStream>;
47
+ export declare const createDisplayStream: () => Promise<LocalDisplayStream>;
48
+ export declare const createDisplayStreamWithAudio: () => Promise<[LocalDisplayStream, LocalSystemAudioStream]>;
@@ -94,15 +94,15 @@ var LocalMicrophoneStream = /*#__PURE__*/function (_WcmeLocalMicrophoneS) {
94
94
  (0, _createClass2.default)(LocalMicrophoneStream, [{
95
95
  key: "setUnmuteAllowed",
96
96
  value:
97
- /**
98
- * @internal
97
+ /**
98
+ * @internal
99
99
  */
100
100
  function setUnmuteAllowed(allowed) {
101
101
  this.unmuteAllowed = allowed;
102
102
  }
103
103
 
104
- /**
105
- * @returns true if user is allowed to unmute the Stream, false otherwise
104
+ /**
105
+ * @returns true if user is allowed to unmute the Stream, false otherwise
106
106
  */
107
107
  }, {
108
108
  key: "isUnmuteAllowed",
@@ -120,8 +120,8 @@ var LocalMicrophoneStream = /*#__PURE__*/function (_WcmeLocalMicrophoneS) {
120
120
  return (0, _get2.default)((0, _getPrototypeOf2.default)(LocalMicrophoneStream.prototype), "setMuted", this).call(this, muted);
121
121
  }
122
122
 
123
- /**
124
- * @internal
123
+ /**
124
+ * @internal
125
125
  */
126
126
  }, {
127
127
  key: "setServerMuted",
@@ -153,15 +153,15 @@ var LocalCameraStream = /*#__PURE__*/function (_WcmeLocalCameraStrea) {
153
153
  (0, _createClass2.default)(LocalCameraStream, [{
154
154
  key: "setUnmuteAllowed",
155
155
  value:
156
- /**
157
- * @internal
156
+ /**
157
+ * @internal
158
158
  */
159
159
  function setUnmuteAllowed(allowed) {
160
160
  this.unmuteAllowed = allowed;
161
161
  }
162
162
 
163
- /**
164
- * @returns true if user is allowed to unmute the Stream, false otherwise
163
+ /**
164
+ * @returns true if user is allowed to unmute the Stream, false otherwise
165
165
  */
166
166
  }, {
167
167
  key: "isUnmuteAllowed",
@@ -179,8 +179,8 @@ var LocalCameraStream = /*#__PURE__*/function (_WcmeLocalCameraStrea) {
179
179
  return (0, _get2.default)((0, _getPrototypeOf2.default)(LocalCameraStream.prototype), "setMuted", this).call(this, muted);
180
180
  }
181
181
 
182
- /**
183
- * @internal
182
+ /**
183
+ * @internal
184
184
  */
185
185
  }, {
186
186
  key: "setServerMuted",
@@ -1 +1 @@
1
- {"version":3,"names":["_internalMediaCore","require","_tsEvents","_LocalMicrophoneStrea","_LocalCameraStreamEve","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","_Reflect$construct","arguments","apply","_possibleConstructorReturn2","Reflect","sham","Proxy","Boolean","prototype","valueOf","call","e","LocalMicrophoneStreamEventNames","exports","LocalCameraStreamEventNames","ServerMuted","LocalMicrophoneStream","_WcmeLocalMicrophoneS","_inherits2","_super","_this","_classCallCheck2","_len","length","args","Array","_key","concat","_defineProperty2","_assertThisInitialized2","TypedEvent","_createClass2","key","value","setUnmuteAllowed","allowed","unmuteAllowed","isUnmuteAllowed","setMuted","muted","Error","_get2","setServerMuted","reason","emit","WcmeLocalMicrophoneStream","LocalCameraStream","_WcmeLocalCameraStrea","_super2","_this2","_len2","_key2","WcmeLocalCameraStream","createMicrophoneStream","constraints","wcmeCreateMicrophoneStream","createCameraStream","wcmeCreateCameraStream","createDisplayStream","wcmeCreateDisplayStream","LocalDisplayStream","createDisplayStreamWithAudio","wcmeCreateDisplayStreamWithAudio","LocalSystemAudioStream"],"sources":["webrtc-core.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-misused-new */\n/* eslint-disable valid-jsdoc */\n/* eslint-disable require-jsdoc */\nimport {\n AudioDeviceConstraints,\n createCameraStream as wcmeCreateCameraStream,\n createDisplayStream as wcmeCreateDisplayStream,\n createDisplayStreamWithAudio as wcmeCreateDisplayStreamWithAudio,\n createMicrophoneStream as wcmeCreateMicrophoneStream,\n LocalDisplayStream,\n LocalSystemAudioStream,\n LocalMicrophoneStream as WcmeLocalMicrophoneStream,\n LocalCameraStream as WcmeLocalCameraStream,\n VideoDeviceConstraints,\n} from '@webex/internal-media-core';\nimport {TypedEvent} from '@webex/ts-events';\n\nexport {\n getDevices,\n LocalStream,\n LocalDisplayStream,\n LocalSystemAudioStream,\n LocalStreamEventNames,\n StreamEventNames,\n RemoteStream,\n} from '@webex/internal-media-core';\n\nexport type ServerMuteReason =\n | 'remotelyMuted' // other user has remotely muted us\n | 'clientRequestFailed' // client called setMuted() but server request failed\n | 'localUnmuteRequired'; // server forced the client to be unmuted\n\n// these events are in addition to WCME events. This will be properly typed once webrtc-core event types inheritance is fixed\nexport enum LocalMicrophoneStreamEventNames {\n ServerMuted = 'muted:byServer',\n}\n\n// these events are in addition to WCME events. This will be properly typed once webrtc-core event types inheritance is fixed\nexport enum LocalCameraStreamEventNames {\n ServerMuted = 'muted:byServer',\n}\n\nexport class LocalMicrophoneStream extends WcmeLocalMicrophoneStream {\n private unmuteAllowed = true;\n\n [LocalMicrophoneStreamEventNames.ServerMuted] = new TypedEvent<\n (muted: boolean, reason: ServerMuteReason) => void\n >();\n\n /**\n * @internal\n */\n setUnmuteAllowed(allowed) {\n this.unmuteAllowed = allowed;\n }\n\n /**\n * @returns true if user is allowed to unmute the Stream, false otherwise\n */\n isUnmuteAllowed() {\n return this.unmuteAllowed;\n }\n\n setMuted(muted: boolean): void {\n if (!muted) {\n if (!this.isUnmuteAllowed()) {\n throw new Error('Unmute is not allowed');\n }\n }\n\n return super.setMuted(muted);\n }\n\n /**\n * @internal\n */\n setServerMuted(muted: boolean, reason: ServerMuteReason) {\n if (muted !== this.muted) {\n this.setMuted(muted);\n this[LocalMicrophoneStreamEventNames.ServerMuted].emit(muted, reason);\n }\n }\n}\n\nexport class LocalCameraStream extends WcmeLocalCameraStream {\n private unmuteAllowed = true;\n\n [LocalCameraStreamEventNames.ServerMuted] = new TypedEvent<\n (muted: boolean, reason: ServerMuteReason) => void\n >();\n\n /**\n * @internal\n */\n setUnmuteAllowed(allowed) {\n this.unmuteAllowed = allowed;\n }\n\n /**\n * @returns true if user is allowed to unmute the Stream, false otherwise\n */\n isUnmuteAllowed() {\n return this.unmuteAllowed;\n }\n\n setMuted(muted: boolean): void {\n if (!muted) {\n if (!this.isUnmuteAllowed()) {\n throw new Error('Unmute is not allowed');\n }\n }\n\n return super.setMuted(muted);\n }\n\n /**\n * @internal\n */\n setServerMuted(muted: boolean, reason: ServerMuteReason) {\n if (muted !== this.muted) {\n this.setMuted(muted);\n this[LocalCameraStreamEventNames.ServerMuted].emit(muted, reason);\n }\n }\n}\n\nexport const createMicrophoneStream = (constraints?: AudioDeviceConstraints) =>\n wcmeCreateMicrophoneStream(LocalMicrophoneStream, constraints);\n\nexport const createCameraStream = (constraints?: VideoDeviceConstraints) =>\n wcmeCreateCameraStream(LocalCameraStream, constraints);\n\nexport const createDisplayStream = () => wcmeCreateDisplayStream(LocalDisplayStream);\n\nexport const createDisplayStreamWithAudio = () =>\n wcmeCreateDisplayStreamWithAudio(LocalDisplayStream, LocalSystemAudioStream);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,kBAAA,GAAAC,OAAA;AAYA,IAAAC,SAAA,GAAAD,OAAA;AAA4C,IAAAE,qBAAA,EAAAC,qBAAA;AAAA,SAAAC,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,CAAAC,OAAA,EAAAN,OAAA,GAAAO,MAAA,MAAA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BAAA,GAAAA,mBAAA;AAE9E,IAAMG,4BAA4B,GAAG,SAA/BA,4BAA4BA,CAAA;EAAA,OACvC,IAAAC,+CAAgC,EAACF,qCAAkB,EAAEG,yCAAsB,CAAC;AAAA;AAAClD,OAAA,CAAAgD,4BAAA,GAAAA,4BAAA"}
1
+ {"version":3,"names":["_internalMediaCore","require","_tsEvents","_LocalMicrophoneStrea","_LocalCameraStreamEve","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","_Reflect$construct","arguments","apply","_possibleConstructorReturn2","Reflect","sham","Proxy","Boolean","prototype","valueOf","call","e","LocalMicrophoneStreamEventNames","exports","LocalCameraStreamEventNames","ServerMuted","LocalMicrophoneStream","_WcmeLocalMicrophoneS","_inherits2","_super","_this","_classCallCheck2","_len","length","args","Array","_key","concat","_defineProperty2","_assertThisInitialized2","TypedEvent","_createClass2","key","value","setUnmuteAllowed","allowed","unmuteAllowed","isUnmuteAllowed","setMuted","muted","Error","_get2","setServerMuted","reason","emit","WcmeLocalMicrophoneStream","LocalCameraStream","_WcmeLocalCameraStrea","_super2","_this2","_len2","_key2","WcmeLocalCameraStream","createMicrophoneStream","constraints","wcmeCreateMicrophoneStream","createCameraStream","wcmeCreateCameraStream","createDisplayStream","wcmeCreateDisplayStream","LocalDisplayStream","createDisplayStreamWithAudio","wcmeCreateDisplayStreamWithAudio","LocalSystemAudioStream"],"sources":["webrtc-core.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-misused-new */\r\n/* eslint-disable valid-jsdoc */\r\n/* eslint-disable require-jsdoc */\r\nimport {\r\n AudioDeviceConstraints,\r\n createCameraStream as wcmeCreateCameraStream,\r\n createDisplayStream as wcmeCreateDisplayStream,\r\n createDisplayStreamWithAudio as wcmeCreateDisplayStreamWithAudio,\r\n createMicrophoneStream as wcmeCreateMicrophoneStream,\r\n LocalDisplayStream,\r\n LocalSystemAudioStream,\r\n LocalMicrophoneStream as WcmeLocalMicrophoneStream,\r\n LocalCameraStream as WcmeLocalCameraStream,\r\n VideoDeviceConstraints,\r\n} from '@webex/internal-media-core';\r\nimport {TypedEvent} from '@webex/ts-events';\r\n\r\nexport {\r\n getDevices,\r\n LocalStream,\r\n LocalDisplayStream,\r\n LocalSystemAudioStream,\r\n LocalStreamEventNames,\r\n StreamEventNames,\r\n RemoteStream,\r\n} from '@webex/internal-media-core';\r\n\r\nexport type ServerMuteReason =\r\n | 'remotelyMuted' // other user has remotely muted us\r\n | 'clientRequestFailed' // client called setMuted() but server request failed\r\n | 'localUnmuteRequired'; // server forced the client to be unmuted\r\n\r\n// these events are in addition to WCME events. This will be properly typed once webrtc-core event types inheritance is fixed\r\nexport enum LocalMicrophoneStreamEventNames {\r\n ServerMuted = 'muted:byServer',\r\n}\r\n\r\n// these events are in addition to WCME events. This will be properly typed once webrtc-core event types inheritance is fixed\r\nexport enum LocalCameraStreamEventNames {\r\n ServerMuted = 'muted:byServer',\r\n}\r\n\r\nexport class LocalMicrophoneStream extends WcmeLocalMicrophoneStream {\r\n private unmuteAllowed = true;\r\n\r\n [LocalMicrophoneStreamEventNames.ServerMuted] = new TypedEvent<\r\n (muted: boolean, reason: ServerMuteReason) => void\r\n >();\r\n\r\n /**\r\n * @internal\r\n */\r\n setUnmuteAllowed(allowed) {\r\n this.unmuteAllowed = allowed;\r\n }\r\n\r\n /**\r\n * @returns true if user is allowed to unmute the Stream, false otherwise\r\n */\r\n isUnmuteAllowed() {\r\n return this.unmuteAllowed;\r\n }\r\n\r\n setMuted(muted: boolean): void {\r\n if (!muted) {\r\n if (!this.isUnmuteAllowed()) {\r\n throw new Error('Unmute is not allowed');\r\n }\r\n }\r\n\r\n return super.setMuted(muted);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n setServerMuted(muted: boolean, reason: ServerMuteReason) {\r\n if (muted !== this.muted) {\r\n this.setMuted(muted);\r\n this[LocalMicrophoneStreamEventNames.ServerMuted].emit(muted, reason);\r\n }\r\n }\r\n}\r\n\r\nexport class LocalCameraStream extends WcmeLocalCameraStream {\r\n private unmuteAllowed = true;\r\n\r\n [LocalCameraStreamEventNames.ServerMuted] = new TypedEvent<\r\n (muted: boolean, reason: ServerMuteReason) => void\r\n >();\r\n\r\n /**\r\n * @internal\r\n */\r\n setUnmuteAllowed(allowed) {\r\n this.unmuteAllowed = allowed;\r\n }\r\n\r\n /**\r\n * @returns true if user is allowed to unmute the Stream, false otherwise\r\n */\r\n isUnmuteAllowed() {\r\n return this.unmuteAllowed;\r\n }\r\n\r\n setMuted(muted: boolean): void {\r\n if (!muted) {\r\n if (!this.isUnmuteAllowed()) {\r\n throw new Error('Unmute is not allowed');\r\n }\r\n }\r\n\r\n return super.setMuted(muted);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n setServerMuted(muted: boolean, reason: ServerMuteReason) {\r\n if (muted !== this.muted) {\r\n this.setMuted(muted);\r\n this[LocalCameraStreamEventNames.ServerMuted].emit(muted, reason);\r\n }\r\n }\r\n}\r\n\r\nexport const createMicrophoneStream = (constraints?: AudioDeviceConstraints) =>\r\n wcmeCreateMicrophoneStream(LocalMicrophoneStream, constraints);\r\n\r\nexport const createCameraStream = (constraints?: VideoDeviceConstraints) =>\r\n wcmeCreateCameraStream(LocalCameraStream, constraints);\r\n\r\nexport const createDisplayStream = () => wcmeCreateDisplayStream(LocalDisplayStream);\r\n\r\nexport const createDisplayStreamWithAudio = () =>\r\n wcmeCreateDisplayStreamWithAudio(LocalDisplayStream, LocalSystemAudioStream);\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,kBAAA,GAAAC,OAAA;AAYA,IAAAC,SAAA,GAAAD,OAAA;AAA4C,IAAAE,qBAAA,EAAAC,qBAAA;AAAA,SAAAC,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,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,EAACC,qCAAkB,CAAC;AAAA;AAAC/C,OAAA,CAAA6C,mBAAA,GAAAA,mBAAA;AAE9E,IAAMG,4BAA4B,GAAG,SAA/BA,4BAA4BA,CAAA;EAAA,OACvC,IAAAC,+CAAgC,EAACF,qCAAkB,EAAEG,yCAAsB,CAAC;AAAA;AAAClD,OAAA,CAAAgD,4BAAA,GAAAA,4BAAA"}
package/package.json CHANGED
@@ -38,10 +38,10 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@babel/preset-typescript": "7.22.11",
41
- "@webex/test-helper-chai": "^2.59.1-next.0",
42
- "@webex/test-helper-mock-webex": "^2.59.1-next.0",
41
+ "@webex/test-helper-chai": "^2.59.3-next.1",
42
+ "@webex/test-helper-mock-webex": "^2.59.3-next.1",
43
43
  "eslint": "^8.24.0",
44
44
  "sinon": "^9.2.4"
45
45
  },
46
- "version": "3.0.0-next.3"
46
+ "version": "3.0.0-next.4"
47
47
  }
package/src/constants.ts CHANGED
@@ -1,29 +1,29 @@
1
- import {VideoDeviceConstraints} from '@webex/internal-media-core';
2
-
3
- export enum FacingMode {
4
- user = 'user',
5
- environment = 'environment',
6
- }
7
-
8
- // can be used later on when we add constraints in create display track
9
- export enum DisplaySurface {
10
- browser = 'browser',
11
- monitor = 'monitor',
12
- window = 'window',
13
- }
14
-
15
- export const PresetCameraConstraints: {[key: string]: VideoDeviceConstraints} = {
16
- '1080p': {frameRate: 30, width: 1920, height: 1080},
17
-
18
- '720p': {frameRate: 30, width: 1280, height: 720},
19
-
20
- '480p': {frameRate: 30, width: 640, height: 480},
21
-
22
- '360p': {frameRate: 30, width: 640, height: 360},
23
-
24
- '240p': {frameRate: 30, width: 320, height: 240},
25
-
26
- '180p': {frameRate: 30, width: 320, height: 180},
27
-
28
- '120p': {frameRate: 30, width: 160, height: 120},
29
- };
1
+ import {VideoDeviceConstraints} from '@webex/internal-media-core';
2
+
3
+ export enum FacingMode {
4
+ user = 'user',
5
+ environment = 'environment',
6
+ }
7
+
8
+ // can be used later on when we add constraints in create display track
9
+ export enum DisplaySurface {
10
+ browser = 'browser',
11
+ monitor = 'monitor',
12
+ window = 'window',
13
+ }
14
+
15
+ export const PresetCameraConstraints: {[key: string]: VideoDeviceConstraints} = {
16
+ '1080p': {frameRate: 30, width: 1920, height: 1080},
17
+
18
+ '720p': {frameRate: 30, width: 1280, height: 720},
19
+
20
+ '480p': {frameRate: 30, width: 640, height: 480},
21
+
22
+ '360p': {frameRate: 30, width: 640, height: 360},
23
+
24
+ '240p': {frameRate: 30, width: 320, height: 240},
25
+
26
+ '180p': {frameRate: 30, width: 320, height: 180},
27
+
28
+ '120p': {frameRate: 30, width: 160, height: 120},
29
+ };
package/src/index.ts CHANGED
@@ -1,25 +1,25 @@
1
- export {
2
- getDevices,
3
- LocalStream,
4
- LocalDisplayStream,
5
- LocalSystemAudioStream,
6
- LocalStreamEventNames,
7
- StreamEventNames,
8
- type ServerMuteReason,
9
- LocalMicrophoneStreamEventNames,
10
- LocalCameraStreamEventNames,
11
- LocalMicrophoneStream,
12
- LocalCameraStream,
13
- createMicrophoneStream,
14
- createCameraStream,
15
- createDisplayStream,
16
- createDisplayStreamWithAudio,
17
- } from './webrtc-core';
18
-
19
- export {NoiseReductionEffect, VirtualBackgroundEffect} from '@webex/web-media-effects';
20
- export type {
21
- NoiseReductionEffectOptions,
22
- VirtualBackgroundEffectOptions,
23
- } from '@webex/web-media-effects';
24
-
25
- export {FacingMode, DisplaySurface, PresetCameraConstraints} from './constants';
1
+ export {
2
+ getDevices,
3
+ LocalStream,
4
+ LocalDisplayStream,
5
+ LocalSystemAudioStream,
6
+ LocalStreamEventNames,
7
+ StreamEventNames,
8
+ type ServerMuteReason,
9
+ LocalMicrophoneStreamEventNames,
10
+ LocalCameraStreamEventNames,
11
+ LocalMicrophoneStream,
12
+ LocalCameraStream,
13
+ createMicrophoneStream,
14
+ createCameraStream,
15
+ createDisplayStream,
16
+ createDisplayStreamWithAudio,
17
+ } from './webrtc-core';
18
+
19
+ export {NoiseReductionEffect, VirtualBackgroundEffect} from '@webex/web-media-effects';
20
+ export type {
21
+ NoiseReductionEffectOptions,
22
+ VirtualBackgroundEffectOptions,
23
+ } from '@webex/web-media-effects';
24
+
25
+ export {FacingMode, DisplaySurface, PresetCameraConstraints} from './constants';
@@ -1,136 +1,136 @@
1
- /* eslint-disable @typescript-eslint/no-misused-new */
2
- /* eslint-disable valid-jsdoc */
3
- /* eslint-disable require-jsdoc */
4
- import {
5
- AudioDeviceConstraints,
6
- createCameraStream as wcmeCreateCameraStream,
7
- createDisplayStream as wcmeCreateDisplayStream,
8
- createDisplayStreamWithAudio as wcmeCreateDisplayStreamWithAudio,
9
- createMicrophoneStream as wcmeCreateMicrophoneStream,
10
- LocalDisplayStream,
11
- LocalSystemAudioStream,
12
- LocalMicrophoneStream as WcmeLocalMicrophoneStream,
13
- LocalCameraStream as WcmeLocalCameraStream,
14
- VideoDeviceConstraints,
15
- } from '@webex/internal-media-core';
16
- import {TypedEvent} from '@webex/ts-events';
17
-
18
- export {
19
- getDevices,
20
- LocalStream,
21
- LocalDisplayStream,
22
- LocalSystemAudioStream,
23
- LocalStreamEventNames,
24
- StreamEventNames,
25
- RemoteStream,
26
- } from '@webex/internal-media-core';
27
-
28
- export type ServerMuteReason =
29
- | 'remotelyMuted' // other user has remotely muted us
30
- | 'clientRequestFailed' // client called setMuted() but server request failed
31
- | 'localUnmuteRequired'; // server forced the client to be unmuted
32
-
33
- // these events are in addition to WCME events. This will be properly typed once webrtc-core event types inheritance is fixed
34
- export enum LocalMicrophoneStreamEventNames {
35
- ServerMuted = 'muted:byServer',
36
- }
37
-
38
- // these events are in addition to WCME events. This will be properly typed once webrtc-core event types inheritance is fixed
39
- export enum LocalCameraStreamEventNames {
40
- ServerMuted = 'muted:byServer',
41
- }
42
-
43
- export class LocalMicrophoneStream extends WcmeLocalMicrophoneStream {
44
- private unmuteAllowed = true;
45
-
46
- [LocalMicrophoneStreamEventNames.ServerMuted] = new TypedEvent<
47
- (muted: boolean, reason: ServerMuteReason) => void
48
- >();
49
-
50
- /**
51
- * @internal
52
- */
53
- setUnmuteAllowed(allowed) {
54
- this.unmuteAllowed = allowed;
55
- }
56
-
57
- /**
58
- * @returns true if user is allowed to unmute the Stream, false otherwise
59
- */
60
- isUnmuteAllowed() {
61
- return this.unmuteAllowed;
62
- }
63
-
64
- setMuted(muted: boolean): void {
65
- if (!muted) {
66
- if (!this.isUnmuteAllowed()) {
67
- throw new Error('Unmute is not allowed');
68
- }
69
- }
70
-
71
- return super.setMuted(muted);
72
- }
73
-
74
- /**
75
- * @internal
76
- */
77
- setServerMuted(muted: boolean, reason: ServerMuteReason) {
78
- if (muted !== this.muted) {
79
- this.setMuted(muted);
80
- this[LocalMicrophoneStreamEventNames.ServerMuted].emit(muted, reason);
81
- }
82
- }
83
- }
84
-
85
- export class LocalCameraStream extends WcmeLocalCameraStream {
86
- private unmuteAllowed = true;
87
-
88
- [LocalCameraStreamEventNames.ServerMuted] = new TypedEvent<
89
- (muted: boolean, reason: ServerMuteReason) => void
90
- >();
91
-
92
- /**
93
- * @internal
94
- */
95
- setUnmuteAllowed(allowed) {
96
- this.unmuteAllowed = allowed;
97
- }
98
-
99
- /**
100
- * @returns true if user is allowed to unmute the Stream, false otherwise
101
- */
102
- isUnmuteAllowed() {
103
- return this.unmuteAllowed;
104
- }
105
-
106
- setMuted(muted: boolean): void {
107
- if (!muted) {
108
- if (!this.isUnmuteAllowed()) {
109
- throw new Error('Unmute is not allowed');
110
- }
111
- }
112
-
113
- return super.setMuted(muted);
114
- }
115
-
116
- /**
117
- * @internal
118
- */
119
- setServerMuted(muted: boolean, reason: ServerMuteReason) {
120
- if (muted !== this.muted) {
121
- this.setMuted(muted);
122
- this[LocalCameraStreamEventNames.ServerMuted].emit(muted, reason);
123
- }
124
- }
125
- }
126
-
127
- export const createMicrophoneStream = (constraints?: AudioDeviceConstraints) =>
128
- wcmeCreateMicrophoneStream(LocalMicrophoneStream, constraints);
129
-
130
- export const createCameraStream = (constraints?: VideoDeviceConstraints) =>
131
- wcmeCreateCameraStream(LocalCameraStream, constraints);
132
-
133
- export const createDisplayStream = () => wcmeCreateDisplayStream(LocalDisplayStream);
134
-
135
- export const createDisplayStreamWithAudio = () =>
136
- wcmeCreateDisplayStreamWithAudio(LocalDisplayStream, LocalSystemAudioStream);
1
+ /* eslint-disable @typescript-eslint/no-misused-new */
2
+ /* eslint-disable valid-jsdoc */
3
+ /* eslint-disable require-jsdoc */
4
+ import {
5
+ AudioDeviceConstraints,
6
+ createCameraStream as wcmeCreateCameraStream,
7
+ createDisplayStream as wcmeCreateDisplayStream,
8
+ createDisplayStreamWithAudio as wcmeCreateDisplayStreamWithAudio,
9
+ createMicrophoneStream as wcmeCreateMicrophoneStream,
10
+ LocalDisplayStream,
11
+ LocalSystemAudioStream,
12
+ LocalMicrophoneStream as WcmeLocalMicrophoneStream,
13
+ LocalCameraStream as WcmeLocalCameraStream,
14
+ VideoDeviceConstraints,
15
+ } from '@webex/internal-media-core';
16
+ import {TypedEvent} from '@webex/ts-events';
17
+
18
+ export {
19
+ getDevices,
20
+ LocalStream,
21
+ LocalDisplayStream,
22
+ LocalSystemAudioStream,
23
+ LocalStreamEventNames,
24
+ StreamEventNames,
25
+ RemoteStream,
26
+ } from '@webex/internal-media-core';
27
+
28
+ export type ServerMuteReason =
29
+ | 'remotelyMuted' // other user has remotely muted us
30
+ | 'clientRequestFailed' // client called setMuted() but server request failed
31
+ | 'localUnmuteRequired'; // server forced the client to be unmuted
32
+
33
+ // these events are in addition to WCME events. This will be properly typed once webrtc-core event types inheritance is fixed
34
+ export enum LocalMicrophoneStreamEventNames {
35
+ ServerMuted = 'muted:byServer',
36
+ }
37
+
38
+ // these events are in addition to WCME events. This will be properly typed once webrtc-core event types inheritance is fixed
39
+ export enum LocalCameraStreamEventNames {
40
+ ServerMuted = 'muted:byServer',
41
+ }
42
+
43
+ export class LocalMicrophoneStream extends WcmeLocalMicrophoneStream {
44
+ private unmuteAllowed = true;
45
+
46
+ [LocalMicrophoneStreamEventNames.ServerMuted] = new TypedEvent<
47
+ (muted: boolean, reason: ServerMuteReason) => void
48
+ >();
49
+
50
+ /**
51
+ * @internal
52
+ */
53
+ setUnmuteAllowed(allowed) {
54
+ this.unmuteAllowed = allowed;
55
+ }
56
+
57
+ /**
58
+ * @returns true if user is allowed to unmute the Stream, false otherwise
59
+ */
60
+ isUnmuteAllowed() {
61
+ return this.unmuteAllowed;
62
+ }
63
+
64
+ setMuted(muted: boolean): void {
65
+ if (!muted) {
66
+ if (!this.isUnmuteAllowed()) {
67
+ throw new Error('Unmute is not allowed');
68
+ }
69
+ }
70
+
71
+ return super.setMuted(muted);
72
+ }
73
+
74
+ /**
75
+ * @internal
76
+ */
77
+ setServerMuted(muted: boolean, reason: ServerMuteReason) {
78
+ if (muted !== this.muted) {
79
+ this.setMuted(muted);
80
+ this[LocalMicrophoneStreamEventNames.ServerMuted].emit(muted, reason);
81
+ }
82
+ }
83
+ }
84
+
85
+ export class LocalCameraStream extends WcmeLocalCameraStream {
86
+ private unmuteAllowed = true;
87
+
88
+ [LocalCameraStreamEventNames.ServerMuted] = new TypedEvent<
89
+ (muted: boolean, reason: ServerMuteReason) => void
90
+ >();
91
+
92
+ /**
93
+ * @internal
94
+ */
95
+ setUnmuteAllowed(allowed) {
96
+ this.unmuteAllowed = allowed;
97
+ }
98
+
99
+ /**
100
+ * @returns true if user is allowed to unmute the Stream, false otherwise
101
+ */
102
+ isUnmuteAllowed() {
103
+ return this.unmuteAllowed;
104
+ }
105
+
106
+ setMuted(muted: boolean): void {
107
+ if (!muted) {
108
+ if (!this.isUnmuteAllowed()) {
109
+ throw new Error('Unmute is not allowed');
110
+ }
111
+ }
112
+
113
+ return super.setMuted(muted);
114
+ }
115
+
116
+ /**
117
+ * @internal
118
+ */
119
+ setServerMuted(muted: boolean, reason: ServerMuteReason) {
120
+ if (muted !== this.muted) {
121
+ this.setMuted(muted);
122
+ this[LocalCameraStreamEventNames.ServerMuted].emit(muted, reason);
123
+ }
124
+ }
125
+ }
126
+
127
+ export const createMicrophoneStream = (constraints?: AudioDeviceConstraints) =>
128
+ wcmeCreateMicrophoneStream(LocalMicrophoneStream, constraints);
129
+
130
+ export const createCameraStream = (constraints?: VideoDeviceConstraints) =>
131
+ wcmeCreateCameraStream(LocalCameraStream, constraints);
132
+
133
+ export const createDisplayStream = () => wcmeCreateDisplayStream(LocalDisplayStream);
134
+
135
+ export const createDisplayStreamWithAudio = () =>
136
+ wcmeCreateDisplayStreamWithAudio(LocalDisplayStream, LocalSystemAudioStream);
@@ -1,145 +1,145 @@
1
- import {assert, expect} from '@webex/test-helper-chai';
2
- import sinon from 'sinon';
3
- import {
4
- LocalCameraStream,
5
- LocalMicrophoneStream,
6
- LocalMicrophoneStreamEventNames,
7
- LocalCameraStreamEventNames,
8
- LocalDisplayStream,
9
- LocalSystemAudioStream,
10
- createCameraStream,
11
- createMicrophoneStream,
12
- createDisplayStream,
13
- createDisplayStreamWithAudio,
14
- } from '../../../src/webrtc-core';
15
- import * as wcmeStreams from '@webex/internal-media-core';
16
-
17
- describe('media-helpers', () => {
18
- describe('webrtc-core', () => {
19
- const classesToTest = [
20
- {
21
- className: LocalCameraStream,
22
- title: 'LocalCameraStream',
23
- event: LocalCameraStreamEventNames,
24
- createFn: createCameraStream,
25
- spyFn: 'createCameraStream',
26
- },
27
- {
28
- className: LocalMicrophoneStream,
29
- title: 'LocalMicrophoneStream',
30
- event: LocalMicrophoneStreamEventNames,
31
- createFn: createMicrophoneStream,
32
- spyFn: 'createMicrophoneStream',
33
- },
34
- ];
35
-
36
- classesToTest.forEach(({className, title, event, createFn, spyFn}) =>
37
- describe(title, () => {
38
- const fakeStream = {
39
- getStreams: sinon.stub().returns([
40
- {
41
- label: 'fake Stream',
42
- id: 'fake Stream id',
43
- enabled: true,
44
- },
45
- ]),
46
- };
47
- const stream = new className(fakeStream);
48
-
49
- afterEach(() => {
50
- sinon.restore();
51
- });
52
-
53
- it('by default allows unmuting', async () => {
54
- assert.equal(stream.isUnmuteAllowed(), true);
55
- await stream.setMuted(false);
56
- });
57
-
58
- it('rejects setMute(false) if unmute is not allowed', async () => {
59
- stream.setUnmuteAllowed(false);
60
-
61
- assert.equal(stream.isUnmuteAllowed(), false);
62
- const fn = () => stream.setMuted(false);
63
- expect(fn).to.throw(/Unmute is not allowed/);
64
- });
65
-
66
- it('resolves setMute(false) if unmute is allowed', async () => {
67
- stream.setUnmuteAllowed(true);
68
-
69
- assert.equal(stream.isUnmuteAllowed(), true);
70
- await stream.setMuted(false);
71
- });
72
-
73
- describe('#setServerMuted', () => {
74
- afterEach(() => {
75
- sinon.restore();
76
- });
77
-
78
- const checkSetServerMuted = async (startMute, setMute, expectedCalled) => {
79
- await stream.setMuted(startMute);
80
-
81
- assert.equal(stream.muted, startMute);
82
-
83
- const handler = sinon.fake();
84
- stream.on(event.ServerMuted, handler);
85
-
86
- await stream.setServerMuted(setMute, 'remotelyMuted');
87
-
88
- assert.equal(stream.muted, setMute);
89
- if (expectedCalled) {
90
- assert.calledOnceWithExactly(handler, {muted: setMute, reason: 'remotelyMuted'});
91
- } else {
92
- assert.notCalled(handler);
93
- }
94
- };
95
-
96
- it('tests true to false', async () => {
97
- await checkSetServerMuted(true, false, true);
98
- });
99
-
100
- it('tests false to true', async () => {
101
- await checkSetServerMuted(false, true, true);
102
- });
103
-
104
- it('tests true to true', async () => {
105
- await checkSetServerMuted(true, true, false);
106
- });
107
-
108
- it('tests false to false', async () => {
109
- await checkSetServerMuted(false, false, false);
110
- });
111
- });
112
-
113
- describe('#wcmeCreateMicrophoneStream, #wcmeCreateCameraStream', () => {
114
- it('checks creating Streams', async () => {
115
- const constraints = {devideId: 'abc'};
116
-
117
- const spy = sinon.stub(wcmeStreams, spyFn).returns('something');
118
- const result = createFn(constraints);
119
-
120
- assert.equal(result, 'something');
121
- assert.calledOnceWithExactly(spy, className, constraints);
122
- });
123
- });
124
- })
125
- );
126
-
127
- describe('createDisplayStream', () => {
128
- it('checks createDisplayStream', async () => {
129
- const spy = sinon.stub(wcmeStreams, 'createDisplayStream').returns('something');
130
- const result = createDisplayStream();
131
- assert.equal(result, 'something');
132
- assert.calledOnceWithExactly(spy, LocalDisplayStream);
133
- });
134
- });
135
-
136
- describe('createDisplayStreamWithAudio', () => {
137
- it('checks createDisplayStreamWithAudio', async () => {
138
- const spy = sinon.stub(wcmeStreams, 'createDisplayStreamWithAudio').returns('something');
139
- const result = createDisplayStreamWithAudio();
140
- assert.equal(result, 'something');
141
- assert.calledOnceWithExactly(spy, LocalDisplayStream, LocalSystemAudioStream);
142
- });
143
- });
144
- });
145
- });
1
+ import {assert, expect} from '@webex/test-helper-chai';
2
+ import sinon from 'sinon';
3
+ import {
4
+ LocalCameraStream,
5
+ LocalMicrophoneStream,
6
+ LocalMicrophoneStreamEventNames,
7
+ LocalCameraStreamEventNames,
8
+ LocalDisplayStream,
9
+ LocalSystemAudioStream,
10
+ createCameraStream,
11
+ createMicrophoneStream,
12
+ createDisplayStream,
13
+ createDisplayStreamWithAudio,
14
+ } from '../../../src/webrtc-core';
15
+ import * as wcmeStreams from '@webex/internal-media-core';
16
+
17
+ describe('media-helpers', () => {
18
+ describe('webrtc-core', () => {
19
+ const classesToTest = [
20
+ {
21
+ className: LocalCameraStream,
22
+ title: 'LocalCameraStream',
23
+ event: LocalCameraStreamEventNames,
24
+ createFn: createCameraStream,
25
+ spyFn: 'createCameraStream',
26
+ },
27
+ {
28
+ className: LocalMicrophoneStream,
29
+ title: 'LocalMicrophoneStream',
30
+ event: LocalMicrophoneStreamEventNames,
31
+ createFn: createMicrophoneStream,
32
+ spyFn: 'createMicrophoneStream',
33
+ },
34
+ ];
35
+
36
+ classesToTest.forEach(({className, title, event, createFn, spyFn}) =>
37
+ describe(title, () => {
38
+ const fakeStream = {
39
+ getStreams: sinon.stub().returns([
40
+ {
41
+ label: 'fake Stream',
42
+ id: 'fake Stream id',
43
+ enabled: true,
44
+ },
45
+ ]),
46
+ };
47
+ const stream = new className(fakeStream);
48
+
49
+ afterEach(() => {
50
+ sinon.restore();
51
+ });
52
+
53
+ it('by default allows unmuting', async () => {
54
+ assert.equal(stream.isUnmuteAllowed(), true);
55
+ await stream.setMuted(false);
56
+ });
57
+
58
+ it('rejects setMute(false) if unmute is not allowed', async () => {
59
+ stream.setUnmuteAllowed(false);
60
+
61
+ assert.equal(stream.isUnmuteAllowed(), false);
62
+ const fn = () => stream.setMuted(false);
63
+ expect(fn).to.throw(/Unmute is not allowed/);
64
+ });
65
+
66
+ it('resolves setMute(false) if unmute is allowed', async () => {
67
+ stream.setUnmuteAllowed(true);
68
+
69
+ assert.equal(stream.isUnmuteAllowed(), true);
70
+ await stream.setMuted(false);
71
+ });
72
+
73
+ describe('#setServerMuted', () => {
74
+ afterEach(() => {
75
+ sinon.restore();
76
+ });
77
+
78
+ const checkSetServerMuted = async (startMute, setMute, expectedCalled) => {
79
+ await stream.setMuted(startMute);
80
+
81
+ assert.equal(stream.muted, startMute);
82
+
83
+ const handler = sinon.fake();
84
+ stream.on(event.ServerMuted, handler);
85
+
86
+ await stream.setServerMuted(setMute, 'remotelyMuted');
87
+
88
+ assert.equal(stream.muted, setMute);
89
+ if (expectedCalled) {
90
+ assert.calledOnceWithExactly(handler, {muted: setMute, reason: 'remotelyMuted'});
91
+ } else {
92
+ assert.notCalled(handler);
93
+ }
94
+ };
95
+
96
+ it('tests true to false', async () => {
97
+ await checkSetServerMuted(true, false, true);
98
+ });
99
+
100
+ it('tests false to true', async () => {
101
+ await checkSetServerMuted(false, true, true);
102
+ });
103
+
104
+ it('tests true to true', async () => {
105
+ await checkSetServerMuted(true, true, false);
106
+ });
107
+
108
+ it('tests false to false', async () => {
109
+ await checkSetServerMuted(false, false, false);
110
+ });
111
+ });
112
+
113
+ describe('#wcmeCreateMicrophoneStream, #wcmeCreateCameraStream', () => {
114
+ it('checks creating Streams', async () => {
115
+ const constraints = {devideId: 'abc'};
116
+
117
+ const spy = sinon.stub(wcmeStreams, spyFn).returns('something');
118
+ const result = createFn(constraints);
119
+
120
+ assert.equal(result, 'something');
121
+ assert.calledOnceWithExactly(spy, className, constraints);
122
+ });
123
+ });
124
+ })
125
+ );
126
+
127
+ describe('createDisplayStream', () => {
128
+ it('checks createDisplayStream', async () => {
129
+ const spy = sinon.stub(wcmeStreams, 'createDisplayStream').returns('something');
130
+ const result = createDisplayStream();
131
+ assert.equal(result, 'something');
132
+ assert.calledOnceWithExactly(spy, LocalDisplayStream);
133
+ });
134
+ });
135
+
136
+ describe('createDisplayStreamWithAudio', () => {
137
+ it('checks createDisplayStreamWithAudio', async () => {
138
+ const spy = sinon.stub(wcmeStreams, 'createDisplayStreamWithAudio').returns('something');
139
+ const result = createDisplayStreamWithAudio();
140
+ assert.equal(result, 'something');
141
+ assert.calledOnceWithExactly(spy, LocalDisplayStream, LocalSystemAudioStream);
142
+ });
143
+ });
144
+ });
145
+ });
package/tsconfig.json CHANGED
@@ -1,6 +1,6 @@
1
- {
2
- "extends": "../../../tsconfig.json",
3
- "include": [
4
- "src"
5
- ],
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "include": [
4
+ "src"
5
+ ],
6
6
  }