@webex/media-helpers 3.0.0-next.8 → 3.0.0-stream-classes.2

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.
@@ -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","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;AAAA;AAAA,WALYA,UAAU;EAAVA,UAAU;EAAVA,UAAU;AAAA,GAAVA,UAAU,0BAAVA,UAAU;AAAA,IAMVC,cAAc;AAAA;AAAA,WAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;AAAA,GAAdA,cAAc,8BAAdA,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;AAAC"}
package/dist/index.js CHANGED
@@ -76,6 +76,12 @@ _Object$defineProperty(exports, "PresetCameraConstraints", {
76
76
  return _constants.PresetCameraConstraints;
77
77
  }
78
78
  });
79
+ _Object$defineProperty(exports, "RemoteStream", {
80
+ enumerable: true,
81
+ get: function get() {
82
+ return _webrtcCore.RemoteStream;
83
+ }
84
+ });
79
85
  _Object$defineProperty(exports, "StreamEventNames", {
80
86
  enumerable: true,
81
87
  get: function get() {
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":[],"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"}
@@ -77,12 +77,12 @@ exports.LocalCameraStreamEventNames = LocalCameraStreamEventNames;
77
77
  LocalCameraStreamEventNames["ServerMuted"] = "muted:byServer";
78
78
  })(LocalCameraStreamEventNames || (exports.LocalCameraStreamEventNames = LocalCameraStreamEventNames = {}));
79
79
  _LocalMicrophoneStrea = LocalMicrophoneStreamEventNames.ServerMuted;
80
- var LocalMicrophoneStream = /*#__PURE__*/function (_WcmeLocalMicrophoneS) {
81
- (0, _inherits2.default)(LocalMicrophoneStream, _WcmeLocalMicrophoneS);
82
- var _super = _createSuper(LocalMicrophoneStream);
83
- function LocalMicrophoneStream() {
80
+ var _LocalMicrophoneStream = /*#__PURE__*/function (_WcmeLocalMicrophoneS) {
81
+ (0, _inherits2.default)(_LocalMicrophoneStream, _WcmeLocalMicrophoneS);
82
+ var _super = _createSuper(_LocalMicrophoneStream);
83
+ function _LocalMicrophoneStream() {
84
84
  var _this;
85
- (0, _classCallCheck2.default)(this, LocalMicrophoneStream);
85
+ (0, _classCallCheck2.default)(this, _LocalMicrophoneStream);
86
86
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
87
87
  args[_key] = arguments[_key];
88
88
  }
@@ -91,7 +91,7 @@ var LocalMicrophoneStream = /*#__PURE__*/function (_WcmeLocalMicrophoneS) {
91
91
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), _LocalMicrophoneStrea, new _tsEvents.TypedEvent());
92
92
  return _this;
93
93
  }
94
- (0, _createClass2.default)(LocalMicrophoneStream, [{
94
+ (0, _createClass2.default)(_LocalMicrophoneStream, [{
95
95
  key: "setUnmuteAllowed",
96
96
  value:
97
97
  /**
@@ -102,7 +102,7 @@ var LocalMicrophoneStream = /*#__PURE__*/function (_WcmeLocalMicrophoneS) {
102
102
  }
103
103
 
104
104
  /**
105
- * @returns true if user is allowed to unmute the Stream, false otherwise
105
+ * @returns true if user is allowed to unmute the track, false otherwise
106
106
  */
107
107
  }, {
108
108
  key: "isUnmuteAllowed",
@@ -117,7 +117,7 @@ var LocalMicrophoneStream = /*#__PURE__*/function (_WcmeLocalMicrophoneS) {
117
117
  throw new Error('Unmute is not allowed');
118
118
  }
119
119
  }
120
- return (0, _get2.default)((0, _getPrototypeOf2.default)(LocalMicrophoneStream.prototype), "setMuted", this).call(this, muted);
120
+ return (0, _get2.default)((0, _getPrototypeOf2.default)(_LocalMicrophoneStream.prototype), "setMuted", this).call(this, muted);
121
121
  }
122
122
 
123
123
  /**
@@ -131,17 +131,30 @@ var LocalMicrophoneStream = /*#__PURE__*/function (_WcmeLocalMicrophoneS) {
131
131
  this[LocalMicrophoneStreamEventNames.ServerMuted].emit(muted, reason);
132
132
  }
133
133
  }
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
+ }
134
148
  }]);
135
- return LocalMicrophoneStream;
149
+ return _LocalMicrophoneStream;
136
150
  }(_internalMediaCore.LocalMicrophoneStream);
