mediacontroller

The mediacontroller module contains a base class for media components and other widgets related to playing media, such as sliders.

class openlp.core.ui.media.mediacontroller.MediaController(parent=None)[source]

Bases: openlp.core.common.registrymixin.RegistryMixin, openlp.core.common.openlpmixin.OpenLPMixin, openlp.core.common.registryproperties.RegistryProperties

The implementation of the Media Controller. The Media Controller adds an own class for every Player. Currently these are QtWebkit, Phonon and Vlc. display_controllers are an array of controllers keyed on the slidecontroller or plugin which built them.

ControllerType is the class containing the key values.

media_players are an array of media players keyed on player name.

current_media_players is an array of player instances keyed on ControllerType.

bootstrap_initialise()[source]

Check to see if we have any media Player’s available.

finalise()[source]

Reset all the media controllers when OpenLP shuts down

get_media_display_css()[source]

Add css style sheets to htmlbuilder

get_media_display_html()[source]

Add html code to htmlbuilder

get_media_display_javascript()[source]

Add javascript functions to htmlbuilder

media_blank(msg)[source]

Blank the related video Widget

Parameters:msg – First element is the boolean for Live indication Second element is the hide mode
media_hide(msg)[source]

Hide the related video Widget

Parameters:msg – First element is the boolean for Live indication
media_length(service_item)[source]

Loads and starts a media item to obtain the media length

Parameters:service_item – The ServiceItem containing the details to be played.
static media_loop(controller)[source]

Responds to the request to loop a loaded video

Parameters:controller – The controller that needs to be stopped
media_loop_msg(msg)[source]

Responds to the request to loop a loaded video

Parameters:msg – First element is the controller which should be used
media_pause(controller)[source]

Responds to the request to pause a loaded video

Parameters:controller – The Controller to be paused
media_pause_msg(msg)[source]

Responds to the request to pause a loaded video

Parameters:msg – First element is the controller which should be used
media_play(controller, first_time=True)[source]

Responds to the request to play a loaded video

Parameters:
  • controller – The controller to be played
  • first_time
media_play_msg(msg, status=True)[source]

Responds to the request to play a loaded video

Parameters:
  • msg – First element is the controller which should be used
  • status
media_reset(controller)[source]

Responds to the request to reset a loaded video :param controller: The controller to use.

media_seek(controller, seek_value)[source]

Responds to the request to change the seek Slider of a loaded video

Parameters:
  • controller – The controller to use.
  • seek_value – The value to set.
media_seek_msg(msg)[source]

Responds to the request to change the seek Slider of a loaded video via a message

Parameters:msg – First element is the controller which should be used Second element is a list with the seek value as first element
media_setup_optical(filename, title, audio_track, subtitle_track, start, end, display, controller)[source]

Setup playback of optical media

Parameters:
  • filename – Path of the optical device/drive.
  • title – The main/title track to play.
  • audio_track – The audio track to play.
  • subtitle_track – The subtitle track to play.
  • start – Start position in milliseconds.
  • end – End position in milliseconds.
  • display – The display to play the media.
  • controller – The media controller.
Returns:

True if setup succeeded else False.

media_state_live()[source]

Check if there is a running Live media Player and do updating stuff (e.g. update the UI)

media_state_preview()[source]

Check if there is a running Preview media Player and do updating stuff (e.g. update the UI)

media_stop(controller, looping_background=False)[source]

Responds to the request to stop a loaded video

Parameters:
  • controller – The controller that needs to be stopped
  • looping_background – The background is looping so do not blank.
media_stop_msg(msg)[source]

Responds to the request to stop a loaded video

Parameters:msg – First element is the controller which should be used
media_unblank(msg)[source]

Unblank the related video Widget

Parameters:msg – First element is not relevant in this context Second element is the boolean for Live indication
media_volume(controller, volume)[source]

Changes the volume of a running video

Parameters:
  • controller – The Controller to use
  • volume – The volume to be set
media_volume_msg(msg)[source]

Changes the volume of a running video

Parameters:msg – First element is the controller which should be used
register_controller(controller)[source]

Registers media controls where the players will be placed to run.

Parameters:controller – The controller where a player will be placed
register_players(player)[source]

Register each media Player (Webkit, Phonon, etc) and store for later use

Parameters:player – Individual player class which has been enabled
static resize(display, player)[source]

After Mainwindow changes or Splitter moved all related media widgets have to be resized

Parameters:
  • display – The display on which output is playing.
  • player – The player which is doing the playing.
set_controls_visible(controller, value)[source]

After a new display is configured, all media related widget will be created too

Parameters:
  • controller – The controller on which controls act.
  • value – control name to be changed.
setup_display(display, preview)[source]

After a new display is configured, all media related widgets will be created too

Parameters:
  • display – Display on which the output is to be played
  • preview – Whether the display is a main or preview display
setup_generic_controls(controller)[source]

Set up controls on the control_panel for a given controller

Parameters:controller – First element is the controller which should be used
tick(controller)[source]

Add a tick while the media is playing but only count if not paused

Parameters:controller – The Controller to be processed
video(source, service_item, hidden=False, video_behind_text=False)[source]

Loads and starts a video to run with the option of sound

Parameters:
  • source – Where the call originated form
  • service_item – The player which is doing the playing
  • hidden – The player which is doing the playing
  • video_behind_text – Is the video to be played behind text.
class openlp.core.ui.media.mediacontroller.MediaSlider(direction, manager, controller)[source]

Bases: PyQt5.QtWidgets.QSlider

Allows the mouse events of a slider to be overridden and extra functionality added

mouseMoveEvent(event)[source]

Override event to allow hover time to be displayed.

Parameters:event – The triggering event
mousePressEvent(event)[source]

Mouse Press event no new functionality

Parameters:event – The triggering event
mouseReleaseEvent(event)[source]

Set the slider position when the mouse is clicked and released on the slider.

Parameters:event – The triggering event