Gtk.MediaFile¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.MediaStream (29), GObject.Object (37), Gdk.Paintable (10)
- Structs:
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
|||
r/w/en |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Gtk.MediaFile(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
GtkMediaFile
implementsGtkMediaStream
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 implementations using GStreamer and ffmpeg.
- classmethod new_for_file(file)[source]¶
- Parameters:
file (
Gio.File
) – The file to play- Returns:
a new
GtkMediaFile
playing file- Return type:
Creates a new media file to play file.
- classmethod new_for_filename(filename)[source]¶
- Parameters:
filename (
str
) – filename to open- Returns:
a new
GtkMediaFile
playing filename- Return type:
Creates a new media file for the given filename.
This is a utility function that converts the given filename to a
GFile
and calls [ctor`Gtk`.MediaFile.new_for_file].
- classmethod new_for_input_stream(stream)[source]¶
- Parameters:
stream (
Gio.InputStream
) – The stream to play- Returns:
a new
GtkMediaFile
- Return type:
Creates a new media file to play stream.
If you want the resulting media to be seekable, the stream should implement the
GSeekable
interface.
- classmethod new_for_resource(resource_path)[source]¶
- Parameters:
resource_path (
str
) – resource path to open- Returns:
a new
GtkMediaFile
playing resource_path- Return type:
Creates a new new media file for the given resource.
This is a utility function that converts the given resource to a
GFile
and calls [ctor`Gtk`.MediaFile.new_for_file].
- get_file()[source]¶
-
Returns the file that self is currently playing from.
When self is not playing or not playing from a file,
None
is returned.
- get_input_stream()[source]¶
- Returns:
The currently playing stream
- Return type:
Returns the stream that self is currently playing from.
When self is not playing or not playing from a stream,
None
is returned.
- set_file(file)[source]¶
-
Sets the
GtkMediaFile
to play the given file.If any file is still playing, stop playing it.
- set_filename(filename)[source]¶
-
Sets the `:obj:Gtk.MediaFile to play the given file.
This is a utility function that converts the given filename to a
GFile
and calls [method`Gtk`.MediaFile.set_file].
- set_input_stream(stream)[source]¶
- Parameters:
stream (
Gio.InputStream
orNone
) – the stream to play from
Sets the
GtkMediaFile
to play the given stream.If anything is still playing, stop playing it.
Full control about the stream is assumed for the duration of playback. The stream will not be closed.
- set_resource(resource_path)[source]¶
-
Sets the `:obj:Gtk.MediaFile to play the given resource.
This is a utility function that converts the given resource_path to a
GFile
and calls [method`Gtk`.MediaFile.set_file].
- do_close() virtual¶
- do_open() virtual¶
Property Details¶
- Gtk.MediaFile.props.file¶
- Name:
file
- Type:
- Default Value:
- Flags:
The file being played back or
None
if not playing a file.