### Class

# Gtk MediaFile

since: 4.0

#### Description [src]

    abstract class Gtk.MediaFile : Gtk.MediaStream
      implements Gdk.Paintable {
      /* No available fields */
    }

`GtkMediaFile` implements `GtkMediaStream` for files.

This provides a simple way to play back video files with GTK.

GTK provides a GIO extension point for `GtkMediaFile` implementations to allow for external implementations using various media frameworks.

GTK itself includes an implementation using GStreamer.

Available since: 4.0

#### Ancestors

- GtkMediaStream
- GObject

#### Implements

- GdkPaintable

#### Constructors

###### gtk_media_file_new

Creates a new empty media file.

since: 4.0

###### gtk_media_file_new_for_file

Creates a new media file to play `file`.

since: 4.0

###### gtk_media_file_new_for_filename

Creates a new media file for the given filename.

since: 4.0

###### gtk_media_file_new_for_input_stream

Creates a new media file to play `stream`.

since: 4.0

###### gtk_media_file_new_for_resource

Creates a new new media file for the given resource.

since: 4.0

#### Instance methods

###### gtk_media_file_clear

Resets the media file to be empty.

since: 4.0

###### gtk_media_file_get_file

Returns the file that `self` is currently playing from.

since: 4.0

###### gtk_media_file_get_input_stream

Returns the stream that `self` is currently playing from.

since: 4.0

###### gtk_media_file_set_file

Sets the `GtkMediaFile` to play the given file.

since: 4.0

###### gtk_media_file_set_filename

Sets the `GtkMediaFile to play the given file.

since: 4.0

###### gtk_media_file_set_input_stream

Sets the `GtkMediaFile` to play the given stream.

since: 4.0

###### gtk_media_file_set_resource

Sets the `GtkMediaFile to play the given resource.

since: 4.0

##### Methods inherited from GtkMediaStream (34)

Please see GtkMediaStream for a full list of methods.

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

##### Methods inherited from GdkPaintable (9)

###### gdk_paintable_compute_concrete_size

Compute a concrete size for the `GdkPaintable`.

since: 4.0

###### gdk_paintable_get_current_image

Gets an immutable paintable for the current contents displayed by `paintable`.

since: 4.0

###### gdk_paintable_get_flags

Get flags for the paintable.

since: 4.0

###### gdk_paintable_get_intrinsic_aspect_ratio

Gets the preferred aspect ratio the `paintable` would like to be displayed at.

since: 4.0

###### gdk_paintable_get_intrinsic_height

Gets the preferred height the `paintable` would like to be displayed at.

since: 4.0

###### gdk_paintable_get_intrinsic_width

Gets the preferred width the `paintable` would like to be displayed at.

since: 4.0

###### gdk_paintable_invalidate_contents

Called by implementations of `GdkPaintable` to invalidate their contents.

since: 4.0

###### gdk_paintable_invalidate_size

Called by implementations of `GdkPaintable` to invalidate their size.

since: 4.0

###### gdk_paintable_snapshot

Snapshots the given paintable with the given `width` and `height`.

since: 4.0

#### Properties

###### Gtk.MediaFile:file

The file being played back or `NULL` if not playing a file.

since: 4.0

###### Gtk.MediaFile:input-stream

The stream being played back or `NULL` if not playing a stream.

since: 4.0

##### Properties inherited from GtkMediaStream (13)

###### Gtk.MediaStream:duration

The stream’s duration in microseconds or 0 if unknown.

since: 4.0

###### Gtk.MediaStream:ended

Set when playback has finished.

since: 4.0

###### Gtk.MediaStream:error

`NULL` for a properly working stream or the `GError` that the stream is in.

since: 4.0

###### Gtk.MediaStream:has-audio

Whether the stream contains audio.

since: 4.0

###### Gtk.MediaStream:has-video

Whether the stream contains video.

since: 4.0

###### Gtk.MediaStream:loop

Try to restart the media from the beginning once it ended.

since: 4.0

###### Gtk.MediaStream:muted

Whether the audio stream should be muted.

since: 4.0

###### Gtk.MediaStream:playing

Whether the stream is currently playing.

since: 4.0

###### Gtk.MediaStream:prepared

Whether the stream has finished initializing and existence of audio and video is known.

since: 4.0

###### Gtk.MediaStream:seekable

Set unless the stream is known to not support seeking.

since: 4.0

###### Gtk.MediaStream:seeking

Set while a seek is in progress.

since: 4.0

###### Gtk.MediaStream:timestamp

The current presentation timestamp in microseconds.

since: 4.0

###### Gtk.MediaStream:volume

Volume of the audio stream.

since: 4.0

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

since: 2.0

##### Signals inherited from GdkPaintable (2)

###### GdkPaintable::invalidate-contents

Emitted when the contents of the `paintable` change.

since: 4.0

###### GdkPaintable::invalidate-size

Emitted when the intrinsic size of the `paintable` changes.

since: 4.0

#### Class structure

    struct GtkMediaFileClass {
      GtkMediaStreamClass parent_class;
      void (* open) (
        GtkMediaFile* self
      );
      void (* close) (
        GtkMediaFile* self
      );
      void (* _gtk_reserved1) (
    void
      );
      void (* _gtk_reserved2) (
    void
      );
      void (* _gtk_reserved3) (
    void
      );
      void (* _gtk_reserved4) (
    void
      );

    }

No description available.

###### Class members

`parent_class: GtkMediaStreamClass`
  No description available.
`open: void (* open) ( GtkMediaFile* self )`
  No description available.
`close: void (* close) ( GtkMediaFile* self )`
  No description available.
`_gtk_reserved1: void (* _gtk_reserved1) ( void )`
  No description available.
`_gtk_reserved2: void (* _gtk_reserved2) ( void )`
  No description available.
`_gtk_reserved3: void (* _gtk_reserved3) ( void )`
  No description available.
`_gtk_reserved4: void (* _gtk_reserved4) ( void )`
  No description available.

#### Virtual methods

###### Gtk.MediaFileClass.close

No description available.

since: 4.0

###### Gtk.MediaFileClass.open

No description available.

since: 4.0