From 59ca1f546900af4a31a7b51e7dabc96480658474 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 7 Sep 2012 17:58:13 +0100 Subject: [PATCH] Try 2 --- openlp/core/ui/media/mediacontroller.py | 31 ++++++++++++++++--------- openlp/core/ui/slidecontroller.py | 4 +--- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index 94c148912..3a081e23c 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -287,7 +287,7 @@ class MediaController(object): """ player.resize(display) - def video(self, controller, file, muted, isBackground): + def video(self, controller, file, muted, isBackground, hidden=False): """ Loads and starts a video to run with the option of sound """ @@ -333,17 +333,26 @@ class MediaController(object): if controller.isLive and not controller.media_info.is_background: display.frame.evaluateJavaScript(u'show_video( \ "setBackBoard", null, null, null,"visible");') - # now start playing - if controller.isLive and \ - (Settings().value(u'general/auto unblank', - QtCore.QVariant(False)).toBool() or \ - controller.media_info.is_background) or not controller.isLive: + # now start playing - Preview is autoplay! + autoplay = False + # Preview requested + if not controller.isLive: + autoplay = True + # Visible or background requested + elif not hidden or controller.media_info.is_background: + autoplay = True + # Unblank on load set + elif Settings().value(u'general/auto unblank', + QtCore.QVariant(False)).toBool(): + autoplay = True + if autoplay: if not self.video_play([controller]): - critical_error_message_box( - translate('MediaPlugin.MediaItem', 'Unsupported File'), - unicode(translate('MediaPlugin.MediaItem', - 'Unsupported File'))) - return False + if not self.video_play([controller]): + critical_error_message_box( + translate('MediaPlugin.MediaItem', 'Unsupported File'), + unicode(translate('MediaPlugin.MediaItem', + 'Unsupported File'))) + return False self.set_controls_visible(controller, True) log.debug(u'use %s controller' % self.curDisplayMediaPlayer[display]) return True diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 1efe746e0..2d108e72c 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -889,8 +889,6 @@ class SlideController(Controller): self.display.buildHtml(self.serviceItem) if serviceItem.is_media(): self.onMediaStart(serviceItem) - if self.isLive: - Receiver.send_message('playbackPlay', [self, u'(False,)']) self.slideSelected(True) self.previewListWidget.setFocus() if old_item: @@ -1349,7 +1347,7 @@ class SlideController(Controller): """ log.debug(u'SlideController onMediaStart') file = os.path.join(item.get_frame_path(), item.get_frame_title()) - self.mediaController.video(self, file, False, False) + self.mediaController.video(self, file, False, False, self.hideMode()) if not self.isLive or self.mediaController.withLivePreview: self.previewDisplay.show() self.slidePreview.hide()