forked from openlp/openlp
Blank to theme issues with video backgrounds
This commit is contained in:
parent
07c9007173
commit
541bc1508d
@ -62,6 +62,7 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
|
|||||||
self.log_info('MediaController Initialising')
|
self.log_info('MediaController Initialising')
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
|
self.is_theme_background = False
|
||||||
self.vlc_player = None
|
self.vlc_player = None
|
||||||
self.current_media_players = {}
|
self.current_media_players = {}
|
||||||
# Timer for video state
|
# Timer for video state
|
||||||
@ -217,7 +218,7 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
player.resize(controller)
|
player.resize(controller)
|
||||||
|
|
||||||
def load_video(self, source, service_item, hidden=False):
|
def load_video(self, source, service_item, hidden=False, is_theme_background=False):
|
||||||
"""
|
"""
|
||||||
Loads and starts a video to run and sets the stored sound value.
|
Loads and starts a video to run and sets the stored sound value.
|
||||||
|
|
||||||
@ -225,6 +226,7 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
|
|||||||
:param service_item: The player which is doing the playing
|
:param service_item: The player which is doing the playing
|
||||||
:param hidden: The player which is doing the playing
|
:param hidden: The player which is doing the playing
|
||||||
"""
|
"""
|
||||||
|
self.is_theme_background = is_theme_background
|
||||||
is_valid = True
|
is_valid = True
|
||||||
controller = self._display_controllers(source)
|
controller = self._display_controllers(source)
|
||||||
log.debug(f'load_video is_live:{controller.is_live}')
|
log.debug(f'load_video is_live:{controller.is_live}')
|
||||||
@ -314,19 +316,21 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
|
|||||||
if self.live_controller.media_info.media_type == MediaType.Stream:
|
if self.live_controller.media_info.media_type == MediaType.Stream:
|
||||||
self.log_warning('stream cannot be previewed while also streaming live')
|
self.log_warning('stream cannot be previewed while also streaming live')
|
||||||
return
|
return
|
||||||
autoplay = False
|
self.is_autoplay = False
|
||||||
if service_item.requires_media() and hidden == HideMode.Theme:
|
if service_item.requires_media() and hidden == HideMode.Theme:
|
||||||
autoplay = True
|
self.is_autoplay = True
|
||||||
# Preview requested
|
# Preview requested
|
||||||
elif not controller.is_live:
|
elif not controller.is_live:
|
||||||
autoplay = True
|
self.is_autoplay = True
|
||||||
# Visible or background requested or Service Item wants to autostart
|
# Visible or background requested or Service Item wants to autostart
|
||||||
elif not hidden and service_item.will_auto_start:
|
elif not hidden and service_item.will_auto_start:
|
||||||
autoplay = True
|
self.is_autoplay = True
|
||||||
# Unblank on load set
|
# Unblank on load set
|
||||||
elif self.settings.value('core/auto unblank'):
|
elif self.settings.value('core/auto unblank'):
|
||||||
autoplay = True
|
self.is_autoplay = True
|
||||||
if autoplay:
|
if self.is_theme_background:
|
||||||
|
self.is_autoplay = True
|
||||||
|
if self.is_autoplay:
|
||||||
if not self.media_play(controller):
|
if not self.media_play(controller):
|
||||||
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
|
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
|
||||||
translate('MediaPlugin.MediaItem', 'Unsupported File'))
|
translate('MediaPlugin.MediaItem', 'Unsupported File'))
|
||||||
@ -736,18 +740,15 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
|
|||||||
Registry().execute('live_display_hide', hide_mode)
|
Registry().execute('live_display_hide', hide_mode)
|
||||||
controller_type = self.live_controller.controller_type
|
controller_type = self.live_controller.controller_type
|
||||||
playing = self.current_media_players[controller_type].get_live_state() == MediaState.Playing
|
playing = self.current_media_players[controller_type].get_live_state() == MediaState.Playing
|
||||||
if hide_mode == HideMode.Theme:
|
if self.is_theme_background and hide_mode == HideMode.Theme:
|
||||||
if not playing:
|
if not playing:
|
||||||
self.media_play(self.live_controller)
|
self.media_play(self.live_controller)
|
||||||
else:
|
else:
|
||||||
self.live_hide_timer.stop()
|
self.live_hide_timer.stop()
|
||||||
else:
|
else:
|
||||||
if hide_mode == HideMode.Screen:
|
if playing:
|
||||||
if playing:
|
self.media_pause(self.live_controller)
|
||||||
self.media_pause(self.live_controller)
|
self._media_set_visibility(self.live_controller, False)
|
||||||
self._media_set_visibility(self.live_controller, False)
|
|
||||||
else:
|
|
||||||
self.live_hide_timer.start(HIDE_DELAY_TIME)
|
|
||||||
|
|
||||||
def media_unblank(self, msg):
|
def media_unblank(self, msg):
|
||||||
"""
|
"""
|
||||||
|
@ -29,7 +29,6 @@ from threading import Lock
|
|||||||
|
|
||||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
from openlp.core.state import State
|
|
||||||
from openlp.core.common import SlideLimits
|
from openlp.core.common import SlideLimits
|
||||||
from openlp.core.common.actions import ActionList, CategoryOrder
|
from openlp.core.common.actions import ActionList, CategoryOrder
|
||||||
from openlp.core.common.i18n import UiStrings, translate
|
from openlp.core.common.i18n import UiStrings, translate
|
||||||
@ -40,10 +39,12 @@ from openlp.core.display.screens import ScreenList
|
|||||||
from openlp.core.display.window import DisplayWindow
|
from openlp.core.display.window import DisplayWindow
|
||||||
from openlp.core.lib import ServiceItemAction, image_to_byte
|
from openlp.core.lib import ServiceItemAction, image_to_byte
|
||||||
from openlp.core.lib.serviceitem import ItemCapabilities
|
from openlp.core.lib.serviceitem import ItemCapabilities
|
||||||
from openlp.core.ui.media import media_empty_song
|
from openlp.core.lib.theme import BackgroundType
|
||||||
from openlp.core.lib.ui import create_action
|
from openlp.core.lib.ui import create_action
|
||||||
|
from openlp.core.state import State
|
||||||
from openlp.core.ui import DisplayControllerType, HideMode
|
from openlp.core.ui import DisplayControllerType, HideMode
|
||||||
from openlp.core.ui.icons import UiIcons
|
from openlp.core.ui.icons import UiIcons
|
||||||
|
from openlp.core.ui.media import media_empty_song
|
||||||
from openlp.core.widgets.layouts import AspectRatioLayout
|
from openlp.core.widgets.layouts import AspectRatioLayout
|
||||||
from openlp.core.widgets.toolbar import OpenLPToolbar
|
from openlp.core.widgets.toolbar import OpenLPToolbar
|
||||||
from openlp.core.widgets.views import ListPreviewWidget
|
from openlp.core.widgets.views import ListPreviewWidget
|
||||||
@ -1558,15 +1559,20 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
|
|||||||
:param item: The service item to be processed
|
:param item: The service item to be processed
|
||||||
"""
|
"""
|
||||||
if State().check_preconditions('media'):
|
if State().check_preconditions('media'):
|
||||||
|
theme_data = item.get_theme_data()
|
||||||
|
is_theme_background = BackgroundType.from_string(theme_data.background_type) in [BackgroundType.Stream,
|
||||||
|
BackgroundType.Video]
|
||||||
if self.is_live and not item.is_media() and item.requires_media():
|
if self.is_live and not item.is_media() and item.requires_media():
|
||||||
self.media_controller.load_video(self.controller_type, item, self._current_hide_mode)
|
self.media_controller.load_video(self.controller_type, item, self._current_hide_mode,
|
||||||
|
is_theme_background)
|
||||||
elif self.is_live:
|
elif self.is_live:
|
||||||
if self._current_hide_mode == HideMode.Theme:
|
if self._current_hide_mode == HideMode.Theme:
|
||||||
self.set_hide_mode(HideMode.Blank)
|
self.set_hide_mode(HideMode.Blank)
|
||||||
self.media_controller.load_video(self.controller_type, item, self._current_hide_mode)
|
self.media_controller.load_video(self.controller_type, item, self._current_hide_mode,
|
||||||
|
is_theme_background)
|
||||||
elif item.is_media():
|
elif item.is_media():
|
||||||
# avoid loading the video if this is preview and the media is background
|
# avoid loading the video if this is preview and the media is background
|
||||||
self.media_controller.load_video(self.controller_type, item)
|
self.media_controller.load_video(self.controller_type, item, is_theme_background=is_theme_background)
|
||||||
if not self.is_live:
|
if not self.is_live:
|
||||||
self.preview_display.show()
|
self.preview_display.show()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user