forked from openlp/openlp
Fixed bug 900038. Corrected signal names. Corrected pause/stop check.
bzr-revno: 1907 Fixes: https://launchpad.net/bugs/900038
This commit is contained in:
commit
2d18402e0b
@ -58,15 +58,15 @@ class MediaController(object):
|
||||
QtCore.QObject.connect(self.timer,
|
||||
QtCore.SIGNAL("timeout()"), self.video_state)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'media_playback_play'), self.video_play)
|
||||
QtCore.SIGNAL(u'playbackPlay'), self.video_play)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'media_playback_pause'), self.video_pause)
|
||||
QtCore.SIGNAL(u'playbackPause'), self.video_pause)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'media_playback_stop'), self.video_stop)
|
||||
QtCore.SIGNAL(u'playbackStop'), self.video_stop)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'seek_slider'), self.video_seek)
|
||||
QtCore.SIGNAL(u'seekSlider'), self.video_seek)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'volume_slider'), self.video_volume)
|
||||
QtCore.SIGNAL(u'volumeSlider'), self.video_volume)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'media_hide'), self.video_hide)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
@ -160,6 +160,11 @@ class MediaController(object):
|
||||
if self.curDisplayMediaPlayer[display] \
|
||||
.state == MediaState.Playing:
|
||||
return
|
||||
# no players are active anymore
|
||||
for display in self.curDisplayMediaPlayer.keys():
|
||||
if self.curDisplayMediaPlayer[display] \
|
||||
.state != MediaState.Paused:
|
||||
display.controller.seekSlider.setSliderPosition(0)
|
||||
self.timer.stop()
|
||||
|
||||
def get_media_display_css(self):
|
||||
@ -451,6 +456,7 @@ class MediaController(object):
|
||||
display.frame.evaluateJavaScript(u'show_blank("black");')
|
||||
self.curDisplayMediaPlayer[display].stop(display)
|
||||
self.curDisplayMediaPlayer[display].set_visible(display, False)
|
||||
controller.seekSlider.setSliderPosition(0)
|
||||
|
||||
def video_volume(self, msg):
|
||||
"""
|
||||
|
@ -57,7 +57,7 @@ ADDITIONAL_EXT = {
|
||||
|
||||
class PhononPlayer(MediaPlayer):
|
||||
"""
|
||||
A specialised version of the MediaPlayer class, which provides a Phonon
|
||||
A specialised version of the MediaPlayer class, which provides a Phonon
|
||||
display.
|
||||
"""
|
||||
|
||||
@ -192,6 +192,9 @@ class PhononPlayer(MediaPlayer):
|
||||
display.phononWidget.setVisible(status)
|
||||
|
||||
def update_ui(self, display):
|
||||
if display.mediaObject.state() == Phonon.PausedState and \
|
||||
self.state != MediaState.Paused:
|
||||
self.stop(display)
|
||||
controller = display.controller
|
||||
if controller.media_info.end_time > 0:
|
||||
if display.mediaObject.currentTime() > \
|
||||
|
@ -83,7 +83,7 @@ VIDEO_EXT = [
|
||||
|
||||
class VlcPlayer(MediaPlayer):
|
||||
"""
|
||||
A specialised version of the MediaPlayer class, which provides a QtWebKit
|
||||
A specialised version of the MediaPlayer class, which provides a VLC
|
||||
display.
|
||||
"""
|
||||
|
||||
@ -122,7 +122,7 @@ class VlcPlayer(MediaPlayer):
|
||||
display.vlcMediaPlayer.set_hwnd(int(display.vlcWidget.winId()))
|
||||
elif sys.platform == "darwin": # for MacOS
|
||||
display.vlcMediaPlayer.set_agl(int(display.vlcWidget.winId()))
|
||||
else:
|
||||
else:
|
||||
# for Linux using the X Server
|
||||
display.vlcMediaPlayer.set_xwindow(int(display.vlcWidget.winId()))
|
||||
self.hasOwnWidget = True
|
||||
@ -210,6 +210,8 @@ class VlcPlayer(MediaPlayer):
|
||||
display.vlcWidget.setVisible(status)
|
||||
|
||||
def update_ui(self, display):
|
||||
if display.vlcMedia.get_state() == vlc.State.Ended:
|
||||
self.stop(display)
|
||||
controller = display.controller
|
||||
if controller.media_info.end_time > 0:
|
||||
if display.vlcMediaPlayer.get_time() > \
|
||||
|
@ -126,7 +126,7 @@ VIDEO_JS = u"""
|
||||
vid.src = '';
|
||||
vid2.src = '';
|
||||
break;
|
||||
case 'length':
|
||||
case 'length':
|
||||
return vid.duration;
|
||||
case 'currentTime':
|
||||
return vid.currentTime;
|
||||
@ -134,6 +134,8 @@ VIDEO_JS = u"""
|
||||
// doesnt work currently
|
||||
vid.currentTime = varVal;
|
||||
break;
|
||||
case 'isEnded':
|
||||
return vid.ended;
|
||||
case 'setVisible':
|
||||
vid.style.visibility = varVal;
|
||||
break;
|
||||
@ -211,6 +213,8 @@ FLASH_JS = u"""
|
||||
case 'seek':
|
||||
// flashMovie.GotoFrame(varVal);
|
||||
break;
|
||||
case 'isEnded':
|
||||
return false;//TODO check flash end
|
||||
case 'setVisible':
|
||||
text.style.visibility = varVal;
|
||||
break;
|
||||
@ -254,7 +258,7 @@ AUDIO_EXT = [
|
||||
|
||||
class WebkitPlayer(MediaPlayer):
|
||||
"""
|
||||
A specialised version of the MediaPlayer class, which provides a QtWebKit
|
||||
A specialised version of the MediaPlayer class, which provides a QtWebKit
|
||||
display.
|
||||
"""
|
||||
|
||||
@ -356,7 +360,6 @@ class WebkitPlayer(MediaPlayer):
|
||||
display.frame.evaluateJavaScript(u'show_flash("stop");')
|
||||
else:
|
||||
display.frame.evaluateJavaScript(u'show_video("stop");')
|
||||
controller.seekSlider.setSliderPosition(0)
|
||||
self.state = MediaState.Stopped
|
||||
|
||||
def volume(self, display, vol):
|
||||
@ -408,6 +411,9 @@ class WebkitPlayer(MediaPlayer):
|
||||
length = display.frame.evaluateJavaScript( \
|
||||
u'show_flash("length");').toInt()[0]
|
||||
else:
|
||||
if display.frame.evaluateJavaScript( \
|
||||
u'show_video("isEnded");').toString() == 'true':
|
||||
self.stop(display)
|
||||
(currentTime, ok) = display.frame.evaluateJavaScript( \
|
||||
u'show_video("currentTime");').toFloat()
|
||||
# check if conversion was ok and value is not 'NaN'
|
||||
|
Loading…
Reference in New Issue
Block a user