@webex/media-helpers
Advanced tools
Comparing version 3.0.1 to 3.1.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property"); | ||
_Object$defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.PresetCameraConstraints = exports.FacingMode = exports.DisplaySurface = void 0; | ||
let FacingMode = exports.FacingMode = /*#__PURE__*/function (FacingMode) { | ||
var FacingMode = exports.FacingMode = /*#__PURE__*/function (FacingMode) { | ||
FacingMode["user"] = "user"; | ||
@@ -12,3 +13,3 @@ FacingMode["environment"] = "environment"; | ||
}({}); // can be used later on when we add constraints in create display track | ||
let DisplaySurface = exports.DisplaySurface = /*#__PURE__*/function (DisplaySurface) { | ||
var DisplaySurface = exports.DisplaySurface = /*#__PURE__*/function (DisplaySurface) { | ||
DisplaySurface["browser"] = "browser"; | ||
@@ -19,3 +20,3 @@ DisplaySurface["monitor"] = "monitor"; | ||
}({}); | ||
const PresetCameraConstraints = exports.PresetCameraConstraints = { | ||
var PresetCameraConstraints = exports.PresetCameraConstraints = { | ||
'1080p': { | ||
@@ -22,0 +23,0 @@ frameRate: 30, |
@@ -1,4 +0,4 @@ | ||
export { getDevices, LocalStream, LocalDisplayStream, LocalSystemAudioStream, LocalStreamEventNames, StreamEventNames, RemoteStream, type ServerMuteReason, LocalMicrophoneStreamEventNames, LocalCameraStreamEventNames, LocalMicrophoneStream, LocalCameraStream, createMicrophoneStream, createCameraStream, createDisplayStream, createDisplayStreamWithAudio, type VideoContentHint, } from './webrtc-core'; | ||
export { getDevices, LocalStream, LocalDisplayStream, LocalSystemAudioStream, LocalStreamEventNames, StreamEventNames, RemoteStream, RemoteStreamEventNames, type ServerMuteReason, LocalMicrophoneStreamEventNames, LocalCameraStreamEventNames, LocalMicrophoneStream, LocalCameraStream, createMicrophoneStream, createCameraStream, createDisplayStream, createDisplayStreamWithAudio, type VideoContentHint, } from './webrtc-core'; | ||
export { NoiseReductionEffect, VirtualBackgroundEffect } from '@webex/web-media-effects'; | ||
export type { NoiseReductionEffectOptions, VirtualBackgroundEffectOptions, } from '@webex/web-media-effects'; | ||
export { FacingMode, DisplaySurface, PresetCameraConstraints } from './constants'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property"); | ||
_Object$defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "DisplaySurface", { | ||
_Object$defineProperty(exports, "DisplaySurface", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _constants.DisplaySurface; | ||
} | ||
}); | ||
Object.defineProperty(exports, "FacingMode", { | ||
_Object$defineProperty(exports, "FacingMode", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _constants.FacingMode; | ||
} | ||
}); | ||
Object.defineProperty(exports, "LocalCameraStream", { | ||
_Object$defineProperty(exports, "LocalCameraStream", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _webrtcCore.LocalCameraStream; | ||
} | ||
}); | ||
Object.defineProperty(exports, "LocalCameraStreamEventNames", { | ||
_Object$defineProperty(exports, "LocalCameraStreamEventNames", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _webrtcCore.LocalCameraStreamEventNames; | ||
} | ||
}); | ||
Object.defineProperty(exports, "LocalDisplayStream", { | ||
_Object$defineProperty(exports, "LocalDisplayStream", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _webrtcCore.LocalDisplayStream; | ||
} | ||
}); | ||
Object.defineProperty(exports, "LocalMicrophoneStream", { | ||
_Object$defineProperty(exports, "LocalMicrophoneStream", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _webrtcCore.LocalMicrophoneStream; | ||
} | ||
}); | ||
Object.defineProperty(exports, "LocalMicrophoneStreamEventNames", { | ||
_Object$defineProperty(exports, "LocalMicrophoneStreamEventNames", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _webrtcCore.LocalMicrophoneStreamEventNames; | ||
} | ||
}); | ||
Object.defineProperty(exports, "LocalStream", { | ||
_Object$defineProperty(exports, "LocalStream", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _webrtcCore.LocalStream; | ||
} | ||
}); | ||
Object.defineProperty(exports, "LocalStreamEventNames", { | ||
_Object$defineProperty(exports, "LocalStreamEventNames", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _webrtcCore.LocalStreamEventNames; | ||
} | ||
}); | ||
Object.defineProperty(exports, "LocalSystemAudioStream", { | ||
_Object$defineProperty(exports, "LocalSystemAudioStream", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _webrtcCore.LocalSystemAudioStream; | ||
} | ||
}); | ||
Object.defineProperty(exports, "NoiseReductionEffect", { | ||
_Object$defineProperty(exports, "NoiseReductionEffect", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _webMediaEffects.NoiseReductionEffect; | ||
} | ||
}); | ||
Object.defineProperty(exports, "PresetCameraConstraints", { | ||
_Object$defineProperty(exports, "PresetCameraConstraints", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _constants.PresetCameraConstraints; | ||
} | ||
}); | ||
Object.defineProperty(exports, "RemoteStream", { | ||
_Object$defineProperty(exports, "RemoteStream", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _webrtcCore.RemoteStream; | ||
} | ||
}); | ||
Object.defineProperty(exports, "StreamEventNames", { | ||
_Object$defineProperty(exports, "RemoteStreamEventNames", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _webrtcCore.RemoteStreamEventNames; | ||
} | ||
}); | ||
_Object$defineProperty(exports, "StreamEventNames", { | ||
enumerable: true, | ||
get: function get() { | ||
return _webrtcCore.StreamEventNames; | ||
} | ||
}); | ||
Object.defineProperty(exports, "VirtualBackgroundEffect", { | ||
_Object$defineProperty(exports, "VirtualBackgroundEffect", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _webMediaEffects.VirtualBackgroundEffect; | ||
} | ||
}); | ||
Object.defineProperty(exports, "createCameraStream", { | ||
_Object$defineProperty(exports, "createCameraStream", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _webrtcCore.createCameraStream; | ||
} | ||
}); | ||
Object.defineProperty(exports, "createDisplayStream", { | ||
_Object$defineProperty(exports, "createDisplayStream", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _webrtcCore.createDisplayStream; | ||
} | ||
}); | ||
Object.defineProperty(exports, "createDisplayStreamWithAudio", { | ||
_Object$defineProperty(exports, "createDisplayStreamWithAudio", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _webrtcCore.createDisplayStreamWithAudio; | ||
} | ||
}); | ||
Object.defineProperty(exports, "createMicrophoneStream", { | ||
_Object$defineProperty(exports, "createMicrophoneStream", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _webrtcCore.createMicrophoneStream; | ||
} | ||
}); | ||
Object.defineProperty(exports, "getDevices", { | ||
_Object$defineProperty(exports, "getDevices", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _webrtcCore.getDevices; | ||
@@ -124,0 +131,0 @@ } |
import { AudioDeviceConstraints, LocalDisplayStream, LocalSystemAudioStream, LocalMicrophoneStream as WcmeLocalMicrophoneStream, LocalCameraStream as WcmeLocalCameraStream, VideoDeviceConstraints } from '@webex/internal-media-core'; | ||
import { TypedEvent, WithEventsDummyType } from '@webex/ts-events'; | ||
export { getDevices, LocalStream, LocalDisplayStream, LocalSystemAudioStream, LocalStreamEventNames, StreamEventNames, RemoteStream, type VideoContentHint, } from '@webex/internal-media-core'; | ||
export { getDevices, LocalStream, LocalDisplayStream, LocalSystemAudioStream, LocalStreamEventNames, StreamEventNames, RemoteStream, RemoteStreamEventNames, type VideoContentHint, } from '@webex/internal-media-core'; | ||
export type ServerMuteReason = 'remotelyMuted' | 'clientRequestFailed' | 'localUnmuteRequired'; | ||
@@ -15,3 +15,3 @@ export declare enum LocalMicrophoneStreamEventNames { | ||
interface LocalCameraStreamEvents { | ||
[LocalMicrophoneStreamEventNames.ServerMuted]: TypedEvent<(muted: boolean, reason: ServerMuteReason) => void>; | ||
[LocalCameraStreamEventNames.ServerMuted]: TypedEvent<(muted: boolean, reason: ServerMuteReason) => void>; | ||
} | ||
@@ -25,3 +25,3 @@ declare class _LocalMicrophoneStream extends WcmeLocalMicrophoneStream { | ||
isUnmuteAllowed(): boolean; | ||
setMuted(muted: boolean): void; | ||
setUserMuted(muted: boolean): void; | ||
} | ||
@@ -35,3 +35,3 @@ declare class _LocalCameraStream extends WcmeLocalCameraStream { | ||
isUnmuteAllowed(): boolean; | ||
setMuted(muted: boolean): void; | ||
setUserMuted(muted: boolean): void; | ||
} | ||
@@ -44,5 +44,5 @@ export declare const createMicrophoneStream: (constraints?: AudioDeviceConstraints) => Promise<{ | ||
export declare const createCameraStream: (constraints?: VideoDeviceConstraints) => Promise<{ | ||
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; | ||
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; | ||
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; | ||
on<K extends LocalCameraStreamEventNames.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; | ||
once<K_1 extends LocalCameraStreamEventNames.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; | ||
off<K_2 extends LocalCameraStreamEventNames.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; | ||
} & _LocalCameraStream>; | ||
@@ -58,6 +58,6 @@ export declare const createDisplayStream: () => Promise<LocalDisplayStream>; | ||
export declare const LocalCameraStream: (new (...args: any[]) => { | ||
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; | ||
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; | ||
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; | ||
on<K extends LocalCameraStreamEventNames.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; | ||
once<K_1 extends LocalCameraStreamEventNames.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; | ||
off<K_2 extends LocalCameraStreamEventNames.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; | ||
}) & typeof _LocalCameraStream; | ||
export type LocalCameraStream = _LocalCameraStream & WithEventsDummyType<LocalCameraStreamEvents>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct"); | ||
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property"); | ||
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault"); | ||
_Object$defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.LocalCameraStreamEventNames = exports.LocalCameraStream = void 0; | ||
Object.defineProperty(exports, "LocalDisplayStream", { | ||
_Object$defineProperty(exports, "LocalDisplayStream", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _internalMediaCore.LocalDisplayStream; | ||
@@ -14,29 +17,35 @@ } | ||
exports.LocalMicrophoneStreamEventNames = exports.LocalMicrophoneStream = void 0; | ||
Object.defineProperty(exports, "LocalStream", { | ||
_Object$defineProperty(exports, "LocalStream", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _internalMediaCore.LocalStream; | ||
} | ||
}); | ||
Object.defineProperty(exports, "LocalStreamEventNames", { | ||
_Object$defineProperty(exports, "LocalStreamEventNames", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _internalMediaCore.LocalStreamEventNames; | ||
} | ||
}); | ||
Object.defineProperty(exports, "LocalSystemAudioStream", { | ||
_Object$defineProperty(exports, "LocalSystemAudioStream", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _internalMediaCore.LocalSystemAudioStream; | ||
} | ||
}); | ||
Object.defineProperty(exports, "RemoteStream", { | ||
_Object$defineProperty(exports, "RemoteStream", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _internalMediaCore.RemoteStream; | ||
} | ||
}); | ||
Object.defineProperty(exports, "StreamEventNames", { | ||
_Object$defineProperty(exports, "RemoteStreamEventNames", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _internalMediaCore.RemoteStreamEventNames; | ||
} | ||
}); | ||
_Object$defineProperty(exports, "StreamEventNames", { | ||
enumerable: true, | ||
get: function get() { | ||
return _internalMediaCore.StreamEventNames; | ||
@@ -46,105 +55,164 @@ } | ||
exports.createMicrophoneStream = exports.createDisplayStreamWithAudio = exports.createDisplayStream = exports.createCameraStream = void 0; | ||
Object.defineProperty(exports, "getDevices", { | ||
_Object$defineProperty(exports, "getDevices", { | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _internalMediaCore.getDevices; | ||
} | ||
}); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass")); | ||
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/assertThisInitialized")); | ||
var _get2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/get")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits")); | ||
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn")); | ||
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf")); | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty")); | ||
var _internalMediaCore = require("@webex/internal-media-core"); | ||
var _tsEvents = require("@webex/ts-events"); | ||
var _LocalMicrophoneStrea, _LocalCameraStreamEve; | ||
/* eslint-disable @typescript-eslint/no-misused-new */ | ||
/* eslint-disable valid-jsdoc */ | ||
/* eslint-disable require-jsdoc */ | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
// server forced the client to be unmuted | ||
// these events are in addition to WCME events. This will be properly typed once webrtc-core event types inheritance is fixed | ||
let LocalMicrophoneStreamEventNames = exports.LocalMicrophoneStreamEventNames = /*#__PURE__*/function (LocalMicrophoneStreamEventNames) { | ||
var LocalMicrophoneStreamEventNames = exports.LocalMicrophoneStreamEventNames = /*#__PURE__*/function (LocalMicrophoneStreamEventNames) { | ||
LocalMicrophoneStreamEventNames["ServerMuted"] = "muted:byServer"; | ||
return LocalMicrophoneStreamEventNames; | ||
}({}); // these events are in addition to WCME events. This will be properly typed once webrtc-core event types inheritance is fixed | ||
let LocalCameraStreamEventNames = exports.LocalCameraStreamEventNames = /*#__PURE__*/function (LocalCameraStreamEventNames) { | ||
var LocalCameraStreamEventNames = exports.LocalCameraStreamEventNames = /*#__PURE__*/function (LocalCameraStreamEventNames) { | ||
LocalCameraStreamEventNames["ServerMuted"] = "muted:byServer"; | ||
return LocalCameraStreamEventNames; | ||
}({}); | ||
class _LocalMicrophoneStream extends _internalMediaCore.LocalMicrophoneStream { | ||
unmuteAllowed = true; | ||
[LocalMicrophoneStreamEventNames.ServerMuted] = new _tsEvents.TypedEvent(); | ||
/** | ||
* @internal | ||
*/ | ||
setUnmuteAllowed(allowed) { | ||
this.unmuteAllowed = allowed; | ||
_LocalMicrophoneStrea = LocalMicrophoneStreamEventNames.ServerMuted; | ||
var _LocalMicrophoneStream = /*#__PURE__*/function (_WcmeLocalMicrophoneS) { | ||
(0, _inherits2.default)(_LocalMicrophoneStream, _WcmeLocalMicrophoneS); | ||
var _super = _createSuper(_LocalMicrophoneStream); | ||
function _LocalMicrophoneStream() { | ||
var _this; | ||
(0, _classCallCheck2.default)(this, _LocalMicrophoneStream); | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "unmuteAllowed", true); | ||
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), _LocalMicrophoneStrea, new _tsEvents.TypedEvent()); | ||
return _this; | ||
} | ||
(0, _createClass2.default)(_LocalMicrophoneStream, [{ | ||
key: "setUnmuteAllowed", | ||
value: | ||
/** | ||
* @internal | ||
*/ | ||
function setUnmuteAllowed(allowed) { | ||
this.unmuteAllowed = allowed; | ||
} | ||
/** | ||
* @returns true if user is allowed to unmute the track, false otherwise | ||
*/ | ||
isUnmuteAllowed() { | ||
return this.unmuteAllowed; | ||
} | ||
setMuted(muted) { | ||
if (!muted) { | ||
if (!this.isUnmuteAllowed()) { | ||
throw new Error('Unmute is not allowed'); | ||
/** | ||
* @returns true if user is allowed to unmute the track, false otherwise | ||
*/ | ||
}, { | ||
key: "isUnmuteAllowed", | ||
value: function isUnmuteAllowed() { | ||
return this.unmuteAllowed; | ||
} | ||
}, { | ||
key: "setUserMuted", | ||
value: function setUserMuted(muted) { | ||
if (!muted) { | ||
if (!this.isUnmuteAllowed()) { | ||
throw new Error('Unmute is not allowed'); | ||
} | ||
} | ||
return (0, _get2.default)((0, _getPrototypeOf2.default)(_LocalMicrophoneStream.prototype), "setUserMuted", this).call(this, muted); | ||
} | ||
return super.setMuted(muted); | ||
} | ||
/** | ||
* @internal | ||
*/ | ||
setServerMuted(muted, reason) { | ||
if (muted !== this.muted) { | ||
this.setMuted(muted); | ||
this[LocalMicrophoneStreamEventNames.ServerMuted].emit(muted, reason); | ||
/** | ||
* @internal | ||
*/ | ||
}, { | ||
key: "setServerMuted", | ||
value: function setServerMuted(muted, reason) { | ||
if (muted !== this.userMuted) { | ||
this.setUserMuted(muted); | ||
this[LocalMicrophoneStreamEventNames.ServerMuted].emit(muted, reason); | ||
} | ||
} | ||
}]); | ||
return _LocalMicrophoneStream; | ||
}(_internalMediaCore.LocalMicrophoneStream); | ||
_LocalCameraStreamEve = LocalCameraStreamEventNames.ServerMuted; | ||
var _LocalCameraStream = /*#__PURE__*/function (_WcmeLocalCameraStrea) { | ||
(0, _inherits2.default)(_LocalCameraStream, _WcmeLocalCameraStrea); | ||
var _super2 = _createSuper(_LocalCameraStream); | ||
function _LocalCameraStream() { | ||
var _this2; | ||
(0, _classCallCheck2.default)(this, _LocalCameraStream); | ||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
_this2 = _super2.call.apply(_super2, [this].concat(args)); | ||
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "unmuteAllowed", true); | ||
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), _LocalCameraStreamEve, new _tsEvents.TypedEvent()); | ||
return _this2; | ||
} | ||
} | ||
class _LocalCameraStream extends _internalMediaCore.LocalCameraStream { | ||
unmuteAllowed = true; | ||
[LocalCameraStreamEventNames.ServerMuted] = new _tsEvents.TypedEvent(); | ||
(0, _createClass2.default)(_LocalCameraStream, [{ | ||
key: "setUnmuteAllowed", | ||
value: | ||
/** | ||
* @internal | ||
*/ | ||
function setUnmuteAllowed(allowed) { | ||
this.unmuteAllowed = allowed; | ||
} | ||
/** | ||
* @internal | ||
*/ | ||
setUnmuteAllowed(allowed) { | ||
this.unmuteAllowed = allowed; | ||
} | ||
/** | ||
* @returns true if user is allowed to unmute the track, false otherwise | ||
*/ | ||
isUnmuteAllowed() { | ||
return this.unmuteAllowed; | ||
} | ||
setMuted(muted) { | ||
if (!muted) { | ||
if (!this.isUnmuteAllowed()) { | ||
throw new Error('Unmute is not allowed'); | ||
/** | ||
* @returns true if user is allowed to unmute the track, false otherwise | ||
*/ | ||
}, { | ||
key: "isUnmuteAllowed", | ||
value: function isUnmuteAllowed() { | ||
return this.unmuteAllowed; | ||
} | ||
}, { | ||
key: "setUserMuted", | ||
value: function setUserMuted(muted) { | ||
if (!muted) { | ||
if (!this.isUnmuteAllowed()) { | ||
throw new Error('Unmute is not allowed'); | ||
} | ||
} | ||
return (0, _get2.default)((0, _getPrototypeOf2.default)(_LocalCameraStream.prototype), "setUserMuted", this).call(this, muted); | ||
} | ||
return super.setMuted(muted); | ||
} | ||
/** | ||
* @internal | ||
*/ | ||
setServerMuted(muted, reason) { | ||
if (muted !== this.muted) { | ||
this.setMuted(muted); | ||
this[LocalCameraStreamEventNames.ServerMuted].emit(muted, reason); | ||
/** | ||
* @internal | ||
*/ | ||
}, { | ||
key: "setServerMuted", | ||
value: function setServerMuted(muted, reason) { | ||
if (muted !== this.userMuted) { | ||
this.setUserMuted(muted); | ||
this[LocalCameraStreamEventNames.ServerMuted].emit(muted, reason); | ||
} | ||
} | ||
} | ||
} | ||
const createMicrophoneStream = constraints => (0, _internalMediaCore.createMicrophoneStream)(LocalMicrophoneStream, constraints); | ||
exports.createMicrophoneStream = createMicrophoneStream; | ||
const createCameraStream = constraints => (0, _internalMediaCore.createCameraStream)(LocalCameraStream, constraints); | ||
exports.createCameraStream = createCameraStream; | ||
const createDisplayStream = () => (0, _internalMediaCore.createDisplayStream)(_internalMediaCore.LocalDisplayStream); | ||
exports.createDisplayStream = createDisplayStream; | ||
const createDisplayStreamWithAudio = () => (0, _internalMediaCore.createDisplayStreamWithAudio)(_internalMediaCore.LocalDisplayStream, _internalMediaCore.LocalSystemAudioStream); | ||
exports.createDisplayStreamWithAudio = createDisplayStreamWithAudio; | ||
const LocalMicrophoneStream = exports.LocalMicrophoneStream = (0, _tsEvents.AddEvents)(_LocalMicrophoneStream); | ||
const LocalCameraStream = exports.LocalCameraStream = (0, _tsEvents.AddEvents)(_LocalCameraStream); | ||
}]); | ||
return _LocalCameraStream; | ||
}(_internalMediaCore.LocalCameraStream); | ||
var createMicrophoneStream = exports.createMicrophoneStream = function createMicrophoneStream(constraints) { | ||
return (0, _internalMediaCore.createMicrophoneStream)(LocalMicrophoneStream, constraints); | ||
}; | ||
var createCameraStream = exports.createCameraStream = function createCameraStream(constraints) { | ||
return (0, _internalMediaCore.createCameraStream)(LocalCameraStream, constraints); | ||
}; | ||
var createDisplayStream = exports.createDisplayStream = function createDisplayStream() { | ||
return (0, _internalMediaCore.createDisplayStream)(_internalMediaCore.LocalDisplayStream); | ||
}; | ||
var createDisplayStreamWithAudio = exports.createDisplayStreamWithAudio = function createDisplayStreamWithAudio() { | ||
return (0, _internalMediaCore.createDisplayStreamWithAudio)(_internalMediaCore.LocalDisplayStream, _internalMediaCore.LocalSystemAudioStream); | ||
}; | ||
var LocalMicrophoneStream = exports.LocalMicrophoneStream = (0, _tsEvents.AddEvents)(_LocalMicrophoneStream); | ||
var LocalCameraStream = exports.LocalCameraStream = (0, _tsEvents.AddEvents)(_LocalCameraStream); | ||
//# sourceMappingURL=webrtc-core.js.map |
const config = require('@webex/jest-config-legacy'); | ||
module.exports = { | ||
...config, | ||
testEnvironment: 'jsdom', | ||
}; | ||
module.exports = config; |
@@ -25,5 +25,5 @@ { | ||
"dependencies": { | ||
"@webex/internal-media-core": "2.2.9", | ||
"@webex/internal-media-core": "2.5.0", | ||
"@webex/ts-events": "^1.1.0", | ||
"@webex/web-media-effects": "^2.15.6" | ||
"@webex/web-media-effects": "2.18.0" | ||
}, | ||
@@ -42,8 +42,9 @@ "browserify": { | ||
"@webex/legacy-tools": "0.0.0", | ||
"@webex/test-helper-chai": "3.0.0", | ||
"@webex/test-helper-mock-webex": "3.0.0", | ||
"@webex/test-helper-chai": "3.1.0", | ||
"@webex/test-helper-mock-webex": "3.1.0", | ||
"eslint": "^8.24.0", | ||
"jsdom-global": "3.0.2", | ||
"sinon": "^9.2.4" | ||
}, | ||
"version": "3.0.1" | ||
"version": "3.1.0" | ||
} |
@@ -9,2 +9,3 @@ export { | ||
RemoteStream, | ||
RemoteStreamEventNames, | ||
type ServerMuteReason, | ||
@@ -11,0 +12,0 @@ LocalMicrophoneStreamEventNames, |
@@ -26,2 +26,3 @@ /* eslint-disable @typescript-eslint/no-misused-new */ | ||
RemoteStream, | ||
RemoteStreamEventNames, | ||
type VideoContentHint, | ||
@@ -32,3 +33,3 @@ } from '@webex/internal-media-core'; | ||
| 'remotelyMuted' // other user has remotely muted us | ||
| 'clientRequestFailed' // client called setMuted() but server request failed | ||
| 'clientRequestFailed' // client called setUserMuted() but server request failed | ||
| 'localUnmuteRequired'; // server forced the client to be unmuted | ||
@@ -53,3 +54,3 @@ | ||
interface LocalCameraStreamEvents { | ||
[LocalMicrophoneStreamEventNames.ServerMuted]: TypedEvent< | ||
[LocalCameraStreamEventNames.ServerMuted]: TypedEvent< | ||
(muted: boolean, reason: ServerMuteReason) => void | ||
@@ -80,3 +81,3 @@ >; | ||
setMuted(muted: boolean): void { | ||
setUserMuted(muted: boolean): void { | ||
if (!muted) { | ||
@@ -88,3 +89,3 @@ if (!this.isUnmuteAllowed()) { | ||
return super.setMuted(muted); | ||
return super.setUserMuted(muted); | ||
} | ||
@@ -96,4 +97,4 @@ | ||
setServerMuted(muted: boolean, reason: ServerMuteReason) { | ||
if (muted !== this.muted) { | ||
this.setMuted(muted); | ||
if (muted !== this.userMuted) { | ||
this.setUserMuted(muted); | ||
this[LocalMicrophoneStreamEventNames.ServerMuted].emit(muted, reason); | ||
@@ -125,3 +126,3 @@ } | ||
setMuted(muted: boolean): void { | ||
setUserMuted(muted: boolean): void { | ||
if (!muted) { | ||
@@ -133,3 +134,3 @@ if (!this.isUnmuteAllowed()) { | ||
return super.setMuted(muted); | ||
return super.setUserMuted(muted); | ||
} | ||
@@ -141,4 +142,4 @@ | ||
setServerMuted(muted: boolean, reason: ServerMuteReason) { | ||
if (muted !== this.muted) { | ||
this.setMuted(muted); | ||
if (muted !== this.userMuted) { | ||
this.setUserMuted(muted); | ||
this[LocalCameraStreamEventNames.ServerMuted].emit(muted, reason); | ||
@@ -145,0 +146,0 @@ } |
@@ -0,1 +1,2 @@ | ||
import 'jsdom-global/register'; | ||
import {assert, expect} from '@webex/test-helper-chai'; | ||
@@ -56,18 +57,18 @@ import sinon from 'sinon'; | ||
assert.equal(stream.isUnmuteAllowed(), true); | ||
await stream.setMuted(false); | ||
await stream.setUserMuted(false); | ||
}); | ||
it('rejects setMute(false) if unmute is not allowed', async () => { | ||
await stream.setUnmuteAllowed(false); | ||
it('rejects setUserMuted(false) if unmute is not allowed', async () => { | ||
stream.setUnmuteAllowed(false); | ||
assert.equal(stream.isUnmuteAllowed(), false); | ||
const fn = () => stream.setMuted(false); | ||
const fn = () => stream.setUserMuted(false); | ||
expect(fn).to.throw(/Unmute is not allowed/); | ||
}); | ||
it('resolves setMute(false) if unmute is allowed', async () => { | ||
await stream.setUnmuteAllowed(true); | ||
it('resolves setUserMuted(false) if unmute is allowed', async () => { | ||
stream.setUnmuteAllowed(true); | ||
assert.equal(stream.isUnmuteAllowed(), true); | ||
await stream.setMuted(false); | ||
await stream.setUserMuted(false); | ||
}); | ||
@@ -85,5 +86,5 @@ | ||
const checkSetServerMuted = async (startMute, setMute, expectedCalled) => { | ||
await stream.setMuted(startMute); | ||
await stream.setUserMuted(startMute); | ||
assert.equal(stream.muted, startMute); | ||
assert.equal(stream.userMuted, startMute); | ||
@@ -95,3 +96,3 @@ const handler = sinon.fake(); | ||
assert.equal(stream.muted, setMute); | ||
assert.equal(stream.userMuted, setMute); | ||
if (expectedCalled) { | ||
@@ -98,0 +99,0 @@ assert.calledOnceWithExactly(handler, setMute, 'remotelyMuted'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52248
806
10
+ Added@types/node@20.16.5(transitive)
+ Added@webex/internal-media-core@2.5.0(transitive)
+ Added@webex/json-multistream@2.1.3(transitive)
+ Added@webex/rtcstats@1.4.0(transitive)
+ Added@webex/web-capabilities@1.4.1(transitive)
+ Added@webex/web-client-media-engine@3.17.0(transitive)
+ Added@webex/web-media-effects@2.18.0(transitive)
+ Added@webex/webrtc-core@2.7.0(transitive)
+ Addedasync@3.2.6(transitive)
+ Addedbowser@2.11.0(transitive)
- Removed@types/node@22.5.4(transitive)
- Removed@webex/internal-media-core@2.2.9(transitive)
- Removed@webex/web-media-effects@2.20.8(transitive)
- Removedfast-unique-numbers@9.0.9(transitive)
- Removedworker-timers@8.0.5(transitive)
- Removedworker-timers-broker@7.1.2(transitive)
- Removedworker-timers-worker@8.0.4(transitive)