forked from openlp/openlp
Video reimplementations issues
This commit is contained in:
parent
85da3e53c3
commit
50ff8438a0
@ -71,6 +71,9 @@ body {
|
||||
#video2 {
|
||||
z-index:3;
|
||||
}
|
||||
#flash {
|
||||
z-index:4;
|
||||
}
|
||||
#alert {
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
@ -303,6 +306,63 @@ sup {
|
||||
function show_text_complete(){
|
||||
return (text_opacity()==1);
|
||||
}
|
||||
|
||||
function getFlashMovieObject(movieName)
|
||||
{
|
||||
if (window.document[movieName])
|
||||
{
|
||||
return window.document[movieName];
|
||||
}
|
||||
if (navigator.appName.indexOf("Microsoft Internet")==-1)
|
||||
{
|
||||
if (document.embeds && document.embeds[movieName])
|
||||
return document.embeds[movieName];
|
||||
}
|
||||
else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
|
||||
{
|
||||
return document.getElementById(movieName);
|
||||
}
|
||||
}
|
||||
|
||||
function show_flash(state, path){
|
||||
var text = document.getElementById('flash');
|
||||
var flashMovie=getFlashMovieObject("OpenLPFlashMovie");
|
||||
var src = "src = 'file:///" + path + "'";
|
||||
var view_parm = " wmode='opaque'" +
|
||||
" width='" + window.innerWidth + "'" +
|
||||
" height='" + window.innerHeight + "'";
|
||||
var swf_parm = " autostart='false' loop='false' play='false'" +
|
||||
" hidden='false' swliveconnect='true'" +
|
||||
" name='OpenLPFlashMovie'>";
|
||||
|
||||
switch(state){
|
||||
case 'load':
|
||||
text.innerHTML = "<embed " + src + view_parm + swf_parm + ">";
|
||||
flashMovie = getFlashMovieObject("OpenLPFlashMovie");
|
||||
text.style.visibility = 'visible';
|
||||
flashMovie.Play();
|
||||
break;
|
||||
|
||||
case 'play':
|
||||
text.style.visibility = 'visible';
|
||||
flashMovie.Play();
|
||||
break;
|
||||
|
||||
case 'rewind':
|
||||
ret = 'rewind';
|
||||
alert(' Wert: ' + flashMovie.TGetProperty("/", 4));
|
||||
// flashMovie.TotalFrames()
|
||||
// PercentLoaded()
|
||||
// GotoFrame()
|
||||
break;
|
||||
case 'stop':
|
||||
flashMovie.StopPlay();
|
||||
text.innerHTML = ''
|
||||
text.style.visibility = 'hidden';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
@ -312,6 +372,7 @@ sup {
|
||||
</video>
|
||||
<video id="video2" class="size" style="visibility:hidden" autobuffer preload>
|
||||
</video>
|
||||
<div id="flash" class="size" style="visibility:hidden"></div>
|
||||
%s
|
||||
<div id="footer" class="footer"></div>
|
||||
<div id="black" class="size"></div>
|
||||
|
@ -99,28 +99,30 @@ class MainDisplay(DisplayWidget):
|
||||
self.screen = self.screens.current
|
||||
self.setVisible(False)
|
||||
self.setGeometry(self.screen[u'size'])
|
||||
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()))
|
||||
log.debug(u'Setup Phonon for monitor %s' % self.screens.monitor_number)
|
||||
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)
|
||||
QtCore.QObject.connect(self.mediaObject,
|
||||
QtCore.SIGNAL(u'stateChanged(Phonon::State, Phonon::State)'),
|
||||
self.videoState)
|
||||
QtCore.QObject.connect(self.mediaObject,
|
||||
QtCore.SIGNAL(u'finished()'),
|
||||
self.videoFinished)
|
||||
QtCore.QObject.connect(self.mediaObject,
|
||||
QtCore.SIGNAL(u'tick(qint64)'),
|
||||
self.videoTick)
|
||||
# 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()))
|
||||
# log.debug(u'Setup Phonon for monitor %s' % self.screens.monitor_number)
|
||||
# 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)
|
||||
# QtCore.QObject.connect(self.mediaObject,
|
||||
# QtCore.SIGNAL(u'stateChanged(Phonon::State, Phonon::State)'),
|
||||
# self.videoState)
|
||||
# QtCore.QObject.connect(self.mediaObject,
|
||||
# QtCore.SIGNAL(u'finished()'),
|
||||
# self.videoFinished)
|
||||
# QtCore.QObject.connect(self.mediaObject,
|
||||
# QtCore.SIGNAL(u'tick(qint64)'),
|
||||
# self.videoTick)
|
||||
|
||||
log.debug(u'Setup webView for monitor %s' % self.screens.monitor_number)
|
||||
self.webView = QtWebKit.QWebView(self)
|
||||
self.webView.setGeometry(0, 0,
|
||||
self.screen[u'size'].width(), self.screen[u'size'].height())
|
||||
self.webView.settings().setAttribute(QtWebKit.QWebSettings.PluginsEnabled,True)
|
||||
self.page = self.webView.page()
|
||||
self.frame = self.page.mainFrame()
|
||||
QtCore.QObject.connect(self.webView,
|
||||
@ -173,9 +175,17 @@ class MainDisplay(DisplayWidget):
|
||||
self.primary = False
|
||||
else:
|
||||
self.primary = True
|
||||
Receiver.send_message(u'media_set_display', self)
|
||||
log.debug(
|
||||
u'Finished setup for monitor %s' % self.screens.monitor_number)
|
||||
|
||||
def videoHelper(self, newState, oldState):
|
||||
"""
|
||||
Start the video at a predetermined point.
|
||||
"""
|
||||
if type(newState) == Phonon.State:
|
||||
print "Phonon State alt:%d, neu:%d" % (oldState, newState)
|
||||
|
||||
def text(self, slide):
|
||||
"""
|
||||
Add the slide text from slideController
|
||||
@ -201,7 +211,7 @@ class MainDisplay(DisplayWidget):
|
||||
"""
|
||||
log.debug(u'alert to display')
|
||||
if self.height() != self.screen[u'size'].height() \
|
||||
or not self.isVisible() or self.videoWidget.isVisible():
|
||||
or not self.isVisible():# or self.videoWidget.isVisible():
|
||||
shrink = True
|
||||
else:
|
||||
shrink = False
|
||||
@ -282,129 +292,107 @@ class MainDisplay(DisplayWidget):
|
||||
if self.isLive:
|
||||
Receiver.send_message(u'maindisplay_active')
|
||||
|
||||
def resetVideo(self):
|
||||
"""
|
||||
Used after Video plugin has changed the background
|
||||
"""
|
||||
log.debug(u'resetVideo')
|
||||
if self.phononActive:
|
||||
self.mediaObject.stop()
|
||||
self.mediaObject.clearQueue()
|
||||
self.webView.setVisible(True)
|
||||
self.videoWidget.setVisible(False)
|
||||
self.phononActive = False
|
||||
else:
|
||||
self.frame.evaluateJavaScript(u'show_video("close");')
|
||||
self.override = {}
|
||||
# Update the preview frame.
|
||||
if self.isLive:
|
||||
Receiver.send_message(u'maindisplay_active')
|
||||
|
||||
def videoPlay(self):
|
||||
"""
|
||||
Responds to the request to play a loaded video
|
||||
"""
|
||||
log.debug(u'videoPlay')
|
||||
if self.phononActive:
|
||||
self.mediaObject.play()
|
||||
else:
|
||||
self.frame.evaluateJavaScript(u'show_video("play");')
|
||||
# show screen
|
||||
if self.isLive:
|
||||
self.setVisible(True)
|
||||
|
||||
def videoPause(self):
|
||||
"""
|
||||
Responds to the request to pause a loaded video
|
||||
"""
|
||||
log.debug(u'videoPause')
|
||||
if self.phononActive:
|
||||
self.mediaObject.pause()
|
||||
else:
|
||||
self.frame.evaluateJavaScript(u'show_video("pause");')
|
||||
|
||||
def videoStop(self):
|
||||
"""
|
||||
Responds to the request to stop a loaded video
|
||||
"""
|
||||
log.debug(u'videoStop')
|
||||
if self.phononActive:
|
||||
self.mediaObject.stop()
|
||||
else:
|
||||
self.frame.evaluateJavaScript(u'show_video("stop");')
|
||||
|
||||
def videoVolume(self, volume):
|
||||
"""
|
||||
Changes the volume of a running video
|
||||
"""
|
||||
log.debug(u'videoVolume %d' % volume)
|
||||
vol = float(volume) / float(10)
|
||||
if self.phononActive:
|
||||
self.audio.setVolume(vol)
|
||||
else:
|
||||
self.frame.evaluateJavaScript(u'show_video(null, null, %s);' %
|
||||
str(vol))
|
||||
|
||||
def video(self, videoPath, volume, isBackground=False):
|
||||
"""
|
||||
Loads and starts a video to run with the option of sound
|
||||
"""
|
||||
log.debug(u'video')
|
||||
self.webLoaded = True
|
||||
self.setGeometry(self.screen[u'size'])
|
||||
# We are running a background theme
|
||||
self.override[u'theme'] = u''
|
||||
self.override[u'video'] = True
|
||||
vol = float(volume) / float(10)
|
||||
if isBackground or not self.usePhonon:
|
||||
js = u'show_video("init", "%s", %s, true); show_video("play");' % \
|
||||
(videoPath.replace(u'\\', u'\\\\'), str(vol))
|
||||
self.frame.evaluateJavaScript(js)
|
||||
else:
|
||||
self.phononActive = True
|
||||
self.mediaObject.stop()
|
||||
self.mediaObject.clearQueue()
|
||||
self.mediaObject.setCurrentSource(Phonon.MediaSource(videoPath))
|
||||
# Need the timer to trigger set the trigger to 200ms
|
||||
# Value taken from web documentation.
|
||||
if self.serviceItem.end_time != 0:
|
||||
self.mediaObject.setTickInterval(200)
|
||||
self.mediaObject.play()
|
||||
self.webView.setVisible(False)
|
||||
self.videoWidget.setVisible(True)
|
||||
self.audio.setVolume(vol)
|
||||
# Update the preview frame.
|
||||
if self.isLive:
|
||||
Receiver.send_message(u'maindisplay_active')
|
||||
return self.preview()
|
||||
|
||||
def videoState(self, newState, oldState):
|
||||
"""
|
||||
Start the video at a predetermined point.
|
||||
"""
|
||||
if newState == Phonon.PlayingState \
|
||||
and oldState != Phonon.PausedState \
|
||||
and self.serviceItem.start_time > 0:
|
||||
# set start time in milliseconds
|
||||
self.mediaObject.seek(self.serviceItem.start_time * 1000)
|
||||
|
||||
def videoFinished(self):
|
||||
"""
|
||||
Blank the Video when it has finished so the final frame is not left
|
||||
hanging
|
||||
"""
|
||||
self.videoStop()
|
||||
self.hideDisplay(HideMode.Blank)
|
||||
self.phononActive = False
|
||||
self.videoHide = True
|
||||
|
||||
def videoTick(self, tick):
|
||||
"""
|
||||
Triggered on video tick every 200 milli seconds
|
||||
"""
|
||||
if tick > self.serviceItem.end_time * 1000:
|
||||
self.videoFinished()
|
||||
|
||||
# def resetVideo(self):
|
||||
# """
|
||||
# Used after Video plugin has changed the background
|
||||
# """
|
||||
# log.debug(u'resetVideo')
|
||||
# if self.phononActive:
|
||||
# self.mediaObject.stop()
|
||||
# self.mediaObject.clearQueue()
|
||||
# self.webView.setVisible(True)
|
||||
# self.videoWidget.setVisible(False)
|
||||
# self.phononActive = False
|
||||
# else:
|
||||
# self.frame.evaluateJavaScript(u'show_video("close");')
|
||||
# self.override = {}
|
||||
# # Update the preview frame.
|
||||
# if self.isLive:
|
||||
# Receiver.send_message(u'maindisplay_active')
|
||||
#
|
||||
# def videoPlay(self):
|
||||
# """
|
||||
# Responds to the request to play a loaded video
|
||||
# """
|
||||
# log.debug(u'videoPlay')
|
||||
# self.frame.evaluateJavaScript(u'show_flash("play","");')
|
||||
# self.frame.evaluateJavaScript(u'show_video("stop");')
|
||||
# return
|
||||
# if self.phononActive:
|
||||
# self.mediaObject.play()
|
||||
# else:
|
||||
# self.frame.evaluateJavaScript(u'show_video("play");')
|
||||
# # show screen
|
||||
# if self.isLive:
|
||||
# self.setVisible(True)
|
||||
#
|
||||
# def videoPause(self):
|
||||
# """
|
||||
# Responds to the request to pause a loaded video
|
||||
# """
|
||||
# log.debug(u'videoPause')
|
||||
# if self.phononActive:
|
||||
# self.mediaObject.pause()
|
||||
# else:
|
||||
# self.frame.evaluateJavaScript(u'show_video("pause");')
|
||||
#
|
||||
# def videoStop(self):
|
||||
# """
|
||||
# Responds to the request to stop a loaded video
|
||||
# """
|
||||
# log.debug(u'videoStop')
|
||||
# if self.phononActive:
|
||||
# self.mediaObject.stop()
|
||||
# else:
|
||||
# self.frame.evaluateJavaScript(u'show_video("stop");')
|
||||
#
|
||||
# def videoVolume(self, volume):
|
||||
# """
|
||||
# Changes the volume of a running video
|
||||
# """
|
||||
# log.debug(u'videoVolume %d' % volume)
|
||||
# vol = float(volume) / float(10)
|
||||
# if self.phononActive:
|
||||
# self.audio.setVolume(vol)
|
||||
# else:
|
||||
# self.frame.evaluateJavaScript(u'show_video(null, null, %s);' %
|
||||
# str(vol))
|
||||
#
|
||||
# def video(self, videoPath, volume, isBackground=False):
|
||||
# """
|
||||
# Loads and starts a video to run with the option of sound
|
||||
# """
|
||||
# log.debug(u'video')
|
||||
# Receiver.send_message(u'media_video', [self, videoPath, volume, isBackground])
|
||||
# return self.preview()
|
||||
#
|
||||
# def videoState(self, newState, oldState):
|
||||
# """
|
||||
# Start the video at a predetermined point.
|
||||
# """
|
||||
# if newState == Phonon.PlayingState \
|
||||
# and oldState != Phonon.PausedState \
|
||||
# and self.serviceItem.start_time > 0:
|
||||
# # set start time in milliseconds
|
||||
# self.mediaObject.seek(self.serviceItem.start_time * 1000)
|
||||
#
|
||||
# def videoFinished(self):
|
||||
# """
|
||||
# Blank the Video when it has finished so the final frame is not left
|
||||
# hanging
|
||||
# """
|
||||
# self.videoStop()
|
||||
# self.hideDisplay(HideMode.Blank)
|
||||
# self.phononActive = False
|
||||
# self.videoHide = True
|
||||
#
|
||||
# def videoTick(self, tick):
|
||||
# """
|
||||
# Triggered on video tick every 200 milli seconds
|
||||
# """
|
||||
# if tick > self.serviceItem.end_time * 1000:
|
||||
# self.videoFinished()
|
||||
#
|
||||
def isWebLoaded(self):
|
||||
"""
|
||||
Called by webView event to show display is fully loaded
|
||||
@ -515,8 +503,9 @@ class MainDisplay(DisplayWidget):
|
||||
Store the images so they can be replaced when required
|
||||
"""
|
||||
log.debug(u'hideDisplay mode = %d', mode)
|
||||
if self.phononActive:
|
||||
self.videoPause()
|
||||
# if self.phononActive:
|
||||
# self.videoPause()
|
||||
Receiver.send_message(u'media_pause', self)
|
||||
if mode == HideMode.Screen:
|
||||
self.frame.evaluateJavaScript(u'show_blank("desktop");')
|
||||
self.setVisible(False)
|
||||
@ -543,7 +532,8 @@ class MainDisplay(DisplayWidget):
|
||||
self.setVisible(True)
|
||||
if self.phononActive:
|
||||
self.webView.setVisible(False)
|
||||
self.videoPlay()
|
||||
#self.videoPlay()
|
||||
Receiver.send_message(u'media_play', self)
|
||||
self.hideMode = None
|
||||
# Trigger actions when display is active again
|
||||
if self.isLive:
|
||||
|
@ -225,6 +225,9 @@ class SlideController(QtGui.QWidget):
|
||||
self.songMenu.setMenu(QtGui.QMenu(
|
||||
translate('OpenLP.SlideController', 'Go To'), self.toolbar))
|
||||
self.toolbar.makeWidgetsInvisible([u'Song Menu'])
|
||||
# Build the seekSlider.
|
||||
self.seekSlider = QtGui.QSlider(QtCore.Qt.Horizontal)
|
||||
self.seekSlider.setMaximum(1000)
|
||||
# Build the volumeSlider.
|
||||
self.volumeSlider = QtGui.QSlider(QtCore.Qt.Horizontal)
|
||||
self.volumeSlider.setTickInterval(1)
|
||||
@ -234,11 +237,11 @@ class SlideController(QtGui.QWidget):
|
||||
else:
|
||||
# Build the seekSlider.
|
||||
self.seekSlider = Phonon.SeekSlider()
|
||||
self.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
|
||||
self.seekSlider.setObjectName(u'seekSlider')
|
||||
self.mediabar.addToolbarWidget(u'Seek Slider', self.seekSlider)
|
||||
self.volumeSlider = Phonon.VolumeSlider()
|
||||
self.volumeSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
|
||||
self.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
|
||||
self.seekSlider.setObjectName(u'seekSlider')
|
||||
self.mediabar.addToolbarWidget(u'Seek Slider', self.seekSlider)
|
||||
self.volumeSlider.setGeometry(QtCore.QRect(90, 160, 221, 24))
|
||||
self.volumeSlider.setObjectName(u'volumeSlider')
|
||||
self.mediabar.addToolbarWidget(u'Audio Volume', self.volumeSlider)
|
||||
self.controllerLayout.addWidget(self.mediabar)
|
||||
@ -297,6 +300,8 @@ class SlideController(QtGui.QWidget):
|
||||
QtCore.SIGNAL(u'triggered(bool)'), self.onThemeDisplay)
|
||||
QtCore.QObject.connect(self.desktopScreen,
|
||||
QtCore.SIGNAL(u'triggered(bool)'), self.onHideDisplay)
|
||||
QtCore.QObject.connect(self.seekSlider,
|
||||
QtCore.SIGNAL(u'sliderReleased()'), self.mediaSeek)
|
||||
QtCore.QObject.connect(self.volumeSlider,
|
||||
QtCore.SIGNAL(u'sliderReleased()'), self.mediaVolume)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
@ -392,7 +397,8 @@ class SlideController(QtGui.QWidget):
|
||||
|
||||
def liveEscape(self):
|
||||
self.display.setVisible(False)
|
||||
self.display.videoStop()
|
||||
#self.display.videoStop()
|
||||
Receiver.send_message('media_stop', self.display)
|
||||
|
||||
def servicePrevious(self):
|
||||
Receiver.send_message('servicemanager_previous_item')
|
||||
@ -496,7 +502,7 @@ class SlideController(QtGui.QWidget):
|
||||
len(item.get_frames()) > 1:
|
||||
self.toolbar.makeWidgetsVisible(self.loopList)
|
||||
if item.is_media():
|
||||
self.toolbar.setVisible(False)
|
||||
#self.toolbar.setVisible(False)
|
||||
self.mediabar.setVisible(True)
|
||||
|
||||
def enablePreviewToolBar(self, item):
|
||||
@ -509,7 +515,7 @@ class SlideController(QtGui.QWidget):
|
||||
if item.is_capable(ItemCapabilities.AllowsEdit) and item.from_plugin:
|
||||
self.toolbar.makeWidgetsVisible(self.songEditList)
|
||||
elif item.is_media():
|
||||
self.toolbar.setVisible(False)
|
||||
#self.toolbar.setVisible(False)
|
||||
self.mediabar.setVisible(True)
|
||||
self.volumeSlider.setAudioOutput(self.audio)
|
||||
|
||||
@ -1028,7 +1034,8 @@ class SlideController(QtGui.QWidget):
|
||||
log.debug(u'SlideController onMediaStart')
|
||||
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)
|
||||
Receiver.send_message(u'media_video', [self.display, file, self.volume, False])
|
||||
self.volumeSlider.setValue(self.volume)
|
||||
else:
|
||||
self.mediaObject.stop()
|
||||
@ -1038,13 +1045,24 @@ class SlideController(QtGui.QWidget):
|
||||
self.seekSlider.show()
|
||||
self.onMediaPlay()
|
||||
|
||||
def mediaSeek(self):
|
||||
"""
|
||||
Respond to the release of Seek Slider
|
||||
"""
|
||||
log.debug(u'SlideController mediaSeek')
|
||||
self.seekPos = self.seekSlider.value()
|
||||
#self.display.videoVolume(self.volume)
|
||||
Receiver.send_message(u'media_seek', [self.display, self.seekPos])
|
||||
|
||||
def mediaVolume(self):
|
||||
"""
|
||||
Respond to the release of Volume Slider
|
||||
"""
|
||||
log.debug(u'SlideController mediaVolume')
|
||||
self.volume = self.volumeSlider.value()
|
||||
self.display.videoVolume(self.volume)
|
||||
#self.display.videoVolume(self.volume)
|
||||
Receiver.send_message(u'media_volume', [self.display, self.volume])
|
||||
|
||||
|
||||
def onMediaPause(self):
|
||||
"""
|
||||
@ -1052,7 +1070,8 @@ class SlideController(QtGui.QWidget):
|
||||
"""
|
||||
log.debug(u'SlideController onMediaPause')
|
||||
if self.isLive:
|
||||
self.display.videoPause()
|
||||
#self.display.videoPause()
|
||||
Receiver.send_message(u'media_pause', self.display)
|
||||
else:
|
||||
self.mediaObject.pause()
|
||||
|
||||
@ -1062,7 +1081,8 @@ class SlideController(QtGui.QWidget):
|
||||
"""
|
||||
log.debug(u'SlideController onMediaPlay')
|
||||
if self.isLive:
|
||||
self.display.videoPlay()
|
||||
Receiver.send_message(u'media_play', self.display)
|
||||
#self.display.videoPlay()
|
||||
else:
|
||||
self.slidePreview.hide()
|
||||
self.video.show()
|
||||
@ -1074,7 +1094,8 @@ class SlideController(QtGui.QWidget):
|
||||
"""
|
||||
log.debug(u'SlideController onMediaStop')
|
||||
if self.isLive:
|
||||
self.display.videoStop()
|
||||
#self.display.videoStop()
|
||||
Receiver.send_message(u'media_stop', self.display)
|
||||
else:
|
||||
self.mediaObject.stop()
|
||||
self.video.hide()
|
||||
@ -1085,9 +1106,10 @@ class SlideController(QtGui.QWidget):
|
||||
"""
|
||||
Respond to a request to close the Video
|
||||
"""
|
||||
log.debug(u'SlideController onMediaStop')
|
||||
log.debug(u'SlideController onMediaClose')
|
||||
if self.isLive:
|
||||
self.display.resetVideo()
|
||||
#self.display.resetVideo()
|
||||
Receiver.send_message(u'media_reset', self.display)
|
||||
else:
|
||||
self.mediaObject.stop()
|
||||
self.mediaObject.clearQueue()
|
||||
|
@ -24,7 +24,53 @@
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
from PyQt4 import QtCore
|
||||
|
||||
class MediaBackends(object):
|
||||
"""
|
||||
An enumeration for possible Backends.
|
||||
"""
|
||||
Webkit = 0
|
||||
Phonon = 1
|
||||
Vlc = 2
|
||||
|
||||
class MediaController(object):
|
||||
"""
|
||||
"""
|
||||
def __init__(self, parent):
|
||||
self.parent = parent
|
||||
self.state = 0
|
||||
self.Timer = QtCore.QTimer()
|
||||
QtCore.QObject.connect(self.Timer,
|
||||
QtCore.SIGNAL("timeout()"), self.updatePlayer)
|
||||
|
||||
|
||||
def load(self, display, path, volume):
|
||||
pass
|
||||
|
||||
def play(self, display):
|
||||
pass
|
||||
|
||||
def pause(self, display):
|
||||
pass
|
||||
|
||||
def stop(self, display):
|
||||
pass
|
||||
|
||||
def seek(self, display, seekVal):
|
||||
pass
|
||||
|
||||
def reset(self, display):
|
||||
pass
|
||||
|
||||
def updatePlayer(self):
|
||||
pass
|
||||
|
||||
from mediaitem import MediaMediaItem
|
||||
from mediatab import MediaTab
|
||||
from mediacontroller import MediaManager
|
||||
from webkitcontroller import WebkitController
|
||||
#from phononcontroller import PhononController
|
||||
#from vlccontroller import VlcController
|
||||
|
||||
__all__ = ['MediaMediaItem']
|
||||
|
300
openlp/plugins/media/lib/mediacontroller.py
Normal file
300
openlp/plugins/media/lib/mediacontroller.py
Normal file
@ -0,0 +1,300 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2011 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, #
|
||||
# Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, #
|
||||
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# This program is free software; you can redistribute it and/or modify it #
|
||||
# under the terms of the GNU General Public License as published by the Free #
|
||||
# Software Foundation; version 2 of the License. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||
# more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License along #
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
import logging
|
||||
|
||||
import sys, types
|
||||
from PyQt4 import QtCore
|
||||
import vlc
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt4.phonon import Phonon
|
||||
|
||||
from openlp.core.lib import Receiver
|
||||
from openlp.plugins.media.lib import MediaBackends
|
||||
from webkitcontroller import WebkitController
|
||||
from phononcontroller import PhononController
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class MediaManager(object):
|
||||
"""
|
||||
"""
|
||||
def __init__(self, parent):
|
||||
self.parent = parent
|
||||
|
||||
self.availableBackends = [
|
||||
MediaBackends.Webkit,
|
||||
MediaBackends.Phonon,
|
||||
MediaBackends.Vlc]
|
||||
self.curDisplayMediaController = {}
|
||||
self.displayWebkitController = WebkitController(self)
|
||||
self.displayPhononController = PhononController(self)
|
||||
#self.displayVlcController = VlcController(self)
|
||||
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'media_set_display'), self.setDisplay)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'media_video'), self.video)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'media_play'), self.videoPlay)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'media_pause'), self.videoPause)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'media_stop'), self.videoStop)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'media_seek'), self.videoSeek)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'media_volume'), self.videoVolume)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'media_reset'), self.videoReset)
|
||||
|
||||
|
||||
def setDisplay(self, display):
|
||||
print display
|
||||
#self.setupVlcController(display)
|
||||
self.setupPhononController(display)
|
||||
self.setupWebkitController(display)
|
||||
|
||||
|
||||
def setupWebkitController(self, display):
|
||||
#self.displayWebkitController[display] = display.webView
|
||||
display.webView.raise_()
|
||||
|
||||
def setupPhononController(self, display):
|
||||
display.phononWidget = Phonon.VideoWidget(display)
|
||||
display.phononWidget.setVisible(False)
|
||||
display.phononWidget.setGeometry(QtCore.QRect(0, 0,
|
||||
display.screen[u'size'].width(), display.screen[u'size'].height()))
|
||||
display.mediaObject = Phonon.MediaObject(display)
|
||||
display.audio = Phonon.AudioOutput(Phonon.VideoCategory, display.mediaObject)
|
||||
Phonon.createPath(display.mediaObject, display.phononWidget)
|
||||
Phonon.createPath(display.mediaObject, display.audio)
|
||||
display.phononWidget.raise_()
|
||||
QtCore.QObject.connect(display.mediaObject,
|
||||
QtCore.SIGNAL(u'stateChanged(Phonon::State, Phonon::State)'),
|
||||
display.videoHelper)
|
||||
# display.mediaObject.stateChanged.connect(self.videoState)
|
||||
# QtCore.QObject.connect(display.mediaObject,
|
||||
# QtCore.SIGNAL(u'finished()'),
|
||||
# self.videoFinished)
|
||||
# QtCore.QObject.connect(display.mediaObject,
|
||||
# QtCore.SIGNAL(u'tick(qint64)'),
|
||||
# self.videoTick)
|
||||
|
||||
#self.displayPhononController[display] = display.mediaObject
|
||||
|
||||
def setupVlcController(self, display):
|
||||
display.vlcWidget = QtGui.QWidget(display)
|
||||
instance=vlc.Instance()
|
||||
self.movieName = None
|
||||
player=instance.media_player_new(self.movieName)
|
||||
# the media player has to be 'connected' to the QFrame
|
||||
# (otherwise a video would be displayed in it's own window)
|
||||
# this is platform specific!
|
||||
# you have to give the id of the QFrame (or similar object) to
|
||||
# vlc, different platforms have different functions for this
|
||||
if sys.platform == "linux2": # for Linux using the X Server
|
||||
player.set_xwindow(self.hwnd)
|
||||
elif sys.platform == "win32": # for Windows
|
||||
player.set_hwnd(self.hwnd)
|
||||
elif sys.platform == "darwin": # for MacOS
|
||||
player.set_agl(self.hwnd)
|
||||
|
||||
display.vlcWidget.setGeometry(QtCore.QRect(0, 0,
|
||||
display.screen[u'size'].width(), display.screen[u'size'].height()))
|
||||
display.vlcWidget.raise_()
|
||||
#self.displayVlcController[display] = player
|
||||
|
||||
def video(self, msg):
|
||||
"""
|
||||
Loads and starts a video to run with the option of sound
|
||||
"""
|
||||
display = msg[0]
|
||||
videoPath = msg[1]
|
||||
volume = msg[2]
|
||||
isBackground = msg[3]
|
||||
|
||||
log.debug(u'video')
|
||||
display.webLoaded = True
|
||||
display.setGeometry(display.screen[u'size'])
|
||||
# We are running a background theme
|
||||
display.override[u'theme'] = u''
|
||||
display.override[u'video'] = True
|
||||
vol = float(volume) / float(10)
|
||||
usePhonon = QtCore.QSettings().value(
|
||||
u'media/use phonon', QtCore.QVariant(True)).toBool()
|
||||
if usePhonon:
|
||||
self.curDisplayMediaController[display] = self.displayPhononController
|
||||
display.phononWidget.setVisible(True)
|
||||
display.webView.setVisible(False)
|
||||
|
||||
else:
|
||||
self.curDisplayMediaController[display] = self.displayWebkitController
|
||||
display.phononWidget.setVisible(False)
|
||||
display.webView.setVisible(True)
|
||||
|
||||
self.curDisplayMediaController[display].load(display, videoPath, volume)
|
||||
if display.isLive:
|
||||
Receiver.send_message(u'maindisplay_active')
|
||||
return
|
||||
if isBackground or not display.usePhonon:
|
||||
if videoPath.endswith(u'.swf'):
|
||||
js = u'show_flash("load","%s");' % \
|
||||
(videoPath.replace(u'\\', u'\\\\'))
|
||||
else:
|
||||
js = u'show_video("init", "%s", %s, true); show_video("play");' % \
|
||||
(videoPath.replace(u'\\', u'\\\\'), str(vol))
|
||||
display.frame.evaluateJavaScript(js)
|
||||
else:
|
||||
display.phononActive = True
|
||||
display.mediaObject.stop()
|
||||
display.mediaObject.clearQueue()
|
||||
display.mediaObject.setCurrentSource(Phonon.MediaSource(videoPath))
|
||||
# Need the timer to trigger set the trigger to 200ms
|
||||
# Value taken from web documentation.
|
||||
if display.serviceItem.end_time != 0:
|
||||
display.mediaObject.setTickInterval(200)
|
||||
display.mediaObject.play()
|
||||
display.webView.setVisible(False)
|
||||
display.phononWidget.setVisible(True)
|
||||
display.audio.setVolume(vol)
|
||||
# Update the preview frame.
|
||||
if display.isLive:
|
||||
Receiver.send_message(u'maindisplay_active')
|
||||
|
||||
def resetVideo(self):
|
||||
"""
|
||||
Used after Video plugin has changed the background
|
||||
"""
|
||||
log.debug(u'resetVideo')
|
||||
if display.phononActive:
|
||||
display.mediaObject.stop()
|
||||
display.mediaObject.clearQueue()
|
||||
display.webView.setVisible(True)
|
||||
display.phononWidget.setVisible(False)
|
||||
display.phononActive = False
|
||||
else:
|
||||
display.frame.evaluateJavaScript(u'show_video("close");')
|
||||
display.override = {}
|
||||
# Update the preview frame.
|
||||
if display.isLive:
|
||||
Receiver.send_message(u'maindisplay_active')
|
||||
|
||||
def videoPlay(self, display):
|
||||
"""
|
||||
Responds to the request to play a loaded video
|
||||
"""
|
||||
log.debug(u'videoPlay')
|
||||
self.curDisplayMediaController[display].play(display)
|
||||
# show screen
|
||||
if display.isLive:
|
||||
display.setVisible(True)
|
||||
|
||||
def videoPause(self, display):
|
||||
"""
|
||||
Responds to the request to pause a loaded video
|
||||
"""
|
||||
log.debug(u'videoPause')
|
||||
if display in self.curDisplayMediaController:
|
||||
self.curDisplayMediaController[display].pause(display)
|
||||
return
|
||||
|
||||
def videoStop(self, display):
|
||||
"""
|
||||
Responds to the request to stop a loaded video
|
||||
"""
|
||||
log.debug(u'videoStop')
|
||||
print type(display)
|
||||
if type(display) is types.ListType:
|
||||
return
|
||||
print display, self.curDisplayMediaController
|
||||
if display in self.curDisplayMediaController:
|
||||
self.curDisplayMediaController[display].stop(display)
|
||||
if display.isLive:
|
||||
display.setVisible(False)
|
||||
|
||||
|
||||
def videoVolume(self, msg):
|
||||
"""
|
||||
Changes the volume of a running video
|
||||
"""
|
||||
display = msg[0]
|
||||
volume = msg[1]
|
||||
log.debug(u'videoVolume %d' % volume)
|
||||
vol = float(volume) / float(10)
|
||||
if display.phononActive:
|
||||
display.audio.setVolume(vol)
|
||||
else:
|
||||
display.frame.evaluateJavaScript(u'show_video(null, null, %s);' %
|
||||
str(vol))
|
||||
|
||||
def videoState(self, newState, oldState):
|
||||
"""
|
||||
Start the video at a predetermined point.
|
||||
"""
|
||||
print "display", self.sender()
|
||||
# if newState == Phonon.PlayingState \
|
||||
# and oldState != Phonon.PausedState \
|
||||
# and self.serviceItem.start_time > 0:
|
||||
# # set start time in milliseconds
|
||||
# self.mediaObject.seek(self.serviceItem.start_time * 1000)
|
||||
|
||||
def videoFinished(self):
|
||||
"""
|
||||
Blank the Video when it has finished so the final frame is not left
|
||||
hanging
|
||||
"""
|
||||
display.videoStop()
|
||||
display.hideDisplay(HideMode.Blank)
|
||||
display.phononActive = False
|
||||
display.videoHide = True
|
||||
|
||||
def videoTick(self, tick):
|
||||
"""
|
||||
Triggered on video tick every 200 milli seconds
|
||||
"""
|
||||
if tick > display.serviceItem.end_time * 1000:
|
||||
display.videoFinished()
|
||||
|
||||
def videoSeek(self, msg):
|
||||
"""
|
||||
Responds to the request to change the seek Slider of a loaded video
|
||||
"""
|
||||
log.debug(u'videoSeek')
|
||||
display = msg[0]
|
||||
seekVal = msg[1]
|
||||
if display in self.curDisplayMediaController:
|
||||
self.curDisplayMediaController[display].seek(display, seekVal)
|
||||
|
||||
def videoReset(self, display):
|
||||
"""
|
||||
Responds to the request to reset a loaded video
|
||||
"""
|
||||
log.debug(u'videoReset')
|
||||
if display in self.curDisplayMediaController:
|
||||
self.curDisplayMediaController[display].reset(display)
|
@ -108,7 +108,9 @@ class MediaMediaItem(MediaManagerItem):
|
||||
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||
if os.path.exists(filename):
|
||||
(path, name) = os.path.split(filename)
|
||||
self.parent.liveController.display.video(filename, 0, True)
|
||||
#self.parent.liveController.display.video(filename, 0, True)
|
||||
Receiver.send_message(u'media_video',
|
||||
[self.parent.liveController.display, filename, 0, True])
|
||||
self.resetAction.setVisible(True)
|
||||
else:
|
||||
critical_error_message_box(UiStrings.LiveBGError,
|
||||
@ -129,35 +131,35 @@ class MediaMediaItem(MediaManagerItem):
|
||||
unicode(translate('MediaPlugin.MediaItem',
|
||||
'The file %s no longer exists.')) % filename)
|
||||
return False
|
||||
self.mediaObject.stop()
|
||||
self.mediaObject.clearQueue()
|
||||
self.mediaObject.setCurrentSource(Phonon.MediaSource(filename))
|
||||
if not self.mediaStateWait(Phonon.StoppedState):
|
||||
# self.mediaObject.stop()
|
||||
# self.mediaObject.clearQueue()
|
||||
# self.mediaObject.setCurrentSource(Phonon.MediaSource(filename))
|
||||
# if not self.mediaStateWait(Phonon.StoppedState):
|
||||
# Due to string freeze, borrow a message from presentations
|
||||
# This will be corrected in 1.9.6
|
||||
critical_error_message_box(
|
||||
translate('PresentationPlugin.MediaItem', 'Unsupported File'),
|
||||
unicode(translate('PresentationPlugin.MediaItem',
|
||||
'Unsupported File')))
|
||||
return False
|
||||
# critical_error_message_box(
|
||||
# translate('PresentationPlugin.MediaItem', 'Unsupported File'),
|
||||
# unicode(translate('PresentationPlugin.MediaItem',
|
||||
# 'Unsupported File')))
|
||||
#return False
|
||||
# File too big for processing
|
||||
if os.path.getsize(filename) <= 52428800: # 50MiB
|
||||
self.mediaObject.play()
|
||||
if not self.mediaStateWait(Phonon.PlayingState) \
|
||||
or self.mediaObject.currentSource().type() \
|
||||
== Phonon.MediaSource.Invalid:
|
||||
# Due to string freeze, borrow a message from presentations
|
||||
# This will be corrected in 1.9.6
|
||||
self.mediaObject.stop()
|
||||
critical_error_message_box(
|
||||
translate('PresentationPlugin.MediaItem',
|
||||
'Unsupported File'),
|
||||
unicode(translate('PresentationPlugin.MediaItem',
|
||||
'Unsupported File')))
|
||||
return False
|
||||
self.mediaLength = self.mediaObject.totalTime() / 1000
|
||||
self.mediaObject.stop()
|
||||
service_item.media_length = self.mediaLength
|
||||
# self.mediaObject.play()
|
||||
# if not self.mediaStateWait(Phonon.PlayingState) \
|
||||
# or self.mediaObject.currentSource().type() \
|
||||
# == Phonon.MediaSource.Invalid:
|
||||
# # Due to string freeze, borrow a message from presentations
|
||||
# # This will be corrected in 1.9.6
|
||||
# self.mediaObject.stop()
|
||||
# critical_error_message_box(
|
||||
# translate('PresentationPlugin.MediaItem',
|
||||
# 'Unsupported File'),
|
||||
# unicode(translate('PresentationPlugin.MediaItem',
|
||||
# 'Unsupported File')))
|
||||
# #return False
|
||||
# self.mediaLength = self.mediaObject.totalTime() / 1000
|
||||
# self.mediaObject.stop()
|
||||
# service_item.media_length = self.mediaLength
|
||||
service_item.add_capability(
|
||||
ItemCapabilities.AllowsVariableStartTime)
|
||||
service_item.title = unicode(self.plugin.nameStrings[u'singular'])
|
||||
|
81
openlp/plugins/media/lib/phononcontroller.py
Normal file
81
openlp/plugins/media/lib/phononcontroller.py
Normal file
@ -0,0 +1,81 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2011 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, #
|
||||
# Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, #
|
||||
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# This program is free software; you can redistribute it and/or modify it #
|
||||
# under the terms of the GNU General Public License as published by the Free #
|
||||
# Software Foundation; version 2 of the License. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||
# more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License along #
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
from PyQt4.phonon import Phonon
|
||||
|
||||
from openlp.plugins.media.lib import MediaController
|
||||
|
||||
class PhononController(MediaController):
|
||||
"""
|
||||
"""
|
||||
def __init__(self, parent):
|
||||
self.parent = parent
|
||||
MediaController.__init__(self, parent)
|
||||
|
||||
def load(self, display, path, volume):
|
||||
display.phononActive = True
|
||||
display.mediaObject.stop()
|
||||
display.mediaObject.clearQueue()
|
||||
display.mediaObject.setCurrentSource(Phonon.MediaSource(path))
|
||||
# Need the timer to trigger set the trigger to 200ms
|
||||
# Value taken from web documentation.
|
||||
vol = float(volume) / float(10)
|
||||
if display.serviceItem.end_time != 0:
|
||||
display.mediaObject.setTickInterval(200)
|
||||
display.mediaObject.play()
|
||||
display.audio.setVolume(vol)
|
||||
self.Timer.setInterval(200)
|
||||
|
||||
|
||||
def play(self, display):
|
||||
display.mediaObject.play()
|
||||
display.parent.seekSlider.setMaximum(display.mediaObject.totalTime())
|
||||
|
||||
def pause(self, display):
|
||||
display.mediaObject.pause()
|
||||
self.Timer.stop()
|
||||
|
||||
def stop(self, display):
|
||||
display.mediaObject.stop()
|
||||
self.Timer.stop()
|
||||
|
||||
def seek(self, display, seekVal):
|
||||
print "seek"
|
||||
display.mediaObject.seek(seekVal)
|
||||
|
||||
def reset(self, display):
|
||||
display.mediaObject.stop()
|
||||
display.mediaObject.clearQueue()
|
||||
display.webView.setVisible(True)
|
||||
display.phononWidget.setVisible(False)
|
||||
display.phononActive = False
|
||||
self.Timer.stop()
|
||||
|
||||
def updatePlayer(self):
|
||||
for controller in self.parent.curDisplayMediaController:
|
||||
if controller.getState() == 1:
|
||||
pass
|
6106
openlp/plugins/media/lib/vlc.py
Normal file
6106
openlp/plugins/media/lib/vlc.py
Normal file
File diff suppressed because it is too large
Load Diff
49
openlp/plugins/media/lib/vlccontroller.py
Normal file
49
openlp/plugins/media/lib/vlccontroller.py
Normal file
@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2011 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, #
|
||||
# Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, #
|
||||
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# This program is free software; you can redistribute it and/or modify it #
|
||||
# under the terms of the GNU General Public License as published by the Free #
|
||||
# Software Foundation; version 2 of the License. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||
# more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License along #
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
from openlp.plugins.media.lib import MediaController
|
||||
|
||||
class WebkitController(MediaController):
|
||||
"""
|
||||
"""
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def load(self, display, path, volume):
|
||||
pass
|
||||
|
||||
def play(self, display):
|
||||
self.display[u'live']
|
||||
|
||||
def pause(self):
|
||||
pass
|
||||
|
||||
def stop(self):
|
||||
pass
|
||||
|
||||
def seek(self):
|
||||
pass
|
77
openlp/plugins/media/lib/webkitcontroller.py
Normal file
77
openlp/plugins/media/lib/webkitcontroller.py
Normal file
@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||
|
||||
###############################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2011 Raoul Snyman #
|
||||
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, #
|
||||
# Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, #
|
||||
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# This program is free software; you can redistribute it and/or modify it #
|
||||
# under the terms of the GNU General Public License as published by the Free #
|
||||
# Software Foundation; version 2 of the License. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||
# more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License along #
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
from openlp.plugins.media.lib import MediaController
|
||||
|
||||
class WebkitController(MediaController):
|
||||
"""
|
||||
"""
|
||||
def __init__(self, parent):
|
||||
self.parent = parent
|
||||
MediaController.__init__(self, parent)
|
||||
self.isFlash = False
|
||||
|
||||
def load(self, display, path, volume):
|
||||
vol = float(volume) / float(10)
|
||||
display.webView.setVisible(True)
|
||||
display.phononWidget.setVisible(False)
|
||||
if path.endswith(u'.swf'):
|
||||
js = u'show_flash("load","%s");' % \
|
||||
(path.replace(u'\\', u'\\\\'))
|
||||
self.isFlash = True
|
||||
else:
|
||||
js = u'show_video("init", "%s", %s, false); show_video("play");' % \
|
||||
(path.replace(u'\\', u'\\\\'), str(vol))
|
||||
self.isFlash = False
|
||||
display.frame.evaluateJavaScript(js)
|
||||
|
||||
def play(self, display):
|
||||
if self.isFlash:
|
||||
display.frame.evaluateJavaScript(u'show_flash("play","");')
|
||||
# display.frame.evaluateJavaScript(u'show_video("stop");')
|
||||
else:
|
||||
# display.frame.evaluateJavaScript(u'show_flash("stop","");')
|
||||
display.frame.evaluateJavaScript(u'show_video("play");')
|
||||
|
||||
|
||||
def pause(self, display):
|
||||
if self.isFlash:
|
||||
display.frame.evaluateJavaScript(u'show_flash("pause","");')
|
||||
else:
|
||||
display.frame.evaluateJavaScript(u'show_video("pause");')
|
||||
|
||||
def stop(self, display):
|
||||
if self.isFlash:
|
||||
display.frame.evaluateJavaScript(u'show_flash("stop","");')
|
||||
else:
|
||||
display.frame.evaluateJavaScript(u'show_video("stop");')
|
||||
|
||||
def seek(self, display):
|
||||
pass
|
||||
|
||||
def reset(self, display):
|
||||
display.frame.evaluateJavaScript(u'show_video("close");')
|
@ -30,7 +30,7 @@ import mimetypes
|
||||
from PyQt4.phonon import Phonon
|
||||
|
||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate
|
||||
from openlp.plugins.media.lib import MediaMediaItem, MediaTab
|
||||
from openlp.plugins.media.lib import MediaMediaItem, MediaTab, MediaManager
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -68,6 +68,7 @@ class MediaPlugin(Plugin):
|
||||
self._addToList(self.audio_extensions_list, mimetype)
|
||||
elif mimetype.startswith(u'video/'):
|
||||
self._addToList(self.video_extensions_list, mimetype)
|
||||
self.mediaManager = MediaManager(self)
|
||||
|
||||
def _addToList(self, list, mimetype):
|
||||
# Add all extensions which mimetypes provides us for supported types.
|
||||
|
Loading…
Reference in New Issue
Block a user