1

I want to run a video in my second monitor/projector using vlc-package pip3 install python-vlc and python3 in Raspberry Pi 4. I set the Fullscreen Video Device of the vlc-software to HDMI-2 Tools --> Preferences --> Video --> Fullscreen Video Device --> HDMI-2. When I run the code, it displays the video however in HDMI-1. Here is my code:

class Video():
    def __init__(self, properties_list):
        self.properties_list = properties_list
        self.instance = vlc.Instance(self.properties_list)
        self.player = self.instance.media_player_new()
        self.player.set_fullscreen(True)
        
    def play(self, video):
        media = self.instance.media_new(video)
        self.player.set_media(media)
        self.player.play()
        
    def stop(self):
        self.player.stop()

if __name__ == '__main__':
    video_name = '/path/to/video/file.mp4'
    vlc_setting = ['--vout=XVideo', '--fullscreen', '--play-and-exit']
    video = Video(vlc_setting)
    video.play()

When I play the video directly using vlc software, it displays the video in HDMI-2. Only when I run the code using python, I face the Problem. I had the idea to move the menu bar (panel bar) to monitor 2 and run the code from monitor 2 (HDMI-2). Surprisingly, it runs in HDMI-2 and I couldn't play the video in HDMI-1. How can I play the video in the HDMI-2 via python and vlc?

Some more information:

debian_version = 10.4
vlc --version = 3.0.11
python = 3.7.3
python-vlc = 3.0.9113
Baraa
  • 176
  • 8

0 Answers0