From 7c90b688f4f72dd56abec235cfc40b697766e61b Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Mon, 2 Jun 2014 10:24:14 +0200 Subject: [PATCH] Default MoH to pause Fix #51 --- lib/Vroom/I18N/en.pm | 3 ++- lib/Vroom/I18N/fr.pm | 3 ++- public/js/vroom.js | 19 +++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/Vroom/I18N/en.pm b/lib/Vroom/I18N/en.pm index 3046315..876f888 100644 --- a/lib/Vroom/I18N/en.pm +++ b/lib/Vroom/I18N/en.pm @@ -168,7 +168,8 @@ our %Lexicon = ( "SCREEN_SHARING_CANCELLED" => "Screen sharing has been cancelled", "EXTENSION_REQUIRED" => "An extension is required", "VROOM_CHROME_EXTENSION" => "To enable screen sharing, you need to install an extension. Click on the following link and refresh this page", - "PAUSE_MOH" => "Pause music", + "PAUSE_MOH" => "Play/Pause music", + "WAIT_WITH_MUSIC" => "Why don't you listen to some music while waiting for others ?", "ALONE_IN_ROOM" => "Please wait a moment while nobody is here yet", "EVERYONE_CAN_SEE_YOUR_SCREEN" => "All other participants can see your screen now", "SCREEN_UNSHARED" => "You do no longer share your screen", diff --git a/lib/Vroom/I18N/fr.pm b/lib/Vroom/I18N/fr.pm index 0f1e832..48cbaf6 100644 --- a/lib/Vroom/I18N/fr.pm +++ b/lib/Vroom/I18N/fr.pm @@ -180,7 +180,8 @@ our %Lexicon = ( "EXTENSION_REQUIRED" => "Une extension est nécessaire", "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", - "PAUSE_MOH" => "Mettre la musique en pause", + "PAUSE_MOH" => "Mettre en pause ou jouer la musique d'attente", + "WAIT_WITH_MUSIC" => "Un peu de musique en attendant d'autres participants ?", "ALONE_IN_ROOM" => "Patientez quelques instants le temps que d'autres personnes vous rejoignent", "EVERYONE_CAN_SEE_YOUR_SCREEN" => "Tous les autres participants peuvent voir votre écran", "SCREEN_UNSHARED" => "Vous ne partagez plus votre écran", diff --git a/public/js/vroom.js b/public/js/vroom.js index 9e23548..5c62174 100644 --- a/public/js/vroom.js +++ b/public/js/vroom.js @@ -67,7 +67,8 @@ var locale = { DISPLAY_NAME_REQUIRED: '', A_ROOM_ADMIN: '', A_PARTICIPANT: '', - PASSWORDS_DO_NOT_MATCH: '' + PASSWORDS_DO_NOT_MATCH: '', + WAIT_WITH_MUSIC: '' }; // Localize the strings we need @@ -248,8 +249,7 @@ function initVroom(room) { var mainVid = false, chatHistory = {}, chatIndex = 0, - maxVol = -100, - moh = false; + maxVol = -100; $('#name_local').css('background-color', peers.local.color); @@ -517,7 +517,6 @@ function initVroom(room) { // Stop moh, we're not alone anymore $('#mohPlayer')[0].pause(); $('.aloneEl').hide(300); - moh = false; } $(div).attr('id', 'peer_' + id); // Disable context menu on the video @@ -679,13 +678,13 @@ function initVroom(room) { // Check if MoH is needed function checkMoh(){ setTimeout(function(){ - if (!moh && Object.keys(peers).length < 2){ - if (!$('#pauseMohButton').is(':checked')){ + if (Object.keys(peers).length < 2){ + if ($('#pauseMohButton').is(':checked')){ $('#mohPlayer').get(0).volume = .25; $('#mohPlayer').get(0).play(); - moh = true; } $('.aloneEl').show(200); + $('#pauseMohButton').notify(locale.WAIT_WITH_MUSIC, 'info'); } }, 3000); } @@ -1591,14 +1590,14 @@ function initVroom(room) { downloadContent('VROOM Tchat (' + room + ').html', $('#chatHistory').html()); }); - // Suspend MoH + // Suspend/Play MoH $('#pauseMohButton').change(function(){ if ($(this).is(":checked")){ - $('#mohPlayer')[0].pause(); + $('#mohPlayer')[0].play(); $('#pauseMohLabel').addClass('btn-danger'); } else{ - $('#mohPlayer')[0].play(); + $('#mohPlayer')[0].pause(); $('#pauseMohLabel').removeClass('btn-danger'); } });