137
- exports.LocalMicrophoneStream = LocalMicrophoneStream;
138
151
  _LocalCameraStreamEve = LocalCameraStreamEventNames.ServerMuted;
139
- var LocalCameraStream = /*#__PURE__*/function (_WcmeLocalCameraStrea) {
140
- (0, _inherits2.default)(LocalCameraStream, _WcmeLocalCameraStrea);
141
- var _super2 = _createSuper(LocalCameraStream);
142
- function LocalCameraStream() {
152
+ var _LocalCameraStream = /*#__PURE__*/function (_WcmeLocalCameraStrea) {
153
+ (0, _inherits2.default)(_LocalCameraStream, _WcmeLocalCameraStrea);
154
+ var _super2 = _createSuper(_LocalCameraStream);
155
+ function _LocalCameraStream() {
143
156
  var _this2;
144
- (0, _classCallCheck2.default)(this, LocalCameraStream);
157
+ (0, _classCallCheck2.default)(this, _LocalCameraStream);
145
158
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
146
159
  args[_key2] = arguments[_key2];
147
160
  }
@@ -150,7 +163,7 @@ var LocalCameraStream = /*#__PURE__*/function (_WcmeLocalCameraStrea) {
150
163
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), _LocalCameraStreamEve, new _tsEvents.TypedEvent());
151
164
  return _this2;
152
165
  }
153
- (0, _createClass2.default)(LocalCameraStream, [{
166
+ (0, _createClass2.default)(_LocalCameraStream, [{
154
167
  key: "setUnmuteAllowed",
155
168
  value:
156
169
  /**
@@ -161,7 +174,7 @@ var LocalCameraStream = /*#__PURE__*/function (_WcmeLocalCameraStrea) {
161
174
  }
162
175
 
163
176
  /**
164
- * @returns true if user is allowed to unmute the Stream, false otherwise
177
+ * @returns true if user is allowed to unmute the track, false otherwise
165
178
  */
166
179
  }, {
167
180
  key: "isUnmuteAllowed",
@@ -176,7 +189,7 @@ var LocalCameraStream = /*#__PURE__*/function (_WcmeLocalCameraStrea) {
176
189
  throw new Error('Unmute is not allowed');
177
190
  }
178
191
  }
179
- return (0, _get2.default)((0, _getPrototypeOf2.default)(LocalCameraStream.prototype), "setMuted", this).call(this, muted);
192
+ return (0, _get2.default)((0, _getPrototypeOf2.default)(_LocalCameraStream.prototype), "setMuted", this).call(this, muted);
180
193
  }
181
194
 
182
195
  /**
@@ -190,10 +203,23 @@ var LocalCameraStream = /*#__PURE__*/function (_WcmeLocalCameraStrea) {
190
203
  this[LocalCameraStreamEventNames.ServerMuted].emit(muted, reason);
191
204
  }
192
205
  }
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
+ }
193
220
  }]);
194
- return LocalCameraStream;
221
+ return _LocalCameraStream;
195
222
  }(_internalMediaCore.LocalCameraStream);
196
- exports.LocalCameraStream = LocalCameraStream;
197
223
  var createMicrophoneStream = function createMicrophoneStream(constraints) {
198
224
  return (0, _internalMediaCore.createMicrophoneStream)(LocalMicrophoneStream, constraints);
199
225
  };
@@ -210,4 +236,8 @@ var createDisplayStreamWithAudio = function createDisplayStreamWithAudio() {
210
236
  return (0, _internalMediaCore.createDisplayStreamWithAudio)(_internalMediaCore.LocalDisplayStream, _internalMediaCore.LocalSystemAudioStream);
211
237
  };
212
238
  exports.createDisplayStreamWithAudio = createDisplayStreamWithAudio;
239
+ var LocalMicrophoneStream = (0, _tsEvents.AddEvents)(_LocalMicrophoneStream);
240
+ exports.LocalMicrophoneStream = LocalMicrophoneStream;
241
+ var LocalCameraStream = (0, _tsEvents.AddEvents)(_LocalCameraStream);
242
+ exports.LocalCameraStream = LocalCameraStream;
213
243
  //# sourceMappingURL=webrtc-core.js.map
