:right-sidebar: True Video =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: Video(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ConstraintTarget` :Constructors: :: Video(**properties) new() -> Gtk.Widget new_for_file(file:Gio.File=None) -> Gtk.Widget new_for_filename(filename:str=None) -> Gtk.Widget new_for_media_stream(stream:Gtk.MediaStream=None) -> Gtk.Widget new_for_resource(resource_path:str=None) -> Gtk.Widget Constructors ------------ .. rst-class:: interim-class .. class:: Video :no-index: .. classmethod:: new() -> ~gi.repository.Gtk.Widget Creates a new empty ``GtkVideo``. .. classmethod:: new_for_file(file: ~gi.repository.Gio.File | None = None) -> ~gi.repository.Gtk.Widget Creates a ``GtkVideo`` to play back the given ``file``. :param file: a ``GFile`` .. classmethod:: new_for_filename(filename: str | None = None) -> ~gi.repository.Gtk.Widget Creates a ``GtkVideo`` to play back the given ``filename``. This is a utility function that calls :obj:`~gi.repository.Gtk.Video.new_for_file`, See that function for details. :param filename: filename to play back .. classmethod:: new_for_media_stream(stream: ~gi.repository.Gtk.MediaStream | None = None) -> ~gi.repository.Gtk.Widget Creates a ``GtkVideo`` to play back the given ``stream``. :param stream: a ``GtkMediaStream`` .. classmethod:: new_for_resource(resource_path: str | None = None) -> ~gi.repository.Gtk.Widget Creates a ``GtkVideo`` to play back the resource at the given ``resource_path``. This is a utility function that calls :obj:`~gi.repository.Gtk.Video.new_for_file`. :param resource_path: resource path to play back Methods ------- .. rst-class:: interim-class .. class:: Video :no-index: .. method:: get_autoplay() -> bool Returns :const:`True` if videos have been set to loop. .. method:: get_file() -> ~gi.repository.Gio.File | None Gets the file played by ``self`` or :const:`None` if not playing back a file. .. method:: get_graphics_offload() -> ~gi.repository.Gtk.GraphicsOffloadEnabled Returns whether graphics offload is enabled. See :obj:`~gi.repository.Gtk.GraphicsOffload` for more information on graphics offload. .. versionadded:: 4.14 .. method:: get_loop() -> bool Returns :const:`True` if videos have been set to loop. .. method:: get_media_stream() -> ~gi.repository.Gtk.MediaStream | None Gets the media stream managed by ``self`` or :const:`None` if none. .. method:: set_autoplay(autoplay: bool) -> None Sets whether ``self`` automatically starts playback when it becomes visible or when a new file gets loaded. :param autoplay: whether media streams should autoplay .. method:: set_file(file: ~gi.repository.Gio.File | None = None) -> None Makes ``self`` play the given ``file``. :param file: the file to play .. method:: set_filename(filename: str | None = None) -> None Makes ``self`` play the given ``filename``. This is a utility function that calls :func:`~gi.repository.Gtk.Video.set_file`, :param filename: the filename to play .. method:: set_graphics_offload(enabled: ~gi.repository.Gtk.GraphicsOffloadEnabled) -> None Sets whether to enable graphics offload. See :obj:`~gi.repository.Gtk.GraphicsOffload` for more information on graphics offload. .. versionadded:: 4.14 :param enabled: the new graphics offload status .. method:: set_loop(loop: bool) -> None Sets whether new files loaded by ``self`` should be set to loop. :param loop: whether media streams should loop .. method:: set_media_stream(stream: ~gi.repository.Gtk.MediaStream | None = None) -> None 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 :obj:`~gi.repository.Gtk.Picture` for display. If you want to display a file, consider using :obj:`~gi.repository.Gtk.Video.set_file` instead. :param stream: The media stream to play or :const:`None` to unset .. method:: set_resource(resource_path: str | None = None) -> None Makes ``self`` play the resource at the given ``resource_path``. This is a utility function that calls :obj:`~gi.repository.Gtk.Video.set_file`. :param resource_path: the resource to set Properties ---------- .. rst-class:: interim-class .. class:: Video :no-index: .. attribute:: props.autoplay :type: bool If the video should automatically begin playing. .. attribute:: props.file :type: ~gi.repository.Gio.File The file played by this video if the video is playing a file. .. attribute:: props.graphics_offload :type: ~gi.repository.Gtk.GraphicsOffloadEnabled Whether to enable graphics offload. .. versionadded:: 4.14 .. attribute:: props.loop :type: bool If new media files should be set to loop. .. attribute:: props.media_stream :type: ~gi.repository.Gtk.MediaStream The media-stream played