diff --git a/.bzrignore b/.bzrignore
index adae3204e..d806b6d44 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -14,6 +14,7 @@ documentation/build/html
*.e4*
*eric[1-9]project
.git
+env
# Git files
.gitignore
htmlcov
diff --git a/openlp/core/ui/media/__init__.py b/openlp/core/ui/media/__init__.py
index d60046a16..16ff3d2c3 100644
--- a/openlp/core/ui/media/__init__.py
+++ b/openlp/core/ui/media/__init__.py
@@ -48,6 +48,7 @@ class MediaType(object):
CD = 3
DVD = 4
Folder = 5
+ Stream = 6
class ItemMediaInfo(object):
diff --git a/openlp/core/ui/media/mediatab.py b/openlp/core/ui/media/mediatab.py
new file mode 100644
index 000000000..315bc2bef
--- /dev/null
+++ b/openlp/core/ui/media/mediatab.py
@@ -0,0 +1,259 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2018 OpenLP Developers #
+# --------------------------------------------------------------------------- #
+# 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 #
+###############################################################################
+"""
+The :mod:`~openlp.core.ui.media.playertab` module holds the configuration tab for the media stuff.
+"""
+import platform
+
+from PyQt5 import QtCore, QtWidgets
+
+from openlp.core.common.i18n import UiStrings, translate
+from openlp.core.common.registry import Registry
+from openlp.core.common.settings import Settings
+from openlp.core.lib.settingstab import SettingsTab
+from openlp.core.lib.ui import create_button
+from openlp.core.ui.icons import UiIcons
+from openlp.core.widgets.buttons import ColorButton
+
+LINUX_STREAM = 'v4l2:// :v4l-vdev="/dev/video0"'
+WIN_STREAM = 'dshow:// :dshow-vdev='
+
+
+class MediaTab(SettingsTab):
+ """
+ MediaTab is the Media settings tab in the settings dialog.
+ """
+ def __init__(self, parent):
+ """
+ Constructor
+ """
+ # self.media_players = Registry().get('media_controller').media_players
+ # self.saved_used_players = None
+ self.icon_path = UiIcons().video
+ player_translated = translate('OpenLP.MediaTab', 'Media')
+ super(MediaTab, self).__init__(parent, 'Media', player_translated)
+
+ def setupUi(self):
+ """
+ Set up the UI
+ """
+ self.setObjectName('MediaTab')
+ super(MediaTab, self).setupUi()
+ self.live_media_group_box = QtWidgets.QGroupBox(self.left_column)
+ self.live_media_group_box.setObjectName('live_media_group_box')
+ self.media_layout = QtWidgets.QVBoxLayout(self.live_media_group_box)
+ self.media_layout.setObjectName('live_media_layout')
+ self.auto_start_check_box = QtWidgets.QCheckBox(self.live_media_group_box)
+ self.auto_start_check_box.setObjectName('auto_start_check_box')
+ self.media_layout.addWidget(self.auto_start_check_box)
+ self.left_layout.addWidget(self.live_media_group_box)
+ self.stream_media_group_box = QtWidgets.QGroupBox(self.left_column)
+ self.stream_media_group_box.setObjectName('stream_media_group_box')
+ self.media_layout = QtWidgets.QVBoxLayout(self.stream_media_group_box)
+ self.media_layout.setObjectName('media_layout')
+ self.left_layout.addWidget(self.stream_media_group_box)
+ self.left_layout.addStretch()
+ self.right_layout.addStretch()
+ # self.background_color_group_box = QtWidgets.QGroupBox(self.left_column)
+ # self.background_color_group_box.setObjectName('background_color_group_box')
+ # self.form_layout = QtWidgets.QFormLayout(self.background_color_group_box)
+ # self.form_layout.setObjectName('form_layout')
+ # self.color_layout = QtWidgets.QHBoxLayout()
+ # self.background_color_label = QtWidgets.QLabel(self.background_color_group_box)
+ # self.background_color_label.setObjectName('background_color_label')
+ # self.color_layout.addWidget(self.background_color_label)
+ # self.background_color_button = ColorButton(self.background_color_group_box)
+ # self.background_color_button.setObjectName('background_color_button')
+ # self.color_layout.addWidget(self.background_color_button)
+ # self.form_layout.addRow(self.color_layout)
+ # self.information_label = QtWidgets.QLabel(self.background_color_group_box)
+ # self.information_label.setObjectName('information_label')
+ # self.information_label.setWordWrap(True)
+ # self.form_layout.addRow(self.information_label)
+ # self.left_layout.addWidget(self.background_color_group_box)
+ # self.right_column.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
+ # self.media_player_group_box = QtWidgets.QGroupBox(self.left_column)
+ # self.media_player_group_box.setObjectName('media_player_group_box')
+ # self.media_player_layout = QtWidgets.QVBoxLayout(self.media_player_group_box)
+ # self.media_player_layout.setObjectName('media_player_layout')
+ # self.player_check_boxes = {}
+ # self.left_layout.addWidget(self.media_player_group_box)
+ # self.player_order_group_box = QtWidgets.QGroupBox(self.left_column)
+ # self.player_order_group_box.setObjectName('player_order_group_box')
+ # self.player_order_layout = QtWidgets.QHBoxLayout(self.player_order_group_box)
+ # self.player_order_layout.setObjectName('player_order_layout')
+ # self.player_order_list_widget = QtWidgets.QListWidget(self.player_order_group_box)
+ # size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ # size_policy.setHorizontalStretch(0)
+ # size_policy.setVerticalStretch(0)
+ # size_policy.setHeightForWidth(self.player_order_list_widget.sizePolicy().hasHeightForWidth())
+ # self.player_order_list_widget.setSizePolicy(size_policy)
+ # self.player_order_list_widget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
+ # self.player_order_list_widget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
+ # self.player_order_list_widget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
+ # self.player_order_list_widget.setObjectName('player_order_list_widget')
+ # self.player_order_layout.addWidget(self.player_order_list_widget)
+ # self.ordering_button_layout = QtWidgets.QVBoxLayout()
+ # self.ordering_button_layout.setObjectName('ordering_button_layout')
+ # self.ordering_button_layout.addStretch(1)
+ # self.ordering_up_button = create_button(self, 'ordering_up_button', role='up',
+ # click=self.on_up_button_clicked)
+ # self.ordering_down_button = create_button(self, 'ordering_down_button', role='down',
+ # click=self.on_down_button_clicked)
+ # self.ordering_button_layout.addWidget(self.ordering_up_button)
+ # self.ordering_button_layout.addWidget(self.ordering_down_button)
+ # self.ordering_button_layout.addStretch(1)
+ # self.player_order_layout.addLayout(self.ordering_button_layout)
+ # self.left_layout.addWidget(self.player_order_group_box)
+ self.left_layout.addStretch()
+ self.right_layout.addStretch()
+ # # Signals and slots
+ # self.background_color_button.colorChanged.connect(self.on_background_color_changed)
+
+ def retranslateUi(self):
+ """
+ Translate the UI on the fly
+ """
+ self.live_media_group_box.setTitle(translate('MediaPlugin.MediaTab', 'Live Media'))
+ self.stream_media_group_box.setTitle(translate('MediaPlugin.MediaTab', 'Stream Media'))
+ self.auto_start_check_box.setText(translate('MediaPlugin.MediaTab', 'Start automatically'))
+
+ def on_background_color_changed(self, color):
+ """
+ Set the background color
+
+ :param color: The color to be set.
+ """
+ self.background_color = color
+
+ def on_player_check_box_changed(self, check_state):
+ """
+ Add or remove players depending on their status
+
+ :param check_state: The requested status.
+ """
+ player = self.sender().player_name
+ if check_state == QtCore.Qt.Checked:
+ if player not in self.used_players:
+ self.used_players.append(player)
+ else:
+ if player in self.used_players:
+ self.used_players.remove(player)
+ self.update_player_list()
+
+ def update_player_list(self):
+ """
+ Update the list of media players
+ """
+ self.player_order_list_widget.clear()
+ for player in self.used_players:
+ if player in list(self.player_check_boxes.keys()):
+ if len(self.used_players) == 1:
+ # At least one media player has to stay active
+ self.player_check_boxes['%s' % player].setEnabled(False)
+ else:
+ self.player_check_boxes['%s' % player].setEnabled(True)
+ self.player_order_list_widget.addItem(self.media_players[str(player)].original_name)
+
+ def on_up_button_clicked(self):
+ """
+ Move a media player up in the order
+ """
+ row = self.player_order_list_widget.currentRow()
+ if row <= 0:
+ return
+ item = self.player_order_list_widget.takeItem(row)
+ self.player_order_list_widget.insertItem(row - 1, item)
+ self.player_order_list_widget.setCurrentRow(row - 1)
+ self.used_players.insert(row - 1, self.used_players.pop(row))
+
+ def on_down_button_clicked(self):
+ """
+ Move a media player down in the order
+ """
+ row = self.player_order_list_widget.currentRow()
+ if row == -1 or row > self.player_order_list_widget.count() - 1:
+ return
+ item = self.player_order_list_widget.takeItem(row)
+ self.player_order_list_widget.insertItem(row + 1, item)
+ self.player_order_list_widget.setCurrentRow(row + 1)
+ self.used_players.insert(row + 1, self.used_players.pop(row))
+
+ def load(self):
+ """
+ Load the settings
+ """
+ self.auto_start_check_box.setChecked(Settings().value(self.settings_section + '/media auto start'))
+ # if self.saved_used_players:
+ # self.used_players = self.saved_used_players
+ # # self.used_players = get_media_players()[0]
+ # self.saved_used_players = self.used_players
+ # settings = Settings()
+ # settings.beginGroup(self.settings_section)
+ # self.update_player_list()
+ # self.background_color = settings.value('background color')
+ # self.initial_color = self.background_color
+ # settings.endGroup()
+ # self.background_color_button.color = self.background_color
+
+ def save(self):
+ """
+ Save the settings
+ """
+ setting_key = self.settings_section + '/media auto start'
+ if Settings().value(setting_key) != self.auto_start_check_box.checkState():
+ Settings().setValue(setting_key, self.auto_start_check_box.checkState())
+ # settings = Settings()
+ # settings.beginGroup(self.settings_section)
+ # settings.setValue('background color', self.background_color)
+ # settings.endGroup()
+ # old_players, override_player = get_media_players()
+ # if self.used_players != old_players:
+ # # clean old Media stuff
+ # set_media_players(self.used_players, override_player)
+ # self.settings_form.register_post_process('mediaitem_suffix_reset')
+ # self.settings_form.register_post_process('mediaitem_media_rebuild')
+ # self.settings_form.register_post_process('config_screen_changed')
+
+ def post_set_up(self, post_update=False):
+ """
+ Late setup for players as the MediaController has to be initialised first.
+
+ :param post_update: Indicates if called before or after updates.
+ """
+ pass
+ # for key, player in self.media_players.items():
+ # player = self.media_players[key]
+ # checkbox = MediaQCheckBox(self.media_player_group_box)
+ # checkbox.setEnabled(player.available)
+ # checkbox.setObjectName(player.name + '_check_box')
+ # checkbox.setToolTip(player.get_info())
+ # checkbox.set_player_name(player.name)
+ # self.player_check_boxes[player.name] = checkbox
+ # checkbox.stateChanged.connect(self.on_player_check_box_changed)
+ # self.media_player_layout.addWidget(checkbox)
+ # if player.available and player.name in self.used_players:
+ # checkbox.setChecked(True)
+ # else:
+ # checkbox.setChecked(False)
+ # self.update_player_list()
+ # self.retranslate_players()
diff --git a/openlp/core/ui/media/systemplayer.py b/openlp/core/ui/media/systemplayer.py
deleted file mode 100644
index 063c9acea..000000000
--- a/openlp/core/ui/media/systemplayer.py
+++ /dev/null
@@ -1,331 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2018 OpenLP Developers #
-# --------------------------------------------------------------------------- #
-# 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 #
-###############################################################################
-"""
-The :mod:`~openlp.core.ui.media.systemplayer` contains the system (aka QtMultimedia) player component.
-"""
-import functools
-import logging
-import mimetypes
-
-from PyQt5 import QtCore, QtMultimedia, QtMultimediaWidgets
-
-from openlp.core.common.i18n import translate
-from openlp.core.ui.media import MediaState
-from openlp.core.ui.media.mediaplayer import MediaPlayer
-from openlp.core.threading import ThreadWorker, run_thread, is_thread_finished
-
-log = logging.getLogger(__name__)
-
-ADDITIONAL_EXT = {
- 'audio/ac3': ['.ac3'],
- 'audio/flac': ['.flac'],
- 'audio/x-m4a': ['.m4a'],
- 'audio/midi': ['.mid', '.midi'],
- 'audio/x-mp3': ['.mp3'],
- 'audio/mpeg': ['.mp3', '.mp2', '.mpga', '.mpega', '.m4a'],
- 'audio/qcelp': ['.qcp'],
- 'audio/x-wma': ['.wma'],
- 'audio/x-ms-wma': ['.wma'],
- 'video/x-flv': ['.flv'],
- 'video/x-matroska': ['.mpv', '.mkv'],
- 'video/x-wmv': ['.wmv'],
- 'video/x-mpg': ['.mpg'],
- 'video/mpeg': ['.mp4', '.mts', '.mov'],
- 'video/x-ms-wmv': ['.wmv']
-}
-
-
-class SystemPlayer(MediaPlayer):
- """
- A specialised version of the MediaPlayer class, which provides a QtMultimedia display.
- """
-
- def __init__(self, parent):
- """
- Constructor
- """
- super(SystemPlayer, self).__init__(parent, 'system')
- self.original_name = 'System'
- self.display_name = '&System'
- self.parent = parent
- self.additional_extensions = ADDITIONAL_EXT
- self.media_player = QtMultimedia.QMediaPlayer(None, QtMultimedia.QMediaPlayer.VideoSurface)
- mimetypes.init()
- media_service = self.media_player.service()
- log.info(media_service.__class__.__name__)
- # supportedMimeTypes doesn't return anything on Linux and Windows and
- # the mimetypes it returns on Mac OS X may not be playable.
- supported_codecs = self.media_player.supportedMimeTypes()
- for mime_type in supported_codecs:
- mime_type = str(mime_type)
- log.info(mime_type)
- if mime_type.startswith('audio/'):
- self._add_to_list(self.audio_extensions_list, mime_type)
- elif mime_type.startswith('video/'):
- self._add_to_list(self.video_extensions_list, mime_type)
-
- def _add_to_list(self, mime_type_list, mime_type):
- """
- Add mimetypes to the provided list
- """
- # Add all extensions which mimetypes provides us for supported types.
- extensions = mimetypes.guess_all_extensions(mime_type)
- for extension in extensions:
- ext = '*%s' % extension
- if ext not in mime_type_list:
- mime_type_list.append(ext)
- log.info('MediaPlugin: %s extensions: %s', mime_type, ' '.join(extensions))
-
- def disconnect_slots(self, signal):
- """
- Safely disconnect the slots from `signal`
- """
- try:
- signal.disconnect()
- except TypeError:
- # If disconnect() is called on a signal without slots, it throws a TypeError
- pass
-
- def setup(self, display):
- """
- Set up the player widgets
- :param display:
- """
- display.video_widget = QtMultimediaWidgets.QVideoWidget(display)
- display.video_widget.resize(display.size())
- display.media_player = QtMultimedia.QMediaPlayer(display)
- display.media_player.setVideoOutput(display.video_widget)
- display.video_widget.raise_()
- display.video_widget.hide()
- self.has_own_widget = True
-
- def check_available(self):
- """
- Check if the player is available
- """
- return True
-
- def load(self, display):
- """
- Load a video into the display
-
- :param display: The display where the media is
- """
- log.debug('load vid in System Controller')
- controller = display.controller
- volume = controller.media_info.volume
- path = controller.media_info.file_info.absoluteFilePath()
- # Check if file is playable due to mimetype filters being nonexistent on Linux and Windows
- if self.check_media(path):
- display.media_player.setMedia(QtMultimedia.QMediaContent(QtCore.QUrl.fromLocalFile(path)))
- self.volume(display, volume)
- return True
- else:
- return False
-
- def resize(self, display):
- """
- Resize the display
-
- :param display: The display where the media is
- """
- display.video_widget.resize(display.size())
-
- def play(self, display):
- """
- Play the current media item
-
- :param display: The display where the media is
- """
- log.info('Play the current item')
- controller = display.controller
- start_time = 0
- if display.controller.is_live:
- if self.get_live_state() != QtMultimedia.QMediaPlayer.PausedState and controller.media_info.start_time > 0:
- start_time = controller.media_info.start_time
- else:
- if self.get_preview_state() != QtMultimedia.QMediaPlayer.PausedState and \
- controller.media_info.start_time > 0:
- start_time = controller.media_info.start_time
- display.media_player.play()
- if start_time > 0:
- self.seek(display, controller.media_info.start_time * 1000)
- self.volume(display, controller.media_info.volume)
- self.disconnect_slots(display.media_player.durationChanged)
- display.media_player.durationChanged.connect(functools.partial(self.set_duration, controller))
- self.set_state(MediaState.Playing, display)
- display.video_widget.raise_()
- return True
-
- def pause(self, display):
- """
- Pause the current media item
-
- :param display: The display where the media is
- """
- display.media_player.pause()
- if display.controller.is_live:
- if self.get_live_state() == QtMultimedia.QMediaPlayer.PausedState:
- self.set_state(MediaState.Paused, display)
- else:
- if self.get_preview_state() == QtMultimedia.QMediaPlayer.PausedState:
- self.set_state(MediaState.Paused, display)
-
- def stop(self, display):
- """
- Stop the current media item
-
- :param display: The display where the media is
- """
- display.media_player.stop()
- self.set_visible(display, False)
- self.set_state(MediaState.Stopped, display)
-
- def volume(self, display, volume):
- """
- Set the volume
-
- :param display: The display where the media is
- :param volume: The volume to be set
- """
- if display.has_audio:
- display.media_player.setVolume(volume)
-
- def seek(self, display, seek_value):
- """
- Go to a particular point in the current media item
-
- :param display: The display where the media is
- :param seek_value: The where to seek to
- """
- display.media_player.setPosition(seek_value)
-
- def reset(self, display):
- """
- Reset the media player
-
- :param display: The display where the media is
- """
- display.media_player.stop()
- display.media_player.setMedia(QtMultimedia.QMediaContent())
- self.set_visible(display, False)
- display.video_widget.setVisible(False)
- self.set_state(MediaState.Off, display)
-
- def set_visible(self, display, status):
- """
- Set the visibility of the widget
-
- :param display: The display where the media is
- :param status: The visibility status to be set
- """
- if self.has_own_widget:
- display.video_widget.setVisible(status)
-
- @staticmethod
- def set_duration(controller, duration):
- """
-
- :param controller: the controller displaying the media
- :param duration: how long is the media
- :return:
- """
- controller.seek_slider.setMaximum(controller.media_info.length)
-
- def update_ui(self, display):
- """
- Update the UI
-
- :param display: The display where the media is
- """
- if display.media_player.state() == QtMultimedia.QMediaPlayer.PausedState and self.state != MediaState.Paused:
- self.pause(display)
- controller = display.controller
- if controller.media_info.end_time > 0:
- if display.media_player.position() > controller.media_info.end_time:
- self.stop(display)
- self.set_visible(display, False)
- if not controller.seek_slider.isSliderDown():
- controller.seek_slider.blockSignals(True)
- controller.seek_slider.setSliderPosition(display.media_player.position())
- controller.seek_slider.blockSignals(False)
-
- def get_media_display_css(self):
- """
- Add css style sheets to htmlbuilder
- """
- return ''
-
- def get_info(self):
- """
- Return some info about this player
- """
- return (translate('Media.player', 'This media player uses your operating system '
- 'to provide media capabilities.') +
- '
' + translate('Media.player', 'Audio') +
- '
' + str(self.audio_extensions_list) +
- '
' + translate('Media.player', 'Video') +
- '
' + str(self.video_extensions_list) + '
')
-
- def check_media(self, path):
- """
- Check if a file can be played
- Uses a separate QMediaPlayer in a thread
-
- :param path: Path to file to be checked
- :return: True if file can be played otherwise False
- """
- check_media_worker = CheckMediaWorker(path)
- check_media_worker.setVolume(0)
- run_thread(check_media_worker, 'check_media')
- while not is_thread_finished('check_media'):
- self.application.processEvents()
- return check_media_worker.result
-
-
-class CheckMediaWorker(QtMultimedia.QMediaPlayer, ThreadWorker):
- """
- Class used to check if a media file is playable
- """
- def __init__(self, path):
- super(CheckMediaWorker, self).__init__(None, QtMultimedia.QMediaPlayer.VideoSurface)
- self.path = path
-
- def start(self):
- """
- Start the thread worker
- """
- self.result = None
- self.error.connect(functools.partial(self.signals, 'error'))
- self.mediaStatusChanged.connect(functools.partial(self.signals, 'media'))
- self.setMedia(QtMultimedia.QMediaContent(QtCore.QUrl.fromLocalFile(self.path)))
- self.play()
-
- def signals(self, origin, status):
- if origin == 'media' and status == self.BufferedMedia:
- self.result = True
- self.stop()
- self.quit.emit()
- elif origin == 'error' and status != self.NoError:
- self.result = False
- self.stop()
- self.quit.emit()
diff --git a/openlp/core/ui/media/vlcplayer.py b/openlp/core/ui/media/vlcplayer.py
index 417936d24..4f55bc4e9 100644
--- a/openlp/core/ui/media/vlcplayer.py
+++ b/openlp/core/ui/media/vlcplayer.py
@@ -223,6 +223,8 @@ class VlcPlayer(MediaPlayer):
if not audio_cd_tracks or audio_cd_tracks.count() < 1:
return False
display.vlc_media = audio_cd_tracks.item_at_index(controller.media_info.title_track)
+ elif controller.media_info.media_type == MediaType.Stream:
+ display.vlc_media = display.vlc_instance.media_new_location("XXXXXXXXXXXXX")
else:
display.vlc_media = display.vlc_instance.media_new_path(path)
# put the media in the media player
diff --git a/openlp/core/ui/media/webkitplayer.py b/openlp/core/ui/media/webkitplayer.py
deleted file mode 100644
index 5845d655e..000000000
--- a/openlp/core/ui/media/webkitplayer.py
+++ /dev/null
@@ -1,312 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2018 OpenLP Developers #
-# --------------------------------------------------------------------------- #
-# 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 #
-###############################################################################
-"""
-The :mod:`~openlp.core.ui.media.webkit` module contains our WebKit video player
-"""
-import logging
-
-from PyQt5 import QtGui, QtWebKitWidgets
-
-from openlp.core.common.i18n import translate
-from openlp.core.common.settings import Settings
-from openlp.core.ui.media import MediaState
-from openlp.core.ui.media.mediaplayer import MediaPlayer
-
-log = logging.getLogger(__name__)
-
-VIDEO_CSS = """
-#videobackboard {
- z-index:3;
- background-color: %(bgcolor)s;
-}
-#video {
- background-color: %(bgcolor)s;
- z-index:4;
-}
-"""
-
-VIDEO_JS = """
- function show_video(state, path, volume, variable_value){
- // Sometimes video.currentTime stops slightly short of video.duration and video.ended is intermittent!
-
- var video = document.getElementById('video');
- if(volume != null){
- video.volume = volume;
- }
- switch(state){
- case 'load':
- video.src = 'file:///' + path;
- video.load();
- break;
- case 'play':
- video.play();
- break;
- case 'pause':
- video.pause();
- break;
- case 'stop':
- show_video('pause');
- video.currentTime = 0;
- break;
- case 'close':
- show_video('stop');
- video.src = '';
- break;
- case 'length':
- return video.duration;
- case 'current_time':
- return video.currentTime;
- case 'seek':
- video.currentTime = variable_value;
- break;
- case 'isEnded':
- return video.ended;
- case 'setVisible':
- video.style.visibility = variable_value;
- break;
- case 'setBackBoard':
- var back = document.getElementById('videobackboard');
- back.style.visibility = variable_value;
- break;
- }
- }
-"""
-
-VIDEO_HTML = """
-