@@ -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":";;;;;;;;;;;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AAA;AAE1D,IAAMG,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIF,WAAoC;EAAA,OACrE,IAAAG,qCAAsB,EAACX,iBAAiB,EAAEQ,WAAW,CAAC;AAAA;AAACzC,OAAA,CAAA2C,kBAAA,GAAAA,kBAAA;AAElD,IAAME,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAA;EAAA,OAAS,IAAAC,sCAAuB,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"}
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,IAAI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xCf,kBAAkB,CACnB;AAAC"}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@webex/media-helpers",
3
- "description": "Package that provides helper functions for media related activities.",
3
+ "version": "3.0.0-stream-classes.02",
4
+ "description": "",
4
5
  "license": "Cisco EULA (https://www.cisco.com/c/en/us/products/end-user-license-agreement.html)",
5
6
  "main": "dist/index.js",
6
7
  "devMain": "src/index.ts",
@@ -12,19 +13,10 @@
12
13
  "engines": {
13
14
  "node": ">=16"
14
15
  },
15
- "scripts": {
16
- "build:src": "yarn run -T tsc --declaration true --declarationDir ./dist",
17
- "test:broken": "yarn test:style && yarn test:unit && yarn test:integration && yarn test:browser",
18
- "test:browser:broken": "webex-legacy-tools test --integration --unit --runner karma",
19
- "test:integration:broken": "webex-legacy-tools test --integration --runner mocha",
20
- "test:style": "eslint 'src/**/*.ts' --fix",
21
- "test:unit:broken": "webex-legacy-tools test --unit --runner mocha",
22
- "deploy:npm": "yarn npm publish"
23
- },
24
16
  "dependencies": {
25
- "@webex/internal-media-core": "^2.0.0",
17
+ "@webex/internal-media-core": "2.0.3",
26
18
  "@webex/ts-events": "^1.1.0",
27
- "@webex/web-media-effects": "^2.13.1"
19
+ "@webex/web-media-effects": "^2.8.0"
28
20
  },
29
21
  "browserify": {
30
22
  "transform": [
@@ -33,15 +25,8 @@
33
25
  ]
34
26
  },
