Class Video

All Implemented Interfaces:
PointerInterface

public class Video extends Widget
`GtkVideo` is a widget to show a `GtkMediaStream` with media controls.

![An example GtkVideo](video.png)

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.

https://docs.gtk.org/gtk4/class.Video.html

  • Constructor Details

    • Video

      public Video(PointerContainer pointer)
    • Video

      public Video()
      Creates a new empty `GtkVideo`.
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • newForFileVideo

      public static Video newForFileVideo(@Nullable File file)
      Creates a `GtkVideo` to play back the given @file.
      Parameters:
      file - a `GFile`
      Returns:
      a new `GtkVideo`
    • newForFilenameVideo

      public static Video newForFilenameVideo(@Nullable Str filename)
      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.
      Parameters:
      filename - filename to play back
      Returns:
      a new `GtkVideo`
    • newForFilenameVideo

      public static Video newForFilenameVideo(String filename)
      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.
      Parameters:
      filename - filename to play back
      Returns:
      a new `GtkVideo`
    • newForMediaStreamVideo

      public static Video newForMediaStreamVideo(@Nullable MediaStream stream)
      Creates a `GtkVideo` to play back the given @stream.
      Parameters:
      stream - a `GtkMediaStream`
      Returns:
      a new `GtkVideo`
    • newForResourceVideo

      public static Video newForResourceVideo(@Nullable Str resource_path)
      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].
      Parameters:
      resource_path - resource path to play back
      Returns:
      a new `GtkVideo`
    • newForResourceVideo

      public static Video newForResourceVideo(String resource_path)
      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].
      Parameters:
      resource_path - resource path to play back
      Returns:
      a new `GtkVideo`
    • getAutoplay

      public boolean getAutoplay()
      Returns %TRUE if videos have been set to loop.
      Returns:
      %TRUE if streams should autoplay
    • getFile

      public File getFile()
      Gets the file played by @self or %NULL if not playing back
      a file.
      Returns:
      The file played by @self
    • getLoop

      public boolean getLoop()
      Returns %TRUE if videos have been set to loop.
      Returns:
      %TRUE if streams should loop
    • getMediaStream

      public MediaStream getMediaStream()
      Gets the media stream managed by @self or %NULL if none.
      Returns:
      The media stream managed by @self
    • setAutoplay

      public void setAutoplay(boolean autoplay)
      Sets whether @self automatically starts playback when it
      becomes visible or when a new file gets loaded.
      Parameters:
      autoplay - whether media streams should autoplay
    • setFile

      public void setFile(@Nullable File file)
      Makes @self play the given @file.
      Parameters:
      file - the file to play
    • setFilename

      public void setFilename(@Nullable Str filename)
      Makes @self play the given @filename.

      This is a utility function that calls gtk_video_set_file(),
      Parameters:
      filename - the filename to play
    • setFilename

      public void setFilename(String filename)
      Makes @self play the given @filename.

      This is a utility function that calls gtk_video_set_file(),
      Parameters:
      filename - the filename to play
    • setLoop

      public void setLoop(boolean loop)
      Sets whether new files loaded by @self should be set to loop.
      Parameters:
      loop - whether media streams should loop
    • setMediaStream

      public void setMediaStream(@Nullable MediaStream 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
      [class@Gtk.Picture] for display.

      If you want to display a file, consider using [method@Gtk.Video.set_file]
      instead.
      Parameters:
      stream - The media stream to play or %NULL to unset
    • setResource

      public void setResource(@Nullable Str resource_path)
      Makes @self play the resource at the given @resource_path.

      This is a utility function that calls [method@Gtk.Video.set_file].
      Parameters:
      resource_path - the resource to set
    • setResource

      public void setResource(String resource_path)
      Makes @self play the resource at the given @resource_path.

      This is a utility function that calls [method@Gtk.Video.set_file].
      Parameters:
      resource_path - the resource to set
    • asAccessible

      public Accessible asAccessible()
      Implements interface Accessible. Call this to get access to interface functions.
      Overrides:
      asAccessible in class Widget
      Returns:
      Accessible
    • asBuildable

      public Buildable asBuildable()
      Implements interface Buildable. Call this to get access to interface functions.
      Overrides:
      asBuildable in class Widget
      Returns:
      Buildable
    • asConstraintTarget

      public ConstraintTarget asConstraintTarget()
      Implements interface ConstraintTarget. Call this to get access to interface functions.
      Overrides:
      asConstraintTarget in class Widget
      Returns:
      ConstraintTarget
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()