captureUserMedia = () => {
if (navigator.getDisplayMedia || navigator.mediaDevices.getDisplayMedia) {
if (navigator.mediaDevices.getDisplayMedia) {
navigator.mediaDevices.getDisplayMedia({ video: true }).then(stream => {
this.onGettingStream(stream, this.pc);
}, this.getDisplayMediaError).catch(this.getDisplayMediaError);
}
else if (navigator.getDisplayMedia) {
navigator.getDisplayMedia({ video: true }).then(stream => {
this.onGettingStream(stream, this.pc);
}, this.getDisplayMediaError).catch(this.getDisplayMediaError);
}
}
else {
if (DetectRTC.browser.version == 71) {
this.showErrorMessage(
'Please enable "Experimental WebPlatform" flag via chrome://flags.');
} else if (DetectRTC.browser.version < 71) {
this.showErrorMessage('Please upgrade your Chrome browser.');
} else {
this.showErrorMessage('Please make sure that you are not using Chrome on iOS.');
}
}
this.showErrorMessage('Please upgrade your Firefox browser.');
}
this.showErrorMessage('Please upgrade your Edge browser.');
}
this.showErrorMessage('Safari does NOT supports getDisplayMedia API yet.');
}
}
}
HTH. At least it should give you a good start