Fix Stream.isSendScreen() for custom videoSource

The custom MediaStreamTrack provided as videoSource parameter in the Publisher factory functions is now examined by the Stream.isSendScreen() method if it is a screen sharing video track.
pull/809/head
Matthias Seemann 2023-06-21 21:36:37 +02:00 committed by GitHub
parent 734bc2710d
commit 63e273129b
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;
}