gtk4::prelude

Trait MediaFileExt

Source
pub trait MediaFileExt:
    IsA<MediaFile>
    + Sealed
    + 'static {
    // Provided methods
    fn clear(&self) { ... }
    fn file(&self) -> Option<File> { ... }
    fn input_stream(&self) -> Option<InputStream> { ... }
    fn set_file(&self, file: Option<&impl IsA<File>>) { ... }
    fn set_filename(&self, filename: Option<impl AsRef<Path>>) { ... }
    fn set_input_stream(&self, stream: Option<&impl IsA<InputStream>>) { ... }
    fn set_resource(&self, resource_path: Option<&str>) { ... }
    fn connect_file_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId { ... }
    fn connect_input_stream_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all MediaFile methods.

§Implementors

MediaFile

Provided Methods§

Source

fn clear(&self)

Resets the media file to be empty.

Source

fn file(&self) -> Option<File>

Returns the file that @self is currently playing from.

When @self is not playing or not playing from a file, None is returned.

§Returns

The currently playing file

Source

fn input_stream(&self) -> Option<InputStream>

Returns the stream that @self is currently playing from.

When @self is not playing or not playing from a stream, None is returned.

§Returns

The currently playing stream

Source

fn set_file(&self, file: Option<&impl IsA<File>>)

Sets the MediaFile to play the given file.

If any file is still playing, stop playing it.

§file

the file to play

Source

fn set_filename(&self, filename: Option<impl AsRef<Path>>)

Sets the `GtkMediaFile to play the given file.

This is a utility function that converts the given @filename to a GFile and calls set_file().

§filename

name of file to play

Source

fn set_input_stream(&self, stream: Option<&impl IsA<InputStream>>)

Sets the MediaFile 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.

§stream

the stream to play from

Source

fn set_resource(&self, resource_path: Option<&str>)

Sets the `GtkMediaFile to play the given resource.

This is a utility function that converts the given @resource_path to a GFile and calls set_file().

§resource_path

path to resource to play

Source

fn connect_file_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Source

fn connect_input_stream_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§