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

Commit 910436a

Browse files
apply comments
1 parent ba0aba7 commit 910436a

File tree

6 files changed

+23
-97
lines changed

6 files changed

+23
-97
lines changed

src/extension/screen-sharing-chrome-extension/manifest.json

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/extension/screen-sharing-chrome-extension/script.js

Lines changed: 0 additions & 36 deletions
This file was deleted.
-14.4 KB
Binary file not shown.
-3.21 KB
Binary file not shown.
-5.29 KB
Binary file not shown.

src/sdk/base/mediastream-factory.js

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class AudioTrackConstraints {
2020
// eslint-disable-next-line require-jsdoc
2121
constructor(source) {
2222
if (!Object.values(MediaFormatModule.AudioSourceInfo)
23-
.some((v) => v === source)) {
23+
.some((v) => v === source)) {
2424
throw new TypeError('Invalid source.');
2525
}
2626
/**
@@ -94,7 +94,6 @@ export class VideoTrackConstraints {
9494
* @constructor
9595
* @param {?Owt.Base.AudioTrackConstraints} audioConstraints
9696
* @param {?Owt.Base.VideoTrackConstraints} videoConstraints
97-
* @param {?string} extensionId The ID of Chrome screen sharing extension.
9897
*/
9998
export class StreamConstraints {
10099
// eslint-disable-next-line require-jsdoc
@@ -111,12 +110,6 @@ export class StreamConstraints {
111110
* @instance
112111
*/
113112
this.video = videoConstraints;
114-
/**
115-
* @member {string} extensionId
116-
* @memberof Owt.Base.MediaStreamDeviceConstraints
117-
* @desc The ID of Chrome Extension for screen sharing.
118-
* @instance
119-
*/
120113
}
121114
}
122115

@@ -147,38 +140,38 @@ export class MediaStreamFactory {
147140
*/
148141
static createMediaStream(constraints) {
149142
if (typeof constraints !== 'object' ||
150-
(!constraints.audio && !constraints.video)) {
143+
(!constraints.audio && !constraints.video)) {
151144
return Promise.reject(new TypeError('Invalid constrains'));
152145
}
153146
if (!isVideoConstrainsForScreenCast(constraints) &&
154-
(typeof constraints.audio === 'object') &&
155-
constraints.audio.source ===
156-
MediaFormatModule.AudioSourceInfo.SCREENCAST) {
147+
(typeof constraints.audio === 'object') &&
148+
constraints.audio.source ===
149+
MediaFormatModule.AudioSourceInfo.SCREENCAST) {
157150
return Promise.reject(
158-
new TypeError('Cannot share screen without video.'));
151+
new TypeError('Cannot share screen without video.'));
159152
}
160153
if (isVideoConstrainsForScreenCast(constraints) && !utils.isChrome() &&
161-
!utils.isFirefox()) {
154+
!utils.isFirefox()) {
162155
return Promise.reject(
163-
new TypeError('Screen sharing only supports Chrome and Firefox.'));
156+
new TypeError('Screen sharing only supports Chrome and Firefox.'));
164157
}
165158
if (isVideoConstrainsForScreenCast(constraints) &&
166-
typeof constraints.audio === 'object' &&
167-
constraints.audio.source !==
168-
MediaFormatModule.AudioSourceInfo.SCREENCAST) {
159+
typeof constraints.audio === 'object' &&
160+
constraints.audio.source !==
161+
MediaFormatModule.AudioSourceInfo.SCREENCAST) {
169162
return Promise.reject(new TypeError(
170-
'Cannot capture video from screen cast while capture audio from'
171-
+ ' other source.'));
163+
'Cannot capture video from screen cast while capture audio from'
164+
+ ' other source.'));
172165
}
173166

174-
// check and convert constraints
167+
// Check and convert constraints.
175168
if (!constraints.audio && !constraints.video) {
176169
return Promise.reject(new TypeError(
177170
'At least one of audio and video must be requested.'));
178171
}
179172
const mediaConstraints = Object.create({});
180173
if (typeof constraints.audio === 'object' &&
181-
constraints.audio.source === MediaFormatModule.AudioSourceInfo.MIC) {
174+
constraints.audio.source === MediaFormatModule.AudioSourceInfo.MIC) {
182175
mediaConstraints.audio = Object.create({});
183176
if (utils.isEdge()) {
184177
mediaConstraints.audio.deviceId = constraints.audio.deviceId;
@@ -191,8 +184,8 @@ export class MediaStreamFactory {
191184
mediaConstraints.audio = constraints.audio;
192185
}
193186
if (typeof constraints.audio === 'object' &&
194-
constraints.audio.source ===
195-
MediaFormatModule.AudioSourceInfo.SCREENCAST) {
187+
constraints.audio.source ===
188+
MediaFormatModule.AudioSourceInfo.SCREENCAST) {
196189
Logger.warning(
197190
'Screen sharing with audio is not supported in Firefox.');
198191
mediaConstraints.audio = false;
@@ -203,21 +196,21 @@ export class MediaStreamFactory {
203196
mediaConstraints.video.frameRate = constraints.video.frameRate;
204197
}
205198
if (constraints.video.resolution &&
206-
constraints.video.resolution.width &&
207-
constraints.video.resolution.height) {
199+
constraints.video.resolution.width &&
200+
constraints.video.resolution.height) {
208201
mediaConstraints.video.width = Object.create({});
209202
mediaConstraints.video.width.exact =
210-
constraints.video.resolution.width;
203+
constraints.video.resolution.width;
211204
mediaConstraints.video.height = Object.create({});
212205
mediaConstraints.video.height.exact =
213-
constraints.video.resolution.height;
206+
constraints.video.resolution.height;
214207
}
215208
if (typeof constraints.video.deviceId === 'string') {
216209
mediaConstraints.video.deviceId = { exact: constraints.video.deviceId };
217210
}
218211
if (utils.isFirefox() &&
219-
constraints.video.source ===
220-
MediaFormatModule.VideoSourceInfo.SCREENCAST) {
212+
constraints.video.source ===
213+
MediaFormatModule.VideoSourceInfo.SCREENCAST) {
221214
mediaConstraints.video.mediaSource = 'screen';
222215
}
223216
} else {

0 commit comments

Comments
 (0)