From d95b4343b55e82d0245fe29741f0f407efaafb7d Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 2 May 2019 20:23:23 -0700 Subject: [PATCH] Temporary workaround for VLC --- openlp/core/ui/media/vlcplayer.py | 56 ++++++++++++++++--------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/openlp/core/ui/media/vlcplayer.py b/openlp/core/ui/media/vlcplayer.py index 8e1989fda..b88314eb9 100644 --- a/openlp/core/ui/media/vlcplayer.py +++ b/openlp/core/ui/media/vlcplayer.py @@ -161,33 +161,35 @@ class VlcPlayer(MediaPlayer): :return: """ vlc = get_vlc() - output_display.vlc_widget = QtWidgets.QFrame(output_display) - output_display.vlc_widget.setFrameStyle(QtWidgets.QFrame.NoFrame) - # creating a basic vlc instance - command_line_options = '--no-video-title-show' - if Settings().value('advanced/hide mouse') and live_display: - command_line_options += ' --mouse-hide-timeout=0' - output_display.vlc_instance = vlc.Instance(command_line_options) - # creating an empty vlc media player - output_display.vlc_media_player = output_display.vlc_instance.media_player_new() - output_display.vlc_widget.resize(output_display.size()) - output_display.vlc_widget.raise_() - output_display.vlc_widget.hide() - # The media player has to be 'connected' to the QFrame. - # (otherwise a video would be displayed in it's own window) - # This is platform specific! - # You have to give the id of the QFrame (or similar object) - # to vlc, different platforms have different functions for this. - win_id = int(output_display.vlc_widget.winId()) - if is_win(): - output_display.vlc_media_player.set_hwnd(win_id) - elif is_macosx(): - # We have to use 'set_nsobject' since Qt5 on OSX uses Cocoa - # framework and not the old Carbon. - output_display.vlc_media_player.set_nsobject(win_id) - else: - # for Linux/*BSD using the X Server - output_display.vlc_media_player.set_xwindow(win_id) + # Temporary workaround + if vlc: + output_display.vlc_widget = QtWidgets.QFrame(output_display) + output_display.vlc_widget.setFrameStyle(QtWidgets.QFrame.NoFrame) + # creating a basic vlc instance + command_line_options = '--no-video-title-show' + if Settings().value('advanced/hide mouse') and live_display: + command_line_options += ' --mouse-hide-timeout=0' + output_display.vlc_instance = vlc.Instance(command_line_options) + # creating an empty vlc media player + output_display.vlc_media_player = output_display.vlc_instance.media_player_new() + output_display.vlc_widget.resize(output_display.size()) + output_display.vlc_widget.raise_() + output_display.vlc_widget.hide() + # The media player has to be 'connected' to the QFrame. + # (otherwise a video would be displayed in it's own window) + # This is platform specific! + # You have to give the id of the QFrame (or similar object) + # to vlc, different platforms have different functions for this. + win_id = int(output_display.vlc_widget.winId()) + if is_win(): + output_display.vlc_media_player.set_hwnd(win_id) + elif is_macosx(): + # We have to use 'set_nsobject' since Qt5 on OSX uses Cocoa + # framework and not the old Carbon. + output_display.vlc_media_player.set_nsobject(win_id) + else: + # for Linux/*BSD using the X Server + output_display.vlc_media_player.set_xwindow(win_id) self.has_own_widget = True def check_available(self):