Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome General
 PowerHome Messageboard : PowerHome General
Subject Topic: PH and VLC Media Player Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: January 25 2019 at 20:25 | IP Logged Quote smarty

I am trying to have Powerhome connect to and then send commands to the telnet interface that is an available option from within the VLC open source media player.

How to set up telnet control on VLC:
Telnet remote control of VLC can be made available by going into the "Tools", "Preferences", Show setting - All"...Scroll down to "Main Interfaces", and click on "Lua".

There you can set the port, password, and IP address (local host or IP of the machine it is running on - for remote control). FYI...VLC does not seem to let you log into the telnet control until you set a password (leaving it blank does not seem to work).

I have VLC running on a Raspberry Pi (192.168.0.28 - port 4212, password=pswd). I can connect to to it and send commands via telnet and also Putty (full remote control). Therefore, I figured I should also be able to connect to it via PH sockets...however...I am having limited success. It would be very useful for a PH VLC plugin or VLC control like there is for WinAmp (my two cents).

Anyway, here are a few of the things I have tried:

ph_sendsocketdata1("192.168.0.28",4212,1,"pswd" + char(013))
ph_sendsocketdata1("192.168.0.28",4212,1,"pswd\013")

However, since I want to keep the connection open continually, setting up a plugin makes for a better approach. Mine was this:

ID=VLC-TELNET, type=ActiveX, classname=PH_Socket.phsocket Init Data=192.168.0.28 4212

After restarting PH, the plugin shows enabled, but when I try to send it the passord to login, I have no success.

I tried to send it:
ph_picmd(1,"VLC-TELNET",1,0,0,"yz125" + char(013),"")
ph_picmd(1,"VLC-TELNET",1,0,0,"yz125\013","")

After I set up a "Generic Plugin" trigger, This is what I get back:

temp1= __AVLC temp2= 10057 temp3= 0 temp4= 4212 temp5= No connection established with remote host temp6= 27 temp7= VLC-TELNET temp8= 1 temp9= 4 temp10= 192.168.0.28


Since VLC can play or stream music and video....it can be extemely useful for displaying security cams, switching cams views, switching video, etc, etc...I really think PH should be able to control VLC well (especially since WinAmp is mostly dead).

__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: January 26 2019 at 13:53 | IP Logged Quote dhoward

Steve,

I will add "Create VLC plugin" to the todo list. I can definitely see the value of something like this since I use VLC myself. No promises on when I'll get
it done though.

In the meantime, using the socket plugin is probably the best bet. Your ph_sendsocketdata1 function should work but you need to set the flags parameter to
14. The \013 won't be translated into a carriage return unless the flags parameter contains a 2. I wouldnt use a 1 (close socket on send complete) as
you'll never get the results of what you sent. With the 14, you'll at least see what is returned from sending the password. However, I don't think this
will ultimately accomplish your goal.

With the plugin, you should be able to get the desired results although I have not taken a look at the protocol so cant be 100% sure.

For defining the plugin, I would live the Init Data blank so the connection is NOT initiated when the plugin is loaded. After the plugin is loaded, you can
then call:

ph_picmd(3,"VLC-TELNET",2,4212,1,"192.168.0.28","")

This should make the connection to VLC. The 1 in data2 is the escape parameter for returned data. A value of 0 means returned data is not escaped, 1 value
of 1 means non-printable characters are escaped, and a value of 2 means EVERY character is escaped. Assuming everything is working properly, then should
fire a generic plugin trigger on command 1, option 2. You should then be able to send the following:

ph_picmd(3,"VLC-TELNET",1,3,0,"yz125~r","")

The 3 in data1 is a timeout value for the socket to send the data. The "~r" is a PowerHome shortcut for carriage return. You could also use "~h13".

The only problem is that the socket plugin does not currently have a method to handled escaped data like the ph_sendsocketdata1 function does. Ive added
this to the todo list as well.

Let me know how it goes.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: January 27 2019 at 20:32 | IP Logged Quote smarty

Tried this:
ph_sendsocketdata1("192.168.0.28",4212,14,"yz125\013")

Returns:
Formula Evaluation
     Execution time: 0.078 seconds.
     The formula evaluates to: VLC media player 3.0.6 Vetinari\010Password: \255\251\001

......
It does not appear to be logging in properly to the VLC telnet interface.

When using plain old Telnet, I see the same text (VLC media player 3.0.6 Vetinari), with a line feed (\010) prior to the "Password:" prompt.

When I enter the password, the characters are not visible. Once I hit enter, I get a "Welcome Master" and a ">" shaped prompt, letting me know that I am logged in.

FYI - VLC now does hardware accelerated video decoding. Just select "X11 video output (XCB)" under the Video Settings preferences....my CPU usage dropped from 97% to 25%.


Edited by smarty - January 27 2019 at 20:36


__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum