Skip to content

Commit

Permalink
Merge pull request #24 from lisandro52/master
Browse files Browse the repository at this point in the history
Fix #23: Blop.wav not reproducing on Firefox due to enconding and JS …
  • Loading branch information
igorantun committed Sep 4, 2015
2 parents 877bd3d + 31262e2 commit 2a406d8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions public/js/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ var connect = function() {
if(dev) {
console.log(data);
}




if(data.type == 'delete') {
return $('div[data-mid="' + data.message + '"]').remove();
}
Expand Down Expand Up @@ -196,7 +198,7 @@ var connect = function() {
textToSpeech.text = data.message;
speechSynthesis.speak(textToSpeech);
}

showChat(data.type, data.user, data.message, data.subtxt, data.mid);
}

Expand Down Expand Up @@ -692,24 +694,27 @@ if('SpeechRecognition' in window || 'webkitSpeechRecognition' in window) {
speechToText.lang = 'en-US';
}

speechToText.onresult = function(event) {
$('#message').val('');

for (var i = event.resultIndex; i < event.results.length; ++i) {
if (event.results[i].isFinal) {
$('#message').val(event.results[i][0].transcript);
updateBar('mdi-content-send', 'Enter your message here', false);
speechToText.stop();
handleInput();
} else {
var oldval = $('#message').val();
$('#message').val(oldval + event.results[i][0].transcript);
if(speechToText) {
speechToText.onresult = function(event) {
$('#message').val('');

for (var i = event.resultIndex; i < event.results.length; ++i) {
if (event.results[i].isFinal) {
$('#message').val(event.results[i][0].transcript);
updateBar('mdi-content-send', 'Enter your message here', false);
speechToText.stop();
handleInput();
} else {
var oldval = $('#message').val();
$('#message').val(oldval + event.results[i][0].transcript);
}
}
}
}

speechToText.onerror = function(event) {
updateBar('mdi-content-send', 'Enter your message here', false);

speechToText.onerror = function(event) {
updateBar('mdi-content-send', 'Enter your message here', false);
}

}

function desktopNotif(message) {
Expand Down Expand Up @@ -748,6 +753,7 @@ window.onfocus = function() {
unread = 0;
};


window.onblur = function() {
focus = false;
};
Binary file modified public/sounds/blop.wav
Binary file not shown.

0 comments on commit 2a406d8

Please sign in to comment.