Merge pull request #809 from semmel/patch-2

Fix Stream.isSendScreen() for custom videoSource
pull/816/head
Carlos Ruiz Ballesteros 2023-06-22 11:43:24 +02:00 committed by GitHub
commit 759b7b2a70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -790,12 +790,20 @@ export class Stream {
* @hidden
*/
isSendScreen(): boolean {
let screen = this.outboundStreamOpts.publisherProperties.videoSource === 'screen';
if (platform.isElectron()) {
let screen;
if (typeof MediaStreamTrack !== 'undefined' &&
this.outboundStreamOpts.publisherProperties.videoSource instanceof MediaStreamTrack) {
var trackSettings = this.outboundStreamOpts.publisherProperties.videoSource.getSettings();
screen = ["monitor", "window", "browser"].includes(trackSettings.displaySurface);
}
else if (platform.isElectron()) {
screen =
typeof this.outboundStreamOpts.publisherProperties.videoSource === 'string' &&
this.outboundStreamOpts.publisherProperties.videoSource.startsWith('screen:');
}
else {
screen = this.outboundStreamOpts.publisherProperties.videoSource === 'screen';
}
return !!this.outboundStreamOpts && screen;
}