35
27
  "devDependencies": {
36
- "@babel/preset-typescript": "7.22.11",
37
- "@webex/babel-config-legacy": "^0.0.0",
38
- "@webex/eslint-config-legacy": "^0.0.0",
39
- "@webex/jest-config-legacy": "^0.0.0",
40
- "@webex/legacy-tools": "^0.0.0",
41
- "@webex/test-helper-chai": "^2.59.3-next.1",
42
- "@webex/test-helper-mock-webex": "^2.59.3-next.1",
43
- "eslint": "^8.24.0",
28
+ "@webex/test-helper-chai": "workspace:^",
29
+ "@webex/test-helper-mock-webex": "workspace:^",
44
30
  "sinon": "^9.2.4"
45
- },
46
- "version": "3.0.0-next.8"
47
- }
31
+ }
32
+ }
package/src/index.ts CHANGED
@@ -5,6 +5,7 @@ export {
5
5
  LocalSystemAudioStream,
6
6
  LocalStreamEventNames,
7
7
  StreamEventNames,
8
+ RemoteStream,
8
9
  type ServerMuteReason,
9
10
  LocalMicrophoneStreamEventNames,
10
11
  LocalCameraStreamEventNames,
@@ -14,6 +15,7 @@ export {
14
15
  createCameraStream,
15
16
  createDisplayStream,
16
17
  createDisplayStreamWithAudio,
18
+ type VideoContentHint,
17
19
  } from './webrtc-core';
18
20
 
19
21
  export {NoiseReductionEffect, VirtualBackgroundEffect} from '@webex/web-media-effects';
@@ -13,7 +13,7 @@ import {
13
13
  LocalCameraStream as WcmeLocalCameraStream,
14
14
  VideoDeviceConstraints,
15
15
  } from '@webex/internal-media-core';
16
- import {TypedEvent} from '@webex/ts-events';
16
+ import {AddEvents, TypedEvent, WithEventsDummyType} from '@webex/ts-events';
17
17
 
18
18
  export {
19
19
  getDevices,
@@ -23,6 +23,7 @@ export {
23
23
  LocalStreamEventNames,
24
24
  StreamEventNames,
25
25
  RemoteStream,
26
+ type VideoContentHint,
26
27
  } from '@webex/internal-media-core';
27
28
 
28
29
  export type ServerMuteReason =
@@ -40,7 +41,19 @@ export enum LocalCameraStreamEventNames {
40
41
  ServerMuted = 'muted:byServer',
41
42
  }
42
43
 
43
- export class LocalMicrophoneStream extends WcmeLocalMicrophoneStream {
44
+ interface LocalMicrophoneStreamEvents {
45
+ [LocalMicrophoneStreamEventNames.ServerMuted]: TypedEvent<
46
+ (muted: boolean, reason: ServerMuteReason) => void
47
+ >;
48
+ }
49
+
50
+ interface LocalCameraStreamEvents {
51
+ [LocalMicrophoneStreamEventNames.ServerMuted]: TypedEvent<
52
+ (muted: boolean, reason: ServerMuteReason) => void
53
+ >;
54
+ }
55
+
56
+ class _LocalMicrophoneStream extends WcmeLocalMicrophoneStream {
44
57
  private unmuteAllowed = true;
45
58
 
46
59
  [LocalMicrophoneStreamEventNames.ServerMuted] = new TypedEvent<
@@ -55,7 +68,7 @@ export class LocalMicrophoneStream extends WcmeLocalMicrophoneStream {
55
68
  }
56
69
 
57
70
  /**
58
- * @returns true if user is allowed to unmute the Stream, false otherwise
71
+ * @returns true if user is allowed to unmute the track, false otherwise
59
72
  */
60
73
  isUnmuteAllowed() {
61
74
  return this.unmuteAllowed;
@@ -80,9 +93,19 @@ export class LocalMicrophoneStream extends WcmeLocalMicrophoneStream {
80
93
  this[LocalMicrophoneStreamEventNames.ServerMuted].emit(muted, reason);
81
94
  }
82
95
  }
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
+ }
83
106
  }
84
107
 
85
- export class LocalCameraStream extends WcmeLocalCameraStream {
108
+ class _LocalCameraStream extends WcmeLocalCameraStream {
86
109
  private unmuteAllowed = true;
87
110
 
88
111
  [LocalCameraStreamEventNames.ServerMuted] = new TypedEvent<
@@ -97,7 +120,7 @@ export class LocalCameraStream extends WcmeLocalCameraStream {
97
120
  }
98
121
 
99
122
  /**
100
- * @returns true if user is allowed to unmute the Stream, false otherwise
123
+ * @returns true if user is allowed to unmute the track, false otherwise
101
124
  */
102
125
  isUnmuteAllowed() {
103
126
  return this.unmuteAllowed;
@@ -122,6 +145,16 @@ export class LocalCameraStream extends WcmeLocalCameraStream {
122
145
  this[LocalCameraStreamEventNames.ServerMuted].emit(muted, reason);
123
146
  }
124
147
  }
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
+ }
125
158
  }
126
159
 
127
160
  export const createMicrophoneStream = (constraints?: AudioDeviceConstraints) =>
@@ -134,3 +167,17 @@ export const createDisplayStream = () => wcmeCreateDisplayStream(LocalDisplayStr
134
167
 
135
168
  export const createDisplayStreamWithAudio = () =>
136
169
  wcmeCreateDisplayStreamWithAudio(LocalDisplayStream, LocalSystemAudioStream);
170
+
171
+ export const LocalMicrophoneStream = AddEvents<
172
+ typeof _LocalMicrophoneStream,
173
+ LocalMicrophoneStreamEvents
174
+ >(_LocalMicrophoneStream);
175
+
176
+ export type LocalMicrophoneStream = _LocalMicrophoneStream &
177
+ WithEventsDummyType<LocalMicrophoneStreamEvents>;
178
+
179
+ export const LocalCameraStream = AddEvents<typeof _LocalCameraStream, LocalCameraStreamEvents>(
180
+ _LocalCameraStream
181
+ );
182
+
183
+ export type LocalCameraStream = _LocalCameraStream & WithEventsDummyType<LocalCameraStreamEvents>;
@@ -12,7 +12,7 @@ import {
12
12
  createDisplayStream,
13
13
  createDisplayStreamWithAudio,
14
14
  } from '../../../src/webrtc-core';
15
- import * as wcmeStreams from '@webex/internal-media-core';
15
+ import * as wcmestreams from '@webex/internal-media-core';
16
16
 
17
17
  describe('media-helpers', () => {
18
18
  describe('webrtc-core', () => {
@@ -36,11 +36,12 @@ describe('media-helpers', () => {
36
36
  classesToTest.forEach(({className, title, event, createFn, spyFn}) =>
37
37
  describe(title, () => {
38
38
  const fakeStream = {
39
- getStreams: sinon.stub().returns([
39
+ getTracks: sinon.stub().returns([
40
40
  {
41
- label: 'fake Stream',
42
- id: 'fake Stream id',
41
+ label: 'fake track',
42
+ id: 'fake track id',
43
43
  enabled: true,
44
+ addEventListener: sinon.stub(),
44
45
  },
45
46
  ]),
46
47
  };
@@ -70,6 +71,10 @@ describe('media-helpers', () => {
70
71
  await stream.setMuted(false);
71
72
  });
72
73
 
74
+ it('returns a reasonable length string from JSON.stringify()', () => {
75
+ assert.isBelow(JSON.stringify(stream).length, 200);
76
+ })
77
+
73
78
  describe('#setServerMuted', () => {
74
79
  afterEach(() => {
75
80
  sinon.restore();
@@ -87,7 +92,7 @@ describe('media-helpers', () => {
87
92
 
88
93
  assert.equal(stream.muted, setMute);
89
94
  if (expectedCalled) {
90
- assert.calledOnceWithExactly(handler, {muted: setMute, reason: 'remotelyMuted'});
95
+ assert.calledOnceWithExactly(handler, setMute, 'remotelyMuted');
91
96
  } else {
92
97
  assert.notCalled(handler);
93
98
  }
@@ -111,10 +116,10 @@ describe('media-helpers', () => {
111
116
  });
112
117
 
113
118
  describe('#wcmeCreateMicrophoneStream, #wcmeCreateCameraStream', () => {
114
- it('checks creating Streams', async () => {
115
- const constraints = {devideId: 'abc'};
119
+ it('checks creating tracks', async () => {
120
+ const constraints = {deviceId: 'abc'};
116
121
 
117
- const spy = sinon.stub(wcmeStreams, spyFn).returns('something');
122
+ const spy = sinon.stub(wcmestreams, spyFn).returns('something');
118
123
  const result = createFn(constraints);
119
124
 
120
125
  assert.equal(result, 'something');
@@ -126,16 +131,16 @@ describe('media-helpers', () => {
126
131
 
127
132
  describe('createDisplayStream', () => {
128
133
  it('checks createDisplayStream', async () => {
129
- const spy = sinon.stub(wcmeStreams, 'createDisplayStream').returns('something');
134
+ const spy = sinon.stub(wcmestreams, 'createDisplayStream').returns('something');
130
135
  const result = createDisplayStream();
131
136
  assert.equal(result, 'something');
132
137
  assert.calledOnceWithExactly(spy, LocalDisplayStream);
133
138
  });
134
139
  });
135
-
140
+
136
141
  describe('createDisplayStreamWithAudio', () => {
137
142
  it('checks createDisplayStreamWithAudio', async () => {
138
- const spy = sinon.stub(wcmeStreams, 'createDisplayStreamWithAudio').returns('something');
143
+ const spy = sinon.stub(wcmestreams, 'createDisplayStreamWithAudio').returns('something');
139
144
  const result = createDisplayStreamWithAudio();
140
145
  assert.equal(result, 'something');
141
146
  assert.calledOnceWithExactly(spy, LocalDisplayStream, LocalSystemAudioStream);
package/babel.config.json DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "presets": [
3
- [
4
- "@babel/preset-env",
5
- {
6
- "targets": {
7
- "node": "current"
8
- }
9
- }
10
- ],
11
- "@babel/preset-typescript"
12
- ],
13
- }
@@ -1,13 +0,0 @@
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
- };
package/dist/index.d.ts DELETED
@@ -1,4 +0,0 @@
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,48 +0,0 @@
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]>;
package/tsconfig.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "extends": "../../../tsconfig.json",
3
- "include": [
4
- "src"
5
- ],
6
- }