From 3c91a6bbfd45714ebe617a5446e2063112c21291 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 1 Jul 2014 22:06:55 +0200 Subject: [PATCH] Fixed seeking when playing mediaclip --- openlp/core/ui/media/vlcplayer.py | 18 ++++++++++++++---- .../media/forms/mediaclipselectordialog.py | 1 - 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/media/vlcplayer.py b/openlp/core/ui/media/vlcplayer.py index 0c6d91078..8c957ea1d 100644 --- a/openlp/core/ui/media/vlcplayer.py +++ b/openlp/core/ui/media/vlcplayer.py @@ -246,10 +246,12 @@ class VlcPlayer(MediaPlayer): if controller.media_info.start_time > 0: log.debug('vlc play, starttime set: ' + str(controller.media_info.start_time)) start_time = controller.media_info.start_time + controller.media_info.length = controller.media_info.end_time - controller.media_info.start_time + else: + controller.media_info.length = int(display.vlc_media_player.get_media().get_duration() / 1000) self.volume(display, controller.media_info.volume) - if start_time > 0: - self.seek(display, int(start_time * 1000)) - controller.media_info.length = int(display.vlc_media_player.get_media().get_duration() / 1000) + if start_time > 0 and display.vlc_media_player.is_seekable(): + display.vlc_media_player.set_time(int(start_time * 1000)) controller.seek_slider.setMaximum(controller.media_info.length * 1000) self.state = MediaState.Playing display.vlc_widget.raise_() @@ -283,6 +285,9 @@ class VlcPlayer(MediaPlayer): """ Go to a particular position """ + if display.controller.media_info.media_type == MediaType.CD \ + or display.controller.media_info.media_type == MediaType.DVD: + seek_value += int(display.controller.media_info.start_time * 1000) if display.vlc_media_player.is_seekable(): display.vlc_media_player.set_time(seek_value) @@ -315,7 +320,12 @@ class VlcPlayer(MediaPlayer): self.set_visible(display, False) if not controller.seek_slider.isSliderDown(): controller.seek_slider.blockSignals(True) - controller.seek_slider.setSliderPosition(display.vlc_media_player.get_time()) + if display.controller.media_info.media_type == MediaType.CD \ + or display.controller.media_info.media_type == MediaType.DVD: + controller.seek_slider.setSliderPosition(display.vlc_media_player.get_time() - + int(display.controller.media_info.start_time * 1000)) + else: + controller.seek_slider.setSliderPosition(display.vlc_media_player.get_time()) controller.seek_slider.blockSignals(False) def get_info(self): diff --git a/openlp/plugins/media/forms/mediaclipselectordialog.py b/openlp/plugins/media/forms/mediaclipselectordialog.py index ad23aa83e..225be5cb0 100644 --- a/openlp/plugins/media/forms/mediaclipselectordialog.py +++ b/openlp/plugins/media/forms/mediaclipselectordialog.py @@ -166,7 +166,6 @@ class Ui_MediaClipSelector(object): self.position_horizontalslider.setInvertedAppearance(False) self.position_horizontalslider.setObjectName("position_horizontalslider") self.gridLayout.addWidget(self.position_horizontalslider, 6, 1, 1, 3) - self.retranslateUi(MediaClipSelector) QtCore.QMetaObject.connectSlotsByName(MediaClipSelector) MediaClipSelector.setTabOrder(self.media_path_combobox, self.load_disc_pushbutton)