forked from openlp/openlp
More media fixes
This commit is contained in:
parent
5caca527e1
commit
7cc367801a
@ -328,6 +328,7 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
|
|||||||
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'))
|
||||||
return False
|
return False
|
||||||
|
self._update_seek_ui(controller)
|
||||||
self.set_controls_visible(controller, True)
|
self.set_controls_visible(controller, True)
|
||||||
self.log_debug('use {nm} controller'.
|
self.log_debug('use {nm} controller'.
|
||||||
format(nm=self.current_media_players[controller.controller_type].display_name))
|
format(nm=self.current_media_players[controller.controller_type].display_name))
|
||||||
@ -493,7 +494,8 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
|
|||||||
stopped = True
|
stopped = True
|
||||||
|
|
||||||
if start_again:
|
if start_again:
|
||||||
controller.seek_slider.setSliderPosition(0)
|
controller.media_info.timer = 0
|
||||||
|
self._update_seek_ui(controller)
|
||||||
return not stopped
|
return not stopped
|
||||||
|
|
||||||
def _update_seek_ui(self, controller):
|
def _update_seek_ui(self, controller):
|
||||||
@ -530,7 +532,6 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
|
|||||||
if controller.controller_type in self.current_media_players:
|
if controller.controller_type in self.current_media_players:
|
||||||
self.current_media_players[controller.controller_type].pause(controller)
|
self.current_media_players[controller.controller_type].pause(controller)
|
||||||
controller.mediabar.actions['playbackPlay'].setVisible(True)
|
controller.mediabar.actions['playbackPlay'].setVisible(True)
|
||||||
controller.mediabar.actions['playbackStop'].setDisabled(False)
|
|
||||||
controller.mediabar.actions['playbackPause'].setVisible(False)
|
controller.mediabar.actions['playbackPause'].setVisible(False)
|
||||||
controller.media_info.is_playing = False
|
controller.media_info.is_playing = False
|
||||||
# Add a tick to the timer to prevent it finishing the video before it can loop back or stop
|
# Add a tick to the timer to prevent it finishing the video before it can loop back or stop
|
||||||
@ -586,7 +587,7 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
|
|||||||
if not controller.media_info.is_background:
|
if not controller.media_info.is_background:
|
||||||
display = self._define_display(controller)
|
display = self._define_display(controller)
|
||||||
if display.hide_mode == HideMode.Screen:
|
if display.hide_mode == HideMode.Screen:
|
||||||
controller.set_hide_mode(HideMode.Blank)
|
Registry().execute('live_display_hide', HideMode.Blank)
|
||||||
else:
|
else:
|
||||||
controller.set_hide_mode(display.hide_mode or HideMode.Blank)
|
controller.set_hide_mode(display.hide_mode or HideMode.Blank)
|
||||||
else:
|
else:
|
||||||
|
@ -76,7 +76,7 @@ class MediaPlayer(RegistryProperties):
|
|||||||
|
|
||||||
def play(self, controller, display):
|
def play(self, controller, display):
|
||||||
"""
|
"""
|
||||||
Starts playing of current Media File
|
Starts playing of current Media File, media player is expected to loop automatically
|
||||||
|
|
||||||
:param controller: Which Controller is running the show.
|
:param controller: Which Controller is running the show.
|
||||||
:param display: The display to be updated.
|
:param display: The display to be updated.
|
||||||
|
@ -113,7 +113,7 @@ class VlcPlayer(MediaPlayer):
|
|||||||
controller.vlc_widget = QtWidgets.QFrame(display)
|
controller.vlc_widget = QtWidgets.QFrame(display)
|
||||||
controller.vlc_widget.setFrameStyle(QtWidgets.QFrame.NoFrame)
|
controller.vlc_widget.setFrameStyle(QtWidgets.QFrame.NoFrame)
|
||||||
# creating a basic vlc instance
|
# creating a basic vlc instance
|
||||||
command_line_options = '--no-video-title-show '
|
command_line_options = '--no-video-title-show --input-repeat=99999999 '
|
||||||
if self.settings.value('advanced/hide mouse') and controller.is_live:
|
if self.settings.value('advanced/hide mouse') and controller.is_live:
|
||||||
command_line_options += '--mouse-hide-timeout=0 '
|
command_line_options += '--mouse-hide-timeout=0 '
|
||||||
if self.settings.value('media/vlc arguments'):
|
if self.settings.value('media/vlc arguments'):
|
||||||
|
@ -218,6 +218,33 @@ def test_media_stop(media_env):
|
|||||||
mocked_slide_controller.set_hide_mode.assert_called_once_with(HideMode.Blank)
|
mocked_slide_controller.set_hide_mode.assert_called_once_with(HideMode.Blank)
|
||||||
|
|
||||||
|
|
||||||
|
def test_media_stop_no_hide_change(media_env):
|
||||||
|
"""
|
||||||
|
Test that the media_stop doesn't change the hide mode of OpenLP when screen is visible
|
||||||
|
"""
|
||||||
|
# GIVEN: A live media controller and a message with two elements
|
||||||
|
mocked_slide_controller = MagicMock()
|
||||||
|
mocked_media_player = MagicMock()
|
||||||
|
mocked_display = MagicMock(hide_mode=HideMode.Screen)
|
||||||
|
mocked_slide_controller.controller_type = 'media player'
|
||||||
|
mocked_slide_controller.media_info = MagicMock(is_background=False)
|
||||||
|
mocked_slide_controller.set_hide_mode = MagicMock()
|
||||||
|
mocked_slide_controller.is_live = True
|
||||||
|
media_env.media_controller.current_media_players = {'media player': mocked_media_player}
|
||||||
|
media_env.media_controller.live_hide_timer = MagicMock()
|
||||||
|
media_env.media_controller._define_display = MagicMock(return_value=mocked_display)
|
||||||
|
|
||||||
|
# WHEN: media_stop() is called
|
||||||
|
result = media_env.media_controller.media_stop(mocked_slide_controller)
|
||||||
|
|
||||||
|
# THEN: Result should be successful, media player should be stopped and the hide timer should have started
|
||||||
|
# The controller's hide mode should not have been set
|
||||||
|
assert result is True
|
||||||
|
mocked_media_player.stop.assert_called_once_with(mocked_slide_controller)
|
||||||
|
media_env.media_controller.live_hide_timer.start.assert_called_once()
|
||||||
|
mocked_slide_controller.set_hide_mode.assert_not_called()
|
||||||
|
|
||||||
|
|
||||||
def test_media_volume_msg(media_env):
|
def test_media_volume_msg(media_env):
|
||||||
"""
|
"""
|
||||||
Test that the media controller responds to the request to change the volume
|
Test that the media controller responds to the request to change the volume
|
||||||
|
@ -116,7 +116,7 @@ def test_setup(MockedQtWidgets, mocked_get_vlc, mocked_is_macosx, mocked_is_win,
|
|||||||
mocked_qframe.setFrameStyle.assert_called_with(1)
|
mocked_qframe.setFrameStyle.assert_called_with(1)
|
||||||
mock_settings.value.assert_any_call('advanced/hide mouse')
|
mock_settings.value.assert_any_call('advanced/hide mouse')
|
||||||
mock_settings.value.assert_any_call('media/vlc arguments')
|
mock_settings.value.assert_any_call('media/vlc arguments')
|
||||||
mocked_vlc.Instance.assert_called_with('--no-video-title-show ')
|
mocked_vlc.Instance.assert_called_with('--no-video-title-show --input-repeat=99999999 ')
|
||||||
assert mocked_output_display.vlc_instance == mocked_instance
|
assert mocked_output_display.vlc_instance == mocked_instance
|
||||||
mocked_instance.media_player_new.assert_called_with()
|
mocked_instance.media_player_new.assert_called_with()
|
||||||
assert mocked_output_display.vlc_media_player == mocked_media_player_new
|
assert mocked_output_display.vlc_media_player == mocked_media_player_new
|
||||||
@ -159,7 +159,7 @@ def test_setup_has_audio(MockedQtWidgets, mocked_get_vlc, mocked_is_macosx, mock
|
|||||||
vlc_player.setup(mocked_output_display, mocked_controller)
|
vlc_player.setup(mocked_output_display, mocked_controller)
|
||||||
|
|
||||||
# THEN: The VLC instance should be created with the correct options
|
# THEN: The VLC instance should be created with the correct options
|
||||||
mocked_vlc.Instance.assert_called_with('--no-video-title-show ')
|
mocked_vlc.Instance.assert_called_with('--no-video-title-show --input-repeat=99999999 ')
|
||||||
|
|
||||||
|
|
||||||
@patch('openlp.core.ui.media.vlcplayer.is_win')
|
@patch('openlp.core.ui.media.vlcplayer.is_win')
|
||||||
@ -194,7 +194,7 @@ def test_setup_visible_mouse(MockedQtWidgets, mocked_get_vlc, mocked_is_macosx,
|
|||||||
vlc_player.setup(mocked_output_display, mocked_controller)
|
vlc_player.setup(mocked_output_display, mocked_controller)
|
||||||
|
|
||||||
# THEN: The VLC instance should be created with the correct options
|
# THEN: The VLC instance should be created with the correct options
|
||||||
mocked_vlc.Instance.assert_called_with('--no-video-title-show ')
|
mocked_vlc.Instance.assert_called_with('--no-video-title-show --input-repeat=99999999 ')
|
||||||
|
|
||||||
|
|
||||||
@patch('openlp.core.ui.media.vlcplayer.is_win')
|
@patch('openlp.core.ui.media.vlcplayer.is_win')
|
||||||
|
Loading…
Reference in New Issue
Block a user