@webex/media-helpers 3.0.0-stream-classes.5 → 3.0.0-test.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/README.md CHANGED
@@ -51,7 +51,7 @@ const effect = new VirtualBackgroundEffect({
51
51
  });
52
52
 
53
53
  // add the effect on the input camera stream.
54
- await cameraStream.addEffect("background-blur", effect);
54
+ await cameraStream.addEffect(effect);
55
55
 
56
56
  //enable the effect once it is added to the stream
57
57
  await effect.enable()
@@ -79,7 +79,7 @@ const effect = new NoiseReductionEffect({
79
79
  });
80
80
 
81
81
  // add the effect on microphone stream.
82
- await microphoneStream.addEffect("background-noise-removal", effect);
82
+ await microphoneStream.addEffect(effect);
83
83
 
84
84
  //enable the effect once it is added to the track
85
85
  await effect.enable()
@@ -0,0 +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
+ };
@@ -0,0 +1,4 @@
1
+ export { getDevices, LocalStream, LocalDisplayStream, LocalSystemAudioStream, LocalStreamEventNames, StreamEventNames, RemoteStream, RemoteStreamEventNames, type ServerMuteReason, LocalMicrophoneStreamEventNames, LocalCameraStreamEventNames, LocalMicrophoneStream, LocalCameraStream, createMicrophoneStream, createCameraStream, createDisplayStream, createDisplayStreamWithAudio, type VideoContentHint, } 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 CHANGED
@@ -82,6 +82,12 @@ _Object$defineProperty(exports, "RemoteStream", {
82
82
  return _webrtcCore.RemoteStream;
83
83
  }
84
84
  });
