3

I want to code a snippet / module in python that opens up a VLC player on a specific display / monitor and plays a specific file.

I use the package python-vlc, and I succesfully managed to play a video file using the package:

    import vlc

    vlc_options = "--embedded-video --no-audio --fullscreen"
    vlc_instance = vlc.Instance(vlc_options)
    # vlc.Instance.url = filepath

    player = vlc_instance.media_player_new()
    player.set_mrl(filepath)
    player.set_fullscreen(True)
    player.play()

    while True:
        pass

I searched everywhere in the documentation but I did not find anything useful, on how I could choose a specific display to start the media instance on.

https://www.olivieraubert.net/vlc/python-ctypes/doc/
https://wiki.videolan.org/python_bindings

And neither succeeded using the CLI commands:
https://wiki.videolan.org/VLC_command-line_help/

Alex M.M.
  • 501
  • 1
  • 7
  • 18
  • I am also facing the same problem (https://stackoverflow.com/questions/63300652/vlc-python-does-not-play-a-video-in-hdmi2-in-raspberry-pi4). My operating system is raspbian (Rasperry Pi 4). Did you find a solution for this problem? – Baraa Aug 07 '20 at 14:05
  • 1
    @Baraa no, unfortunately. For the moment i switched to mpv, its more developer friendly and the CLI options can solve many tasks that vlc can not handle. – Alex M.M. Aug 07 '20 at 14:09
  • In CLI you can instantiate the vlc and by using xdotool or wmctrl you can set position, size and perhaps also display. But with just python bindings i could not find any way for the moment. – Alex M.M. Aug 07 '20 at 14:12
  • Thank you very much for the comment. Can I ask you which operating system you use? – Baraa Aug 07 '20 at 14:15
  • Its ubuntu 19 with kde. Tested also on ubuntu kde 18. If you need more details about my experience please ask. Im kinda dissapointed vlc has so many fragile features for devs. – Alex M.M. Aug 07 '20 at 14:18

1 Answers1

1

What I found is the following: To some extent you might have some luck to control this by going to Tools --> Preference --> Video --> Fullscreen Video Device --> Here you choose the display you want in VLC software. It depends as well on the output mode. You need to try them.

Baraa
  • 176
  • 8