node-red-contrib-pi-omxplayer
Version:
A Node-RED node to control OMXPlayer on the Raspberry pi
97 lines (86 loc) • 3.96 kB
HTML
<script type="text/javascript">
RED.nodes.registerType('rpi-omxplayer',{
category: 'Raspberry Pi',
color: '#c6dbef',
defaults: {
name: {value:""},
filename: {value:""},
audiooutput: {value:"hdmi"},
blackbackground: {value: true},
disablekeys: {value: false},
disableosd: {value: true},
disableghostbox: {value: false},
subtitlepath: {value: ""},
loop: {value: false}
},
inputs:1,
outputs:1,
icon: "rpi.png",
label: function() {
return this.name||"omxplayer";
},
labelStyle: function() {
return this.name?"node_label_italic":"";
}
});
</script>
<script type="text/x-red" data-template-name="rpi-omxplayer">
<div class="form-row node-input-filename">
<label for="node-input-filename" style="width:29%"><i class="fa fa-file"></i> Filename</label>
<input id="node-input-filename" type="text">
</div>
<div class="form-row node-input-audiooutput">
<label for="node-input-audiooutput" style="width:29%"><i class="fa volume-up"></i> Audio output</label>
<input id="node-input-audiooutput" type="text">
</div>
<div class="form-row">
<label style="width:29%"><i class="fa fa-wrench"></i> Black background</span></label>
<input type="checkbox" id="node-input-blackbackground" style="display: inline-block; width: auto; vertical-align: top;">
</div>
<div class="form-row">
<label style="width:29%"><i class="fa fa-wrench"></i> Disable keys</span></label>
<input type="checkbox" id="node-input-disablekeys" style="display: inline-block; width: auto; vertical-align: top;">
</div>
<div class="form-row">
<label style="width:29%"><i class="fa fa-desktop"></i> Disable OSD</span></label>
<input type="checkbox" id="node-input-disableosd" style="display: inline-block; width: auto; vertical-align: top;">
</div>
<div class="form-row">
<label style="width:29%"><i class="fa fa-wrench"></i> Disable Ghostbox</span></label>
<input type="checkbox" id="node-input-disableghostbox" style="display: inline-block; width: auto; vertical-align: top;">
</div>
<div class="form-row">
<label style="width:29%"><i class="fa fa-refresh"></i> Loop</span></label>
<input type="checkbox" id="node-input-loop" style="display: inline-block; width: auto; vertical-align: top;">
</div>
<div class="form-row">
<label for="node-input-subtitlepath" style="width:29%"><i class=" fa fa-font"></i> Subtitle path</label>
<input type="text" id="node-input-subtitlepath" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-name" style="width:29%"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<script type="text/x-red" data-help-name="rpi-omxplayer">
<p>A node to control OMXPlayer on the Raspberry pi</p>
<p>This node will accept the following commands as <code>msg.payload</code>:</p>
<ul>
<li>open</li>
<li>playpause</li>
<li>pause</li>
<li>stop</li>
<li>volumeup</li>
<li>volumedown</li>
<li>getduration</li>
<li>getposition</li>
<li>getstatus</li>
<li>getvolume</li>
<li>setvolume float (0-1)</li>
<li>setposition int</li>
</ul>
<p>The file to play can be set either in the node configuration or by using <code>msg.filename</code>.
The filename set in the configuration has precedence over <code>msg.filename</code>.</p>
<p>The node will output it's current status periodically in the <code>msg.status</code> object.
Calls to the different getter functions will also return a <code>msg.status</code> object.</p>
</script>