Gnome::Gtk4::Video
Description
Gnome::Gtk4::Video is a widget to show a Gnome::Gtk4::MediaStream with media controls.
The controls are available separately as Gnome::Gtk4::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 Gnome::Gtk4::Picture.
Gnome::Gtk4::Video 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 Gnome::Gdk4::R-Paintable API and a media framework such as Gstreamer directly.
Class initialization
new
:native-object
Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.
multi method new ( N-Object :$native-object! )
new-video
Creates a new empty Gnome::Gtk4::Video.
method new-video ( --> Gnome::Gtk4::Video \)
new-for-file
Creates a Gnome::Gtk4::Video to play back the given $file
.
method new-for-file ( N-Object() $file --> Gnome::Gtk4::Video \)
$file; a Gnome::Gio::R-File.
new-for-filename
Creates a Gnome::Gtk4::Video to play back the given $filename
.
This is a utility function that calls .new-for-file()
, See that function for details.
method new-for-filename ( Str $filename --> Gnome::Gtk4::Video \)
$filename; filename to play back.
new-for-media-stream
Creates a Gnome::Gtk4::Video to play back the given $stream
.
method new-for-media-stream ( N-Object() $stream --> Gnome::Gtk4::Video \)
$stream; a Gnome::Gtk4::MediaStream.
new-for-resource
Creates a Gnome::Gtk4::Video to play back the resource at the given $resource-path
.
This is a utility function that calls .new-for-file()
.
method new-for-resource ( Str $resource-path --> Gnome::Gtk4::Video \)
$resource-path; resource path to play back.
Methods
get-autoplay
Returns True
if videos have been set to loop.
method get-autoplay (--> Bool )
Return value; True
if streams should autoplay.
get-file
Gets the file played by $self
or undefined if not playing back a file.
method get-file (--> N-Object )
Return value; The file played by $self
.
get-graphics-offload This function is not yet available
Returns whether graphics offload is enabled.
See Gnome::Gtk4::GraphicsOffload for more information on graphics offload.
method get-graphics-offload (--> GtkGraphicsOffloadEnabled )
Return value; the graphics offload status.
get-loop
Returns True
if videos have been set to loop.
method get-loop (--> Bool )
Return value; True
if streams should loop.
get-media-stream
Gets the media stream managed by $self
or undefined if none.
method get-media-stream (--> N-Object )
Return value; The media stream managed by $self
.
set-autoplay
Sets whether $self
automatically starts playback when it becomes visible or when a new file gets loaded.
method set-autoplay ( Bool() $autoplay )
$autoplay; whether media streams should autoplay.
set-file
Makes $self
play the given $file
.
method set-file ( N-Object() $file )
$file; the file to play.
set-filename
Makes $self
play the given $filename
.
This is a utility function that calls .set-file()
,
method set-filename ( Str $filename )
$filename; the filename to play.
set-graphics-offload This function is not yet available
Sets whether to enable graphics offload.
See Gnome::Gtk4::GraphicsOffload for more information on graphics offload.
method set-graphics-offload ( GtkGraphicsOffloadEnabled $enabled )
$enabled; the new graphics offload status.
set-loop
Sets whether new files loaded by $self
should be set to loop.
method set-loop ( Bool() $loop )
$loop; whether media streams should loop.
set-media-stream
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 Gnome::Gtk4::Picture for display.
If you want to display a file, consider using .set-file()
instead.
method set-media-stream ( N-Object() $stream )
$stream; The media stream to play or undefined to unset.
set-resource
Makes $self
play the resource at the given $resource-path
.
This is a utility function that calls .set-file()
.
method set-resource ( Str $resource-path )
$resource-path; the resource to set.