From 83cafa75369b7d725473b74d0d3b6ebf01e80953 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 15 May 2014 14:02:37 +0200 Subject: [PATCH] Warn if no sound has been detected Fix #29 --- lib/Vroom/I18N/en.pm | 1 + lib/Vroom/I18N/fr.pm | 1 + public/js/vroom.js | 19 +++++++++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/Vroom/I18N/en.pm b/lib/Vroom/I18N/en.pm index 041bbc8..669df33 100644 --- a/lib/Vroom/I18N/en.pm +++ b/lib/Vroom/I18N/en.pm @@ -65,6 +65,7 @@ our %Lexicon = ( "CLICK_TO_CHAT" => "Click to access the chat", "PREVENT_TO_JOIN" => "Prevent other participants to join this room", "MUTE_MIC" => "Turn off your microphone", + "NO_SOUND_DETECTED" => "No sound detected, please check your microphone (input level might be too low)", "SUSPEND_CAM" => "Suspend your webcam, other will see a black screen instead, but can still hear you", "CONFIGURE" => "Configuration", "YOU_CAN_PASSWORD_PROTECT_JOIN" => "You can protect this room with a password", diff --git a/lib/Vroom/I18N/fr.pm b/lib/Vroom/I18N/fr.pm index 2cdf634..2266dde 100644 --- a/lib/Vroom/I18N/fr.pm +++ b/lib/Vroom/I18N/fr.pm @@ -70,6 +70,7 @@ our %Lexicon = ( "CLICK_TO_CHAT" => "Cliquez ici pour accéder au tchat", "PREVENT_TO_JOIN" => "Empêchez d'autres participants de rejoindre ce salon", "MUTE_MIC" => "Coupez votre micro", + "NO_SOUND_DETECTED" => "Aucun son n'a été détecté. Vérifiez votre micro (le volume de votre micro est peut-être trop faible)", "SUSPEND_CAM" => "Stoppez la webcam, les autres verront un écran noir à la place, " . "mais pourront toujours vous entendre", "CONFIGURE" => "Configuration", diff --git a/public/js/vroom.js b/public/js/vroom.js index 25664fe..d416e7c 100644 --- a/public/js/vroom.js +++ b/public/js/vroom.js @@ -33,7 +33,8 @@ var locale = { OWNER_PASSWORD_REMOVED_BY_s: '', CANT_SEND_TO_s: '', SCREEN_s: '', - TO_INVITE_SHARE_THIS_URL: '' + TO_INVITE_SHARE_THIS_URL: '', + NO_SOUND_DETECTED: '' }; // Localize the strings we need @@ -83,7 +84,8 @@ function initVroom(room) { }; var mainVid = false, chatHistory = {}, - chatIndex = 0; + chatIndex = 0, + maxVol = -100; $('#name_local').css('background-color', peers.local.color); @@ -354,6 +356,9 @@ function initVroom(room) { // Handle volume changes from our own mic webrtc.on('volumeChange', function (volume, treshold) { + if (volume > maxVol){ + maxVol = volume; + } if (peers.local.micMuted) { return; } @@ -950,6 +955,16 @@ function initVroom(room) { }); }, 60000); + // Check if sound is detected and warn if it hasn't + setTimeout(function (){ + if (maxVol < -40){ + $.notify(locale.NO_SOUND_DETECTED, { + className: 'error', + autoHide: false + }); + } + }, 10000); + window.onresize = function (){ $('#webRTCVideo').css('max-height', maxHeight()); $('#mainVideo>video').css('max-height', maxHeight());