UNPKG

node-red-contrib-lgtv-with-fullscreen

Version:

Node-RED Nodes to control LG webOS Smart TVs, with browser fullscreen

26 lines (21 loc) 743 B
module.exports = function (RED) { function LgtvYoutubeNode(n) { RED.nodes.createNode(this, n); const node = this; this.tv = n.tv; this.passthru = n.passthru; this.tvConn = RED.nodes.getNode(this.tv); if (this.tvConn) { this.tvConn.register(node); this.on('close', done => { node.tvConn.deregister(node, done); }); node.on('input', msg => { node.tvConn.request('ssap://system.launcher/launch', {id: 'youtube.leanback.v4', contentId: msg.payload}); }); } else { this.error('No TV Configuration'); } } RED.nodes.registerType('lgtv-youtube', LgtvYoutubeNode); };