85
+ _Object$defineProperty(exports, "RemoteStreamEventNames", {
86
+ enumerable: true,
87
+ get: function get() {
88
+ return _webrtcCore.RemoteStreamEventNames;
89
+ }
90
+ });
85
91
  _Object$defineProperty(exports, "StreamEventNames", {
86
92
  enumerable: true,
87
93
  get: function get() {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export {\n getDevices,\n LocalStream,\n LocalDisplayStream,\n LocalSystemAudioStream,\n LocalStreamEventNames,\n StreamEventNames,\n RemoteStream,\n type ServerMuteReason,\n LocalMicrophoneStreamEventNames,\n LocalCameraStreamEventNames,\n LocalMicrophoneStream,\n LocalCameraStream,\n createMicrophoneStream,\n createCameraStream,\n createDisplayStream,\n createDisplayStreamWithAudio,\n type VideoContentHint,\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;AAoBA;AAMA"}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export {\n getDevices,\n LocalStream,\n LocalDisplayStream,\n LocalSystemAudioStream,\n LocalStreamEventNames,\n StreamEventNames,\n RemoteStream,\n RemoteStreamEventNames,\n type ServerMuteReason,\n LocalMicrophoneStreamEventNames,\n LocalCameraStreamEventNames,\n LocalMicrophoneStream,\n LocalCameraStream,\n createMicrophoneStream,\n createCameraStream,\n createDisplayStream,\n createDisplayStreamWithAudio,\n type VideoContentHint,\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;AAqBA;AAMA"}
@@ -0,0 +1,58 @@
1
+ import { AudioDeviceConstraints, LocalDisplayStream, LocalSystemAudioStream, LocalMicrophoneStream as WcmeLocalMicrophoneStream, LocalCameraStream as WcmeLocalCameraStream, VideoDeviceConstraints } from '@webex/internal-media-core';
2
+ import { TypedEvent, WithEventsDummyType } from '@webex/ts-events';
3
+ export { getDevices, LocalStream, LocalDisplayStream, LocalSystemAudioStream, LocalStreamEventNames, StreamEventNames, RemoteStream, RemoteStreamEventNames, type VideoContentHint, } 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
+ interface LocalMicrophoneStreamEvents {
12
+ [LocalMicrophoneStreamEventNames.ServerMuted]: TypedEvent<(muted: boolean, reason: ServerMuteReason) => void>;
13
+ }
14
+ interface LocalCameraStreamEvents {
15
+ [LocalMicrophoneStreamEventNames.ServerMuted]: TypedEvent<(muted: boolean, reason: ServerMuteReason) => void>;
16
+ }
17
+ declare class _LocalMicrophoneStream extends WcmeLocalMicrophoneStream {
18
+ private unmuteAllowed;
19
+ [LocalMicrophoneStreamEventNames.ServerMuted]: TypedEvent<(muted: boolean, reason: ServerMuteReason) => void>;
20
+ /**
21
+ * @returns true if user is allowed to unmute the track, false otherwise
22
+ */
23
+ isUnmuteAllowed(): boolean;
24
+ setUserMuted(muted: boolean): void;
25
+ }
26
+ declare class _LocalCameraStream extends WcmeLocalCameraStream {
27
+ private unmuteAllowed;
28
+ [LocalCameraStreamEventNames.ServerMuted]: TypedEvent<(muted: boolean, reason: ServerMuteReason) => void>;
29
+ /**
30
+ * @returns true if user is allowed to unmute the track, false otherwise
31
+ */
32
+ isUnmuteAllowed(): boolean;
33
+ setUserMuted(muted: boolean): void;
34
+ }
35
+ export declare const createMicrophoneStream: (constraints?: AudioDeviceConstraints) => Promise<{
36
+ on<K extends LocalMicrophoneStreamEventNames.ServerMuted, E extends LocalMicrophoneStreamEvents[K] extends infer T ? T extends LocalMicrophoneStreamEvents[K] ? T extends TypedEvent<infer X extends (...args: any[]) => void> ? X : never : never : never>(eventName: K, handler: E): void;
37
+ once<K_1 extends LocalMicrophoneStreamEventNames.ServerMuted, E_1 extends LocalMicrophoneStreamEvents[K_1] extends infer T_1 ? T_1 extends LocalMicrophoneStreamEvents[K_1] ? T_1 extends TypedEvent<infer X extends (...args: any[]) => void> ? X : never : never : never>(eventName: K_1, handler: E_1): void;
38
+ off<K_2 extends LocalMicrophoneStreamEventNames.ServerMuted, E_2 extends LocalMicrophoneStreamEvents[K_2] extends infer T_2 ? T_2 extends LocalMicrophoneStreamEvents[K_2] ? T_2 extends TypedEvent<infer X extends (...args: any[]) => void> ? X : never : never : never>(eventName: K_2, handler: E_2): void;
39
+ } & _LocalMicrophoneStream>;
40
+ export declare const createCameraStream: (constraints?: VideoDeviceConstraints) => Promise<{
41
+ on<K extends LocalMicrophoneStreamEventNames.ServerMuted, E extends LocalCameraStreamEvents[K] extends infer T ? T extends LocalCameraStreamEvents[K] ? T extends TypedEvent<infer X extends (...args: any[]) => void> ? X : never : never : never>(eventName: K, handler: E): void;
42
+ once<K_1 extends LocalMicrophoneStreamEventNames.ServerMuted, E_1 extends LocalCameraStreamEvents[K_1] extends infer T_1 ? T_1 extends LocalCameraStreamEvents[K_1] ? T_1 extends TypedEvent<infer X extends (...args: any[]) => void> ? X : never : never : never>(eventName: K_1, handler: E_1): void;
43
+ off<K_2 extends LocalMicrophoneStreamEventNames.ServerMuted, E_2 extends LocalCameraStreamEvents[K_2] extends infer T_2 ? T_2 extends LocalCameraStreamEvents[K_2] ? T_2 extends TypedEvent<infer X extends (...args: any[]) => void> ? X : never : never : never>(eventName: K_2, handler: E_2): void;
44
+ } & _LocalCameraStream>;
45
+ export declare const createDisplayStream: () => Promise<LocalDisplayStream>;
46
+ export declare const createDisplayStreamWithAudio: () => Promise<[LocalDisplayStream, LocalSystemAudioStream]>;
47
+ export declare const LocalMicrophoneStream: (new (...args: any[]) => {
48
+ on<K extends LocalMicrophoneStreamEventNames.ServerMuted, E extends LocalMicrophoneStreamEvents[K] extends infer T ? T extends LocalMicrophoneStreamEvents[K] ? T extends TypedEvent<infer X extends (...args: any[]) => void> ? X : never : never : never>(eventName: K, handler: E): void;
49
+ once<K_1 extends LocalMicrophoneStreamEventNames.ServerMuted, E_1 extends LocalMicrophoneStreamEvents[K_1] extends infer T_1 ? T_1 extends LocalMicrophoneStreamEvents[K_1] ? T_1 extends TypedEvent<infer X extends (...args: any[]) => void> ? X : never : never : never>(eventName: K_1, handler: E_1): void;
50
+ off<K_2 extends LocalMicrophoneStreamEventNames.ServerMuted, E_2 extends LocalMicrophoneStreamEvents[K_2] extends infer T_2 ? T_2 extends LocalMicrophoneStreamEvents[K_2] ? T_2 extends TypedEvent<infer X extends (...args: any[]) => void> ? X : never : never : never>(eventName: K_2, handler: E_2): void;
51
+ }) & typeof _LocalMicrophoneStream;
52
+ export type LocalMicrophoneStream = _LocalMicrophoneStream & WithEventsDummyType<LocalMicrophoneStreamEvents>;
53
+ export declare const LocalCameraStream: (new (...args: any[]) => {
54
+ on<K extends LocalMicrophoneStreamEventNames.ServerMuted, E extends LocalCameraStreamEvents[K] extends infer T ? T extends LocalCameraStreamEvents[K] ? T extends TypedEvent<infer X extends (...args: any[]) => void> ? X : never : never : never>(eventName: K, handler: E): void;
55
+ once<K_1 extends LocalMicrophoneStreamEventNames.ServerMuted, E_1 extends LocalCameraStreamEvents[K_1] extends infer T_1 ? T_1 extends LocalCameraStreamEvents[K_1] ? T_1 extends TypedEvent<infer X extends (...args: any[]) => void> ? X : never : never : never>(eventName: K_1, handler: E_1): void;
56
+ off<K_2 extends LocalMicrophoneStreamEventNames.ServerMuted, E_2 extends LocalCameraStreamEvents[K_2] extends infer T_2 ? T_2 extends LocalCameraStreamEvents[K_2] ? T_2 extends TypedEvent<infer X extends (...args: any[]) => void> ? X : never : never : never>(eventName: K_2, handler: E_2): void;
57
+ }) & typeof _LocalCameraStream;
58
+ export type LocalCameraStream = _LocalCameraStream & WithEventsDummyType<LocalCameraStreamEvents>;
@@ -38,6 +38,12 @@ _Object$defineProperty(exports, "RemoteStream", {
38
38
  return _internalMediaCore.RemoteStream;
39
39
  }
40
40
  });
41
+ _Object$defineProperty(exports, "RemoteStreamEventNames", {
42
+ enumerable: true,
43
+ get: function get() {
44
+ return _internalMediaCore.RemoteStreamEventNames;
45
+ }
46
+ });
41
47
  _Object$defineProperty(exports, "StreamEventNames", {
42
48
  enumerable: true,
43
49
  get: function get() {
@@ -110,14 +116,14 @@ var _LocalMicrophoneStream = /*#__PURE__*/function (_WcmeLocalMicrophoneS) {
110
116
  return this.unmuteAllowed;
111
117
  }
112
118
  }, {
113
- key: "setMuted",
114
- value: function setMuted(muted) {
119
+ key: "setUserMuted",
120
+ value: function setUserMuted(muted) {
115
121
  if (!muted) {
116
122
  if (!this.isUnmuteAllowed()) {
117
123
  throw new Error('Unmute is not allowed');
118
124
  }
119
125
  }
120
- return (0, _get2.default)((0, _getPrototypeOf2.default)(_LocalMicrophoneStream.prototype), "setMuted", this).call(this, muted);
126
+ return (0, _get2.default)((0, _getPrototypeOf2.default)(_LocalMicrophoneStream.prototype), "setUserMuted", this).call(this, muted);
121
127
  }
122
128
 
123
129
  /**
@@ -126,25 +132,11 @@ var _LocalMicrophoneStream = /*#__PURE__*/function (_WcmeLocalMicrophoneS) {
126
132
  }, {
127
133
  key: "setServerMuted",
128
134
  value: function setServerMuted(muted, reason) {
129
- if (muted !== this.muted) {
130
- this.setMuted(muted);
135
+ if (muted !== this.userMuted) {
136
+ this.setUserMuted(muted);
131
137
  this[LocalMicrophoneStreamEventNames.ServerMuted].emit(muted, reason);
132
138
  }
133
139
  }
134
- }, {
135
- key: "toJSON",
136
- value: function toJSON() {
137
- var _this$inputTrack;
138
- return {
139
- id: this.id,
140
- enabled: (_this$inputTrack = this.inputTrack) === null || _this$inputTrack === void 0 ? void 0 : _this$inputTrack.enabled,
141
- label: this.label,
142
- readyState: this.readyState,
143
- numEnabledEffects: this.getAllEffects().filter(function (item) {
144
- return item.effect.isEnabled;
145
- }).length
146
- };
147
- }
148
140
  }]);
149
141
  return _LocalMicrophoneStream;
150
142
  }(_internalMediaCore.LocalMicrophoneStream);
@@ -182,14 +174,14 @@ var _LocalCameraStream = /*#__PURE__*/function (_WcmeLocalCameraStrea) {
182
174
  return this.unmuteAllowed;
183
175
  }
184
176
  }, {
185
- key: "setMuted",
186
- value: function setMuted(muted) {
177
+ key: "setUserMuted",
178
+ value: function setUserMuted(muted) {
187
179
  if (!muted) {
188
180
  if (!this.isUnmuteAllowed()) {
189
181
  throw new Error('Unmute is not allowed');
190
182
  }
191
183
  }
192
- return (0, _get2.default)((0, _getPrototypeOf2.default)(_LocalCameraStream.prototype), "setMuted", this).call(this, muted);
184
+ return (0, _get2.default)((0, _getPrototypeOf2.default)(_LocalCameraStream.prototype), "setUserMuted", this).call(this, muted);
193
185
  }
194
186
 
195
187
  /**
@@ -198,25 +190,11 @@ var _LocalCameraStream = /*#__PURE__*/function (_WcmeLocalCameraStrea) {
198
190
  }, {
199
191
  key: "setServerMuted",
200
192
  value: function setServerMuted(muted, reason) {
201
- if (muted !== this.muted) {
202
- this.setMuted(muted);
193
+ if (muted !== this.userMuted) {
194
+ this.setUserMuted(muted);
203
195
  this[LocalCameraStreamEventNames.ServerMuted].emit(muted, reason);
204
196
  }
205
197
  }
206
- }, {
207
- key: "toJSON",
208
- value: function toJSON() {
209
- var _this$inputTrack2;
210
- return {
211
- id: this.id,
212
- enabled: (_this$inputTrack2 = this.inputTrack) === null || _this$inputTrack2 === void 0 ? void 0 : _this$inputTrack2.enabled,
213
- label: this.label,
214
- readyState: this.readyState,
215
- numEnabledEffects: this.getAllEffects().filter(function (item) {
216
- return item.effect.isEnabled;
217
- }).length
218
- };
219
- }
220
198
  }]);
221
199
  return _LocalCameraStream;
222
200
  }(_internalMediaCore.LocalCameraStream);
@@ -1 +1 @@
1
- {"version":3,"names":["LocalMicrophoneStreamEventNames","LocalCameraStreamEventNames","ServerMuted","_LocalMicrophoneStream","TypedEvent","allowed","unmuteAllowed","muted","isUnmuteAllowed","Error","reason","setMuted","emit","id","enabled","inputTrack","label","readyState","numEnabledEffects","getAllEffects","filter","item","effect","isEnabled","length","WcmeLocalMicrophoneStream","_LocalCameraStream","WcmeLocalCameraStream","createMicrophoneStream","constraints","wcmeCreateMicrophoneStream","LocalMicrophoneStream","createCameraStream","wcmeCreateCameraStream","LocalCameraStream","createDisplayStream","wcmeCreateDisplayStream","LocalDisplayStream","createDisplayStreamWithAudio","wcmeCreateDisplayStreamWithAudio","LocalSystemAudioStream","AddEvents"],"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 {AddEvents, TypedEvent, WithEventsDummyType} from '@webex/ts-events';\n\nexport {\n getDevices,\n LocalStream,\n LocalDisplayStream,\n LocalSystemAudioStream,\n LocalStreamEventNames,\n StreamEventNames,\n RemoteStream,\n type VideoContentHint,\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\ninterface LocalMicrophoneStreamEvents {\n [LocalMicrophoneStreamEventNames.ServerMuted]: TypedEvent<\n (muted: boolean, reason: ServerMuteReason) => void\n >;\n}\n\ninterface LocalCameraStreamEvents {\n [LocalMicrophoneStreamEventNames.ServerMuted]: TypedEvent<\n (muted: boolean, reason: ServerMuteReason) => void\n >;\n}\n\nclass _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 track, 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 toJSON() {\n return {\n id: this.id,\n enabled: this.inputTrack?.enabled,\n label: this.label,\n readyState: this.readyState,\n numEnabledEffects: this.getAllEffects().filter((item) => item.effect.isEnabled).length,\n };\n }\n}\n\nclass _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 track, 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 toJSON() {\n return {\n id: this.id,\n enabled: this.inputTrack?.enabled,\n label: this.label,\n readyState: this.readyState,\n numEnabledEffects: this.getAllEffects().filter((item) => item.effect.isEnabled).length,\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\nexport const LocalMicrophoneStream = AddEvents<\n typeof _LocalMicrophoneStream,\n LocalMicrophoneStreamEvents\n>(_LocalMicrophoneStream);\n\nexport type LocalMicrophoneStream = _LocalMicrophoneStream &\n WithEventsDummyType<LocalMicrophoneStreamEvents>;\n\nexport const LocalCameraStream = AddEvents<typeof _LocalCameraStream, LocalCameraStreamEvents>(\n _LocalCameraStream\n);\n\nexport type LocalCameraStream = _LocalCameraStream & WithEventsDummyType<LocalCameraStreamEvents>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;AAYA;AAA4E;AAAA;AAAA;AAgBjD;AAE3B;AAAA,IACYA,+BAA+B,EAI3C;AAAA;AAAA,WAJYA,+BAA+B;EAA/BA,+BAA+B;AAAA,GAA/BA,+BAA+B,+CAA/BA,+BAA+B;AAAA,IAK/BC,2BAA2B;AAAA;AAAA,WAA3BA,2BAA2B;EAA3BA,2BAA2B;AAAA,GAA3BA,2BAA2B,2CAA3BA,2BAA2B;AAAA,wBAmBpCD,+BAA+B,CAACE,WAAW;AAAA,IAHxCC,sBAAsB;EAAA;EAAA;EAAA;IAAA;IAAA;IAAA;MAAA;IAAA;IAAA;IAAA,4FACF,IAAI;IAAA,kGAEoB,IAAIC,oBAAU,EAE3D;IAAA;EAAA;EAAA;IAAA;IAAA;IAEH;AACF;AACA;IACE,0BAAiBC,OAAO,EAAE;MACxB,IAAI,CAACC,aAAa,GAAGD,OAAO;IAC9B;;IAEA;AACF;AACA;EAFE;IAAA;IAAA,OAGA,2BAAkB;MAChB,OAAO,IAAI,CAACC,aAAa;IAC3B;EAAC;IAAA;IAAA,OAED,kBAASC,KAAc,EAAQ;MAC7B,IAAI,CAACA,KAAK,EAAE;QACV,IAAI,CAAC,IAAI,CAACC,eAAe,EAAE,EAAE;UAC3B,MAAM,IAAIC,KAAK,CAAC,uBAAuB,CAAC;QAC1C;MACF;MAEA,wHAAsBF,KAAK;IAC7B;;IAEA;AACF;AACA;EAFE;IAAA;IAAA,OAGA,wBAAeA,KAAc,EAAEG,MAAwB,EAAE;MACvD,IAAIH,KAAK,KAAK,IAAI,CAACA,KAAK,EAAE;QACxB,IAAI,CAACI,QAAQ,CAACJ,KAAK,CAAC;QACpB,IAAI,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MicrophoneStream","TypedEvent","allowed","unmuteAllowed","muted","isUnmuteAllowed","Error","reason","userMuted","setUserMuted","emit","WcmeLocalMicrophoneStream","_LocalCameraStream","WcmeLocalCameraStream","createMicrophoneStream","constraints","wcmeCreateMicrophoneStream","LocalMicrophoneStream","createCameraStream","wcmeCreateCameraStream","LocalCameraStream","createDisplayStream","wcmeCreateDisplayStream","LocalDisplayStream","createDisplayStreamWithAudio","wcmeCreateDisplayStreamWithAudio","LocalSystemAudioStream","AddEvents"],"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 {AddEvents, TypedEvent, WithEventsDummyType} from '@webex/ts-events';\n\nexport {\n getDevices,\n LocalStream,\n LocalDisplayStream,\n LocalSystemAudioStream,\n LocalStreamEventNames,\n StreamEventNames,\n RemoteStream,\n RemoteStreamEventNames,\n type VideoContentHint,\n} from '@webex/internal-media-core';\n\nexport type ServerMuteReason =\n | 'remotelyMuted' // other user has remotely muted us\n | 'clientRequestFailed' // client called setUserMuted() 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\ninterface LocalMicrophoneStreamEvents {\n [LocalMicrophoneStreamEventNames.ServerMuted]: TypedEvent<\n (muted: boolean, reason: ServerMuteReason) => void\n >;\n}\n\ninterface LocalCameraStreamEvents {\n [LocalMicrophoneStreamEventNames.ServerMuted]: TypedEvent<\n (muted: boolean, reason: ServerMuteReason) => void\n >;\n}\n\nclass _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: boolean) {\n this.unmuteAllowed = allowed;\n }\n\n /**\n * @returns true if user is allowed to unmute the track, false otherwise\n */\n isUnmuteAllowed() {\n return this.unmuteAllowed;\n }\n\n setUserMuted(muted: boolean): void {\n if (!muted) {\n if (!this.isUnmuteAllowed()) {\n throw new Error('Unmute is not allowed');\n }\n }\n\n return super.setUserMuted(muted);\n }\n\n /**\n * @internal\n */\n setServerMuted(muted: boolean, reason: ServerMuteReason) {\n if (muted !== this.userMuted) {\n this.setUserMuted(muted);\n this[LocalMicrophoneStreamEventNames.ServerMuted].emit(muted, reason);\n }\n }\n}\n\nclass _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: boolean) {\n this.unmuteAllowed = allowed;\n }\n\n /**\n * @returns true if user is allowed to unmute the track, false otherwise\n */\n isUnmuteAllowed() {\n return this.unmuteAllowed;\n }\n\n setUserMuted(muted: boolean): void {\n if (!muted) {\n if (!this.isUnmuteAllowed()) {\n throw new Error('Unmute is not allowed');\n }\n }\n\n return super.setUserMuted(muted);\n }\n\n /**\n * @internal\n */\n setServerMuted(muted: boolean, reason: ServerMuteReason) {\n if (muted !== this.userMuted) {\n this.setUserMuted(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\nexport const LocalMicrophoneStream = AddEvents<\n typeof _LocalMicrophoneStream,\n LocalMicrophoneStreamEvents\n>(_LocalMicrophoneStream);\n\nexport type LocalMicrophoneStream = _LocalMicrophoneStream &\n WithEventsDummyType<LocalMicrophoneStreamEvents>;\n\nexport const LocalCameraStream = AddEvents<typeof _LocalCameraStream, LocalCameraStreamEvents>(\n _LocalCameraStream\n);\n\nexport type LocalCameraStream = _LocalCameraStream & WithEventsDummyType<LocalCameraStreamEvents>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;AAYA;AAA4E;AAAA;AAAA;AAiBjD;AAE3B;AAAA,IACYA,+BAA+B,EAI3C;AAAA;AAAA,WAJYA,+BAA+B;EAA/BA,+BAA+B;AAAA,GAA/BA,+BAA+B,+CAA/BA,+BAA+B;AAAA,IAK/BC,2BAA2B;AAAA;AAAA,WAA3BA,2BAA2B;EAA3BA,2BAA2B;AAAA,GAA3BA,2BAA2B,2CAA3BA,2BAA2B;AAAA,wBAmBpCD,+BAA+B,CAACE,WAAW;AAAA,IAHxCC,sBAAsB;EAAA;EAAA;EAAA;IAAA;IAAA;IAAA;MAAA;IAAA;IAAA;IAAA,4FACF,IAAI;IAAA,kGAEoB,IAAIC,oBAAU,EAE3D;IAAA;EAAA;EAAA;IAAA;IAAA;IAEH;AACF;AACA;IACE,0BAAiBC,OAAgB,EAAE;MACjC,I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;EAFE;IAAA;IAAA,OAGA,wBAAeA,KAAc,EAAEG,MAAwB,EAAE;MACvD,IAAIH,KAAK,KAAK,IAAI,CAACI,SAAS,EAAE;QAC5B,IAAI,CAACC,YAAY,CAACL,KAAK,CAAC;QACxB,IAAI,CAACN,2BAA2B,CAACC,WAAW,CAAC,CAACW,IAAI,CAACN,KAAK,EAAEG,MAAM,CAAC;MACnE;IACF;EAAC;EAAA;AAAA,EAvC8BM,oCAAqB;AA0C/C,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAsB,CAAIC,WAAoC;EAAA,OACzE,IAAAC,yCAA0B,EAACC,qBAAqB,EAAEF,WAAW,CAAC;AAAA;AAAC;AAE1D,IAAMG,kBAAkB,GAAG,SAArBA,kBAAkB,CAAIH,WAAoC;EAAA,OACrE,IAAAI,qCAAsB,EAACC,iBAAiB,EAAEL,WAAW,CAAC;AAAA;AAAC;AAElD,IAAMM,mBAAmB,GAAG,SAAtBA,mBAAmB;EAAA,OAAS,IAAAC,sCAAuB,EAACC,qCAAkB,CAAC;AAAA;AAAC;AAE9E,IAAMC,4BAA4B,GAAG,SAA/BA,4BAA4B;EAAA,OACvC,IAAAC,+CAAgC,EAACF,qCAAkB,EAAEG,yCAAsB,CAAC;AAAA;AAAC;AAExE,IAAMT,qBAAqB,GAAG,IAAAU,mBAAS,EAG5C3B,sBAAsB,CAAC;AAAC;AAKnB,IAAMoB,iBAAiB,GAAG,IAAAO,mBAAS,EACxCf,kBAAkB,CACnB;AAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/media-helpers",
3
- "version": "3.0.0-stream-classes.5",
3
+ "version": "3.0.0-test.01",
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",
@@ -10,13 +10,16 @@
10
10
  "url": "https://github.com/webex/webex-js-sdk.git",
11
11
  "directory": "packages/@webex/media-helpers"
12
12
  },
13
+ "scripts": {
14
+ "build:src": "yarn run -T tsc --declaration true --declarationDir ./dist"
15
+ },
13
16
  "engines": {
14
17
  "node": ">=16"
15
18
  },
16
19
  "dependencies": {
17
- "@webex/internal-media-core": "2.0.3",
20
+ "@webex/internal-media-core": "2.3.0",
18
21
  "@webex/ts-events": "^1.1.0",
19
- "@webex/web-media-effects": "^2.13.3"
22
+ "@webex/web-media-effects": "^2.15.6"
20
23
  },
21
24
  "browserify": {
22
25
  "transform": [
package/src/index.ts CHANGED
@@ -6,6 +6,7 @@ export {
6
6
  LocalStreamEventNames,
7
7
  StreamEventNames,
8
8
  RemoteStream,
9
+ RemoteStreamEventNames,
9
10
  type ServerMuteReason,
10
11
  LocalMicrophoneStreamEventNames,
11
12
  LocalCameraStreamEventNames,
@@ -23,12 +23,13 @@ export {
23
23
  LocalStreamEventNames,
24
24
  StreamEventNames,
25
25
  RemoteStream,
26
+ RemoteStreamEventNames,
26
27
  type VideoContentHint,
27
28
  } from '@webex/internal-media-core';
28
29
 
29
30
  export type ServerMuteReason =
30
31
  | 'remotelyMuted' // other user has remotely muted us
31
- | 'clientRequestFailed' // client called setMuted() but server request failed
32
+ | 'clientRequestFailed' // client called setUserMuted() but server request failed
32
33
  | 'localUnmuteRequired'; // server forced the client to be unmuted
33
34
 
34
35
  // these events are in addition to WCME events. This will be properly typed once webrtc-core event types inheritance is fixed
@@ -63,7 +64,7 @@ class _LocalMicrophoneStream extends WcmeLocalMicrophoneStream {
63
64
  /**
64
65
  * @internal
65
66
  */
66
- setUnmuteAllowed(allowed) {
67
+ setUnmuteAllowed(allowed: boolean) {
67
68
  this.unmuteAllowed = allowed;
68
69
  }
69
70
 
@@ -74,35 +75,25 @@ class _LocalMicrophoneStream extends WcmeLocalMicrophoneStream {
74
75
  return this.unmuteAllowed;
75
76
  }
76
77
 
77
- setMuted(muted: boolean): void {
78
+ setUserMuted(muted: boolean): void {
78
79
  if (!muted) {
79
80
  if (!this.isUnmuteAllowed()) {
80
81
  throw new Error('Unmute is not allowed');
81
82
  }
82
83
  }
83
84
 
84
- return super.setMuted(muted);
85
+ return super.setUserMuted(muted);
85
86
  }
86
87
 
87
88
  /**
88
89
  * @internal
89
90
  */
90
91
  setServerMuted(muted: boolean, reason: ServerMuteReason) {
91
- if (muted !== this.muted) {
92
- this.setMuted(muted);
92
+ if (muted !== this.userMuted) {
93
+ this.setUserMuted(muted);
93
94
  this[LocalMicrophoneStreamEventNames.ServerMuted].emit(muted, reason);
94
95
  }
95
96
  }
96
-
97
- toJSON() {
98
- return {
99
- id: this.id,
100
- enabled: this.inputTrack?.enabled,
101
- label: this.label,
102
- readyState: this.readyState,
103
- numEnabledEffects: this.getAllEffects().filter((item) => item.effect.isEnabled).length,
104
- };
105
- }
106
97
  }
107
98
 
108
99
  class _LocalCameraStream extends WcmeLocalCameraStream {
@@ -115,7 +106,7 @@ class _LocalCameraStream extends WcmeLocalCameraStream {
115
106
  /**
116
107
  * @internal
117
108
  */
118
- setUnmuteAllowed(allowed) {
109
+ setUnmuteAllowed(allowed: boolean) {
119
110
  this.unmuteAllowed = allowed;
120
111
  }
121
112
 
@@ -126,35 +117,25 @@ class _LocalCameraStream extends WcmeLocalCameraStream {
126
117
  return this.unmuteAllowed;
127
118
  }
128
119
 
129
- setMuted(muted: boolean): void {
120
+ setUserMuted(muted: boolean): void {
130
121
  if (!muted) {
131
122
  if (!this.isUnmuteAllowed()) {
132
123
  throw new Error('Unmute is not allowed');
133
124
  }
134
125
  }
135
126
 
136
- return super.setMuted(muted);
127
+ return super.setUserMuted(muted);
137
128
  }
138
129
 
139
130
  /**
140
131
  * @internal
141
132
  */
142
133
  setServerMuted(muted: boolean, reason: ServerMuteReason) {
143
- if (muted !== this.muted) {
144
- this.setMuted(muted);
134
+ if (muted !== this.userMuted) {
135
+ this.setUserMuted(muted);
145
136
  this[LocalCameraStreamEventNames.ServerMuted].emit(muted, reason);
146
137
  }
147
138
  }
148
-
149
- toJSON() {
150
- return {
151
- id: this.id,
152
- enabled: this.inputTrack?.enabled,
153
- label: this.label,
154
- readyState: this.readyState,
155
- numEnabledEffects: this.getAllEffects().filter((item) => item.effect.isEnabled).length,
156
- };
157
- }
158
139
  }
159
140
 
160
141
  export const createMicrophoneStream = (constraints?: AudioDeviceConstraints) =>
@@ -11,7 +11,7 @@ import {
11
11
  createMicrophoneStream,
12
12
  createDisplayStream,
13
13
  createDisplayStreamWithAudio,
14
- } from '../../../src/webrtc-core';
14
+ } from '@webex/media-helpers';
15
15
  import * as wcmestreams from '@webex/internal-media-core';
16
16
 
17
17
  describe('media-helpers', () => {
@@ -41,6 +41,7 @@ describe('media-helpers', () => {
41
41
  label: 'fake track',
42
42
  id: 'fake track id',
43
43
  enabled: true,
44
+ muted: false,
44
45
  addEventListener: sinon.stub(),
45
46
  },
46
47
  ]),
@@ -53,44 +54,44 @@ describe('media-helpers', () => {
53
54
 
54
55
  it('by default allows unmuting', async () => {
55
56
  assert.equal(stream.isUnmuteAllowed(), true);
56
- await stream.setMuted(false);
57
+ await stream.setUserMuted(false);
57
58
  });
58
59
 
59
- it('rejects setMute(false) if unmute is not allowed', async () => {
60
+ it('rejects setUserMuted(false) if unmute is not allowed', async () => {
60
61
  stream.setUnmuteAllowed(false);
61
62
 
62
63
  assert.equal(stream.isUnmuteAllowed(), false);
63
- const fn = () => stream.setMuted(false);
64
+ const fn = () => stream.setUserMuted(false);
64
65
  expect(fn).to.throw(/Unmute is not allowed/);
65
66
  });
66
67
 
67
- it('resolves setMute(false) if unmute is allowed', async () => {
68
+ it('resolves setUserMuted(false) if unmute is allowed', async () => {
68
69
  stream.setUnmuteAllowed(true);
69
70
 
70
71
  assert.equal(stream.isUnmuteAllowed(), true);
71
- await stream.setMuted(false);
72
+ await stream.setUserMuted(false);
72
73
  });
73
74
 
74
75
  it('returns a reasonable length string from JSON.stringify()', () => {
75
76
  assert.isBelow(JSON.stringify(stream).length, 200);
76
- })
77
+ });
77
78
 
78
79
  describe('#setServerMuted', () => {
79
80
  afterEach(() => {
80
81
  sinon.restore();
81
82
  });
82
83
 
83
- const checkSetServerMuted = async (startMute, setMute, expectedCalled) => {
84
- await stream.setMuted(startMute);
84
+ const checkSetServerMuted = (startMute, setMute, expectedCalled) => {
85
+ stream.setUserMuted(startMute);
85
86
 
86
- assert.equal(stream.muted, startMute);
87
+ assert.equal(stream.userMuted, startMute);
87
88
 
88
89
  const handler = sinon.fake();
89
90
  stream.on(event.ServerMuted, handler);
90
91
 
91
- await stream.setServerMuted(setMute, 'remotelyMuted');
92
+ stream.setServerMuted(setMute, 'remotelyMuted');
92
93
 
93
- assert.equal(stream.muted, setMute);
94
+ assert.equal(stream.userMuted, setMute);
94
95
  if (expectedCalled) {
95
96
  assert.calledOnceWithExactly(handler, setMute, 'remotelyMuted');
96
97
  } else {
@@ -99,19 +100,19 @@ describe('media-helpers', () => {
99
100
  };
100
101
 
101
102
  it('tests true to false', async () => {
102
- await checkSetServerMuted(true, false, true);
103
+ checkSetServerMuted(true, false, true);
103
104
  });
104
105
 
105
106
  it('tests false to true', async () => {
106
- await checkSetServerMuted(false, true, true);
107
+ checkSetServerMuted(false, true, true);
107
108
  });
108
109
 
109
110
  it('tests true to true', async () => {
110
- await checkSetServerMuted(true, true, false);
111
+ checkSetServerMuted(true, true, false);
111
112
  });
112
113
 
113
114
  it('tests false to false', async () => {
114
- await checkSetServerMuted(false, false, false);
115
+ checkSetServerMuted(false, false, false);
115
116
  });
116
117
  });
117
118
 
@@ -137,7 +138,7 @@ describe('media-helpers', () => {
137
138
  assert.calledOnceWithExactly(spy, LocalDisplayStream);
138
139
  });
139
140
  });
140
-
141
+
141
142
  describe('createDisplayStreamWithAudio', () => {
142
143
  it('checks createDisplayStreamWithAudio', async () => {
143
144
  const spy = sinon.stub(wcmestreams, 'createDisplayStreamWithAudio').returns('something');
package/tsconfig.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "include": [
4
+ "src"
5
+ ],
6
+ }