forked from openlp/openlp
next steps
This commit is contained in:
parent
e730dc366f
commit
d4162e814c
@ -325,22 +325,18 @@ sup {
|
|||||||
if (document.embeds && document.embeds[movieName])
|
if (document.embeds && document.embeds[movieName])
|
||||||
return document.embeds[movieName];
|
return document.embeds[movieName];
|
||||||
}
|
}
|
||||||
else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
|
|
||||||
{
|
|
||||||
return document.getElementById(movieName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_flash(state, path){
|
function show_flash(state, path){
|
||||||
var text = document.getElementById('flash');
|
var text = document.getElementById('flash');
|
||||||
var flashMovie=getFlashMovieObject("OpenLPFlashMovie");
|
var flashMovie = getFlashMovieObject("OpenLPFlashMovie");
|
||||||
var src = "src = 'file:///" + path + "'";
|
var src = "src = 'file:///" + path + "'";
|
||||||
var view_parm = " wmode='opaque'" +
|
var view_parm = " wmode='opaque'" +
|
||||||
" width='" + window.innerWidth + "'" +
|
" width='" + window.innerWidth + "'" +
|
||||||
" height='" + window.innerHeight + "'";
|
" height='" + window.innerHeight + "'";
|
||||||
var swf_parm = " autostart='false' loop='false' play='false'" +
|
var swf_parm = " autostart='false' loop='false' play='false'" +
|
||||||
" hidden='false' swliveconnect='true'" +
|
" hidden='false' swliveconnect='true'" +
|
||||||
" name='OpenLPFlashMovie'>";
|
" name='OpenLPFlashMovie'>";
|
||||||
|
|
||||||
switch(state){
|
switch(state){
|
||||||
case 'load':
|
case 'load':
|
||||||
@ -349,12 +345,10 @@ sup {
|
|||||||
text.style.visibility = 'visible';
|
text.style.visibility = 'visible';
|
||||||
flashMovie.Play();
|
flashMovie.Play();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'play':
|
case 'play':
|
||||||
text.style.visibility = 'visible';
|
text.style.visibility = 'visible';
|
||||||
flashMovie.Play();
|
flashMovie.Play();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'rewind':
|
case 'rewind':
|
||||||
ret = 'rewind';
|
ret = 'rewind';
|
||||||
alert(' Wert: ' + flashMovie.TGetProperty("/", 4));
|
alert(' Wert: ' + flashMovie.TGetProperty("/", 4));
|
||||||
@ -364,7 +358,7 @@ sup {
|
|||||||
break;
|
break;
|
||||||
case 'stop':
|
case 'stop':
|
||||||
flashMovie.StopPlay();
|
flashMovie.StopPlay();
|
||||||
text.innerHTML = ''
|
text.innerHTML = '';
|
||||||
text.style.visibility = 'hidden';
|
text.style.visibility = 'hidden';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ from firsttimelanguageform import FirstTimeLanguageForm
|
|||||||
from themeform import ThemeForm
|
from themeform import ThemeForm
|
||||||
from filerenameform import FileRenameForm
|
from filerenameform import FileRenameForm
|
||||||
from starttimeform import StartTimeForm
|
from starttimeform import StartTimeForm
|
||||||
from maindisplay import MainDisplay
|
from maindisplay import MainDisplay, Display
|
||||||
from servicenoteform import ServiceNoteForm
|
from servicenoteform import ServiceNoteForm
|
||||||
from serviceitemeditform import ServiceItemEditForm
|
from serviceitemeditform import ServiceItemEditForm
|
||||||
from screen import ScreenList
|
from screen import ScreenList
|
||||||
|
@ -55,6 +55,30 @@ class DisplayWidget(QtGui.QGraphicsView):
|
|||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.live = live
|
self.live = live
|
||||||
|
|
||||||
|
class Display(QtGui.QFrame):
|
||||||
|
"""
|
||||||
|
This is the display screen for preview Widgets.
|
||||||
|
"""
|
||||||
|
def __init__(self, parent):
|
||||||
|
QtGui.QFrame.__init__(self, parent)
|
||||||
|
self.parent = parent
|
||||||
|
|
||||||
|
def setup(self):
|
||||||
|
"""
|
||||||
|
Set up and build the preview screen
|
||||||
|
"""
|
||||||
|
self.webView = QtWebKit.QWebView(self)
|
||||||
|
self.webView.setGeometry(0, 0,
|
||||||
|
self.parent.width(), self.parent.height())
|
||||||
|
self.webView.settings().setAttribute(QtWebKit.QWebSettings.PluginsEnabled, True)
|
||||||
|
self.page = self.webView.page()
|
||||||
|
self.frame = self.page.mainFrame()
|
||||||
|
screen = {}
|
||||||
|
screen[u'size'] = self.size()
|
||||||
|
serviceItem = ServiceItem()
|
||||||
|
self.webView.setHtml(build_html(serviceItem, screen,
|
||||||
|
None, None, None))
|
||||||
|
self.webView.hide()
|
||||||
|
|
||||||
class MainDisplay(DisplayWidget):
|
class MainDisplay(DisplayWidget):
|
||||||
"""
|
"""
|
||||||
@ -103,7 +127,7 @@ class MainDisplay(DisplayWidget):
|
|||||||
self.webView = QtWebKit.QWebView(self)
|
self.webView = QtWebKit.QWebView(self)
|
||||||
self.webView.setGeometry(0, 0,
|
self.webView.setGeometry(0, 0,
|
||||||
self.screen[u'size'].width(), self.screen[u'size'].height())
|
self.screen[u'size'].width(), self.screen[u'size'].height())
|
||||||
self.webView.settings().setAttribute(QtWebKit.QWebSettings.PluginsEnabled,True)
|
self.webView.settings().setAttribute(QtWebKit.QWebSettings.PluginsEnabled, True)
|
||||||
self.page = self.webView.page()
|
self.page = self.webView.page()
|
||||||
self.frame = self.page.mainFrame()
|
self.frame = self.page.mainFrame()
|
||||||
QtCore.QObject.connect(self.webView,
|
QtCore.QObject.connect(self.webView,
|
||||||
@ -156,7 +180,6 @@ class MainDisplay(DisplayWidget):
|
|||||||
self.primary = False
|
self.primary = False
|
||||||
else:
|
else:
|
||||||
self.primary = True
|
self.primary = True
|
||||||
Receiver.send_message(u'media_set_display', self)
|
|
||||||
log.debug(
|
log.debug(
|
||||||
u'Finished setup for monitor %s' % self.screens.monitor_number)
|
u'Finished setup for monitor %s' % self.screens.monitor_number)
|
||||||
|
|
||||||
|
@ -979,7 +979,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
for fileId, filename in enumerate(recentFilesToDisplay):
|
for fileId, filename in enumerate(recentFilesToDisplay):
|
||||||
log.debug('Recent file name: %s', filename)
|
log.debug('Recent file name: %s', filename)
|
||||||
action = base_action(self, u'')
|
action = base_action(self, u'')
|
||||||
action.setText(u'&%d %s' %
|
action.setText(u'&%d %s' %
|
||||||
(fileId + 1, QtCore.QFileInfo(filename).fileName()))
|
(fileId + 1, QtCore.QFileInfo(filename).fileName()))
|
||||||
action.setData(QtCore.QVariant(filename))
|
action.setData(QtCore.QVariant(filename))
|
||||||
self.connect(action, QtCore.SIGNAL(u'triggered()'),
|
self.connect(action, QtCore.SIGNAL(u'triggered()'),
|
||||||
|
@ -33,7 +33,7 @@ from PyQt4.phonon import Phonon
|
|||||||
from openlp.core.lib import OpenLPToolbar, Receiver, resize_image, \
|
from openlp.core.lib import OpenLPToolbar, Receiver, resize_image, \
|
||||||
ItemCapabilities, translate
|
ItemCapabilities, translate
|
||||||
from openlp.core.lib.ui import UiStrings, shortcut_action
|
from openlp.core.lib.ui import UiStrings, shortcut_action
|
||||||
from openlp.core.ui import HideMode, MainDisplay
|
from openlp.core.ui import HideMode, MainDisplay, Display
|
||||||
from openlp.core.utils.actions import ActionList, CategoryOrder
|
from openlp.core.utils.actions import ActionList, CategoryOrder
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -234,19 +234,15 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.songMenu.setMenu(QtGui.QMenu(
|
self.songMenu.setMenu(QtGui.QMenu(
|
||||||
translate('OpenLP.SlideController', 'Go To'), self.toolbar))
|
translate('OpenLP.SlideController', 'Go To'), self.toolbar))
|
||||||
self.toolbar.makeWidgetsInvisible([u'Song Menu'])
|
self.toolbar.makeWidgetsInvisible([u'Song Menu'])
|
||||||
# Build the seekSlider.
|
# Build the seekSlider.
|
||||||
self.seekSlider = QtGui.QSlider(QtCore.Qt.Horizontal)
|
self.seekSlider = QtGui.QSlider(QtCore.Qt.Horizontal)
|
||||||
self.seekSlider.setMaximum(1000)
|
self.seekSlider.setMaximum(1000)
|
||||||
# Build the volumeSlider.
|
# Build the volumeSlider.
|
||||||
self.volumeSlider = QtGui.QSlider(QtCore.Qt.Horizontal)
|
self.volumeSlider = QtGui.QSlider(QtCore.Qt.Horizontal)
|
||||||
self.volumeSlider.setTickInterval(1)
|
self.volumeSlider.setTickInterval(1)
|
||||||
self.volumeSlider.setTickPosition(QtGui.QSlider.TicksAbove)
|
self.volumeSlider.setTickPosition(QtGui.QSlider.TicksAbove)
|
||||||
self.volumeSlider.setMinimum(0)
|
self.volumeSlider.setMinimum(0)
|
||||||
self.volumeSlider.setMaximum(10)
|
self.volumeSlider.setMaximum(10)
|
||||||
else:
|
|
||||||
# Build the seekSlider.
|
|
||||||
self.seekSlider = Phonon.SeekSlider()
|
|
||||||
self.volumeSlider = Phonon.VolumeSlider()
|
|
||||||
self.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
|
self.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
|
||||||
self.seekSlider.setObjectName(u'seekSlider')
|
self.seekSlider.setObjectName(u'seekSlider')
|
||||||
self.mediabar.addToolbarWidget(u'Seek Slider', self.seekSlider)
|
self.mediabar.addToolbarWidget(u'Seek Slider', self.seekSlider)
|
||||||
@ -271,15 +267,9 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.slideLayout.setSpacing(0)
|
self.slideLayout.setSpacing(0)
|
||||||
self.slideLayout.setMargin(0)
|
self.slideLayout.setMargin(0)
|
||||||
self.slideLayout.setObjectName(u'SlideLayout')
|
self.slideLayout.setObjectName(u'SlideLayout')
|
||||||
self.mediaObject = Phonon.MediaObject(self)
|
self.previewDisplay = Display(self)
|
||||||
self.video = Phonon.VideoWidget()
|
self.previewDisplay.setGeometry(QtCore.QRect(0, 0, 300, 300))
|
||||||
self.video.setVisible(False)
|
self.slideLayout.insertWidget(0, self.previewDisplay)
|
||||||
self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject)
|
|
||||||
Phonon.createPath(self.mediaObject, self.video)
|
|
||||||
Phonon.createPath(self.mediaObject, self.audio)
|
|
||||||
if not self.isLive:
|
|
||||||
self.video.setGeometry(QtCore.QRect(0, 0, 300, 225))
|
|
||||||
self.slideLayout.insertWidget(0, self.video)
|
|
||||||
# Actual preview screen
|
# Actual preview screen
|
||||||
self.slidePreview = QtGui.QLabel(self)
|
self.slidePreview = QtGui.QLabel(self)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
|
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
|
||||||
@ -402,8 +392,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
|
|
||||||
def liveEscape(self):
|
def liveEscape(self):
|
||||||
self.display.setVisible(False)
|
self.display.setVisible(False)
|
||||||
#self.display.videoStop()
|
Receiver.send_message('media_stop', self)
|
||||||
Receiver.send_message('media_stop', self.display)
|
|
||||||
|
|
||||||
def servicePrevious(self):
|
def servicePrevious(self):
|
||||||
Receiver.send_message('servicemanager_previous_item')
|
Receiver.send_message('servicemanager_previous_item')
|
||||||
@ -427,6 +416,10 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.ratio = float(self.screens.current[u'size'].width()) / \
|
self.ratio = float(self.screens.current[u'size'].width()) / \
|
||||||
float(self.screens.current[u'size'].height())
|
float(self.screens.current[u'size'].height())
|
||||||
self.previewSizeChanged()
|
self.previewSizeChanged()
|
||||||
|
Receiver.send_message(u'setup_display', self.display)
|
||||||
|
self.previewDisplay.resize(self.slidePreview.size())
|
||||||
|
self.previewDisplay.setup()
|
||||||
|
Receiver.send_message(u'setup_display', self.previewDisplay)
|
||||||
if self.serviceItem:
|
if self.serviceItem:
|
||||||
self.refreshServiceItem()
|
self.refreshServiceItem()
|
||||||
|
|
||||||
@ -522,7 +515,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
elif item.is_media():
|
elif item.is_media():
|
||||||
#self.toolbar.setVisible(False)
|
#self.toolbar.setVisible(False)
|
||||||
self.mediabar.setVisible(True)
|
self.mediabar.setVisible(True)
|
||||||
self.volumeSlider.setAudioOutput(self.audio)
|
# self.volumeSlider.setAudioOutput(self.audio)
|
||||||
|
|
||||||
def refreshServiceItem(self):
|
def refreshServiceItem(self):
|
||||||
"""
|
"""
|
||||||
@ -1060,16 +1053,9 @@ class SlideController(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'SlideController onMediaStart')
|
log.debug(u'SlideController onMediaStart')
|
||||||
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:
|
Receiver.send_message(u'media_video', [self, file, self.volume, False])
|
||||||
Receiver.send_message(u'media_video', [self.display, file, self.volume, False])
|
self.volumeSlider.setValue(self.volume)
|
||||||
self.volumeSlider.setValue(self.volume)
|
self.slidePreview.hide()
|
||||||
else:
|
|
||||||
self.mediaObject.stop()
|
|
||||||
self.mediaObject.clearQueue()
|
|
||||||
self.mediaObject.setCurrentSource(Phonon.MediaSource(file))
|
|
||||||
self.seekSlider.setMediaObject(self.mediaObject)
|
|
||||||
self.seekSlider.show()
|
|
||||||
self.onMediaPlay()
|
|
||||||
|
|
||||||
def mediaSeek(self):
|
def mediaSeek(self):
|
||||||
"""
|
"""
|
||||||
@ -1077,7 +1063,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'SlideController mediaSeek')
|
log.debug(u'SlideController mediaSeek')
|
||||||
self.seekPos = self.seekSlider.value()
|
self.seekPos = self.seekSlider.value()
|
||||||
Receiver.send_message(u'media_seek', [self.display, self.seekPos])
|
Receiver.send_message(u'media_seek', [self, self.seekPos])
|
||||||
|
|
||||||
def mediaVolume(self):
|
def mediaVolume(self):
|
||||||
"""
|
"""
|
||||||
@ -1085,7 +1071,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'SlideController mediaVolume')
|
log.debug(u'SlideController mediaVolume')
|
||||||
self.volume = self.volumeSlider.value()
|
self.volume = self.volumeSlider.value()
|
||||||
Receiver.send_message(u'media_volume', [self.display, self.volume])
|
Receiver.send_message(u'media_volume', [self, self.volume])
|
||||||
|
|
||||||
|
|
||||||
def onMediaPause(self):
|
def onMediaPause(self):
|
||||||
@ -1093,33 +1079,22 @@ class SlideController(QtGui.QWidget):
|
|||||||
Respond to the Pause from the media Toolbar
|
Respond to the Pause from the media Toolbar
|
||||||
"""
|
"""
|
||||||
log.debug(u'SlideController onMediaPause')
|
log.debug(u'SlideController onMediaPause')
|
||||||
if self.isLive:
|
Receiver.send_message(u'media_pause', self)
|
||||||
Receiver.send_message(u'media_pause', self.display)
|
|
||||||
else:
|
|
||||||
self.mediaObject.pause()
|
|
||||||
|
|
||||||
def onMediaPlay(self):
|
def onMediaPlay(self):
|
||||||
"""
|
"""
|
||||||
Respond to the Play from the media Toolbar
|
Respond to the Play from the media Toolbar
|
||||||
"""
|
"""
|
||||||
log.debug(u'SlideController onMediaPlay')
|
log.debug(u'SlideController onMediaPlay')
|
||||||
if self.isLive:
|
Receiver.send_message(u'media_play', self)
|
||||||
Receiver.send_message(u'media_play', self.display)
|
self.slidePreview.hide()
|
||||||
else:
|
|
||||||
self.slidePreview.hide()
|
|
||||||
self.video.show()
|
|
||||||
self.mediaObject.play()
|
|
||||||
|
|
||||||
def onMediaStop(self):
|
def onMediaStop(self):
|
||||||
"""
|
"""
|
||||||
Respond to the Stop from the media Toolbar
|
Respond to the Stop from the media Toolbar
|
||||||
"""
|
"""
|
||||||
log.debug(u'SlideController onMediaStop')
|
log.debug(u'SlideController onMediaStop')
|
||||||
if self.isLive:
|
Receiver.send_message(u'media_stop', self)
|
||||||
Receiver.send_message(u'media_stop', self.display)
|
|
||||||
else:
|
|
||||||
self.mediaObject.stop()
|
|
||||||
self.video.hide()
|
|
||||||
self.slidePreview.clear()
|
self.slidePreview.clear()
|
||||||
self.slidePreview.show()
|
self.slidePreview.show()
|
||||||
|
|
||||||
@ -1128,12 +1103,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
Respond to a request to close the Video
|
Respond to a request to close the Video
|
||||||
"""
|
"""
|
||||||
log.debug(u'SlideController onMediaClose')
|
log.debug(u'SlideController onMediaClose')
|
||||||
if self.isLive:
|
Receiver.send_message(u'media_reset', self)
|
||||||
Receiver.send_message(u'media_reset', self.display)
|
|
||||||
else:
|
|
||||||
self.mediaObject.stop()
|
|
||||||
self.mediaObject.clearQueue()
|
|
||||||
self.video.hide()
|
|
||||||
self.slidePreview.clear()
|
self.slidePreview.clear()
|
||||||
self.slidePreview.show()
|
self.slidePreview.show()
|
||||||
|
|
||||||
|
@ -32,16 +32,16 @@ class MediaBackends(object):
|
|||||||
Phonon = 1
|
Phonon = 1
|
||||||
Vlc = 2
|
Vlc = 2
|
||||||
|
|
||||||
class MediaStates(object):
|
class MediaState(object):
|
||||||
"""
|
"""
|
||||||
An enumeratioin for possible States of the Media Player
|
An enumeration for possible States of the Media Player
|
||||||
(copied from Phonon::State
|
(copied from Phonon::State
|
||||||
"""
|
"""
|
||||||
LoadingState = 0
|
Loading = 0
|
||||||
StoppedState = 1
|
Stopped = 1
|
||||||
PlayingState = 2
|
Playing = 2
|
||||||
PausedState = 4
|
Paused = 4
|
||||||
OffState = 6
|
Off = 6
|
||||||
|
|
||||||
class MediaController(object):
|
class MediaController(object):
|
||||||
"""
|
"""
|
||||||
@ -50,11 +50,14 @@ class MediaController(object):
|
|||||||
"""
|
"""
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.state = MediaStates.OffState
|
self.state = MediaState.Off
|
||||||
|
|
||||||
def load(self, display, path, volume):
|
def load(self, display, path, volume):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def resize(self, display, controller):
|
||||||
|
pass
|
||||||
|
|
||||||
def play(self, display):
|
def play(self, display):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -64,16 +67,19 @@ class MediaController(object):
|
|||||||
def stop(self, display):
|
def stop(self, display):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def volume(self, display, vol):
|
||||||
|
pass
|
||||||
|
|
||||||
def seek(self, display, seekVal):
|
def seek(self, display, seekVal):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def reset(self, display):
|
def reset(self, display):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def updateUI(self, display):
|
def update_ui(self, controller, display):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def getSupportedFileTypes(self):
|
def get_supported_file_types(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
from mediaitem import MediaMediaItem
|
from mediaitem import MediaMediaItem
|
||||||
|
@ -31,11 +31,11 @@ import sys, types
|
|||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore
|
||||||
import vlc
|
import vlc
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui, QtWebKit
|
||||||
from PyQt4.phonon import Phonon
|
from PyQt4.phonon import Phonon
|
||||||
|
|
||||||
from openlp.core.lib import Receiver
|
from openlp.core.lib import Receiver
|
||||||
from openlp.plugins.media.lib import MediaBackends, MediaStates
|
from openlp.plugins.media.lib import MediaBackends, MediaState
|
||||||
from webkitcontroller import WebkitController
|
from webkitcontroller import WebkitController
|
||||||
from phononcontroller import PhononController
|
from phononcontroller import PhononController
|
||||||
from vlccontroller import VlcController
|
from vlccontroller import VlcController
|
||||||
@ -44,83 +44,53 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class MediaManager(object):
|
class MediaManager(object):
|
||||||
"""
|
"""
|
||||||
The implementation of a Media Manager
|
The implementation of a Media Manager
|
||||||
The idea is to separate the media related implementation into the plugin files
|
The idea is to separate the media related implementation into the plugin files
|
||||||
and unify the access from other parts of code
|
and unify the access from other parts of code
|
||||||
The media manager adds an own class for every type of backend
|
The media manager adds an own class for every type of backend
|
||||||
Currently these are QtWebkit, Phonon and planed Vlc.
|
Currently these are QtWebkit, Phonon and planed Vlc.
|
||||||
On the other hand currently the previewController display only use phonon for media output.
|
On the other hand currently the previewController display only use phonon for media output.
|
||||||
So I would suggest to rename the maindisplay.py to display.py and modify the code,
|
So I would suggest to rename the maindisplay.py to display.py and modify the code,
|
||||||
so that the display class can be used for the maindisplay as well as for the previewController display.
|
so that the display class can be used for the maindisplay as well as for the previewController display.
|
||||||
|
|
||||||
Workflow idea:
|
|
||||||
- OpenLP is starting
|
|
||||||
- Live display and preview display are call setup
|
|
||||||
- Live display and preview display send signal with a pointer to their own to the media controller ('media_set_display')
|
|
||||||
- media controller register all available displays and create for each display all types of media backends (see setDisplay)
|
|
||||||
- in the OpenLP configuration dialog the user no longe will decide between using Webkit OR Phonon.
|
|
||||||
- instead of this there is a list widget with all available backends and the user can switch off/on the backends
|
|
||||||
and change the priority order
|
|
||||||
(this is necessary, because of not all backends can play all media files and text over video is currently only with QtWebkit possible)
|
|
||||||
- later on, if the user add a new media service item the signal ('media_video') will be send
|
|
||||||
- as a result of this the media manager checks which controller is needed for this filetyp
|
|
||||||
and assign the related backend controller to the right display
|
|
||||||
- Now all related media stuff (play, pause, ...) will be routed to the related backend controller and there processed
|
|
||||||
- if one or more medias loaded a generic 200ms Timer will be started peridiodically to refresh the UI
|
|
||||||
- Signal ('media_reset') will close the related video and disconnect the backend from the display
|
|
||||||
|
|
||||||
Advantages:
|
|
||||||
- clean and easy interface from other parts of code (slidecontroller and display classes)
|
|
||||||
- more and better configuration possibilities inside the special backend controllers
|
|
||||||
- same handling for preview and live display (or later on other additionally displays with their slide controllers)
|
|
||||||
|
|
||||||
Disadvantages:
|
|
||||||
- because of there will be display widgets created outside of the maindisplay.py file it is more complicate to read the code
|
|
||||||
- some more signals are send arround the system
|
|
||||||
|
|
||||||
Notices:
|
|
||||||
- the flash support uses the flash plugin from Mozilla. So there is a js-check that this plugin is installed.
|
|
||||||
- maybe there would be the installed flashplugin of the IE possible could also used, but I'm not sure about this?
|
|
||||||
- I would suggest to not hide the main toolbar in case of media, instead of this the media toolbar should be
|
|
||||||
visible as second toolbar (so the screen can be blanked also during a running video, ...)
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
|
||||||
self.availableBackends = [
|
self.availableBackends = [
|
||||||
MediaBackends.Webkit,
|
MediaBackends.Webkit,
|
||||||
MediaBackends.Phonon,
|
MediaBackends.Phonon,
|
||||||
MediaBackends.Vlc]
|
MediaBackends.Vlc]
|
||||||
self.curDisplayMediaController = {}
|
self.curDisplayMediaController = {}
|
||||||
|
#one controller for every backend
|
||||||
self.displayWebkitController = WebkitController(self)
|
self.displayWebkitController = WebkitController(self)
|
||||||
self.displayPhononController = PhononController(self)
|
self.displayPhononController = PhononController(self)
|
||||||
self.displayVlcController = VlcController(self)
|
self.displayVlcController = VlcController(self)
|
||||||
|
#Timer for video state
|
||||||
self.Timer = QtCore.QTimer()
|
self.Timer = QtCore.QTimer()
|
||||||
self.Timer.setInterval(200)
|
self.Timer.setInterval(200)
|
||||||
|
#signals
|
||||||
QtCore.QObject.connect(self.Timer,
|
QtCore.QObject.connect(self.Timer,
|
||||||
QtCore.SIGNAL("timeout()"), self.videoState)
|
QtCore.SIGNAL("timeout()"), self.video_state)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'media_set_display'), self.setDisplay)
|
QtCore.SIGNAL(u'setup_display'), self.setup_display)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'media_video'), self.video)
|
QtCore.SIGNAL(u'media_video'), self.video)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'media_play'), self.videoPlay)
|
QtCore.SIGNAL(u'media_play'), self.video_play)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'media_pause'), self.videoPause)
|
QtCore.SIGNAL(u'media_pause'), self.video_pause)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'media_stop'), self.videoStop)
|
QtCore.SIGNAL(u'media_stop'), self.video_stop)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'media_seek'), self.videoSeek)
|
QtCore.SIGNAL(u'media_seek'), self.video_seek)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'media_volume'), self.videoVolume)
|
QtCore.SIGNAL(u'media_volume'), self.video_volume)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'media_reset'), self.videoReset)
|
QtCore.SIGNAL(u'media_reset'), self.video_reset)
|
||||||
|
|
||||||
def videoState(self):
|
def video_state(self):
|
||||||
"""
|
"""
|
||||||
check if there is an assigned media backend and do some
|
Check if there is an assigned media backend and do some
|
||||||
updating stuff (e.g. update the UI)
|
updating stuff (e.g. update the UI)
|
||||||
"""
|
"""
|
||||||
isAnyonePlaying = False
|
isAnyonePlaying = False
|
||||||
@ -128,67 +98,94 @@ class MediaManager(object):
|
|||||||
self.Timer.stop()
|
self.Timer.stop()
|
||||||
else:
|
else:
|
||||||
for display in self.curDisplayMediaController.keys():
|
for display in self.curDisplayMediaController.keys():
|
||||||
self.curDisplayMediaController[display].updateUI(display)
|
if display == self.parent.previewController.previewDisplay or \
|
||||||
if self.curDisplayMediaController[display].state == MediaStates.PlayingState:
|
display == self.parent.previewController.display:
|
||||||
|
self.curDisplayMediaController[display].update_ui(self.parent.previewController, display)
|
||||||
|
else:
|
||||||
|
self.curDisplayMediaController[display].update_ui(self.parent.liveController, display)
|
||||||
|
if self.curDisplayMediaController[display].state == MediaState.Playing:
|
||||||
isAnyonePlaying = True
|
isAnyonePlaying = True
|
||||||
if not isAnyonePlaying:
|
if not isAnyonePlaying:
|
||||||
self.Timer.stop()
|
self.Timer.stop()
|
||||||
|
|
||||||
def setDisplay(self, display):
|
def setup_display(self, display):
|
||||||
self.setupVlcController(display)
|
# check controller relevant displays
|
||||||
self.setupPhononController(display)
|
if display == self.parent.previewController.previewDisplay or \
|
||||||
self.setupWebkitController(display)
|
display == self.parent.liveController.previewDisplay or \
|
||||||
|
display == self.parent.liveController.display:
|
||||||
|
self.setup_vlc_controller(display)
|
||||||
|
self.setup_phonon_controller(display)
|
||||||
|
self.setup_webkit_controller(display)
|
||||||
|
|
||||||
|
def setup_webkit_controller(self, display):
|
||||||
def setupWebkitController(self, display):
|
if display == self.parent.previewController.previewDisplay or \
|
||||||
|
display == self.parent.liveController.previewDisplay:
|
||||||
|
display.webView.resize(display.size())
|
||||||
display.webView.raise_()
|
display.webView.raise_()
|
||||||
|
|
||||||
def setupPhononController(self, display):
|
def setup_phonon_controller(self, display):
|
||||||
display.phononWidget = Phonon.VideoWidget(display)
|
display.phononWidget = Phonon.VideoWidget(display)
|
||||||
display.phononWidget.setVisible(False)
|
display.phononWidget.setVisible(False)
|
||||||
display.phononWidget.setGeometry(QtCore.QRect(0, 0,
|
display.phononWidget.resize(display.size())
|
||||||
display.screen[u'size'].width(), display.screen[u'size'].height()))
|
|
||||||
display.mediaObject = Phonon.MediaObject(display)
|
display.mediaObject = Phonon.MediaObject(display)
|
||||||
display.audio = Phonon.AudioOutput(Phonon.VideoCategory, display.mediaObject)
|
display.audio = Phonon.AudioOutput(Phonon.VideoCategory, display.mediaObject)
|
||||||
Phonon.createPath(display.mediaObject, display.phononWidget)
|
Phonon.createPath(display.mediaObject, display.phononWidget)
|
||||||
Phonon.createPath(display.mediaObject, display.audio)
|
Phonon.createPath(display.mediaObject, display.audio)
|
||||||
display.phononWidget.raise_()
|
display.phononWidget.raise_()
|
||||||
|
|
||||||
def setupVlcController(self, display):
|
def setup_vlc_controller(self, display):
|
||||||
display.vlcWidget = QtGui.QFrame(display)
|
display.vlcWidget = QtGui.QFrame(display)
|
||||||
# creating a basic vlc instance
|
# creating a basic vlc instance
|
||||||
display.vlcInstance = vlc.Instance()
|
display.vlcInstance = vlc.Instance()
|
||||||
# creating an empty vlc media player
|
# creating an empty vlc media player
|
||||||
display.vlcMediaPlayer = display.vlcInstance.media_player_new()
|
display.vlcMediaPlayer = display.vlcInstance.media_player_new()
|
||||||
display.vlcWidget.setGeometry(QtCore.QRect(0, 0,
|
display.vlcWidget.resize(display.size())
|
||||||
display.screen[u'size'].width(), display.screen[u'size'].height()))
|
|
||||||
display.vlcWidget.raise_()
|
display.vlcWidget.raise_()
|
||||||
|
|
||||||
|
def resize(self, controller):
|
||||||
|
for display in self.curDisplayMediaController.keys():
|
||||||
|
display.resize(controller.slidePreview.size())
|
||||||
|
self.curDisplayMediaController[display].resize(display, controller)
|
||||||
|
|
||||||
def video(self, msg):
|
def video(self, msg):
|
||||||
"""
|
"""
|
||||||
Loads and starts a video to run with the option of sound
|
Loads and starts a video to run with the option of sound
|
||||||
"""
|
"""
|
||||||
display = msg[0]
|
controller = msg[0]
|
||||||
videoPath = msg[1]
|
videoPath = msg[1]
|
||||||
volume = msg[2]
|
volume = msg[2]
|
||||||
isBackground = msg[3]
|
isBackground = msg[3]
|
||||||
|
|
||||||
log.debug(u'video')
|
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)
|
vol = float(volume) / float(10)
|
||||||
self.checkFileType(display, videoPath, isBackground)
|
#stop running videos
|
||||||
self.curDisplayMediaController[display].load(display, videoPath, volume)
|
self.video_reset(controller)
|
||||||
if display.isLive:
|
if controller.isLive:
|
||||||
|
# We are running a background theme
|
||||||
|
controller.display.override[u'theme'] = u''
|
||||||
|
controller.display.override[u'video'] = True
|
||||||
|
display = controller.previewDisplay
|
||||||
|
self.check_file_type(display, videoPath, False)
|
||||||
|
self.curDisplayMediaController[display].load(display, videoPath, volume)
|
||||||
|
display = controller.display
|
||||||
|
self.check_file_type(display, videoPath, False)
|
||||||
|
self.curDisplayMediaController[display].load(display, videoPath, volume)
|
||||||
|
controller.display.webLoaded = True
|
||||||
Receiver.send_message(u'maindisplay_active')
|
Receiver.send_message(u'maindisplay_active')
|
||||||
|
else:
|
||||||
|
display = controller.previewDisplay
|
||||||
|
self.check_file_type(display, videoPath, False)
|
||||||
|
self.curDisplayMediaController[display].load(display, videoPath, volume)
|
||||||
|
#check size of all media_widgets
|
||||||
|
self.resize(controller)
|
||||||
|
#now start playing
|
||||||
|
for display in self.curDisplayMediaController.keys():
|
||||||
|
if display.parent == controller:
|
||||||
|
self.curDisplayMediaController[display].pause(display)
|
||||||
|
|
||||||
def checkFileType(self, display, videoPath, isBackground):
|
def check_file_type(self, display, videoPath, isBackground):
|
||||||
"""
|
"""
|
||||||
Used to choose the right media backend type
|
Used to choose the right media backend type
|
||||||
from the prioritized backend list
|
from the prioritized backend list
|
||||||
"""
|
"""
|
||||||
usePhonon = QtCore.QSettings().value(
|
usePhonon = QtCore.QSettings().value(
|
||||||
u'media/use phonon', QtCore.QVariant(True)).toBool()
|
u'media/use phonon', QtCore.QVariant(True)).toBool()
|
||||||
@ -199,127 +196,104 @@ class MediaManager(object):
|
|||||||
elif videoPath.endswith(u'.wmv'):
|
elif videoPath.endswith(u'.wmv'):
|
||||||
useVlc = False
|
useVlc = False
|
||||||
usePhonon = True
|
usePhonon = True
|
||||||
|
|
||||||
if useVlc:
|
if useVlc:
|
||||||
self.curDisplayMediaController[display] = self.displayVlcController
|
self.curDisplayMediaController[display] = self.displayVlcController
|
||||||
display.phononWidget.setVisible(False)
|
display.phononWidget.setVisible(False)
|
||||||
display.webView.setVisible(False)
|
|
||||||
display.vlcWidget.setVisible(True)
|
display.vlcWidget.setVisible(True)
|
||||||
|
display.webView.setVisible(False)
|
||||||
elif usePhonon and not isBackground:
|
elif usePhonon and not isBackground:
|
||||||
self.curDisplayMediaController[display] = self.displayPhononController
|
self.curDisplayMediaController[display] = self.displayPhononController
|
||||||
display.phononWidget.setVisible(True)
|
display.phononWidget.setVisible(True)
|
||||||
display.webView.setVisible(False)
|
|
||||||
display.vlcWidget.setVisible(False)
|
display.vlcWidget.setVisible(False)
|
||||||
|
display.webView.setVisible(False)
|
||||||
else:
|
else:
|
||||||
self.curDisplayMediaController[display] = self.displayWebkitController
|
self.curDisplayMediaController[display] = self.displayWebkitController
|
||||||
display.phononWidget.setVisible(False)
|
display.phononWidget.setVisible(False)
|
||||||
display.webView.setVisible(True)
|
|
||||||
display.vlcWidget.setVisible(False)
|
display.vlcWidget.setVisible(False)
|
||||||
|
display.webView.setVisible(True)
|
||||||
if len(self.curDisplayMediaController) > 0:
|
if len(self.curDisplayMediaController) > 0:
|
||||||
if not self.Timer.isActive():
|
if not self.Timer.isActive():
|
||||||
self.Timer.start()
|
self.Timer.start()
|
||||||
|
|
||||||
|
def video_play(self, controller):
|
||||||
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.frame.evaluateJavaScript(u'show_flash("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
|
Responds to the request to play a loaded video
|
||||||
"""
|
"""
|
||||||
log.debug(u'videoPlay')
|
log.debug(u'video_play')
|
||||||
self.curDisplayMediaController[display].play(display)
|
for display in self.curDisplayMediaController.keys():
|
||||||
|
print display, display.parent, controller
|
||||||
|
if display.parent == controller:
|
||||||
|
self.curDisplayMediaController[display].play(display)
|
||||||
# show screen
|
# show screen
|
||||||
if display.isLive:
|
if not self.Timer.isActive():
|
||||||
if not self.Timer.isActive():
|
self.Timer.start()
|
||||||
self.Timer.start()
|
display.setVisible(True)
|
||||||
display.setVisible(True)
|
|
||||||
|
|
||||||
def videoPause(self, display):
|
def video_pause(self, controller):
|
||||||
"""
|
"""
|
||||||
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 display in self.curDisplayMediaController:
|
for display in self.curDisplayMediaController.keys():
|
||||||
self.curDisplayMediaController[display].pause(display)
|
if display.parent == controller:
|
||||||
return
|
self.curDisplayMediaController[display].pause(display)
|
||||||
|
|
||||||
def videoStop(self, display):
|
def video_stop(self, controller):
|
||||||
"""
|
"""
|
||||||
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'video_stop')
|
||||||
if type(display) is types.ListType:
|
for display in self.curDisplayMediaController.keys():
|
||||||
return
|
if display.parent == controller:
|
||||||
if display in self.curDisplayMediaController:
|
self.curDisplayMediaController[display].stop(display)
|
||||||
self.curDisplayMediaController[display].stop(display)
|
|
||||||
if display.isLive:
|
|
||||||
display.setVisible(False)
|
|
||||||
|
|
||||||
|
def video_volume(self, msg):
|
||||||
def videoVolume(self, msg):
|
|
||||||
"""
|
"""
|
||||||
Changes the volume of a running video
|
Changes the volume of a running video
|
||||||
"""
|
"""
|
||||||
display = msg[0]
|
controller = msg[0]
|
||||||
volume = msg[1]
|
volume = msg[1]
|
||||||
log.debug(u'videoVolume %d' % volume)
|
log.debug(u'video_volume %d' % volume)
|
||||||
vol = float(volume) / float(10)
|
vol = float(volume) / float(10)
|
||||||
if display.phononActive:
|
for display in self.curDisplayMediaController.keys():
|
||||||
display.audio.setVolume(vol)
|
if display.parent == controller:
|
||||||
else:
|
self.curDisplayMediaController[display].volume(display, vol)
|
||||||
display.frame.evaluateJavaScript(u'show_video(null, null, %s);' %
|
|
||||||
str(vol))
|
|
||||||
|
|
||||||
def videoFinished(self):
|
def video_finished(self):
|
||||||
"""
|
"""
|
||||||
Blank the Video when it has finished so the final frame is not left
|
Blank the Video when it has finished so the final frame is not left
|
||||||
hanging
|
hanging
|
||||||
"""
|
"""
|
||||||
display.videoStop()
|
display.videoStop()
|
||||||
display.hideDisplay(HideMode.Blank)
|
display.hideDisplay(HideMode.Blank)
|
||||||
display.phononActive = False
|
|
||||||
display.videoHide = True
|
display.videoHide = True
|
||||||
|
|
||||||
def videoTick(self, tick):
|
def video_tick(self, tick):
|
||||||
"""
|
"""
|
||||||
Triggered on video tick every 200 milli seconds
|
Triggered on video tick every 200 milli seconds
|
||||||
"""
|
"""
|
||||||
if tick > display.serviceItem.end_time * 1000:
|
if tick > display.serviceItem.end_time * 1000:
|
||||||
display.videoFinished()
|
display.videoFinished()
|
||||||
|
|
||||||
def videoSeek(self, msg):
|
def video_seek(self, msg):
|
||||||
"""
|
"""
|
||||||
Responds to the request to change the seek Slider of a loaded video
|
Responds to the request to change the seek Slider of a loaded video
|
||||||
"""
|
"""
|
||||||
log.debug(u'videoSeek')
|
log.debug(u'video_seek')
|
||||||
display = msg[0]
|
controller = msg[0]
|
||||||
seekVal = msg[1]
|
seekVal = msg[1]
|
||||||
if display in self.curDisplayMediaController:
|
for display in self.curDisplayMediaController.keys():
|
||||||
self.curDisplayMediaController[display].seek(display, seekVal)
|
if display.parent == controller:
|
||||||
|
self.curDisplayMediaController[display].seek(display, seekVal)
|
||||||
|
|
||||||
def videoReset(self, display):
|
def video_reset(self, controller):
|
||||||
"""
|
"""
|
||||||
Responds to the request to reset a loaded video
|
Responds to the request to reset a loaded video
|
||||||
"""
|
"""
|
||||||
log.debug(u'videoReset')
|
log.debug(u'video_reset')
|
||||||
print "videoReset"
|
for display in self.curDisplayMediaController.keys():
|
||||||
if display in self.curDisplayMediaController:
|
if display.parent == controller:
|
||||||
self.curDisplayMediaController[display].reset(display)
|
self.curDisplayMediaController[display].reset(display)
|
||||||
self.curDisplayMediaController[display]
|
del self.curDisplayMediaController[display]
|
||||||
|
if controller.isLive:
|
||||||
|
Receiver.send_message(u'maindisplay_active')
|
||||||
|
@ -91,7 +91,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
self.resetAction.setVisible(False)
|
self.resetAction.setVisible(False)
|
||||||
#self.parent.liveController.display.resetVideo()
|
#self.parent.liveController.display.resetVideo()
|
||||||
Receiver.send_message(u'media_reset',
|
Receiver.send_message(u'media_reset',
|
||||||
self.parent.liveController.display)
|
self.parent.liveController)
|
||||||
|
|
||||||
def videobackgroundReplaced(self):
|
def videobackgroundReplaced(self):
|
||||||
"""
|
"""
|
||||||
@ -110,9 +110,8 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
(path, name) = os.path.split(filename)
|
(path, name) = os.path.split(filename)
|
||||||
#self.parent.liveController.display.video(filename, 0, True)
|
|
||||||
Receiver.send_message(u'media_video',
|
Receiver.send_message(u'media_video',
|
||||||
[self.parent.liveController.display, filename, 0, True])
|
[self.parent.liveController, filename, 0, True])
|
||||||
self.resetAction.setVisible(True)
|
self.resetAction.setVisible(True)
|
||||||
else:
|
else:
|
||||||
critical_error_message_box(UiStrings().LiveBGError,
|
critical_error_message_box(UiStrings().LiveBGError,
|
||||||
@ -136,7 +135,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
# self.mediaObject.stop()
|
# self.mediaObject.stop()
|
||||||
# self.mediaObject.clearQueue()
|
# self.mediaObject.clearQueue()
|
||||||
# self.mediaObject.setCurrentSource(Phonon.MediaSource(filename))
|
# self.mediaObject.setCurrentSource(Phonon.MediaSource(filename))
|
||||||
# if not self.mediaStateWait(Phonon.StoppedState):
|
# if not self.mediaStateWait(Phonon.Stopped):
|
||||||
# Due to string freeze, borrow a message from presentations
|
# Due to string freeze, borrow a message from presentations
|
||||||
# This will be corrected in 1.9.6
|
# This will be corrected in 1.9.6
|
||||||
# critical_error_message_box(
|
# critical_error_message_box(
|
||||||
@ -147,7 +146,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
# File too big for processing
|
# File too big for processing
|
||||||
if os.path.getsize(filename) <= 52428800: # 50MiB
|
if os.path.getsize(filename) <= 52428800: # 50MiB
|
||||||
# self.mediaObject.play()
|
# self.mediaObject.play()
|
||||||
# if not self.mediaStateWait(Phonon.PlayingState) \
|
# if not self.mediaStateWait(Phonon.Playing) \
|
||||||
# or self.mediaObject.currentSource().type() \
|
# or self.mediaObject.currentSource().type() \
|
||||||
# == Phonon.MediaSource.Invalid:
|
# == Phonon.MediaSource.Invalid:
|
||||||
# # Due to string freeze, borrow a message from presentations
|
# # Due to string freeze, borrow a message from presentations
|
||||||
@ -213,4 +212,4 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
img = QtGui.QPixmap(u':/media/media_video.png').toImage()
|
img = QtGui.QPixmap(u':/media/media_video.png').toImage()
|
||||||
item_name.setIcon(build_icon(img))
|
item_name.setIcon(build_icon(img))
|
||||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
|
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
|
||||||
self.listView.addItem(item_name)
|
self.listView.addItem(item_name)
|
||||||
|
@ -27,16 +27,32 @@
|
|||||||
|
|
||||||
from PyQt4.phonon import Phonon
|
from PyQt4.phonon import Phonon
|
||||||
|
|
||||||
from openlp.plugins.media.lib import MediaController, MediaStates
|
from openlp.plugins.media.lib import MediaController, MediaState
|
||||||
|
|
||||||
class PhononController(MediaController):
|
class PhononController(MediaController):
|
||||||
"""
|
"""
|
||||||
Specialiced MediaController class
|
Specialiced MediaController class
|
||||||
to reflect Features of the Phonon backend
|
to reflect Features of the Phonon backend
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
self.parent = parent
|
|
||||||
MediaController.__init__(self, parent)
|
MediaController.__init__(self, parent)
|
||||||
|
self.parent = parent
|
||||||
|
self.additional_extensions = {
|
||||||
|
u'audio/ac3': [u'.ac3'],
|
||||||
|
u'audio/flac': [u'.flac'],
|
||||||
|
u'audio/x-m4a': [u'.m4a'],
|
||||||
|
u'audio/midi': [u'.mid', u'.midi'],
|
||||||
|
u'audio/x-mp3': [u'.mp3'],
|
||||||
|
u'audio/mpeg': [u'.mp3', u'.mp2', u'.mpga', u'.mpega', u'.m4a'],
|
||||||
|
u'audio/qcelp': [u'.qcp'],
|
||||||
|
u'audio/x-wma': [u'.wma'],
|
||||||
|
u'audio/x-ms-wma': [u'.wma'],
|
||||||
|
u'video/x-flv': [u'.flv'],
|
||||||
|
u'video/x-matroska': [u'.mpv', u'.mkv'],
|
||||||
|
u'video/x-wmv': [u'.wmv'],
|
||||||
|
u'video/x-ms-wmv': [u'.wmv']}
|
||||||
|
|
||||||
|
|
||||||
def load(self, display, path, volume):
|
def load(self, display, path, volume):
|
||||||
print "load vid in Phonon Controller"
|
print "load vid in Phonon Controller"
|
||||||
@ -47,47 +63,46 @@ class PhononController(MediaController):
|
|||||||
# Need the timer to trigger set the trigger to 200ms
|
# Need the timer to trigger set the trigger to 200ms
|
||||||
# Value taken from web documentation.
|
# Value taken from web documentation.
|
||||||
vol = float(volume) / float(10)
|
vol = float(volume) / float(10)
|
||||||
if display.serviceItem.end_time != 0:
|
|
||||||
display.mediaObject.setTickInterval(200)
|
|
||||||
display.mediaObject.play()
|
|
||||||
display.audio.setVolume(vol)
|
display.audio.setVolume(vol)
|
||||||
self.state = MediaStates.PlayingState
|
|
||||||
|
|
||||||
|
def resize(self, display):
|
||||||
|
display.phononWidget.resize(display.size())
|
||||||
|
|
||||||
def play(self, display):
|
def play(self, display):
|
||||||
|
vol = float(display.parent.volume) / float(10)
|
||||||
|
display.audio.setVolume(vol)
|
||||||
display.mediaObject.play()
|
display.mediaObject.play()
|
||||||
self.state = MediaStates.PlayingState
|
self.state = MediaState.Playing
|
||||||
|
|
||||||
def pause(self, display):
|
def pause(self, display):
|
||||||
display.mediaObject.pause()
|
display.mediaObject.pause()
|
||||||
self.state = MediaStates.PausedState
|
self.state = MediaState.Paused
|
||||||
|
|
||||||
def stop(self, display):
|
def stop(self, display):
|
||||||
display.mediaObject.stop()
|
display.mediaObject.stop()
|
||||||
self.state = MediaStates.StoppedState
|
self.state = MediaState.Stopped
|
||||||
|
|
||||||
|
def volume(self, display, vol):
|
||||||
|
display.audio.setVolume(vol)
|
||||||
|
|
||||||
def seek(self, display, seekVal):
|
def seek(self, display, seekVal):
|
||||||
print "seek"
|
|
||||||
display.mediaObject.seek(seekVal)
|
display.mediaObject.seek(seekVal)
|
||||||
|
|
||||||
def reset(self, display):
|
def reset(self, display):
|
||||||
display.mediaObject.stop()
|
display.mediaObject.stop()
|
||||||
display.mediaObject.clearQueue()
|
display.mediaObject.clearQueue()
|
||||||
display.webView.setVisible(True)
|
|
||||||
display.phononWidget.setVisible(False)
|
display.phononWidget.setVisible(False)
|
||||||
display.phononActive = False
|
#display.webView.setVisible(True)
|
||||||
|
|
||||||
def updateUI(self, display):
|
def update_ui(self, controller, display):
|
||||||
display.parent.seekSlider.setMaximum(display.mediaObject.totalTime())
|
controller.seekSlider.setMaximum(display.mediaObject.totalTime())
|
||||||
if not display.parent.seekSlider.isSliderDown():
|
if not controller.seekSlider.isSliderDown():
|
||||||
display.parent.seekSlider.setSliderPosition(display.mediaObject.currentTime())
|
controller.seekSlider.setSliderPosition(display.mediaObject.currentTime())
|
||||||
# if newState == Phonon.PlayingState \
|
# if newState == Phonon.Playing \
|
||||||
# and oldState != Phonon.PausedState \
|
# and oldState != Phonon.Paused \
|
||||||
# and self.serviceItem.start_time > 0:
|
# and self.serviceItem.start_time > 0:
|
||||||
# # set start time in milliseconds
|
# # set start time in milliseconds
|
||||||
# self.mediaObject.seek(self.serviceItem.start_time * 1000)
|
# self.mediaObject.seek(self.serviceItem.start_time * 1000)
|
||||||
|
|
||||||
pass
|
def get_supported_file_types(self):
|
||||||
|
|
||||||
def getSupportedFileTypes(self):
|
|
||||||
pass
|
pass
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from openlp.plugins.media.lib import MediaController, MediaStates
|
from openlp.plugins.media.lib import MediaController, MediaState
|
||||||
|
|
||||||
class VlcController(MediaController):
|
class VlcController(MediaController):
|
||||||
"""
|
"""
|
||||||
@ -35,8 +35,23 @@ class VlcController(MediaController):
|
|||||||
to reflect Features of the Vlc backend
|
to reflect Features of the Vlc backend
|
||||||
"""
|
"""
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
self.parent = parent
|
|
||||||
MediaController.__init__(self, parent)
|
MediaController.__init__(self, parent)
|
||||||
|
self.parent = parent
|
||||||
|
self.supported_file_types = ['avi']
|
||||||
|
self.additional_extensions = {
|
||||||
|
u'audio/ac3': [u'.ac3'],
|
||||||
|
u'audio/flac': [u'.flac'],
|
||||||
|
u'audio/x-m4a': [u'.m4a'],
|
||||||
|
u'audio/midi': [u'.mid', u'.midi'],
|
||||||
|
u'audio/x-mp3': [u'.mp3'],
|
||||||
|
u'audio/mpeg': [u'.mp3', u'.mp2', u'.mpga', u'.mpega', u'.m4a'],
|
||||||
|
u'audio/qcelp': [u'.qcp'],
|
||||||
|
u'audio/x-wma': [u'.wma'],
|
||||||
|
u'audio/x-ms-wma': [u'.wma'],
|
||||||
|
u'video/x-flv': [u'.flv'],
|
||||||
|
u'video/x-matroska': [u'.mpv', u'.mkv'],
|
||||||
|
u'video/x-wmv': [u'.wmv'],
|
||||||
|
u'video/x-ms-wmv': [u'.wmv']}
|
||||||
|
|
||||||
def load(self, display, path, volume):
|
def load(self, display, path, volume):
|
||||||
print "load vid in Vlc Controller"
|
print "load vid in Vlc Controller"
|
||||||
@ -61,34 +76,38 @@ class VlcController(MediaController):
|
|||||||
display.vlcMediaPlayer.set_hwnd(int(display.vlcWidget.winId()))
|
display.vlcMediaPlayer.set_hwnd(int(display.vlcWidget.winId()))
|
||||||
elif sys.platform == "darwin": # for MacOS
|
elif sys.platform == "darwin": # for MacOS
|
||||||
display.vlcMediaPlayer.set_agl(int(display.vlcWidget.winId()))
|
display.vlcMediaPlayer.set_agl(int(display.vlcWidget.winId()))
|
||||||
# start playing
|
|
||||||
self.play(display)
|
def resize(self, display):
|
||||||
self.state = MediaStates.PlayingState
|
display.vlcWidget.resize(display.size())
|
||||||
|
|
||||||
def play(self, display):
|
def play(self, display):
|
||||||
display.vlcMediaPlayer.play()
|
display.vlcMediaPlayer.play()
|
||||||
self.state = MediaStates.PlayingState
|
self.state = MediaState.Playing
|
||||||
|
|
||||||
def pause(self, display):
|
def pause(self, display):
|
||||||
display.vlcMediaPlayer.pause()
|
display.vlcMediaPlayer.pause()
|
||||||
self.state = MediaStates.PausedState
|
self.state = MediaState.Paused
|
||||||
|
|
||||||
def stop(self, display):
|
def stop(self, display):
|
||||||
display.vlcMediaPlayer.stop()
|
display.vlcMediaPlayer.stop()
|
||||||
self.state = MediaStates.StoppedState
|
self.state = MediaState.Stopped
|
||||||
|
|
||||||
|
def volume(self, display, vol):
|
||||||
|
pass
|
||||||
|
|
||||||
def seek(self, display, seekVal):
|
def seek(self, display, seekVal):
|
||||||
if display.vlcMediaPlayer.is_seekable():
|
if display.vlcMediaPlayer.is_seekable():
|
||||||
display.vlcMediaPlayer.set_position(seekVal/1000.0)
|
display.vlcMediaPlayer.set_position(seekVal/1000.0)
|
||||||
|
|
||||||
def reset(self, display):
|
def reset(self, display):
|
||||||
pass
|
display.vlcWidget.setVisible(False)
|
||||||
|
#display.webView.setVisible(True)
|
||||||
|
|
||||||
def updateUI(self, display):
|
def update_ui(self, controller, display):
|
||||||
display.parent.seekSlider.setMaximum(1000)
|
controller.seekSlider.setMaximum(1000)
|
||||||
if not display.parent.seekSlider.isSliderDown():
|
if not controller.seekSlider.isSliderDown():
|
||||||
currentPos = display.vlcMediaPlayer.get_position() * 1000
|
currentPos = display.vlcMediaPlayer.get_position() * 1000
|
||||||
display.parent.seekSlider.setSliderPosition(currentPos)
|
controller.seekSlider.setSliderPosition(currentPos)
|
||||||
|
|
||||||
def getSupportedFileTypes(self):
|
def get_supported_file_types(self):
|
||||||
pass
|
pass
|
||||||
|
@ -25,17 +25,20 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
from openlp.plugins.media.lib import MediaController, MediaStates
|
from openlp.plugins.media.lib import MediaController, MediaState
|
||||||
|
|
||||||
class WebkitController(MediaController):
|
class WebkitController(MediaController):
|
||||||
"""
|
"""
|
||||||
Specialiced MediaController class
|
Specialiced MediaController class
|
||||||
to reflect Features of the QtWebkit backend
|
to reflect Features of the QtWebkit backend
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
self.parent = parent
|
|
||||||
MediaController.__init__(self, parent)
|
MediaController.__init__(self, parent)
|
||||||
|
self.parent = parent
|
||||||
self.isFlash = False
|
self.isFlash = False
|
||||||
|
self.additional_extensions = {
|
||||||
|
u'video/shockwave': [u'.swf']}
|
||||||
|
|
||||||
def load(self, display, path, volume):
|
def load(self, display, path, volume):
|
||||||
print "load vid in Webkit Controller"
|
print "load vid in Webkit Controller"
|
||||||
@ -48,48 +51,60 @@ class WebkitController(MediaController):
|
|||||||
(path.replace(u'\\', u'\\\\'))
|
(path.replace(u'\\', u'\\\\'))
|
||||||
self.isFlash = True
|
self.isFlash = True
|
||||||
else:
|
else:
|
||||||
js = u'show_video("init", "%s", %s, false); show_video("play");' % \
|
js = u'show_video("init", "%s", %s, false);' % \
|
||||||
(path.replace(u'\\', u'\\\\'), str(vol))
|
(path.replace(u'\\', u'\\\\'), str(vol))
|
||||||
self.isFlash = False
|
self.isFlash = False
|
||||||
display.frame.evaluateJavaScript(js)
|
display.frame.evaluateJavaScript(js)
|
||||||
self.state = MediaStates.PlayingState
|
|
||||||
|
def resize(self, display, controller):
|
||||||
|
if display == controller.previewDisplay:
|
||||||
|
print display.size()
|
||||||
|
display.webView.resize(display.size())
|
||||||
|
|
||||||
def play(self, display):
|
def play(self, display):
|
||||||
if self.isFlash:
|
if self.isFlash:
|
||||||
display.frame.evaluateJavaScript(u'show_flash("play","");')
|
display.frame.evaluateJavaScript(u'show_flash("play","");')
|
||||||
else:
|
else:
|
||||||
display.frame.evaluateJavaScript(u'show_video("play");')
|
display.frame.evaluateJavaScript(u'show_video("play");')
|
||||||
self.state = MediaStates.PlayingState
|
self.state = MediaState.Playing
|
||||||
|
|
||||||
def pause(self, display):
|
def pause(self, display):
|
||||||
if self.isFlash:
|
if self.isFlash:
|
||||||
display.frame.evaluateJavaScript(u'show_flash("pause","");')
|
display.frame.evaluateJavaScript(u'show_flash("pause","");')
|
||||||
else:
|
else:
|
||||||
display.frame.evaluateJavaScript(u'show_video("pause");')
|
display.frame.evaluateJavaScript(u'show_video("pause");')
|
||||||
self.state = MediaStates.PausedState
|
self.state = MediaState.Paused
|
||||||
|
|
||||||
def stop(self, display):
|
def stop(self, display):
|
||||||
if self.isFlash:
|
if self.isFlash:
|
||||||
display.frame.evaluateJavaScript(u'show_flash("stop","");')
|
display.frame.evaluateJavaScript(u'show_flash("stop","");')
|
||||||
else:
|
else:
|
||||||
display.frame.evaluateJavaScript(u'show_video("stop");')
|
display.frame.evaluateJavaScript(u'show_video("stop");')
|
||||||
self.state = MediaStates.StoppedState
|
self.state = MediaState.Stopped
|
||||||
|
|
||||||
|
def volume(self, display, vol):
|
||||||
|
if not self.isFlash:
|
||||||
|
display.frame.evaluateJavaScript(u'show_video(null, null, %s);' %
|
||||||
|
str(vol))
|
||||||
|
|
||||||
def seek(self, display, seekVal):
|
def seek(self, display, seekVal):
|
||||||
if not self.isFlash:
|
if not self.isFlash:
|
||||||
print seekVal, float(seekVal)/1000
|
|
||||||
display.frame.evaluateJavaScript(u'show_video("seek", "%f");' % (float(seekVal)/1000))
|
display.frame.evaluateJavaScript(u'show_video("seek", "%f");' % (float(seekVal)/1000))
|
||||||
|
|
||||||
def reset(self, display):
|
def reset(self, display):
|
||||||
display.frame.evaluateJavaScript(u'show_video("close");')
|
if self.isFlash:
|
||||||
|
display.frame.evaluateJavaScript(u'show_flash("close","");')
|
||||||
|
else:
|
||||||
|
display.frame.evaluateJavaScript(u'show_video("close");')
|
||||||
|
|
||||||
def updateUI(self, display):
|
def update_ui(self, controller, display):
|
||||||
|
return
|
||||||
if not self.isFlash:
|
if not self.isFlash:
|
||||||
length = display.frame.evaluateJavaScript(u'show_video("length");')
|
length = display.frame.evaluateJavaScript(u'show_video("length");')
|
||||||
display.parent.seekSlider.setMaximum(length.toFloat()[0]*1000)
|
controller.seekSlider.setMaximum(length.toFloat()[0]*1000)
|
||||||
if not display.parent.seekSlider.isSliderDown():
|
if not controller.seekSlider.isSliderDown():
|
||||||
currentTime = display.frame.evaluateJavaScript(u'show_video("currentTime");')
|
currentTime = display.frame.evaluateJavaScript(u'show_video("currentTime");')
|
||||||
display.parent.seekSlider.setSliderPosition(currentTime.toFloat()[0]*1000)
|
controller.seekSlider.setSliderPosition(currentTime.toFloat()[0]*1000)
|
||||||
|
|
||||||
def getSupportedFileTypes(self):
|
def get_supported_file_types(self):
|
||||||
pass
|
pass
|
||||||
|
@ -123,3 +123,12 @@ class MediaPlugin(Plugin):
|
|||||||
'Add the selected Media to the service')
|
'Add the selected Media to the service')
|
||||||
}
|
}
|
||||||
self.setPluginUiTextStrings(tooltips)
|
self.setPluginUiTextStrings(tooltips)
|
||||||
|
|
||||||
|
def finalise(self):
|
||||||
|
"""
|
||||||
|
Time to tidy up on exit
|
||||||
|
"""
|
||||||
|
log.info(u'Media Finalising')
|
||||||
|
self.mediaManager.Timer.stop()
|
||||||
|
self.mediaManager.video_reset(self.previewController)
|
||||||
|
self.mediaManager.video_reset(self.liveController)
|
||||||
|
Loading…
Reference in New Issue
Block a user