Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 6aac12a

Browse files
authored
Merge pull request #153 from jianjunz/4.2.x
Merge to 4.2.x: change constraints setting value
2 parents 2d064cc + d57b388 commit 6aac12a

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

src/sdk/base/mediastream-factory.js

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,11 @@ export class MediaStreamFactory {
181181
};
182182
}
183183
} else {
184-
mediaConstraints.audio = constraints.audio;
184+
if (constraints.audio.source === MediaFormatModule.AudioSourceInfo.SCREENCAST) {
185+
mediaConstraints.audio = true;
186+
} else {
187+
mediaConstraints.audio = constraints.audio;
188+
}
185189
}
186190
if (typeof constraints.audio === 'object' &&
187191
constraints.audio.source ===
@@ -198,12 +202,21 @@ export class MediaStreamFactory {
198202
if (constraints.video.resolution &&
199203
constraints.video.resolution.width &&
200204
constraints.video.resolution.height) {
201-
mediaConstraints.video.width = Object.create({});
202-
mediaConstraints.video.width.exact =
203-
constraints.video.resolution.width;
204-
mediaConstraints.video.height = Object.create({});
205-
mediaConstraints.video.height.exact =
206-
constraints.video.resolution.height;
205+
if (constraints.video.source ===
206+
MediaFormatModule.VideoSourceInfo.SCREENCAST) {
207+
mediaConstraints.video.width =
208+
constraints.video.resolution.width;
209+
mediaConstraints.video.height =
210+
constraints.video.resolution.height;
211+
} else {
212+
mediaConstraints.video.width = Object.create({});
213+
mediaConstraints.video.width.exact =
214+
constraints.video.resolution.width;
215+
mediaConstraints.video.height = Object.create({});
216+
mediaConstraints.video.height.exact =
217+
constraints.video.resolution.height;
218+
219+
}
207220
}
208221
if (typeof constraints.video.deviceId === 'string') {
209222
mediaConstraints.video.deviceId = { exact: constraints.video.deviceId };

0 commit comments

Comments
 (0)