← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~crichter/openlp/bug-900038 into lp:openlp

 

rimach has proposed merging lp:~crichter/openlp/bug-900038 into lp:openlp.

Requested reviews:
  Jonathan Corwin (j-corwin)
Related bugs:
  Bug #900038 in OpenLP: "Video slider doesn't go back to the beginning once the video is complete"
  https://bugs.launchpad.net/openlp/+bug/900038

For more details, see:
https://code.launchpad.net/~crichter/openlp/bug-900038/+merge/97991

Fix for Bug 900038
- add check if is video ended.
 
- correct Signal names (play, pause, stop, seek, volume was broken since last action item change)
- correct pause/stop check
-- 
https://code.launchpad.net/~crichter/openlp/bug-900038/+merge/97991
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/media/mediacontroller.py'
--- openlp/core/ui/media/mediacontroller.py	2012-03-12 08:25:48 +0000
+++ openlp/core/ui/media/mediacontroller.py	2012-03-16 21:22:25 +0000
@@ -58,15 +58,15 @@
         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.QObject.connect(Receiver.get_receiver(),
-            QtCore.SIGNAL(u'media_playback_pause'), self.video_pause)
-        QtCore.QObject.connect(Receiver.get_receiver(),
-            QtCore.SIGNAL(u'media_playback_stop'), self.video_stop)
-        QtCore.QObject.connect(Receiver.get_receiver(),
-            QtCore.SIGNAL(u'seek_slider'), self.video_seek)
-        QtCore.QObject.connect(Receiver.get_receiver(),
-            QtCore.SIGNAL(u'volume_slider'), self.video_volume)
+            QtCore.SIGNAL(u'playbackPlay'), self.video_play)
+        QtCore.QObject.connect(Receiver.get_receiver(),
+            QtCore.SIGNAL(u'playbackPause'), self.video_pause)
+        QtCore.QObject.connect(Receiver.get_receiver(),
+            QtCore.SIGNAL(u'playbackStop'), self.video_stop)
+        QtCore.QObject.connect(Receiver.get_receiver(),
+            QtCore.SIGNAL(u'seekSlider'), self.video_seek)
+        QtCore.QObject.connect(Receiver.get_receiver(),
+            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 @@
                 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 @@
                 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):
         """

=== modified file 'openlp/core/ui/media/phononplayer.py'
--- openlp/core/ui/media/phononplayer.py	2012-03-12 08:17:20 +0000
+++ openlp/core/ui/media/phononplayer.py	2012-03-16 21:22:25 +0000
@@ -57,7 +57,7 @@
 
 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 @@
             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() > \

=== modified file 'openlp/core/ui/media/vlcplayer.py'
--- openlp/core/ui/media/vlcplayer.py	2012-03-12 08:25:48 +0000
+++ openlp/core/ui/media/vlcplayer.py	2012-03-16 21:22:25 +0000
@@ -83,7 +83,7 @@
 
 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 @@
             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 @@
             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() > \

=== modified file 'openlp/core/ui/media/webkitplayer.py'
--- openlp/core/ui/media/webkitplayer.py	2012-03-12 08:25:48 +0000
+++ openlp/core/ui/media/webkitplayer.py	2012-03-16 21:22:25 +0000
@@ -126,7 +126,7 @@
                 vid.src = '';
                 vid2.src = '';
                 break;
-             case 'length':
+            case 'length':
                 return vid.duration;
             case 'currentTime':
                 return vid.currentTime;
@@ -134,6 +134,8 @@
                 // doesnt work currently
                 vid.currentTime = varVal;
                 break;
+            case 'isEnded':
+                return vid.ended;
             case 'setVisible':
                 vid.style.visibility = varVal;
                 break;
@@ -211,6 +213,8 @@
             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 @@
 
 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 @@
             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 @@
             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'


Follow ups