ClapperGtk.Video¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Widget (183), GObject.Object (37), Gtk.Accessible (17), Gtk.Buildable (1)
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9)
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w/en |
|||
r/w/en |
|||
r/en |
|||
r/en |
|||
r/w/en |
Signals¶
- Inherited:
Name |
Short Description |
|---|---|
A helper signal for implementing common seeking by double tap on screen side for touchscreen devices. |
|
A signal that user requested a change in fullscreen state of the video. |
Fields¶
- Inherited:
Class Details¶
- class ClapperGtk.Video(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A ready to be used GTK video widget implementing Clapper API.
ClapperGtk.Videois the main widget exposed byClapperGtkAPI. It both displays videos played by [class`Clapper`.Player] (exposed as its property) and manages revealing and fading of any additional widgets overlaid on top of it.Other widgets provided by
ClapperGtklibrary, once placed anywhere on video (including nesting within another widget like [class`Gtk`.Box]) will automatically controlClapperGtk.Videothey were overlaid on top of. This allows to freely create custom playback control panels best suited for specific application. Additionally, pre-made widgets such as [class`ClapperGtk`.SimpleControls] are also available.- Basic usage
A typical use case is to embed video widget as part of your app where video playback is needed. Get the [class`Clapper`.Player] belonging to the video widget and start adding new [class`Clapper`.MediaItem] items to the [class`Clapper`.Queue] for playback. For more information please refer to the Clapper playback library documentation.
ClapperGtk.Videocan automatically take care of revealing and later fading overlaid content when interacting with the video. To do this, simply add your widgets with [method`ClapperGtk`.Video.add_fading_overlay]. If you want to display some static content on top of video (or take care of visibility within overlaid widget itself) you can add it to the video as a normal overlay with [method`ClapperGtk`.Video.add_overlay].- Actions
ClapperGtk.Videodefines a set of built-in actions:```yaml
“video.toggle-play”: toggle play/pause
“video.play”: start/resume playback
“video.pause”: pause playback
“video.stop”: stop playback
“video.seek”: seek to position (variant “d”)
“video.seek-custom”: seek to position using seek method (variant “(di)”)
“video.toggle-mute”: toggle mute state
“video.set-mute”: set mute state (variant “b”)
“video.volume-up”: increase volume by 2%
“video.volume-down”: decrease volume by 2%
“video.set-volume”: set volume to specified value (variant “d”)
“video.speed-up”: increase speed (from 0.05x - 2x range to nearest quarter)
“video.speed-down”: decrease speed (from 0.05x - 2x range to nearest quarter)
“video.set-speed”: set speed to specified value (variant “d”)
“video.previous-item”: select previous item in queue
“video.next-item”: select next item in queue
“video.select-item”: select item at specified index in queue (variant “u”) ```
ClapperGtk.Videoimplementation of the [iface`Gtk`.Buildable] interface supports placing children as either normal overlay by specifyingoverlayor a fading one by specifyingfading-overlayas thetypeattribute of a<child>element. Position of overlaid content is determined byvalign/halignproperties.``xml <object class=”ClapperGtkVideo” id=”video”>
- <child type=”fading-overlay”>
- <object class=”ClapperGtkTitleHeader”>
<property name=”valign”>start</property>
</object>
</child> <child type=”fading-overlay”>
- <object class=”ClapperGtkSimpleControls”>
<property name=”valign”>end</property>
</object>
</child>
</object> ``
- classmethod new()¶
- Returns:
a new video
Gtk.Widget.- Return type:
Creates a new
ClapperGtk.Videoinstance.Newly created video widget will also set some default GStreamer elements on its [class`Clapper`.Player]. This includes Clapper own video sink and a “scaletempo” element as audio filter. Both can still be changed after construction by setting corresponding player properties.
- add_fading_overlay(widget)¶
- Parameters:
widget (
Gtk.Widget) – aGtk.Widget
Similiar as
ClapperGtk.Video.add_overlay() but will also automatically add fading functionality to overlaidGtk.Widgetfor convenience. This will make widget reveal itself when interacting with self and fade otherwise. Useful when placing widgets such as playback controls panels.
- add_overlay(widget)¶
- Parameters:
widget (
Gtk.Widget) – aGtk.Widget
Add another
Gtk.Widgetto be overlaid on top of video.The position at which widget is placed is determined from [property`Gtk`.Widget:halign] and [property`Gtk`.Widget:valign] properties.
This function will overlay widget as-is meaning that widget is responsible for managing its own visablity if needed. If you want to add a
Gtk.Widgetthat will reveal and fade itself automatically when interacting with self (e.g. controls panel) you can useClapperGtk.Video.add_fading_overlay() function for convenience.
- get_auto_inhibit()¶
-
Get whether automatic session inhibit is enabled.
- get_fade_delay()¶
- Returns:
currently set fade delay.
- Return type:
Get time in milliseconds after which fading overlays should fade.
- get_inhibited()¶
-
Get whether session is currently inhibited by [property`ClapperGtk`.Video:auto-inhibit].
- get_player()¶
- Returns:
a
Clapper.Playerused by video.- Return type:
Get
Clapper.Playerused by thisClapperGtk.Videoinstance.
- get_touch_fade_delay()¶
- Returns:
currently set touch fade delay.
- Return type:
Get time in milliseconds after which fading overlays should fade when revealed using touch device.
- set_auto_inhibit(inhibit)¶
- Parameters:
inhibit (
bool) – whether to enable automatic session inhibit
Set whether video should try to automatically inhibit session from idling (and possibly screen going black) when video is playing.
- set_fade_delay(delay)¶
- Parameters:
delay (
int) – a fade delay
Set time in milliseconds after which fading overlays should fade.
- set_touch_fade_delay(delay)¶
- Parameters:
delay (
int) – a touch fade delay
Set time in milliseconds after which fading overlays should fade when using touchscreen.
It is often useful to set this higher then normal fade delay property, as in case of touch events user do not have a moving pointer that would extend fade timeout, so he can have more time to decide what to press next.
Signal Details¶
- ClapperGtk.Video.signals.seek_request(video, forward)¶
- Signal Name:
seek-request- Flags:
- Parameters:
video (
ClapperGtk.Video) – The object which received the signalforward (
bool) –Trueif seek should be forward,Falseif backward
A helper signal for implementing common seeking by double tap on screen side for touchscreen devices.
Note that forward already takes into account RTL direction, so implementation does not have to check.
- ClapperGtk.Video.signals.toggle_fullscreen(video)¶
- Signal Name:
toggle-fullscreen- Flags:
- Parameters:
video (
ClapperGtk.Video) – The object which received the signal
A signal that user requested a change in fullscreen state of the video.
Note that when going fullscreen from this signal, user will expect for only video to be fullscreened and not the whole app window. It is up to implementation to decide how to handle that.
Property Details¶
- ClapperGtk.Video.props.auto_inhibit¶
- Name:
auto-inhibit- Type:
- Default Value:
- Flags:
Try to automatically inhibit session when video is playing.
- ClapperGtk.Video.props.fade_delay¶
- Name:
fade-delay- Type:
- Default Value:
3000- Flags:
A delay in milliseconds before trying to fade all fading overlays.
- ClapperGtk.Video.props.inhibited¶
- Name:
inhibited- Type:
- Default Value:
- Flags:
Get whether session is currently inhibited by the video.
- ClapperGtk.Video.props.player¶
- Name:
player- Type:
- Default Value:
- Flags:
A
Clapper.Playerused by video.
- ClapperGtk.Video.props.touch_fade_delay¶
- Name:
touch-fade-delay- Type:
- Default Value:
5000- Flags:
A delay in milliseconds before trying to fade all fading overlays after revealed using touchscreen.