Hello out there,
does anybody know of an example that controls a media player (any
media player) programmatically? Not from a mobile phone or an IR
device, but from a program running on the same machine.
Preferably on Windows - but given the VM technology I think I could
work with a Linux example, too.
It needn't even be in Tcl (although it would of course be greatly
preferred) - I think I could translate it from most languages to Tcl.
I started with MPlayer (http://www.mplayerhq.hu). My first attempts
with small snippets were encouraging but when it came to the real
stuff MPlayer only stutttered and didn't advance (this was on
Windows).
Any tip or advice will be greatly appreciated
Helmut
Hello out there,
does anybody know of an example that controls a media player (any
media player) programmatically? Not from a mobile phone or an IR
device, but from a program running on the same machine.
Preferably on Windows - but given the VM technology I think I could
work with a Linux example, too.
It needn't even be in Tcl (although it would of course be greatly
preferred) - I think I could translate it from most languages to Tcl.
I started with MPlayer (http://www.mplayerhq.hu). My first attempts
with small snippets were encouraging but when it came to the real
stuff MPlayer only stutttered and didn't advance (this was on
Windows).
Any tip or advice will be greatly appreciated
Helmut
On 11/7/2023 1:42 PM, Helmut Giese wrote:
Hello out there,
does anybody know of an example that controls a media player (any
media player) programmatically? Not from a mobile phone or an IR
device, but from a program running on the same machine.
Preferably on Windows - but given the VM technology I think I could
work with a Linux example, too.
It needn't even be in Tcl (although it would of course be greatly
preferred) - I think I could translate it from most languages to Tcl.
I started with MPlayer (http://www.mplayerhq.hu). My first attempts
with small snippets were encouraging but when it came to the real
stuff MPlayer only stutttered and didn't advance (this was on
Windows).
Any tip or advice will be greatly appreciated
Helmut
I control the vlc media player from tcl. I use the portable version which you can get (for windows) at portableapps.com. Then I install it on my C drive using the portableapps installer. Then in the following folder,
C:\PortableApps\VLCPortable\App\vlc\lua\http\requests
There's a readme.txt file that shows how to send http requests for most of the commands such as play, pause, skipto, etc.
Most of the commands are sent to the status.xml file, here's a tcl example where I seek +/- one second using the mousewheel.
set ::playerhost localhost ;# can send to other machines on a lan also
proc do_wheel1 {args} {
set direction [lindex $args end]
if { $direction > 0 } {
http_geturl_auth "http://$::playerhost:8080/requests/status.xml?command=seek&val=-1s"
} else {
http_geturl_auth "http://$::playerhost:8080/requests/status.xml?command=seek&val=%2B1s"
}
}
Here's one for pause:
http_geturl_auth "http://$::playerhost:8080/requests/status.xml?command=pl_pause"
There is some setup needed in the vlc program. The most recent versions needs a username and password, which I setup in the vlc program under (choose all settings)
interfaces->main interfaces-> lua
for a password of xyz and you send a blank username (I think that's required). Here's the code I use for the above http sends:
package require base64
proc http_geturl_auth {url {user {}} {pass xyz}} {
return [geturl_auth $url $user $pass]
}
proc geturl_auth {url username password} {
set auth "Basic [base64::encode $username:$password]"
set headerl [list Authorization $auth]
set tok [http::geturl $url -headers $headerl -timeout 200]
return $tok
}
That should be enough to get you started if you want to use vlc from tcl/tk.
This might be helpful also:
https://wiki.videolan.org/Control_VLC_via_a_browser/
Hi Helmut,Hi Scott,
Did you have a look at mplayer's "-slave" mode?
http://www.mplayerhq.hu/DOCS/tech/slave.txt
Kind regards,
Scott
yes, the experiences I mentioned were with using the -slave
option.Thanks for your time
Helmut
Hi Helmut,Hi Scott,
Did you have a look at mplayer's "-slave" mode?
http://www.mplayerhq.hu/DOCS/tech/slave.txt
Kind regards,
Scott
Hi et99,
thanks a lot for your many examples. This will surely give me a point
to start from. I will only have to refresh my knowledge about using
http and friends - but this should be manageable.
Many thanks again and best regards
Helmut
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 493 |
Nodes: | 16 (2 / 14) |
Uptime: | 183:43:01 |
Calls: | 9,705 |
Files: | 13,737 |
Messages: | 6,179,548 |