hobbyquaker / lgtv2

Control LG WebOS TV using node.js :tv:
MIT License
332 stars 45 forks source link

Open Web Browser on specific website #23

Closed elisiariocouto closed 5 years ago

elisiariocouto commented 5 years ago

Hello.

I've successfully managed to connect to my Web OS TV and I can open the web browser. Is it possible to open the web browser on a specific website?

Thanks in advance

elisiariocouto commented 5 years ago

I've found that passing a params property with a target key on the request works. Is there any way of putting a website on fullscreen?

ciberado commented 5 years ago

I've just done it by controlling the mouse cursor:

lgtv.on('connect', function () {
    console.log('connected');
    lgtv.getSocket('ssap://com.webos.service.networkinput/getPointerInputSocket',
      function(err, sock) {
          if (!err) {
              const command = "move\n" + "dx:" + 11 + "\n" + "dy:-8\n" + "down:0\n" + "\n";
              for (let i=0; i < 22; i++) {
                sock.send(command);
              }
              setTimeout(()=>sock.send('click'), 1000);
          }
      }
    );
elisiariocouto commented 5 years ago

I've managed to put the browser in fullscreen with the mouse cursor. Thanks @ciberado !

g-pasquier commented 5 years ago

Thank you @ciberado for the fullscreen tip !

industriousonesoft commented 4 years ago

Wow, what a brilliant solution! Thx you @ciberado, you save my day!

odelma commented 4 years ago

Thanks for the script, it works 😄 However, when I try to add a disconnect to it, for some reason it is not working anymore. For example, the script I was hoping to use: lgtv.on('connect', function () { lgtv.request('ssap://com.webos.applicationManager/listLaunchPoints', function (err, res) { var launchPoints = res.launchPoints; }); lgtv.request('ssap://system.launcher/launch', {id: 'com.webos.app.browser', target: 'http://google.com'}); lgtv.getSocket('ssap://com.webos.service.networkinput/getPointerInputSocket', function(err, sock) { if (!err) { const command = "move\n" + "dx:" + 11 + "\n" + "dy:-8\n" + "down:0\n" + "\n"; for (let i=0; i < 22; i++) { sock.send(command); } setTimeout(()=>sock.send('click'), 1000); } } ); lgtv.disconnect(); });

...will not move the cursor. Then, if I comment out lgtv.disconnect(); the cursor moves and puts browser to full screen. The script however runs until I force it to quit. What would be the correct syntax to gracefully close the connection?

BMW999 commented 2 years ago

Dear all, I'm new to this communitiy and stumbled over this community when searching for a solution for exact same challenge: Would like to launch a video on a LG TV in full screen mode but it only uses the full browser area. Ciberado's code would actually be a nice work around. Though I'm expierenced enough to apply the idea for my purpose. I use OpenHAB 3 and envision to write a script using the this code. Ciberado or anyone else: can pls. somebody help me with the following questions:

  1. What language is the code?
  2. Can I use this language in OpenHAB 3? (I'm only aware of Java and somekind of OpenHAB specific languages Blcokly and DSL) Any comments are highly appreciated! Thanks a lot in advance
BMW999 commented 2 years ago

@ciberado or @odelma : In the meantime I managed to move and click to cursor and switch to full screen. I'm struggelling though with the same issue odelma has ... putting the disconnect command at the right spot. Can you pls help me with that? Thx a lot .... BMW999