MediaFile#
Superclasses: MediaStream
, Object
Implemented Interfaces: Paintable
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.
Constructors#
- class MediaFile
-
- classmethod new_for_file(file: File) MediaFile #
Creates a new media file to play
file
.- Parameters:
file – The file to play
- classmethod new_for_filename(filename: str) MediaFile #
Creates a new media file for the given filename.
This is a utility function that converts the given
filename
to aGFile
and callsnew_for_file
.- Parameters:
filename – filename to open
- classmethod new_for_input_stream(stream: InputStream) MediaFile #
Creates a new media file to play
stream
.If you want the resulting media to be seekable, the stream should implement the
GSeekable
interface.- Parameters:
stream – The stream to play
- classmethod new_for_resource(resource_path: str) MediaFile #
Creates a new new media file for the given resource.
This is a utility function that converts the given
resource
to aGFile
and callsnew_for_file
.- Parameters:
resource_path – resource path to open
Methods#
- class MediaFile
-
- get_file() File | None #
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() InputStream | None #
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: File | None = None) None #
Sets the
GtkMediaFile
to play the given file.If any file is still playing, stop playing it.
- Parameters:
file – the file to play
- set_filename(filename: str | None = None) None #
Sets the `GtkMediaFile to play the given file.
This is a utility function that converts the given
filename
to aGFile
and callsset_file
.- Parameters:
filename – name of file to play
- set_input_stream(stream: InputStream | None = None) None #
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.- Parameters:
stream – the stream to play from
Properties#
- class MediaFile
-
- props.input_stream: InputStream#
The type of the None singleton.
Virtual Methods#
Fields#
- class MediaFile
- parent_instance#