Video#
Superclasses: Widget, InitiallyUnowned, Object
Implemented Interfaces: Accessible, Buildable, ConstraintTarget
GtkVideo is a widget to show a GtkMediaStream with media controls.
The controls are available separately as 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 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 Paintable API and a media framework
such as Gstreamer directly.
Constructors#
- class Video
-
- classmethod new_for_file(file: File | None = None) Widget#
Creates a
GtkVideoto play back the givenfile.- Parameters:
file – a
GFile
- classmethod new_for_filename(filename: str | None = None) Widget#
Creates a
GtkVideoto play back the givenfilename.This is a utility function that calls
new_for_file, See that function for details.- Parameters:
filename – filename to play back
- classmethod new_for_media_stream(stream: MediaStream | None = None) Widget#
Creates a
GtkVideoto play back the givenstream.- Parameters:
stream – a
GtkMediaStream
- classmethod new_for_resource(resource_path: str | None = None) Widget#
Creates a
GtkVideoto play back the resource at the givenresource_path.This is a utility function that calls
new_for_file.- Parameters:
resource_path – resource path to play back
Methods#
- class Video
-
- get_graphics_offload() GraphicsOffloadEnabled#
Returns whether graphics offload is enabled.
See
GraphicsOffloadfor more information on graphics offload.Added in version 4.14.
- get_media_stream() MediaStream | None#
Gets the media stream managed by
selforNoneif none.
- set_autoplay(autoplay: bool) None#
Sets whether
selfautomatically starts playback when it becomes visible or when a new file gets loaded.- Parameters:
autoplay – whether media streams should autoplay
- set_file(file: File | None = None) None#
Makes
selfplay the givenfile.- Parameters:
file – the file to play
- set_filename(filename: str | None = None) None#
Makes
selfplay the givenfilename.This is a utility function that calls
set_file(),- Parameters:
filename – the filename to play
- set_graphics_offload(enabled: GraphicsOffloadEnabled) None#
Sets whether to enable graphics offload.
See
GraphicsOffloadfor more information on graphics offload.Added in version 4.14.
- Parameters:
enabled – the new graphics offload status
- set_loop(loop: bool) None#
Sets whether new files loaded by
selfshould be set to loop.- Parameters:
loop – whether media streams should loop
- set_media_stream(stream: MediaStream | None = None) None#
Sets the media stream to be played back.
selfwill take full control of managing the media stream. If you want to manage a media stream yourself, consider using aPicturefor display.If you want to display a file, consider using
set_fileinstead.- Parameters:
stream – The media stream to play or
Noneto unset
Properties#
- class Video
-
- props.graphics_offload: GraphicsOffloadEnabled#
The type of the None singleton.
Added in version 4.14.
- props.media_stream: MediaStream#
The type of the None singleton.