1
# -*- coding: utf-8 -*-
2
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
4
###############################################################################
5
# OpenLP - Open Source Lyrics Projection #
6
# --------------------------------------------------------------------------- #
7
# Copyright (c) 2008-2011 Raoul Snyman #
8
# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan #
9
# Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, #
10
# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias #
11
# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
12
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund #
13
# --------------------------------------------------------------------------- #
14
# This program is free software; you can redistribute it and/or modify it #
15
# under the terms of the GNU General Public License as published by the Free #
16
# Software Foundation; version 2 of the License. #
18
# This program is distributed in the hope that it will be useful, but WITHOUT #
19
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
20
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
23
# You should have received a copy of the GNU General Public License along #
24
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
25
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
26
###############################################################################
28
from openlp.core.ui.media import MediaState
30
class MediaPlayer(object):
32
This is the base class media Player class to provide OpenLP with a pluggable media display
36
def __init__(self, parent, name=u'media_player'):
39
self.available = self.check_available()
41
self.canBackground = False
42
self.canFolder = False
43
self.state = MediaState.Off
44
self.hasOwnWidget = False
45
self.audio_extensions_list = []
46
self.video_extensions_list = []
48
def check_available(self):
50
Player is available on this machine
54
def setup(self, display):
56
Create the related widgets for the current display
60
def load(self, display):
62
Load a new media file and check if it is valid
66
def resize(self, display):
68
If the main display size or position is changed, the media widgets
73
def play(self, display):
75
Starts playing of current Media File
79
def pause(self, display):
81
Pause of current Media File
85
def stop(self, display):
87
Stop playing of current Media File
91
def volume(self, display, vol):
93
Change volume of current Media File
97
def seek(self, display, seekVal):
99
Change playing position of current Media File
103
def reset(self, display):
105
Remove the current loaded video
109
def set_visible(self, display, status):
111
Show/Hide the media widgets
115
def update_ui(self, display):
117
Do some ui related stuff (e.g. update the seek slider)
121
def get_media_display_css(self):
123
Add css style sheets to htmlbuilder
127
def get_media_display_javascript(self):
129
Add javascript functions to htmlbuilder
133
def get_media_display_html(self):
135
Add html code to htmlbuilder