Gtk.Video¶
Example¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Widget (183), GObject.Object (37), Gtk.Accessible (17), 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 |
|||
r/w/en |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gtk.Video(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Shows a
GtkMediaStreamwith media controls.<picture> <source srcset=”video-dark.png” media=”(prefers-color-scheme: dark)”> <img alt=”An example
Gtk.Video" src=”video.png”> </picture>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].
GtkVideoaims 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
GtkVideoto play back the given file.
- classmethod new_for_filename(filename)[source]¶
- Parameters:
- Returns:
a new
GtkVideo- Return type:
Creates a
GtkVideoto 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.MediaStreamorNone) – aGtkMediaStream- Returns:
a new
GtkVideo- Return type:
Creates a
GtkVideoto play back the given stream.
- classmethod new_for_resource(resource_path)[source]¶
- Parameters:
- Returns:
a new
GtkVideo- Return type:
Creates a
GtkVideoto play back the resource at the given resource_path.This is a utility function that calls [ctor`Gtk`.Video.new_for_file].
- get_graphics_offload()[source]¶
- Returns:
the graphics offload status
- Return type:
Returns whether graphics offload is enabled.
See [class`Gtk`.GraphicsOffload] for more information on graphics offload.
New in version 4.14.
- get_media_stream()[source]¶
- Returns:
The media stream managed by self
- Return type:
Gets the media stream managed by self or
Noneif 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_graphics_offload(enabled)[source]¶
- Parameters:
enabled (
Gtk.GraphicsOffloadEnabled) – the new graphics offload status
Sets whether to enable graphics offload.
See [class`Gtk`.GraphicsOffload] for more information on graphics offload.
New in version 4.14.
- 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.MediaStreamorNone) – The media stream to play orNoneto 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.graphics_offload¶
- Name:
graphics-offload- Type:
- Default Value:
- Flags:
Whether to enable graphics offload.
New in version 4.14.
- 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