Skip to content

Commit

Permalink
Enabling GetDisplayMedia for screensharing (lynckia#1468)
Browse files Browse the repository at this point in the history
  • Loading branch information
Álvaro Alonso authored Oct 3, 2019
1 parent 8400cb8 commit bf1aa82
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions erizo_controller/erizoClient/src/utils/ConnectionHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ const GetUserMedia = (config, callback = () => {}, error = () => {}) => {
navigator.mediaDevices.getUserMedia(userMediaConfig).then(cb).catch(errorCb);
};

const getDisplayMedia = (userMediaConfig, cb, errorCb) => {
navigator.mediaDevices.getDisplayMedia(userMediaConfig).then(cb).catch(errorCb);
};

const configureScreensharing = () => {
Logger.debug('Screen access requested');
switch (getBrowser()) {
case 'electron' :
Logger.debug('Screen sharing in Electron');
Expand Down Expand Up @@ -110,7 +113,13 @@ const GetUserMedia = (config, callback = () => {}, error = () => {}) => {
};

if (config.screen) {
configureScreensharing();
if (config.desktopStreamId || config.extensionId) {
Logger.debug('Screen access requested using GetUserMedia');
configureScreensharing();
} else {
Logger.debug('Screen access requested using GetDisplayMedia');
getDisplayMedia(config, callback, error);
}
} else if (typeof module !== 'undefined' && module.exports) {
Logger.error('Video/audio streams not supported in erizofc yet');
} else {
Expand Down

0 comments on commit bf1aa82

Please sign in to comment.