Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added an input node and send "vacio" if nothing detected #98

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions node-red-node-ui-microphone/ui_microphone.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
mode: { value: "audio" },
interimResults: { value: false }
},
inputs:0,
inputs:1,
outputs:1,
icon: "font-awesome/fa-microphone",
paletteLabel: "microphone",
Expand Down Expand Up @@ -142,7 +142,7 @@
</select>
</div>
<div class="form-row" style="min-width:470px">
<label><i class="fa fa-cog"></i> <span id="record-label"</span></label>
<label><i class="fa fa-cog"></i> <span id="record-label"></span></label>
<select type="text" id="node-input-press" style="width:70%;">
<option value="click" data-i18n="ui_microphone.record.click"></option>
<option value="press" data-i18n="ui_microphone.record.press"></option>
Expand Down
17 changes: 14 additions & 3 deletions node-red-node-ui-microphone/ui_microphone.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ module.exports = function(RED) {
}

var ui = undefined; // instantiate a ui variable to link to the dashboard

function MicrophoneNode(config) {
try {
var node = this;
Expand Down Expand Up @@ -155,7 +154,16 @@ module.exports = function(RED) {
}
}
};

$scope.$watch('msg', function (msg) {
if (!msg) {
return;
}else{
console.log(msg);
$scope.toggleMicrophone();
}
// msg with all it's properties available here

});
$scope.stop = function() {
if (active) {
if (isAudio) {
Expand Down Expand Up @@ -249,6 +257,8 @@ module.exports = function(RED) {
if (active) {
active = false;
$("#microphone_control_"+$scope.$id+" i").addClass("fa-microphone").removeClass("fa-rotate-right fa-spin");
///console.log("no se reconocio nada");
$scope.send({payload:"vacio"});
}
};

Expand Down Expand Up @@ -282,7 +292,6 @@ module.exports = function(RED) {
}
fileReader.readAsArrayBuffer(blob)
};

var convertToWav = function(buffer) {
if (!worker) {
worker = new Worker('ui_microphone/recorderWorker.js');
Expand All @@ -304,6 +313,8 @@ module.exports = function(RED) {
}
});
}


}
catch (e) {
// eslint-disable-next-line no-console
Expand Down