MediaFile

open class MediaFile(pointer: <Error class: unknown class><<Error class: unknown class>>) : MediaStream

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

Link copied to clipboard
constructor()

Creates a new empty media file.

constructor(file: <Error class: unknown class>)

Creates a new media file to play @file.

constructor(filename: String)

Creates a new media file for the given filename.

constructor(stream: <Error class: unknown class>)

Creates a new media file to play @stream.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open val duration: <Error class: unknown class>

The stream's duration in microseconds or 0 if unknown.

Link copied to clipboard
open val error: <Error class: unknown class>?

null for a properly working stream or the GError that the stream is in.

Link copied to clipboard
open var file: <Error class: unknown class>?

The file being played back or null if not playing a file.

Link copied to clipboard
open override val gdkPaintablePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
val gtkMediaFilePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
val gtkMediaStreamPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open var inputStream: <Error class: unknown class>?

The stream being played back or null if not playing a stream.

Link copied to clipboard
open var loop: Boolean

Try to restart the media from the beginning once it ended.

Link copied to clipboard
open var muted: Boolean

Whether the audio stream should be muted.

Link copied to clipboard
open var playing: Boolean

Whether the stream is currently playing.

Link copied to clipboard
open val timestamp: <Error class: unknown class>

The current presentation timestamp in microseconds.

Link copied to clipboard
open var volume: <Error class: unknown class>

Volume of the audio stream.

Functions

Link copied to clipboard
open fun clear()

Resets the media file to be empty.

Link copied to clipboard
open fun ended()

Pauses the media stream and marks it as ended.

Link copied to clipboard
open fun gerror(error: <Error class: unknown class>)

Sets @self into an error state.

Link copied to clipboard
open fun getEnded(): Boolean

Returns whether the streams playback is finished.

Link copied to clipboard
open fun hasAudio(): Boolean

Returns whether the stream has audio.

Link copied to clipboard
open fun hasVideo(): Boolean

Returns whether the stream has video.

Link copied to clipboard
open fun isPrepared(): Boolean

Returns whether the stream has finished initializing.

Link copied to clipboard
open fun isSeekable(): Boolean

Checks if a stream may be seekable.

Link copied to clipboard
open fun isSeeking(): Boolean

Checks if there is currently a seek operation going on.

Link copied to clipboard
open fun pause()

Pauses playback of the stream.

Link copied to clipboard
open fun play()

Starts playing the stream.

Link copied to clipboard
open fun prepared(hasAudio: Boolean, hasVideo: Boolean, seekable: Boolean, duration: <Error class: unknown class>)

Same as gtk_media_stream_stream_prepared().

Link copied to clipboard
open fun realize(surface: <Error class: unknown class>)

Called by users to attach the media stream to a GdkSurface they manage.

Link copied to clipboard
open fun seek(timestamp: <Error class: unknown class>)

Start a seek operation on @self to @timestamp.

Link copied to clipboard
open fun seekFailed()

Ends a seek operation started via GtkMediaStream.seek() as a failure.

Link copied to clipboard
open fun seekSuccess()

Ends a seek operation started via GtkMediaStream.seek() successfully.

Link copied to clipboard
open fun setFilename(filename: String? = null)

Sets the `GtkMediaFile to play the given file.

Link copied to clipboard
open fun setResource(resourcePath: String? = null)

Sets the `GtkMediaFile to play the given resource.

Link copied to clipboard
open fun streamEnded()

Pauses the media stream and marks it as ended.

Link copied to clipboard
open fun streamPrepared(hasAudio: Boolean, hasVideo: Boolean, seekable: Boolean, duration: <Error class: unknown class>)

Called by GtkMediaStream implementations to advertise the stream being ready to play and providing details about the stream.

Link copied to clipboard
open fun streamUnprepared()

Resets a given media stream implementation.

Link copied to clipboard
open fun unprepared()

Same as gtk_media_stream_stream_unprepared().

Link copied to clipboard
open fun unrealize(surface: <Error class: unknown class>)

Undoes a previous call to gtk_media_stream_realize().

Link copied to clipboard
open fun update(timestamp: <Error class: unknown class>)

Media stream implementations should regularly call this function to update the timestamp reported by the stream.