# Class e.c.p.Player(log.Loggable):

Part of elisa.core.player View In Hierarchy

A player can play one audio or video media at a time. All it needs is a `elisa.core.media_uri.MediaUri` and the sinks for the video and audio output. It can also do audio only output and has support for subtitles.

Instance Variables | video_sink | the video sink that this player outputs to (type: `gst.BaseSink` )
| name | the name of the player instance (type: string )
| audio_sink | the audio sink that this player outputs to (type: `gst.BaseSink` )
| volume | the volume level between 0 and 10 (type: float )
| position | the position we are currently playing in nanoseconds; when set, if the value passed is higher than `duration`, position is set to `duration`. If the value passed is lower than 0, position is set to 0. (type: int )
| duration | (read-only) the total length of the loaded media in nanoseconds (type: int )
| speed | The speed of the current playback: Normal playback is 1.0 a positive value means forward a negative one backward the value 0.0 (equivalent to pause) is not allowed (type: float )
| state | (read-only) The current state. See `elisa.core.player.STATES`. (type: `elisa.core.player.STATES` )
| playing | (read-only) is the player currently playing? That also returns False if the player is in LOADING state. (type: bool )
| uri | the uri of the media loaded in the player. (type: `elisa.core.media_uri.MediaUri` )
| subtitle_uri | the uri for subtitles (type: `elisa.core.media_uri.MediaUri` )
| subtitle_callback | the callback, where the timed subtitle texts should be sent to. The callback will get a `gst.Buffer`, containing the subtitle text to be displayed encoded in text/plain or text/x-pango-markup (type: callable )
| muted | True if the player is muted, False otherwise. This is independent of the volume attribute (eg. can be False even if volume is 0). (type: bool )

Line # | Kind | Name | Docs
--- | --- | --- | ---
238 | Method | __init__ |
278 | Method | play | Play the media. If trigger_message is set to True, this triggers first
294 | Method | pause | Pause the playback. If trigger_message is set to True, this triggers
309 | Method | stop | Stop the playback. This is _not_ effecting the subtitles. If
325 | Method | restart_from_beginning | Play the uri from the beginning. This is not triggering any
345 | Method | toggle_play_pause | Toggle the player between play and pause state. If it is not playing
367 | Method | playing__get | Undocumented
372 | Method | volume__set | Undocumented
384 | Method | volume__get | Undocumented
393 | Method | muted__set | Undocumented
408 | Method | muted__get | Undocumented
415 | Method | uri__set | Undocumented
477 | Method | uri__get | Undocumented
490 | Method | subtitle_uri__set | Undocumented
520 | Method | subtitle_uri__get | Undocumented
523 | Method | visualisation__get | Undocumented
526 | Method | visualisation__set | Undocumented
531 | Method | subtitle_callback__set | Undocumented
535 | Method | subtitle_callback__get | Undocumented
576 | Method | state__get | Undocumented
581 | Method | position__get | Undocumented
586 | Method | position__set | Undocumented
602 | Method | duration__get | Undocumented
608 | Method | speed__get | Undocumented
614 | Method | speed__set | Undocumented
621 | Method | video_sink__get | Undocumented
624 | Method | video_sink__set | Undocumented
629 | Method | audio_sink__get | Undocumented
632 | Method | audio_sink__set | Undocumented

def __init__(self, registry):
overrides elisa.core.log.Loggable.__init__

Parameters | registry | the registry to ask for new engines (type: `elisa.core.engine_registry.EngineRegistry` )

def play(self, trigger_message=True):
Play the media. If trigger_message is set to True, this triggers first the message `elisa.core.player.PlayerLoading` message and if the playback is really starting, it triggers `elisa.core.player.PlayerPlaying`. Otherwise it does not trigger any messages.

Parameters | trigger_message | should the player trigger messages here (type: bool )

def pause(self, trigger_message=True):
Pause the playback. If trigger_message is set to True, this triggers the `elisa.core.player.PlayerPausing` message.

Parameters | trigger_message | should the player trigger a message here (type: bool )

def stop(self, trigger_message=True):
Stop the playback. This is _not_ effecting the subtitles. If trigger_message is set, this method triggers the `elisa.core.player.PlayerStopping` message.

Parameters | trigger_message | should the player trigger a message here (type: bool )

def restart_from_beginning(self):
Play the uri from the beginning. This is not triggering any messages.

def toggle_play_pause(self, trigger_message=True):
Toggle the player between play and pause state. If it is not playing yet, then start it. If trigger_message is set, this method might triggers `elisa.core.player.PlayerPlaying` and `elisa.core.player.PlayerLoading` or `elisa.core.player.PlayerPausing`.

Parameters | trigger_message | should the player trigger a message here (type: bool )

def playing__get(self):
Undocumented
def volume__set(self, volume):
Undocumented
def volume__get(self):
Undocumented
def muted__set(self, value):
Undocumented
def muted__get(self):
Undocumented
def uri__set(self, uri):
Undocumented
def uri__get(self):
Undocumented
def subtitle_uri__set(self, uri):
Undocumented
def subtitle_uri__get(self):
Undocumented
def visualisation__get(self):
Undocumented
def visualisation__set(self, new_visu):
Undocumented
def subtitle_callback__set(self, callback):
Undocumented
def subtitle_callback__get(self):
Undocumented
def state__get(self):
Undocumented
def position__get(self):
Undocumented
def position__set(self, position):
Undocumented
def duration__get(self):
Undocumented
def speed__get(self):
Undocumented
def speed__set(self, speed):
Undocumented
def video_sink__get(self):
Undocumented
def video_sink__set(self, sink):
Undocumented
def audio_sink__get(self):
Undocumented
def audio_sink__set(self, sink):
Undocumented