diff --git a/static/js/directives/screenshare.js b/static/js/directives/screenshare.js index 6a060ba9..a199af60 100644 --- a/static/js/directives/screenshare.js +++ b/static/js/directives/screenshare.js @@ -18,7 +18,7 @@ * along with this program. If not, see . * */ -define(['jquery', 'underscore', 'text!partials/screenshare.html', 'text!partials/screensharepeer.html', 'bigscreen'], function($, _, template, templatePeer, BigScreen) { +define(['jquery', 'underscore', 'text!partials/screenshare.html', 'text!partials/screensharepeer.html', 'bigscreen', 'webrtc.adapter'], function($, _, template, templatePeer, BigScreen) { return ["$window", "mediaStream", "$compile", "safeApply", "videoWaiter", "$timeout", "alertify", "translation", "screensharing", function($window, mediaStream, $compile, safeApply, videoWaiter, $timeout, alertify, translation, screensharing) { @@ -266,8 +266,20 @@ define(['jquery', 'underscore', 'text!partials/screenshare.html', 'text!partials $scope.$apply(function(scope) { scope.stopScreenshare(); }); - if (error && error.name === "PermissionDeniedError") { - alertify.dialog.alert(translation._("Permission to start screen sharing was denied. Make sure to have enabled screen sharing access for your browser. Copy chrome://flags/#enable-usermedia-screen-capture and open it with your browser and enable the flag on top. Then restart the browser and you are ready to go.")); + if (error && error.name) { + switch (error.name) { + case "PermissionDeniedError": + if ($window.webrtcDetectedVersion >= 32 && + $window.webrtcDetectedVersion < 37) { + alertify.dialog.alert(translation._("Permission to start screen sharing was denied. Make sure to have enabled screen sharing access for your browser. Copy chrome://flags/#enable-usermedia-screen-capture and open it with your browser and enable the flag on top. Then restart the browser and you are ready to go.")); + } else { + alertify.dialog.alert(translation._("Permission to start screen sharing was denied.")); + } + break; + default: + alertify.dialog.alert(translation._("Failed to start screen sharing (%s).", error.name)); + break + } } });