Create input to node

Hello everyone!
Could someone help me? The attached js code works on the dashboard for clicking, but I want to start it with "start"-"stop" in the payload. I already tried, but it doesn't work. I have already given it the input in the html file, so it appears on the node as input. ( inputs:1, )
mikrofon.txt (17.3 KB)

Can you confirm which node you are using ?

node-red-node-ui-microphone doesn't seem to accept any msg input

node-red-contrib-mic does but its icon is different than yours :wink:

Yes, node-red-node-ui-microphone, set input ok, send start-stop in payload not working

Okay, I can't get a sound out of the mic node, but not even a string. The dashboard mic node has a string output. And that would be important to me.

As I mentioned this node doesn't accept input, are you sure its the one you are using ?

:slightly_smiling_face: Yes sure!

.node-red/node_modules/node-red-node-ui-microphone/ui_microphone.html :

  <script type="text/javascript">
    RED.nodes.registerType('ui_microphone',{    // type MUST start with ui_
        category: 'dashboard',
        color: 'rgb( 90, 242, 2)',     //LIME COLOR  
        defaults: {
            name: {value: ''},
            group: {type: 'ui_group', required:true},
            order: {value: 0},
            width: {
                value: 0,
                validate: function(v) {
                    var valid = true
                    var width = v||0;
                    var currentGroup = $('#node-input-group').val()||;
                    var groupNode = RED.nodes.node(currentGroup);
                    valid = !groupNode || +width <= +groupNode.width;
                    return valid;
            height: {value: 0},
            maxLength: { value: 5 },
            maxRecogLength: { value: 5 },
            timeslice: { value: 0 },
            press : { value: "click" },
            mode: { value: "audio" },
            interimResults: { value: false }
        inputs:1,     //CREATE INPUT
        icon: "font-awesome/fa-microphone",
        paletteLabel: "microphone",
        label: function() {

I understand now - You have modified the code to add the input yes ?

So did you also make modifications to handle the input messages ?

Yes, it is, but the input failed to handle
(receive start-stop payload at the input)

Adding the input to the HTML file is only really cosmetic.

You will also need to re-write the code in ui_microphone.js to make it process any incoming payloads.

Yes, I know that, I don't know the exact js code. I don't have enough knowledge for that. I already know how the $ function is needed, but I can't insert this into the js code of the ui microphone.

node.on('input', function(msg) {
			node.log("Event input: " + msg.payload);
			node.msg = msg;

			switch (msg.payload) {
			case "pause":
			case "resume":
			case "stop":
			case "start":

I don't use this node so cannot help much further.
Having skimmed some search results I suspect that there is more to it than you may think -

Depending on your use case there are quite a few topics to be found in the forum which may be of interest.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.