@webex/media-helpers 3.0.0-beta.396 → 3.0.0-beta.398
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/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/webrtc-core.js +16 -10
- package/dist/webrtc-core.js.map +1 -1
- package/package.json +5 -4
- package/src/index.ts +1 -0
- package/src/webrtc-core.ts +10 -9
- package/test/unit/spec/webrtc-core.js +9 -8
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":"
|
|
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"}
|
package/dist/webrtc-core.js
CHANGED
|
@@ -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: "
|
|
114
|
-
value: function
|
|
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), "
|
|
126
|
+
return (0, _get2.default)((0, _getPrototypeOf2.default)(_LocalMicrophoneStream.prototype), "setUserMuted", this).call(this, muted);
|
|
121
127
|
}
|
|
122
128
|
|
|
123
129
|
/**
|
|
@@ -126,8 +132,8 @@ var _LocalMicrophoneStream = /*#__PURE__*/function (_WcmeLocalMicrophoneS) {
|
|
|
126
132
|
}, {
|
|
127
133
|
key: "setServerMuted",
|
|
128
134
|
value: function setServerMuted(muted, reason) {
|
|
129
|
-
if (muted !== this.
|
|
130
|
-
this.
|
|
135
|
+
if (muted !== this.userMuted) {
|
|
136
|
+
this.setUserMuted(muted);
|
|
131
137
|
this[LocalMicrophoneStreamEventNames.ServerMuted].emit(muted, reason);
|
|
132
138
|
}
|
|
133
139
|
}
|
|
@@ -168,14 +174,14 @@ var _LocalCameraStream = /*#__PURE__*/function (_WcmeLocalCameraStrea) {
|
|
|
168
174
|
return this.unmuteAllowed;
|
|
169
175
|
}
|
|
170
176
|
}, {
|
|
171
|
-
key: "
|
|
172
|
-
value: function
|
|
177
|
+
key: "setUserMuted",
|
|
178
|
+
value: function setUserMuted(muted) {
|
|
173
179
|
if (!muted) {
|
|
174
180
|
if (!this.isUnmuteAllowed()) {
|
|
175
181
|
throw new Error('Unmute is not allowed');
|
|
176
182
|
}
|
|
177
183
|
}
|
|
178
|
-
return (0, _get2.default)((0, _getPrototypeOf2.default)(_LocalCameraStream.prototype), "
|
|
184
|
+
return (0, _get2.default)((0, _getPrototypeOf2.default)(_LocalCameraStream.prototype), "setUserMuted", this).call(this, muted);
|
|
179
185
|
}
|
|
180
186
|
|
|
181
187
|
/**
|
|
@@ -184,8 +190,8 @@ var _LocalCameraStream = /*#__PURE__*/function (_WcmeLocalCameraStrea) {
|
|
|
184
190
|
}, {
|
|
185
191
|
key: "setServerMuted",
|
|
186
192
|
value: function setServerMuted(muted, reason) {
|
|
187
|
-
if (muted !== this.
|
|
188
|
-
this.
|
|
193
|
+
if (muted !== this.userMuted) {
|
|
194
|
+
this.setUserMuted(muted);
|
|
189
195
|
this[LocalCameraStreamEventNames.ServerMuted].emit(muted, reason);
|
|
190
196
|
}
|
|
191
197
|
}
|
package/dist/webrtc-core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LocalMicrophoneStreamEventNames","LocalCameraStreamEventNames","ServerMuted","_LocalMicrophoneStream","TypedEvent","allowed","unmuteAllowed","muted","isUnmuteAllowed","Error","reason","
|
|
1
|
+
{"version":3,"names":["LocalMicrophoneStreamEventNames","LocalCameraStreamEventNames","ServerMuted","_LocalMicrophoneStream","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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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-beta.
|
|
3
|
+
"version": "3.0.0-beta.398",
|
|
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",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"node": ">=16"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@webex/internal-media-core": "2.
|
|
20
|
+
"@webex/internal-media-core": "2.3.0",
|
|
21
21
|
"@webex/ts-events": "^1.1.0",
|
|
22
22
|
"@webex/web-media-effects": "^2.15.6"
|
|
23
23
|
},
|
|
@@ -28,8 +28,9 @@
|
|
|
28
28
|
]
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@webex/test-helper-chai": "3.0.0-beta.
|
|
32
|
-
"@webex/test-helper-mock-webex": "3.0.0-beta.
|
|
31
|
+
"@webex/test-helper-chai": "3.0.0-beta.398",
|
|
32
|
+
"@webex/test-helper-mock-webex": "3.0.0-beta.398",
|
|
33
|
+
"jsdom-global": "3.0.2",
|
|
33
34
|
"sinon": "^9.2.4"
|
|
34
35
|
}
|
|
35
36
|
}
|
package/src/index.ts
CHANGED
package/src/webrtc-core.ts
CHANGED
|
@@ -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
|
|
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
|
|
@@ -74,22 +75,22 @@ class _LocalMicrophoneStream extends WcmeLocalMicrophoneStream {
|
|
|
74
75
|
return this.unmuteAllowed;
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
|
|
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.
|
|
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.
|
|
92
|
-
this.
|
|
92
|
+
if (muted !== this.userMuted) {
|
|
93
|
+
this.setUserMuted(muted);
|
|
93
94
|
this[LocalMicrophoneStreamEventNames.ServerMuted].emit(muted, reason);
|
|
94
95
|
}
|
|
95
96
|
}
|
|
@@ -116,22 +117,22 @@ class _LocalCameraStream extends WcmeLocalCameraStream {
|
|
|
116
117
|
return this.unmuteAllowed;
|
|
117
118
|
}
|
|
118
119
|
|
|
119
|
-
|
|
120
|
+
setUserMuted(muted: boolean): void {
|
|
120
121
|
if (!muted) {
|
|
121
122
|
if (!this.isUnmuteAllowed()) {
|
|
122
123
|
throw new Error('Unmute is not allowed');
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
|
|
126
|
-
return super.
|
|
127
|
+
return super.setUserMuted(muted);
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
/**
|
|
130
131
|
* @internal
|
|
131
132
|
*/
|
|
132
133
|
setServerMuted(muted: boolean, reason: ServerMuteReason) {
|
|
133
|
-
if (muted !== this.
|
|
134
|
-
this.
|
|
134
|
+
if (muted !== this.userMuted) {
|
|
135
|
+
this.setUserMuted(muted);
|
|
135
136
|
this[LocalCameraStreamEventNames.ServerMuted].emit(muted, reason);
|
|
136
137
|
}
|
|
137
138
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import 'jsdom-global/register';
|
|
1
2
|
import {assert, expect} from '@webex/test-helper-chai';
|
|
2
3
|
import sinon from 'sinon';
|
|
3
4
|
import {
|
|
@@ -54,22 +55,22 @@ describe('media-helpers', () => {
|
|
|
54
55
|
|
|
55
56
|
it('by default allows unmuting', async () => {
|
|
56
57
|
assert.equal(stream.isUnmuteAllowed(), true);
|
|
57
|
-
await stream.
|
|
58
|
+
await stream.setUserMuted(false);
|
|
58
59
|
});
|
|
59
60
|
|
|
60
|
-
it('rejects
|
|
61
|
+
it('rejects setUserMuted(false) if unmute is not allowed', async () => {
|
|
61
62
|
stream.setUnmuteAllowed(false);
|
|
62
63
|
|
|
63
64
|
assert.equal(stream.isUnmuteAllowed(), false);
|
|
64
|
-
const fn = () => stream.
|
|
65
|
+
const fn = () => stream.setUserMuted(false);
|
|
65
66
|
expect(fn).to.throw(/Unmute is not allowed/);
|
|
66
67
|
});
|
|
67
68
|
|
|
68
|
-
it('resolves
|
|
69
|
+
it('resolves setUserMuted(false) if unmute is allowed', async () => {
|
|
69
70
|
stream.setUnmuteAllowed(true);
|
|
70
71
|
|
|
71
72
|
assert.equal(stream.isUnmuteAllowed(), true);
|
|
72
|
-
await stream.
|
|
73
|
+
await stream.setUserMuted(false);
|
|
73
74
|
});
|
|
74
75
|
|
|
75
76
|
it('returns a reasonable length string from JSON.stringify()', () => {
|
|
@@ -82,16 +83,16 @@ describe('media-helpers', () => {
|
|
|
82
83
|
});
|
|
83
84
|
|
|
84
85
|
const checkSetServerMuted = (startMute, setMute, expectedCalled) => {
|
|
85
|
-
stream.
|
|
86
|
+
stream.setUserMuted(startMute);
|
|
86
87
|
|
|
87
|
-
assert.equal(stream.
|
|
88
|
+
assert.equal(stream.userMuted, startMute);
|
|
88
89
|
|
|
89
90
|
const handler = sinon.fake();
|
|
90
91
|
stream.on(event.ServerMuted, handler);
|
|
91
92
|
|
|
92
93
|
stream.setServerMuted(setMute, 'remotelyMuted');
|
|
93
94
|
|
|
94
|
-
assert.equal(stream.
|
|
95
|
+
assert.equal(stream.userMuted, setMute);
|
|
95
96
|
if (expectedCalled) {
|
|
96
97
|
assert.calledOnceWithExactly(handler, setMute, 'remotelyMuted');
|
|
97
98
|
} else {
|