forked from openlp/openlp
Optional phonon videos, start
This commit is contained in:
parent
4b5541e97b
commit
f331f13278
@ -114,6 +114,8 @@ class MainDisplay(DisplayWidget):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'Setup live = %s for %s ' % (self.isLive,
|
log.debug(u'Setup live = %s for %s ' % (self.isLive,
|
||||||
self.screens.monitor_number))
|
self.screens.monitor_number))
|
||||||
|
self.usePhonon = QtCore.QSettings().value(
|
||||||
|
u'media/use phonon', QtCore.QVariant(False)).toBool()
|
||||||
self.screen = self.screens.current
|
self.screen = self.screens.current
|
||||||
self.setVisible(False)
|
self.setVisible(False)
|
||||||
self.setGeometry(self.screen[u'size'])
|
self.setGeometry(self.screen[u'size'])
|
||||||
@ -139,6 +141,14 @@ class MainDisplay(DisplayWidget):
|
|||||||
QtCore.Qt.ScrollBarAlwaysOff)
|
QtCore.Qt.ScrollBarAlwaysOff)
|
||||||
self.frame.setScrollBarPolicy(QtCore.Qt.Horizontal,
|
self.frame.setScrollBarPolicy(QtCore.Qt.Horizontal,
|
||||||
QtCore.Qt.ScrollBarAlwaysOff)
|
QtCore.Qt.ScrollBarAlwaysOff)
|
||||||
|
self.videowidget = Phonon.VideoWidget(self)
|
||||||
|
self.videowidget.setVisible(False)
|
||||||
|
self.videowidget.setGeometry(QtCore.QRect(0, 0,
|
||||||
|
self.screen[u'size'].width(), self.screen[u'size'].height()))
|
||||||
|
self.mediaObject = Phonon.MediaObject(self)
|
||||||
|
self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject)
|
||||||
|
Phonon.createPath(self.mediaObject, self.videowidget)
|
||||||
|
Phonon.createPath(self.mediaObject, self.audio)
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
# Build the initial frame.
|
# Build the initial frame.
|
||||||
self.black = QtGui.QImage(
|
self.black = QtGui.QImage(
|
||||||
@ -259,13 +269,20 @@ class MainDisplay(DisplayWidget):
|
|||||||
Used after Video plugin has changed the background
|
Used after Video plugin has changed the background
|
||||||
"""
|
"""
|
||||||
log.debug(u'resetVideo')
|
log.debug(u'resetVideo')
|
||||||
|
if isBackground or not self.usePhonon:
|
||||||
self.frame.evaluateJavaScript(u'show_video("close");')
|
self.frame.evaluateJavaScript(u'show_video("close");')
|
||||||
|
else:
|
||||||
|
self.mediaObject.stop()
|
||||||
|
self.mediaObject.clearQueue()
|
||||||
|
|
||||||
def videoPlay(self):
|
def videoPlay(self):
|
||||||
"""
|
"""
|
||||||
Responds to the request to play a loaded video
|
Responds to the request to play a loaded video
|
||||||
"""
|
"""
|
||||||
log.debug(u'videoPlay')
|
log.debug(u'videoPlay')
|
||||||
|
if self.usePhonon:
|
||||||
|
self.mediaObject.play()
|
||||||
|
else:
|
||||||
self.frame.evaluateJavaScript(u'show_video("play");')
|
self.frame.evaluateJavaScript(u'show_video("play");')
|
||||||
# show screen
|
# show screen
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
@ -276,6 +293,9 @@ class MainDisplay(DisplayWidget):
|
|||||||
Responds to the request to pause a loaded video
|
Responds to the request to pause a loaded video
|
||||||
"""
|
"""
|
||||||
log.debug(u'videoPause')
|
log.debug(u'videoPause')
|
||||||
|
if self.usePhonon:
|
||||||
|
self.mediaObject.pause()
|
||||||
|
else:
|
||||||
self.frame.evaluateJavaScript(u'show_video("pause");')
|
self.frame.evaluateJavaScript(u'show_video("pause");')
|
||||||
|
|
||||||
def videoStop(self):
|
def videoStop(self):
|
||||||
@ -283,6 +303,11 @@ class MainDisplay(DisplayWidget):
|
|||||||
Responds to the request to stop a loaded video
|
Responds to the request to stop a loaded video
|
||||||
"""
|
"""
|
||||||
log.debug(u'videoStop')
|
log.debug(u'videoStop')
|
||||||
|
if self.usePhonon:
|
||||||
|
self.mediaObject.stop()
|
||||||
|
self.webView.setVisible(True)
|
||||||
|
self.videowidget.setVisible(False)
|
||||||
|
else:
|
||||||
self.frame.evaluateJavaScript(u'show_video("stop");')
|
self.frame.evaluateJavaScript(u'show_video("stop");')
|
||||||
|
|
||||||
def videoVolume(self, volume):
|
def videoVolume(self, volume):
|
||||||
@ -290,18 +315,30 @@ class MainDisplay(DisplayWidget):
|
|||||||
Changes the volume of a running video
|
Changes the volume of a running video
|
||||||
"""
|
"""
|
||||||
log.debug(u'videoVolume %d' % volume)
|
log.debug(u'videoVolume %d' % volume)
|
||||||
|
if self.usePhonon:
|
||||||
|
self.audio.setVolume(volume)
|
||||||
|
else:
|
||||||
self.frame.evaluateJavaScript(u'show_video(null, null, %s);' %
|
self.frame.evaluateJavaScript(u'show_video(null, null, %s);' %
|
||||||
str(float(volume)/float(10)))
|
str(float(volume)/float(10)))
|
||||||
|
|
||||||
def video(self, videoPath, volume):
|
def video(self, videoPath, volume, isBackground=False):
|
||||||
"""
|
"""
|
||||||
Loads and starts a video to run with the option of sound
|
Loads and starts a video to run with the option of sound
|
||||||
"""
|
"""
|
||||||
log.debug(u'video')
|
log.debug(u'video')
|
||||||
self.loaded = True
|
self.loaded = True
|
||||||
|
if isBackground or not self.usePhonon:
|
||||||
js = u'show_video("init", "%s", %s, true); show_video("play");' % \
|
js = u'show_video("init", "%s", %s, true); show_video("play");' % \
|
||||||
(videoPath.replace(u'\\', u'\\\\'), str(float(volume)/float(10)))
|
(videoPath.replace(u'\\', u'\\\\'), \
|
||||||
|
str(float(volume)/float(10)))
|
||||||
self.frame.evaluateJavaScript(js)
|
self.frame.evaluateJavaScript(js)
|
||||||
|
else:
|
||||||
|
self.mediaObject.stop()
|
||||||
|
self.mediaObject.clearQueue()
|
||||||
|
self.mediaObject.setCurrentSource(Phonon.MediaSource(videoPath))
|
||||||
|
self.mediaObject.play()
|
||||||
|
self.webView.setVisible(False)
|
||||||
|
self.videowidget.setVisible(True)
|
||||||
return self.preview()
|
return self.preview()
|
||||||
|
|
||||||
def isLoaded(self):
|
def isLoaded(self):
|
||||||
|
@ -926,14 +926,13 @@ class SlideController(QtGui.QWidget):
|
|||||||
Respond to the arrival of a media service item
|
Respond to the arrival of a media service item
|
||||||
"""
|
"""
|
||||||
log.debug(u'SlideController onMediaStart')
|
log.debug(u'SlideController onMediaStart')
|
||||||
if self.isLive:
|
|
||||||
file = os.path.join(item.get_frame_path(), item.get_frame_title())
|
file = os.path.join(item.get_frame_path(), item.get_frame_title())
|
||||||
|
if self.isLive:
|
||||||
self.display.video(file, self.volume)
|
self.display.video(file, self.volume)
|
||||||
self.volumeSlider.setValue(self.volume)
|
self.volumeSlider.setValue(self.volume)
|
||||||
else:
|
else:
|
||||||
self.mediaObject.stop()
|
self.mediaObject.stop()
|
||||||
self.mediaObject.clearQueue()
|
self.mediaObject.clearQueue()
|
||||||
file = os.path.join(item.get_frame_path(), item.get_frame_title())
|
|
||||||
self.mediaObject.setCurrentSource(Phonon.MediaSource(file))
|
self.mediaObject.setCurrentSource(Phonon.MediaSource(file))
|
||||||
self.seekSlider.setMediaObject(self.mediaObject)
|
self.seekSlider.setMediaObject(self.mediaObject)
|
||||||
self.seekSlider.show()
|
self.seekSlider.show()
|
||||||
|
@ -115,7 +115,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
'You must select a media file to replace the background with.')):
|
'You must select a media file to replace the background with.')):
|
||||||
item = self.listView.currentItem()
|
item = self.listView.currentItem()
|
||||||
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||||
self.parent.liveController.display.video(filename, 0)
|
self.parent.liveController.display.video(filename, 0, True)
|
||||||
self.resetButton.setVisible(True)
|
self.resetButton.setVisible(True)
|
||||||
|
|
||||||
def generateSlideData(self, service_item, item=None):
|
def generateSlideData(self, service_item, item=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user