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: Long

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: Long

The current presentation timestamp in microseconds.

Link copied to clipboard
open var volume: Double

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 gerror(error: <Error class: unknown class>)

Sets @self into an error state.

Link copied to clipboard
open fun getDuration(): Long

Gets the duration of the stream.

Link copied to clipboard
open fun getEnded(): Boolean

Returns whether the streams playback is finished.

Link copied to clipboard
open fun getError(): <Error class: unknown class>?

If the stream is in an error state, returns the GError explaining that state.

Link copied to clipboard
open fun getFile(): <Error class: unknown class>?

Returns the file that @self is currently playing from.

Link copied to clipboard
open fun getInputStream(): <Error class: unknown class>?

Returns the stream that @self is currently playing from.

Link copied to clipboard
open fun getLoop(): Boolean

Returns whether the stream is set to loop.

Link copied to clipboard
open fun getMuted(): Boolean

Returns whether the audio for the stream is muted.

Link copied to clipboard
open fun getPlaying(): Boolean

Return whether the stream is currently playing.

Link copied to clipboard
open fun getTimestamp(): Long

Returns the current presentation timestamp in microseconds.

Link copied to clipboard
open fun getVolume(): Double

Returns the volume of the audio for the stream.

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 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: Long)

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 setFile(file: <Error class: unknown class>? = null)

Sets the GtkMediaFile to play the given file.

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

Sets the `GtkMediaFile to play the given file.

Link copied to clipboard
open fun setInputStream(stream: <Error class: unknown class>? = null)

Sets the GtkMediaFile to play the given stream.

Link copied to clipboard
open fun setLoop(loop: Boolean)

Sets whether the stream should loop.

Link copied to clipboard
open fun setMuted(muted: Boolean)

Sets whether the audio stream should be muted.

Link copied to clipboard
open fun setPlaying(playing: Boolean)

Starts or pauses playback of the stream.

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

Sets the `GtkMediaFile to play the given resource.

Link copied to clipboard
open fun setVolume(volume: Double)

Sets the volume of the audio stream.

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: Long)

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 unrealize(surface: <Error class: unknown class>)

Undoes a previous call to gtk_media_stream_realize().

Link copied to clipboard
open fun update(timestamp: Long)

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