diff --git a/chrome-extension/background.js b/chrome-extension/background.js
new file mode 100644
index 0000000..b5cee2b
--- /dev/null
+++ b/chrome-extension/background.js
@@ -0,0 +1,25 @@
+/* background page, responsible for actually choosing media */
+chrome.runtime.onConnect.addListener(function (channel) {
+ channel.onMessage.addListener(function (message) {
+ switch(message.type) {
+ case 'getScreen':
+ var pending = chrome.desktopCapture.chooseDesktopMedia(message.options || ['screen', 'window'],
+ channel.sender.tab, function (streamid) {
+ // communicate this string to the app so it can call getUserMedia with it
+ message.type = 'gotScreen';
+ message.sourceId = streamid;
+ channel.postMessage(message);
+ });
+ // let the app know that it can cancel the timeout
+ message.type = 'getScreenPending';
+ message.request = pending;
+ channel.postMessage(message);
+ break;
+ case 'cancelGetScreen':
+ chrome.desktopCapture.cancelChooseDesktopMedia(message.request);
+ message.type = 'canceledGetScreen';
+ channel.postMessage(message);
+ break;
+ }
+ });
+});
diff --git a/chrome-extension/content.js b/chrome-extension/content.js
new file mode 100644
index 0000000..009df3d
--- /dev/null
+++ b/chrome-extension/content.js
@@ -0,0 +1,14 @@
+/* the chrome content script which can listen to the page dom events */
+var channel = chrome.runtime.connect();
+channel.onMessage.addListener(function (message) {
+ console.log('channel message', message);
+ window.postMessage(message, '*');
+});
+
+window.addEventListener('message', function (event) {
+ if (event.source != window)
+ return;
+ if (!event.data && (event.data.type == 'getScreen' || event.data.type == 'cancelGetScreen'))
+ return;
+ channel.postMessage(event.data);
+});
diff --git a/chrome-extension/manifest.json b/chrome-extension/manifest.json
new file mode 100644
index 0000000..0b6a381
--- /dev/null
+++ b/chrome-extension/manifest.json
@@ -0,0 +1,19 @@
+{
+ "name": "Screen sharing for VROOM",
+ "description": "Allow screen sharing in the VROOM WebRTC visio conference app",
+ "version": "0.0.1",
+ "manifest_version": 2,
+ "minimum_chrome_version": "34",
+ "icons": {
+ },
+ "permissions": [
+ "desktopCapture"
+ ],
+ "background": {
+ "scripts": ["background.js"]
+ },
+ "content_scripts": [ {
+ "js": [ "content.js" ],
+ "matches": ["https://*/*"]
+ }]
+}
diff --git a/conf/vroom.conf.sample b/conf/vroom.conf.sample
index 57dc21b..1ef72b0 100644
--- a/conf/vroom.conf.sample
+++ b/conf/vroom.conf.sample
@@ -24,6 +24,9 @@ secret => 'ChangeMe!',
inactivityTimeout => 3600,
logLevel => 'info',
+# ID of the Chrome extension for screen sharing
+chromeExtensionId => 'ecicdpoejfllflombfanbhfpgcimjddn',
+
# Various
sendmail => '/sbin/sendmail'
};
diff --git a/lib/Vroom/I18N/en.pm b/lib/Vroom/I18N/en.pm
index b0608e5..16dafdb 100644
--- a/lib/Vroom/I18N/en.pm
+++ b/lib/Vroom/I18N/en.pm
@@ -49,6 +49,9 @@ our %Lexicon = (
"CAM_RESUMED" => "Your webcam is on again",
"SHARE_YOUR_SCREEN" => "Share your screen with the other members of this room",
"CANT_SHARE_SCREEN" => "Sorry, your configuration does not allow screen sharing",
+ "SCREEN_SHARING_ONLY_FOR_CHROME" => "Sorry, but you can't share your screen. Only Google Chrome supports this feature for now",
+ "SCREEN_SHARING_CANCELLED" => "Screen sharing has been cancelled",
+ "VROOM_CHROME_EXTENSION" => "To enable screen sharing, you need to install an extension. Click on the following link and refresh this page",
"EVERYONE_CAN_SEE_YOUR_SCREEN" => "All other participants can see your screen now",
"SCREEN_UNSHARED" => "You do no longer share your screen",
"ERROR_MAIL_INVALID" => "Please enter a valid email address",
@@ -79,6 +82,7 @@ our %Lexicon = (
"SCREEN_SHARING" => "Screen Sharing",
"HELP_SCREEN_SHARING" => "VROOM lets you share your screen with the other members of the room. For now " .
"this feature is only available in Google Chrome, and you need to change the following setting " .
+ "(since version 34, this setting isn't needed anymore)" .
"
" .
" - Type chrome://flags in the address bar" .
"
- Look for the option \"Enable screen sharing in getUserMedia()\" and click on " .
diff --git a/lib/Vroom/I18N/fr.pm b/lib/Vroom/I18N/fr.pm
index ccb89e9..f4f6f57 100644
--- a/lib/Vroom/I18N/fr.pm
+++ b/lib/Vroom/I18N/fr.pm
@@ -54,6 +54,10 @@ our %Lexicon = (
"CAM_RESUMED" => "Votre webcam est à nouveau active",
"SHARE_YOUR_SCREEN" => "Partagez votre écran avec les autres membres du salon",
"CANT_SHARE_SCREEN" => "Désolé, mais votre configuration ne vous permet pas de partager votre écran",
+ "SCREEN_SHARING_ONLY_FOR_CHROME" => "Désolé, mais vous ne pouvez pas partager votre écran. Seul le navigateur Google Chrome " .
+ "supporte cette fonction pour l'instant",
+ "SCREEN_SHARING_CANCELLED" => "Le partage d'écran a été annulé",
+ "VROOM_CHROME_EXTENSION" => "Pour activer le partage d'écran, vous devez installer une extension, cliquez sur le lien ci-dessous, puis raffraîchissez cette page",
"EVERYONE_CAN_SEE_YOUR_SCREEN" => "Tous les autres participants peuvent voir votre écran",
"SCREEN_UNSHARED" => "Vous ne partagez plus votre écran",
"ERROR_MAIL_INVALID" => "Veuillez saisir une adresse email valide",
@@ -85,7 +89,8 @@ our %Lexicon = (
"SREEN_SHARING" => "Partage d'écran",
"HELP_SCREEN_SHARING" => "VROOM vous permet de partager votre écran avec tous les autres participants d'une conférence. " .
"Pour l'instant, le partage d'écran ne fonctionne qu'avec le navigateur Google Chrome, " .
- "et nécessite d'effectuer le réglage suivant:" .
+ "et nécessite d'effectuer le réglage suivant (à partir de la version 34, ce réglage n'est " .
+ "plus nécessaire)" .
"
" .
" - Tapez chrome://flags/ dans la barre d'adresse
" .
" - Recherchez \"Activer la fonctionnalité de capture d'écran dans getUserMedia()\" et cliquez sur " .
diff --git a/public/css/vroom.css b/public/css/vroom.css
index 7c3d06f..d9ad7b7 100644
--- a/public/css/vroom.css
+++ b/public/css/vroom.css
@@ -101,6 +101,9 @@
#chatMenu {
margin-bottom: 15px;
}
+#chromeExtMessage {
+ text-align: center;
+}
@media screen and (max-width: 480px) {
body {
font-size: 0.8em;
diff --git a/public/js/vroom.js b/public/js/vroom.js
index 48d7e7e..43072c2 100644
--- a/public/js/vroom.js
+++ b/public/js/vroom.js
@@ -15,6 +15,8 @@ var locale = {
ERROR_MAIL_INVALID: '',
ERROR_OCCURED: '',
CANT_SHARE_SCREEN: '',
+ SCREEN_SHARING_ONLY_FOR_CHROME: '',
+ SCREEN_SHARING_CANCELLED: '',
EVERYONE_CAN_SEE_YOUR_SCREEN: '',
SCREEN_UNSHARED: '',
MIC_MUTED: '',
@@ -63,7 +65,7 @@ function initVroom(room) {
dataType: 'json',
});
- // Screen sharing is onl suported on chrome > 26
+ // Screen sharing is only suported on chrome > 26
if ( !$.browser.webkit || $.browser.versionNumber < 26 ) {
$("#shareScreenLabel").addClass('disabled');
}
@@ -445,15 +447,27 @@ function initVroom(room) {
// ScreenSharing
$('#shareScreenButton').change(function() {
var action = ($(this).is(":checked")) ? 'share':'unshare';
- function cantShare(){
- $.notify(locale.CANT_SHARE_SCREEN, 'error');
- $('#shareScreenLabel').removeClass('active');
+ function cantShare(err){
+ $.notify(err, 'error');
return;
}
if (!peers.local.screenShared && action === 'share'){
webrtc.shareScreen(function(err){
if(err){
- cantShare();
+ if (err.name == 'EXTENSION_UNAVAILABLE'){
+ var ver = 34;
+ if ($.browser.linux) ver = 35;
+ if ($.browser.webkit && $.browser.versionNumber >= ver)
+ $('#chromeExtMessage').modal('show');
+ else
+ cantShare(locale.SCREEN_SHARING_ONLY_FOR_CHROME);
+ }
+ else if (err.name == 'PERMISSION_DENIED' || err.name == 'PermissionDeniedError'){
+ cantShare(locale.SCREEN_SHARING_CANCELLED);
+ }
+ else
+ cantShare(locale.CANT_SHARE_SCREEN + ' ' + err.name);
+ $('#shareScreenLabel').removeClass('active');
return;
}
else{
diff --git a/public/vroom.pl b/public/vroom.pl
index 9c49b23..d6d8aa6 100755
--- a/public/vroom.pl
+++ b/public/vroom.pl
@@ -67,6 +67,7 @@ our $config = plugin Config => {
template => 'default',
inactivityTimeout => 3600,
logLevel => 'info',
+ chromeExtensionId => 'ecicdpoejfllflombfanbhfpgcimjddn',
sendmail => '/sbin/sendmail'
}
};
diff --git a/templates/default/join.html.ep b/templates/default/join.html.ep
index 599882f..b8557f7 100644
--- a/templates/default/join.html.ep
+++ b/templates/default/join.html.ep
@@ -70,6 +70,17 @@
+
+
+
+
<%=l 'VROOM_CHROME_EXTENSION' %>
+
+
+
+
+
+
+