|
16 | 16 | category: 'dashboard',
|
17 | 17 | color: 'rgb( 63, 173, 181)',
|
18 | 18 | defaults: {
|
| 19 | + name: {value: ''}, |
19 | 20 | group: {type: 'ui_group', required:true},
|
20 | 21 | order: {value: 0},
|
21 | 22 | width: {
|
|
30 | 31 | return valid;
|
31 | 32 | }},
|
32 | 33 | height: {value: 0},
|
33 |
| - name: {value: ''}, |
34 | 34 | maxLength: { value: 5 },
|
35 |
| - timeslice: { value: 0 } |
| 35 | + timeslice: { value: 0 }, |
| 36 | + press : { value: "click" } |
36 | 37 | },
|
37 | 38 | inputs:0,
|
38 | 39 | outputs:1,
|
|
45 | 46 | return this.name?"node_label_italic":"";
|
46 | 47 | },
|
47 | 48 | oneditprepare: function() {
|
| 49 | + if (this.press === undefined) { |
| 50 | + $("#node-input-press").val("click"); |
| 51 | + } |
| 52 | + $("#node-input-press").change( function() { |
| 53 | + if ($("#node-input-press").val() === "press") { |
| 54 | + $("#node-rec-max-length").hide(); |
| 55 | + } |
| 56 | + else { |
| 57 | + $("#node-rec-max-length").show(); |
| 58 | + } |
| 59 | + }); |
48 | 60 | $("#node-input-size").elementSizer({
|
49 | 61 | width: "#node-input-width",
|
50 | 62 | height: "#node-input-height",
|
|
78 | 90 | });
|
79 | 91 | </script>
|
80 | 92 |
|
81 |
| -<script type="text/x-red" data-template-name="ui_microphone"> |
| 93 | +<script type="text/html" data-template-name="ui_microphone"> |
82 | 94 | <div class="form-row" id="template-row-group">
|
83 | 95 | <label for="node-input-group"><i class="fa fa-table"></i> Group</span></label>
|
84 | 96 | <input type="text" id="node-input-group">
|
|
89 | 101 | <input type="hidden" id="node-input-height">
|
90 | 102 | <button class="editor-button" id="node-input-size"></button>
|
91 | 103 | </div>
|
92 |
| - <br /> |
93 |
| - <div class="form-row" style="min-width: 470px"> |
94 |
| - <label style="vertical-align: top"><i class="fa fa-cog"></i> Options</label> |
95 |
| - <div style="display: inline-block; min-width: 350px; width: calc(100% - 120px);"> |
96 |
| - <ul> |
97 |
| - <li style="margin: 0 0 8px">Click button to start recording</li> |
98 |
| - <li style="margin: 8px 0 4px">Click again to stop recording</li> |
99 |
| - <li style="margin: 4px 0 4px">Maximum length of recording: <input style="width: 50px" type="text" id="node-input-maxLength"> seconds |
100 |
| - <!-- <li style="margin: 4px 0 4px">Send message <select style="width: auto" id="node-input-select-timeslice"><option value="once">once recording stops</option><option value="interval">at regular interval of</option></select> |
101 |
| - <div id="node-input-row-timeslice"><input style="margin-left: 20px; width: 50px" type="text" id="node-input-timeslice"> seconds</div> |
102 |
| - </li> --> |
103 |
| - </ul> |
104 |
| - </div> |
105 |
| - |
| 104 | + <div class="form-row" style="min-width:470px"> |
| 105 | + <label><i class="fa fa-cog"></i> Record</label> |
| 106 | + <select type="text" id="node-input-press" style="width:70%;"> |
| 107 | + <option value="click">Click to start, click to stop</option> |
| 108 | + <option value="press">Press to start, release to stop</option> |
| 109 | + </select> |
| 110 | + </div> |
| 111 | + <div class="form-row" id="node-rec-max-length"> |
| 112 | + <label></labeL> |
| 113 | + Maximum length of recording: <input style="width:50px" type="text" id="node-input-maxLength"> seconds |
106 | 114 | </div>
|
107 | 115 | <div class="form-row">
|
108 | 116 | <label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
109 | 117 | <input type="text" id="node-input-name" placeholder="Name">
|
110 | 118 | </div>
|
111 | 119 | </script>
|
112 | 120 |
|
113 |
| -<script type="text/x-red" data-help-name="ui_microphone"> |
| 121 | +<script type="text/html" data-help-name="ui_microphone"> |
114 | 122 | <p>A Node Red dashboard ui node to capture audio from the brower's microphone.</p>
|
115 | 123 | <h3>Outputs</h3>
|
116 | 124 | <dl class="message-properties">
|
117 | 125 | <dt>payload<span class="property-type">Buffer</span></dt>
|
118 | 126 | <dd>The captured audio in the required format.</dd>
|
119 | 127 | </dl>
|
120 | 128 | <h3>Details</h3>
|
121 |
| - <p>This node provides a single button widget in the dashboard that, when pressed, |
122 |
| - will begin to capture audio. It will continue to capture audio until the button |
123 |
| - is pressed again , or it reaches its configured maximum duration.</p> |
124 |
| - <p>The audio is captured in WAV format and published by the node as a Buffer |
125 |
| - object.</p> |
| 129 | + <p>This node provides a single button widget in the dashboard. |
| 130 | + The audio is captured in WAV format and published by the node as a Buffer object.</p> |
| 131 | + <p>The button can be configured in two modes. Either click begin to capture audio, and then |
| 132 | + continue to capture audio until the button is pressed again, or it reaches its configured |
| 133 | + maximum duration. Or the button can be configured to record only while the button is pressed.</p> |
| 134 | + <p></p> |
126 | 135 | <p></p>
|
127 | 136 | </script>
|
0 commit comments