Package elisa :: Package core :: Module player :: Class Player
[hide private]
[frames] | no frames]

Class Player

source code


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.

Nested Classes [hide private]
  __metaclass__
Instance Methods [hide private]
 
__init__(self, registry)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
play(self, trigger_message=True)
Play the media.
source code
 
pause(self, trigger_message=True)
Pause the playback.
source code
 
stop(self, trigger_message=True)
Stop the playback.
source code
 
restart_from_beginning(self)
Play the uri from the beginning.
source code
 
toggle_play_pause(self, trigger_message=True)
Toggle the player between play and pause state.
source code
 
playing__get(self) source code
 
volume__set(self, volume) source code
 
volume__get(self) source code
 
muted__set(self, value) source code
 
muted__get(self) source code
 
uri__set(self, uri) source code
 
uri__get(self) source code
 
_remove_engine(self) source code
 
subtitle_uri__set(self, uri) source code
 
subtitle_uri__get(self) source code
 
visualisation__get(self) source code
 
visualisation__set(self, new_visu) source code
 
subtitle_callback__set(self, callback) source code
 
subtitle_callback__get(self) source code
 
_engine_error(self, message, sender) source code
 
_engine_stopped(self, message, sender) source code
 
_update_subtitle_handoff(self) source code
 
_new_clock(self, message, sender) source code
 
_new_base_time(self, message, sender) source code
 
state__get(self) source code
 
position__get(self) source code
 
position__set(self, position) source code
 
duration__get(self) source code
 
speed__get(self) source code
 
speed__set(self, speed) source code
 
video_sink__get(self) source code
 
video_sink__set(self, sink) source code
 
audio_sink__get(self) source code
 
audio_sink__set(self, sink) source code
 
_new_handoff(self, element, buffer, pad) source code
 
_new_audio_sink(self) source code
 
_make_subtitle_pipeline(self) source code

Inherited from extern.log.log.Loggable: debug, doLog, error, info, log, logFunction, logObjectName, warning, warningFailure

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Static Methods [hide private]
 
__classinit__(cls, new_attrs)
Given a class and a new set of attributes (as passed in by __classinit__), create or modify properties based on functions with special names ending in __get, __set, and __del.
source code
Class Variables [hide private]

Inherited from extern.log.log.Loggable: logCategory

Instance Variables [hide private]
gst.BaseSink audio_sink
the audio sink that this player outputs to
int duration
(read-only) the total length of the loaded media in nanoseconds
bool muted
True if the player is muted, False otherwise.
string name = 'player'
the name of the player instance
bool playing
(read-only) is the player currently playing? That also returns False if the player is in LOADING state.
int position
the position we are currently playing in nanoseconds; when set, if the value passed is higher than duration, position is set to duration.
float speed
The speed of the current playback:
elisa.core.player.STATES state
(read-only) The current state.
callable subtitle_callback
the callback, where the timed subtitle texts should be sent to.
elisa.core.media_uri.MediaUri subtitle_uri
the uri for subtitles
elisa.core.media_uri.MediaUri uri
the uri of the media loaded in the player.
gst.BaseSink video_sink
the video sink that this player outputs to
float volume
the volume level between 0 and 10
Properties [hide private]
  visualisation

Inherited from object: __class__

Method Details [hide private]

__init__(self, registry)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Parameters:
  • registry (elisa.core.engine_registry.EngineRegistry) - the registry to ask for new engines
Overrides: log.Loggable.__init__

play(self, trigger_message=True)

source code 
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 (bool) - should the player trigger messages here

pause(self, trigger_message=True)

source code 
Pause the playback. If trigger_message is set to True, this triggers the elisa.core.player.PlayerPausing message.
Parameters:
  • trigger_message (bool) - should the player trigger a message here

stop(self, trigger_message=True)

source code 
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 (bool) - should the player trigger a message here

restart_from_beginning(self)

source code 
Play the uri from the beginning. This is not triggering any messages.

toggle_play_pause(self, trigger_message=True)

source code 
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 (bool) - should the player trigger a message here

Instance Variable Details [hide private]

audio_sink

the audio sink that this player outputs to
Get Method:
elisa.core.player.Player.audio_sink__get(self)
Set Method:
elisa.core.player.Player.audio_sink__set(self, sink)
Delete Method:
'frontend'

duration

(read-only) the total length of the loaded media in nanoseconds
Get Method:
elisa.core.player.Player.duration__get(self)
Set Method:
'frontend'
Delete Method:
'frontend'

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).
Get Method:
elisa.core.player.Player.muted__get(self)
Set Method:
elisa.core.player.Player.muted__set(self, value)
Delete Method:
'frontend'

playing

(read-only) is the player currently playing? That also returns False if the player is in LOADING state.
Get Method:
elisa.core.player.Player.playing__get(self)
Set Method:
'frontend'
Delete Method:
'frontend'

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.
Get Method:
elisa.core.player.Player.position__get(self)
Set Method:
elisa.core.player.Player.position__set(self, position)
Delete Method:
'frontend'

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
Get Method:
elisa.core.player.Player.speed__get(self)
Set Method:
elisa.core.player.Player.speed__set(self, speed)
Delete Method:
'frontend'

state

(read-only) The current state. See elisa.core.player.STATES.
Get Method:
elisa.core.player.Player.state__get(self)
Set Method:
'frontend'
Delete Method:
'frontend'

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
Get Method:
elisa.core.player.Player.subtitle_callback__get(self)
Set Method:
elisa.core.player.Player.subtitle_callback__set(self, callback)
Delete Method:
'frontend'

subtitle_uri

the uri for subtitles
Get Method:
elisa.core.player.Player.subtitle_uri__get(self)
Set Method:
elisa.core.player.Player.subtitle_uri__set(self, uri)
Delete Method:
'frontend'

uri

the uri of the media loaded in the player.
Get Method:
elisa.core.player.Player.uri__get(self)
Set Method:
elisa.core.player.Player.uri__set(self, uri)
Delete Method:
'frontend'

video_sink

the video sink that this player outputs to
Get Method:
elisa.core.player.Player.video_sink__get(self)
Set Method:
elisa.core.player.Player.video_sink__set(self, sink)
Delete Method:
'frontend'

volume

the volume level between 0 and 10
Get Method:
elisa.core.player.Player.volume__get(self)
Set Method:
elisa.core.player.Player.volume__set(self, volume)
Delete Method:
'frontend'

Property Details [hide private]

visualisation

Get Method:
elisa.core.player.Player.visualisation__get(self)
Set Method:
elisa.core.player.Player.visualisation__set(self, new_visu)
Delete Method:
'frontend'