Clapper.Reactable¶
- Implementations:
None
Methods¶
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Properties¶
None
Signals¶
None
Fields¶
None
Class Details¶
- class Clapper.Reactable¶
- Bases:
- Structure:
An interface for creating enhancers that react to the playback and/or events that should influence it.
New in version 0.10.
- get_player()¶
- Returns:
A reference to the parent
Clapper.Player.- Return type:
Get the [class`Clapper`.Player] that this reactable is reacting to.
This is meant to be used in implementations where reaction goes the other way around (from enhancer plugin to the player). For example some external event needs to influence parent player object like changing its state, seeking, etc.
Note that enhancers are working in a non-main application thread, thus if you need to do operations on a [class`Clapper`.Queue] such as adding/removing items, you need to switch thread first. Otherwise this will not be thread safe for applications that use single threaded toolkits such as #GTK. You can do this manually or use provided reactable convenience functions.
Due to the threaded nature, you should also avoid comparisons to the current properties values in the player or its queue. While these are thread safe, there is no guarantee that values/objects between threads are still the same in both (or still exist). For example, instead of using [property`Clapper`.Queue:current_item], monitor it with implemented [vfunc`Clapper`.Reactable.played_item_changed] instead, as these functions are all serialized into your implementation thread.
New in version 0.10.
- queue_append_sync(item)¶
- Parameters:
item (
Clapper.MediaItem) – aClapper.MediaItem
A convenience function that within application main thread synchronously appends an item to the playback queue of the player that self belongs to.
Reactable enhancers should only modify the queue from the application main thread, switching thread either themselves or using this convenience function that does so.
Note that this function will do no operation if called when there is no player set yet (e.g. inside enhancer construction) or if enhancer outlived the parent instance somehow. Both cases are considered to be implementation bug.
New in version 0.10.
- queue_clear_sync()¶
A convenience function that within application main thread synchronously clears the playback queue of the player that self belongs to.
Reactable enhancers should only modify the queue from the application main thread, switching thread either themselves or using this convenience function that does so.
Note that this function will do no operation if called when there is no player set yet (e.g. inside enhancer construction) or if enhancer outlived the parent instance somehow. Both cases are considered to be implementation bug.
New in version 0.10.
- queue_insert_sync(item, after_item)¶
- Parameters:
item (
Clapper.MediaItem) – aClapper.MediaItemafter_item (
Clapper.MediaItem) – aClapper.MediaItemafter which to insert orNoneto prepend
A convenience function that within application main thread synchronously inserts an item to the playback queue position after after_item of the player that self belongs to.
This function uses after_item instead of position index in order to ensure desired position does not change during thread switching.
Reactable enhancers should only modify the queue from the application main thread, switching thread either themselves or using this convenience function that does so.
Note that this function will do no operation if called when there is no player set yet (e.g. inside enhancer construction) or if enhancer outlived the parent instance somehow. Both cases are considered to be implementation bug.
New in version 0.10.
- queue_remove_sync(item)¶
- Parameters:
item (
Clapper.MediaItem) – aClapper.MediaItem
A convenience function that within application main thread synchronously removes an item from the playback queue of the player that self belongs to.
Reactable enhancers should only modify the queue from the application main thread, switching thread either themselves or using this convenience function that does so.
Note that this function will do no operation if called when there is no player set yet (e.g. inside enhancer construction) or if enhancer outlived the parent instance somehow. Both cases are considered to be implementation bug.
New in version 0.10.
- timeline_insert_sync(timeline, marker)¶
- Parameters:
timeline (
Clapper.Timeline) – aClapper.Timelinemarker (
Clapper.Marker) – aClapper.Marker
A convenience function that within application main thread synchronously inserts marker into timeline.
Reactable enhancers should only modify timeline of an item that is already in queue from the application main thread, switching thread either themselves or using this convenience function that does so.
New in version 0.10.
- timeline_remove_sync(timeline, marker)¶
- Parameters:
timeline (
Clapper.Timeline) – aClapper.Timelinemarker (
Clapper.Marker) – aClapper.Marker
A convenience function that within application main thread synchronously removes marker from timeline.
Reactable enhancers should only modify timeline of an item that is already in queue from the application main thread, switching thread either themselves or using this convenience function that does so.
New in version 0.10.
- do_item_updated(item, flags) virtual¶
- Parameters:
item (
Clapper.MediaItem) – aClapper.MediaItemthat was updatedflags (
Clapper.ReactableItemUpdatedFlags) – flags informing which properties were updated
An item in queue got updated.
This might be (or not) currently played item. Implementations can compare it against the last item from [vfunc`Clapper`.Reactable.played_item_changed] if they need to know that.
New in version 0.10.
- do_message_received(msg) virtual¶
- Parameters:
msg (
Gst.Message) – aGst.Message
Custom message from user was received on reactables bus.
New in version 0.10.
- do_mute_changed(mute) virtual¶
-
Player mute state changed.
New in version 0.10.
- do_played_item_changed(item) virtual¶
- Parameters:
item (
Clapper.MediaItem) – aClapper.MediaItemthat is now playing
New media item started playing. All following events (such as position changes) will be related to this item from now on.
New in version 0.10.
- do_position_changed(position) virtual¶
- Parameters:
position (
float) – a decimal number with current position in seconds
Player position changed.
New in version 0.10.
- do_queue_cleared() virtual¶
All items were removed from queue.
Note that in such event [vfunc`Clapper`.Reactable.queue_item_removed] will NOT be called for each item for performance reasons. You probably want to implement this function if you also implemented item removal.
New in version 0.10.
- do_queue_item_added(item, index) virtual¶
- Parameters:
item (
Clapper.MediaItem) – aClapper.MediaItemthat was addedindex (
int) – position at which item was placed in queue
An item was added to the queue.
New in version 0.10.
- do_queue_item_removed(item, index) virtual¶
- Parameters:
item (
Clapper.MediaItem) – aClapper.MediaItemthat was removedindex (
int) – position from which item was removed in queue
An item was removed from queue.
Implementations that are interested in queue items removal should also implement [vfunc`Clapper`.Reactable.queue_cleared].
New in version 0.10.
- do_queue_item_repositioned(before, after) virtual¶
- Parameters:
before (
int) – position from whichClapper.MediaItemwas removedafter (
int) – position at whichClapper.MediaItemwas inserted after removal
An item changed position within queue.
New in version 0.10.
- do_queue_progression_changed(mode) virtual¶
- Parameters:
mode (
Clapper.QueueProgressionMode) – aClapper.QueueProgressionMode
Progression mode of the queue was changed.
New in version 0.10.
- do_speed_changed(speed) virtual¶
- Parameters:
speed (
float) – the playback speed multiplier
Player speed changed.
New in version 0.10.
- do_state_changed(state) virtual¶
- Parameters:
state (
Clapper.PlayerState) – aClapper.PlayerState
Player state changed.
New in version 0.10.