ClapperGtk.Video

g ClapperGtk.Av ClapperGtk.Av ClapperGtk.Video ClapperGtk.Video ClapperGtk.Av->ClapperGtk.Video GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.Widget->ClapperGtk.Av

Subclasses:

None

Methods

Inherited:

ClapperGtk.Av (4), Gtk.Widget (183), GObject.Object (37), Gtk.Accessible (18), Gtk.Buildable (1)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new ()

add_fading_overlay (widget)

add_overlay (widget)

get_fade_delay ()

get_touch_fade_delay ()

set_fade_delay (delay)

set_touch_fade_delay (delay)

Virtual Methods

Inherited:

Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (7), Gtk.Buildable (9)

Properties

Inherited:

ClapperGtk.Av (3), Gtk.Widget (35), Gtk.Accessible (1)

Name

Type

Flags

Short Description

fade-delay

int

r/w/en

touch-fade-delay

int

r/w/en

Signals

Inherited:

Gtk.Widget (13), GObject.Object (1)

Name

Short Description

seek-request

A helper signal for implementing common seeking by double tap on screen side for touchscreen devices.

toggle-fullscreen

A signal that user requested a change in fullscreen state of the video.

Fields

Inherited:

Gtk.Widget (13), GObject.Object (1)

Class Details

class ClapperGtk.Video(**kwargs)
Bases:

ClapperGtk.Av

Abstract:

No

Structure:

ClapperGtk.VideoClass

A ready to be used GTK video widget implementing Clapper API.

ClapperGtk.Video is the main widget exposed by ClapperGtk API. It both displays videos played by [class`Clapper`.Player] (exposed as [property`ClapperGtk`.Av:player] property) and manages revealing and fading of any additional widgets overlaid on top of it.

Other widgets provided by ClapperGtk library, once placed anywhere on video (including nesting within another widget like [class`Gtk`.Box]) will automatically control ClapperGtk.Video they 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 AV 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.Video can 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

You can use built-in actions of parent [class`ClapperGtk`.Av]. See its documentation, for the list of available ones.

ClapperGtk.Video as Gtk.Buildable

ClapperGtk.Video implementation of the [iface`Gtk`.Buildable] interface supports placing children as either normal overlay by specifying overlay or a fading one by specifying fading-overlay as the type attribute of a <child> element. Position of overlaid content is determined by valign/halign properties.

``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:

Gtk.Widget

Creates a new ClapperGtk.Video instance.

Newly created video widget will also have 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) – a Gtk.Widget

Similiar as ClapperGtk.Video.add_overlay() but will also automatically add fading functionality to overlaid Gtk.Widget for 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) – a Gtk.Widget

Add another Gtk.Widget to 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.Widget that will reveal and fade itself automatically when interacting with self (e.g. controls panel) you can use ClapperGtk.Video.add_fading_overlay() function for convenience.

get_fade_delay()
Returns:

currently set fade delay.

Return type:

int

Get time in milliseconds after which fading overlays should fade.

get_touch_fade_delay()
Returns:

currently set touch fade delay.

Return type:

int

Get time in milliseconds after which fading overlays should fade when revealed using touch device.

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:

RUN_LAST, NO_RECURSE, NO_HOOKS

Parameters:

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:

RUN_LAST, NO_RECURSE, NO_HOOKS

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.fade_delay
Name:

fade-delay

Type:

int

Default Value:

3000

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

A delay in milliseconds before trying to fade all fading overlays.

ClapperGtk.Video.props.touch_fade_delay
Name:

touch-fade-delay

Type:

int

Default Value:

5000

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

A delay in milliseconds before trying to fade all fading overlays after revealed using touchscreen.