pub trait MediaStreamImpl: MediaStreamImplExt + ObjectImpl {
    // Provided methods
    fn pause(&self) { ... }
    fn play(&self) -> bool { ... }
    fn realize(&self, surface: Surface) { ... }
    fn seek(&self, timestamp: i64) { ... }
    fn unrealize(&self, surface: Surface) { ... }
    fn update_audio(&self, muted: bool, volume: f64) { ... }

Provided Methods§


fn pause(&self)

Pauses playback of the stream.

If the stream is not playing, do nothing.


fn play(&self) -> bool


fn realize(&self, surface: Surface)

Called by users to attach the media stream to a gdk::Surface they manage.

The stream can then access the resources of @surface for its rendering purposes. In particular, media streams might want to create a gdk::GLContext or sync to the gdk::FrameClock.

Whoever calls this function is responsible for calling MediaStreamExt::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 MediaStreamExt::unrealize().

It is not required to call this function to make a media stream work.


a gdk::Surface


fn seek(&self, timestamp: i64)

Start a seek operation on @self to @timestamp.

If @timestamp is out of range, it will be clamped.

Seek operations may not finish instantly. While a seek operation is in process, the seeking property will be set.

When calling gtk_media_stream_seek() during an ongoing seek operation, the new seek will override any pending seek.


timestamp to seek to.


fn unrealize(&self, surface: Surface)

Undoes a previous call to gtk_media_stream_realize().

This causes the stream to release all resources it had allocated from @surface.


the gdk::Surface the stream was realized with


fn update_audio(&self, muted: bool, volume: f64)

Object Safety§

This trait is not object safe.