Remove flash

This commit is contained in:
Tim Bentley 2016-02-14 08:38:21 +00:00
parent 7a72fe84df
commit 360d1155f1
3 changed files with 27 additions and 57 deletions

View File

@ -60,8 +60,8 @@ class MediaInfo(object):
"""
file_info = None
volume = 100
is_flash = False
is_background = False
loop_playback = False
length = 0
start_time = 0
end_time = 0

View File

@ -107,6 +107,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
Registry().register_function('playbackPlay', self.media_play_msg)
Registry().register_function('playbackPause', self.media_pause_msg)
Registry().register_function('playbackStop', self.media_stop_msg)
Registry().register_function('playbackLoop', self.media_loop_msg)
Registry().register_function('seek_slider', self.media_seek_msg)
Registry().register_function('volume_slider', self.media_volume_msg)
Registry().register_function('media_hide', self.media_hide)
@ -279,6 +280,10 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
icon=':/slides/media_playback_stop.png',
tooltip=translate('OpenLP.SlideController', 'Stop playing media.'),
triggers=controller.send_to_plugins)
controller.mediabar.add_toolbar_action('playbackLoop', text='media_playback_loop',
icon=':/slides/media_playback_stop.png',
tooltip=translate('OpenLP.SlideController', 'Loop playing media.'),
triggers=controller.send_to_plugins)
controller.position_label = QtWidgets.QLabel()
controller.position_label.setText(' 00:00 / 00:00')
controller.position_label.setToolTip(translate('OpenLP.SlideController', 'Video timer.'))
@ -623,11 +628,6 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
if not controller.media_info.is_background:
display.frame.evaluateJavaScript('show_blank("desktop");')
self.current_media_players[controller.controller_type].set_visible(display, True)
# Flash needs to be played and will not AutoPlay
if controller.media_info.is_flash:
controller.mediabar.actions['playbackPlay'].setVisible(True)
controller.mediabar.actions['playbackPause'].setVisible(False)
else:
controller.mediabar.actions['playbackPlay'].setVisible(False)
controller.mediabar.actions['playbackPause'].setVisible(True)
controller.mediabar.actions['playbackStop'].setDisabled(False)

View File

@ -249,10 +249,6 @@ class WebkitPlayer(MediaPlayer):
else:
loop = 'false'
display.web_view.setVisible(True)
if controller.media_info.file_info.suffix() == 'swf':
controller.media_info.is_flash = True
js = 'show_flash("load","%s");' % (path.replace('\\', '\\\\'))
else:
js = 'show_video("load", "%s", %s, %s);' % (path.replace('\\', '\\\\'), str(vol), loop)
display.frame.evaluateJavaScript(js)
return True
@ -274,9 +270,6 @@ class WebkitPlayer(MediaPlayer):
if self.state != MediaState.Paused and controller.media_info.start_time > 0:
start_time = controller.media_info.start_time
self.set_visible(display, True)
if controller.media_info.is_flash:
display.frame.evaluateJavaScript('show_flash("play");')
else:
display.frame.evaluateJavaScript('show_video("play");')
if start_time > 0:
self.seek(display, controller.media_info.start_time * 1000)
@ -291,9 +284,6 @@ class WebkitPlayer(MediaPlayer):
Pause a video
"""
controller = display.controller
if controller.media_info.is_flash:
display.frame.evaluateJavaScript('show_flash("pause");')
else:
display.frame.evaluateJavaScript('show_video("pause");')
self.state = MediaState.Paused
@ -302,9 +292,6 @@ class WebkitPlayer(MediaPlayer):
Stop a video
"""
controller = display.controller
if controller.media_info.is_flash:
display.frame.evaluateJavaScript('show_flash("stop");')
else:
display.frame.evaluateJavaScript('show_video("stop");')
self.state = MediaState.Stopped
@ -316,18 +303,12 @@ class WebkitPlayer(MediaPlayer):
# 1.0 is the highest value
if display.has_audio:
vol = float(volume) / float(100)
if not controller.media_info.is_flash:
display.frame.evaluateJavaScript('show_video(null, null, %s);' % str(vol))
def seek(self, display, seek_value):
"""
Go to a position in the video
"""
controller = display.controller
if controller.media_info.is_flash:
seek = seek_value
display.frame.evaluateJavaScript('show_flash("seek", null, null, "%s");' % seek)
else:
seek = float(seek_value) / 1000
display.frame.evaluateJavaScript('show_video("seek", null, null, null, "%f");' % seek)
@ -335,10 +316,6 @@ class WebkitPlayer(MediaPlayer):
"""
Reset the player
"""
controller = display.controller
if controller.media_info.is_flash:
display.frame.evaluateJavaScript('show_flash("close");')
else:
display.frame.evaluateJavaScript('show_video("close");')
self.state = MediaState.Off
@ -351,9 +328,6 @@ class WebkitPlayer(MediaPlayer):
is_visible = "visible"
else:
is_visible = "hidden"
if controller.media_info.is_flash:
display.frame.evaluateJavaScript('show_flash("setVisible", null, null, "%s");' % is_visible)
else:
display.frame.evaluateJavaScript('show_video("setVisible", null, null, null, "%s");' % is_visible)
def update_ui(self, display):
@ -361,10 +335,6 @@ class WebkitPlayer(MediaPlayer):
Update the UI
"""
controller = display.controller
if controller.media_info.is_flash:
current_time = display.frame.evaluateJavaScript('show_flash("current_time");')
length = display.frame.evaluateJavaScript('show_flash("length");')
else:
if display.frame.evaluateJavaScript('show_video("isEnded");'):
self.stop(display)
current_time = display.frame.evaluateJavaScript('show_video("current_time");')