seek slider works

This commit is contained in:
Tim Bentley 2019-04-21 09:20:43 +01:00
parent f5a2a58234
commit 607d678780
4 changed files with 12 additions and 15 deletions

View File

@ -216,9 +216,6 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
"""
# Generic controls
controller.mediabar.setVisible(value)
# if controller.is_live and controller.display:
# if self.current_media_players and value:
# controller.display.set_transparency(False)
@staticmethod
def resize(display, player):

View File

@ -139,11 +139,12 @@ class MediaPlayer(RegistryProperties):
"""
pass
def update_ui(self, display):
def update_ui(self, controller, output_display):
"""
Do some ui related stuff (e.g. update the seek slider)
:param display: The display to be updated.
:param controller: Which Controller is running the show.
:param output_display: The display where the media is
"""
pass

View File

@ -226,7 +226,8 @@ class VlcPlayer(MediaPlayer):
return False
output_display.vlc_media = audio_cd_tracks.item_at_index(controller.media_info.title_track)
elif controller.media_info.media_type == MediaType.Stream:
output_display.vlc_media = output_display.vlc_instance.media_new_location('ZZZZZZ')
stream_cmd = Settings().value('media/stream command')
output_display.vlc_media = output_display.vlc_instance.media_new_location(stream_cmd)
else:
output_display.vlc_media = output_display.vlc_instance.media_new_path(path)
# put the media in the media player
@ -242,7 +243,7 @@ class VlcPlayer(MediaPlayer):
Wait no longer than 60 seconds. (loading an iso file needs a long time)
:param media_state: The state of the playing media
:param display: The display where the media is
:param output_display: The display where the media is
:return:
"""
vlc = get_vlc()
@ -316,7 +317,7 @@ class VlcPlayer(MediaPlayer):
self.volume(output_display, output_display.media_info.volume)
if start_time > 0 and output_display.vlc_media_player.is_seekable():
output_display.vlc_media_player.set_time(int(start_time))
controller.seek_slider.setMaximum(output_display.media_info.length)
controller.seek_slider.setMaximum(controller.media_info.length)
self.set_state(MediaState.Playing, output_display)
output_display.vlc_widget.raise_()
return True
@ -363,9 +364,9 @@ class VlcPlayer(MediaPlayer):
:param seek_value: The position of where a seek goes to
:param output_display: The display where the media is
"""
if output_display.controller.media_info.media_type == MediaType.CD \
or output_display.controller.media_info.media_type == MediaType.DVD:
seek_value += int(output_display.controller.media_info.start_time)
if output_display.media_info.media_type == MediaType.CD \
or output_display.media_info.media_type == MediaType.DVD:
seek_value += int(output_display.media_info.start_time)
if output_display.vlc_media_player.is_seekable():
output_display.vlc_media_player.set_time(seek_value)

View File

@ -112,7 +112,7 @@ class MediaSlider(QtWidgets.QSlider):
class InfoLabel(QtWidgets.QLabel):
"""
InfoLabel is a subclassed QLabel. Created to provide the ablilty to add a ellipsis if the text is cut off. Original
InfoLabel is a subclassed QLabel. Created to provide the ability to add a ellipsis if the text is cut off. Original
source: https://stackoverflow.com/questions/11446478/pyside-pyqt-truncate-text-in-qlabel-based-on-minimumsize
"""
@ -177,7 +177,6 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
if screen.is_display:
display = DisplayWindow(self, screen)
self.displays.append(display)
# display.media_watcher.progress.connect(self.on_audio_time_remaining)
@property
def display(self):
@ -381,7 +380,7 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
self.position_label.setMinimumSize(90, 0)
self.position_label.setObjectName('position_label')
self.mediabar.add_toolbar_widget(self.position_label)
# Build the seek_slider.
# Build the media seek_slider.
self.seek_slider = MediaSlider(QtCore.Qt.Horizontal, self, self)
self.seek_slider.setMaximum(1000)
self.seek_slider.setTracking(True)
@ -398,7 +397,6 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
self.volume_slider.setMaximum(100)
self.volume_slider.setTracking(True)
self.volume_slider.setToolTip(translate('OpenLP.SlideController', 'Audio Volume.'))
# self.volume_slider.setValue(self.media_info.volume)
self.volume_slider.setGeometry(QtCore.QRect(90, 160, 221, 24))
self.volume_slider.setObjectName('volume_slider')
self.mediabar.add_toolbar_widget(self.volume_slider)