Gtk.Video¶
Example¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1)
- Structs:
class |
|
class |
|
class |
|
class |
|
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/w/en |
|||
r/w/en |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gtk.Video(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
GtkVideo
is a widget to show aGtkMediaStream
with media controls.An example
Gtk.Video
The controls are available separately as [class`Gtk`.MediaControls]. If you just want to display a video without controls, you can treat it like any other paintable and for example put it into a [class`Gtk`.Picture].
GtkVideo
aims to cover use cases such as previews, embedded animations, etc. It supports autoplay, looping, and simple media controls. It does not have support for video overlays, multichannel audio, device selection, or input. If you are writing a full-fledged video player, you may want to use the [iface`Gdk`.Paintable] API and a media framework such as Gstreamer directly.- classmethod new_for_file(file)[source]¶
- Parameters:
- Returns:
a new
GtkVideo
- Return type:
Creates a
GtkVideo
to play back the given file.
- classmethod new_for_filename(filename)[source]¶
- Parameters:
- Returns:
a new
GtkVideo
- Return type:
Creates a
GtkVideo
to play back the given filename.This is a utility function that calls [ctor`Gtk`.Video.new_for_file], See that function for details.
- classmethod new_for_media_stream(stream)[source]¶
- Parameters:
stream (
Gtk.MediaStream
orNone
) – aGtkMediaStream
- Returns:
a new
GtkVideo
- Return type:
Creates a
GtkVideo
to play back the given stream.
- classmethod new_for_resource(resource_path)[source]¶
- Parameters:
- Returns:
a new
GtkVideo
- Return type:
Creates a
GtkVideo
to play back the resource at the given resource_path.This is a utility function that calls [ctor`Gtk`.Video.new_for_file].
- get_media_stream()[source]¶
- Returns:
The media stream managed by self
- Return type:
Gets the media stream managed by self or
None
if none.
- set_autoplay(autoplay)[source]¶
- Parameters:
autoplay (
bool
) – whether media streams should autoplay
Sets whether self automatically starts playback when it becomes visible or when a new file gets loaded.
- set_filename(filename)[source]¶
-
Makes self play the given filename.
This is a utility function that calls
Gtk.Video.set_file
(),
- set_loop(loop)[source]¶
- Parameters:
loop (
bool
) – whether media streams should loop
Sets whether new files loaded by self should be set to loop.
- set_media_stream(stream)[source]¶
- Parameters:
stream (
Gtk.MediaStream
orNone
) – The media stream to play orNone
to unset
Sets the media stream to be played back.
self will take full control of managing the media stream. If you want to manage a media stream yourself, consider using a [class`Gtk`.Picture] for display.
If you want to display a file, consider using [method`Gtk`.Video.set_file] instead.
Property Details¶
- Gtk.Video.props.autoplay¶
- Name:
autoplay
- Type:
- Default Value:
- Flags:
If the video should automatically begin playing.
- Gtk.Video.props.file¶
- Name:
file
- Type:
- Default Value:
- Flags:
The file played by this video if the video is playing a file.
- Gtk.Video.props.loop¶
- Name:
loop
- Type:
- Default Value:
- Flags:
If new media files should be set to loop.
- Gtk.Video.props.media_stream¶
- Name:
media-stream
- Type:
- Default Value:
- Flags:
The media-stream played