Basics
Guides
API Reference
Basics
Guides
API Reference
[493:14] static extends: object
Generated metadata helpers for MediaStream class surfaces.
properties ()
Returns property metadata for
MediaStream.
A list.[21:7] extends: object
The integration point for media playback inside GTK. GTK provides an
implementation of the GtkMediaStream interface that is called
[class@Gtk.MediaFile]. Apart from application-facing API for stream playback,
GtkMediaStream has a number of APIs that are only useful for
implementations and should not be used in applications:
[method@Gtk.MediaStream.prepared], [method@Gtk.MediaStream.unprepared],
[method@Gtk.MediaStream.update], [method@Gtk.MediaStream.ended],
[method@Gtk.MediaStream.seek_success], [method@Gtk.MediaStream.seek_failed],
[method@Gtk.MediaStream.gerror], [method@Gtk.MediaStream.error],
[method@Gtk.MediaStream.error_valist].
MediaStream (Handle = null)
Creates a new
MediaStreamby wrapping a native handle or another wrapper.
Handle is the native handle or another wrapper whose handle to adopt.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asObject ()
Wraps this handle as
Object.
A Object object.asPaintable ()
Wraps this handle as
Paintable.
A Paintable object.getProperty (string Name)
Reads one generated property by name.
setProperty (string Name, Value)
Writes one generated property by name.
setLoop (bool Value)
Try to restart the media from the beginning once it ended.
Value is the new property value.None.setMuted (bool Value)
Whether the audio stream should be muted.
Value is the new property value.None.setPlaying (bool Value)
Whether the stream is currently playing.
Value is the new property value.None.setVolume (double Value)
Volume of the audio stream.
Value is the new property value.None.ended ()
Pauses the media stream and marks it as ended. This is a hint only, calls to [method@Gtk.MediaStream.play] may still happen. The media stream must be prepared when this function is called.
None.gerror (object error)
Sets @self into an error state. This will pause the stream (you can check for an error via [method@Gtk.MediaStream.get_error] in your GtkMediaStream.pause() implementation), abort pending seeks and mark the stream as prepared. if the stream is already in an error state, this call will be ignored and the existing error will be retained. To unset an error, the stream must be reset via a call to [method@Gtk.MediaStream.unprepared].
error is the GError to set.None.get_ended ()
Returns whether the streams playback is finished.
get_error ()
If the stream is in an error state, returns the
GErrorexplaining that state. Any type of error can be reported here depending on the implementation of the media stream. A media stream in an error cannot be operated on, calls like [method@Gtk.MediaStream.play] or [method@Gtk.MediaStream.seek] will not have any effect.GtkMediaStreamitself does not provide a way to unset an error, but implementations may provide options. For example, a [class@Gtk.MediaFile] will unset errors when a new source is set, e.g. with [method@Gtk.MediaFile.set_file].
get_loop ()
Returns whether the stream is set to loop. See [method@Gtk.MediaStream.set_loop] for details.
get_muted ()
Returns whether the audio for the stream is muted. See [method@Gtk.MediaStream.set_muted] for details.
get_playing ()
Return whether the stream is currently playing.
get_volume ()
Returns the volume of the audio for the stream. See [method@Gtk.MediaStream.set_volume] for details.
has_audio ()
Returns whether the stream has audio.
has_video ()
Returns whether the stream has video.
is_prepared ()
Returns whether the stream has finished initializing. At this point the existence of audio and video is known.
is_seekable ()
Checks if a stream may be seekable. This is meant to be a hint. Streams may not allow seeking even if this function returns %TRUE. However, if this function returns %FALSE, streams are guaranteed to not be seekable and user interfaces may hide controls that allow seeking. It is allowed to call [method@Gtk.MediaStream.seek] on a non-seekable stream, though it will not do anything.
is_seeking ()
Checks if there is currently a seek operation going on.
pause ()
Pauses playback of the stream. If the stream is not playing, do nothing.
None.play ()
Starts playing the stream. If the stream is in error or already playing, do nothing.
None.realize (object surface)
Called by users to attach the media stream to a
GdkSurfacethey manage. The stream can then access the resources of @surface for its rendering purposes. In particular, media streams might want to create aGdkGLContextor sync to theGdkFrameClock. Whoever calls this function is responsible for calling [method@Gtk.MediaStream.unrealize] before either the stream or @surface get destroyed. Multiple calls to this function may happen from different users of the video, even with the same @surface. Each of these calls must be followed by its own call to [method@Gtk.MediaStream.unrealize]. It is not required to call this function to make a media stream work.
surface is a GdkSurface.None.seek_failed ()
Ends a seek operation started via GtkMediaStream.seek() as a failure. This will not cause an error on the stream and will assume that playback continues as if no seek had happened. See [method@Gtk.MediaStream.seek_success] for the other way of ending a seek.
None.seek_success ()
Ends a seek operation started via GtkMediaStream.seek() successfully. This function will unset the GtkMediaStream:ended property if it was set. See [method@Gtk.MediaStream.seek_failed] for the other way of ending a seek.
None.set_loop (bool loop)
Sets whether the stream should loop. In this case, it will attempt to restart playback from the beginning instead of stopping at the end. Not all streams may support looping, in particular non-seekable streams. Those streams will ignore the loop setting and just end.
loop is %TRUE if the stream should loop.None.set_muted (bool muted)
Sets whether the audio stream should be muted. Muting a stream will cause no audio to be played, but it does not modify the volume. This means that muting and then unmuting the stream will restore the volume settings. If the stream has no audio, calling this function will still work but it will not have an audible effect.
muted is %TRUE if the stream should be muted.None.set_playing (bool playing)
Starts or pauses playback of the stream.
playing is whether to start or pause playback.None.set_volume (double volume)
Sets the volume of the audio stream. This function call will work even if the stream is muted. The given @volume should range from 0.0 for silence to 1.0 for as loud as possible. Values outside of this range will be clamped to the nearest value. If the stream has no audio or is muted, calling this function will still work but it will not have an immediate audible effect. When the stream is unmuted, the new volume setting will take effect.
volume is New volume of the stream from 0.0 to 1.0.None.stream_ended ()
Pauses the media stream and marks it as ended. This is a hint only, calls to [method@Gtk.MediaStream.play] may still happen. The media stream must be prepared when this function is called.
None.stream_unprepared ()
Resets a given media stream implementation. [method@Gtk.MediaStream.stream_prepared] can then be called again. This function will also reset any error state the stream was in.
None.unprepared ()
Same as gtk_media_stream_stream_unprepared().
None.unrealize (object surface)
Undoes a previous call to gtk_media_stream_realize(). This causes the stream to release all resources it had allocated from @surface.
surface is the GdkSurface the stream was realized with.None.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.