Page 1 of 1

Show a complete VLC player with libvlc

Posted: 02 Jun 2022 11:09
by stefan__o
Hello,
I like to use VLC in a simple Python application. I used the python-bindings for libvlc, but I cannot figure out how to open a complete VLC player window (with all controls and settings etc.). I also tried the http-Interface, but that lacks one feature I need: sub-second time resolution (I realized VLC doesn't seem to offer exact timing, only about 1/4 second resolution, which is just about enough, if one could increase the resolution somehow would be great).
  • Is it (and if yes how) possible to open a complete VLC player with libvlc from Python?
  • If previous answer is no, is it possible with the http interface to access millisecond timing somehow?
  • Is it possible to increase VLCs internal time resolution?
Best regards
Stefan

Re: Show a complete VLC player with libvlc

Posted: 02 Jun 2022 16:40
by Rémi Denis-Courmont
No. No. No.

Re: Show a complete VLC player with libvlc

Posted: 02 Jun 2022 17:29
by stefan__o
There is a time extension that displays milliseconds on the display, isn't it possible to create an extension that either adds one entry to the status.json or provides a new file?

Re: Show a complete VLC player with libvlc

Posted: 02 Jun 2022 18:01
by Rémi Denis-Courmont
Everything is possible if you don't care about actual accuracy.

Re: Show a complete VLC player with libvlc

Posted: 02 Jun 2022 18:44
by stefan__o
The accuracy of vlc.player.get_time() would not be ideal, but just enough (if I can consider the value accurate in the way, that this a rounded value of the current frame).
The question is, how can I provide the output of vlc.player.get_time() to the http interface. I tried adding a status2.json:

Code: Select all

<?vlc local dkjson = require ("dkjson") s ={} s.time = vlc.player.get_time() s.rate = vlc.player.get_rate() s=removeArrayIndicators(s) output=dkjson.encode (s, { indent = true }) print(output) ?>
Unfortunately the vlc object doesn't seem to exist in this context, and the httprequests.lua that provides the info for the status.json is a compiled binary

Re: Show a complete VLC player with libvlc

Posted: 02 Aug 2022 10:44
by Krilya
Hey Stefan__o,
It is possible to start a complete VLC user interface with python-vlc.
PS : I code for fun not a savvy.

import vlc
from tkinter import Tk

root = Tk()
root.withdraw()

vlc_instance = vlc.Instance()
media_player = vlc.MediaPlayer()
vlc.libvlc_add_intf(vlc_instance, name=None)

root.mainloop()