About my projects, examples and tutorials
Gnome::Gtk4::Video

Gnome::Gtk4::Video

Description§

Gnome::Gtk4::Video is a widget to show a Gnome::Gtk4::MediaStream with media controls.

UNKNOWN image§

=for image :class<inline> :src<asset_files/images/video.png> :width<30\%>

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.

Uml Diagram§

UNKNOWN image§

=for image :class<inline> :src<asset_files/images/plantuml/Video.png> :width<70\%>

Class initialization§

new§

:native-object§

Create an object using a native object from an object of the same type found elsewhere. See also Gnome::N::TopLevelSupportClass.

multi method new ( N-Object() :$native-object! )
Code

new-video§

Creates a new empty Gnome::Gtk4::Video.

method new-video ( --> Gnome::Gtk4::Video )
Code

new-for-file§

Creates a Gnome::Gtk4::Video to play back the given $file.

method new-for-file ( N-Object() $file --> Gnome::Gtk4::Video )
Code

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 )
Code
  • $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 )
Code

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 )
Code
  • $resource-path; resource path to play back.

Methods§

get-autoplay§

Returns True if videos have been set to loop.

method get-autoplay (--> Bool )
Code

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 )
Code

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  )
Code

Return value; the graphics offload status.

get-loop§

Returns True if videos have been set to loop.

method get-loop (--> Bool )
Code

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 )
Code

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 )
Code
  • $autoplay; whether media streams should autoplay.

set-file§

Makes $self play the given $file.

method set-file ( N-Object() $file )
Code
  • $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 )
Code
  • $filename; the filename to play.

set-graphics-offload§

Sets whether to enable graphics offload.

See Gnome::Gtk4::GraphicsOffload for more information on graphics offload.

method set-graphics-offload ( GtkGraphicsOffloadEnabled  $enabled )
Code
  • $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 )
Code
  • $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 )
Code
  • $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 )
Code
  • $resource-path; the resource to set.