Class MediaFile
- Direct Known Subclasses:
MediaFile.MediaFile$Impl
GtkMediaStream interface 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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classMediaFile.Builder<B extends MediaFile.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classThe MediaFile$Impl type represents a native instance of the abstract MediaFile class.static classNested classes/interfaces inherited from class org.gnome.gtk.MediaStream
MediaStream.MediaStream$Impl, MediaStream.MediaStreamClassNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClassNested classes/interfaces inherited from interface org.gnome.gdk.Paintable
Paintable.InvalidateContentsCallback, Paintable.InvalidateSizeCallback, Paintable.Paintable$Impl, Paintable.PaintableInterface -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new MediaFile.MediaFile(MemorySegment address) Create a MediaFile proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected MediaFileasParent()Returns this instance as if it were its parent type.voidclear()Resets the media file to be empty.protected voidclose()static MediaFileCreates a new media file to playfile.static MediaFileforFilename(String filename) Creates a new media file for the given filename.static MediaFileforInputStream(InputStream stream) Creates a new media file to playstream.static MediaFileforResource(String resourcePath) Creates a new new media file for the given resource.@Nullable FilegetFile()Returns the file that this MediaFile is currently playing from.@Nullable InputStreamReturns the stream that this MediaFile is currently playing from.static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the MediaFile classprotected voidopen()voidSets theGtkMediaFileto play the given file.voidsetFilename(@Nullable String filename) Sets theGtkMediaFileto play the given file.voidsetInputStream(@Nullable InputStream stream) Sets theGtkMediaFileto play the given stream.voidsetResource(@Nullable String resourcePath) Sets theGtkMediaFileto play the given resource.Methods inherited from class org.gnome.gtk.MediaStream
ended, error, gerror, getDuration, getEnded, getError, getLoop, getMuted, getPlaying, getTimestamp, getVolume, hasAudio, hasVideo, isPrepared, isSeekable, isSeeking, pause, play, prepared, realize, seek, seekFailed, seekSuccess, setLoop, setMuted, setPlaying, setVolume, streamEnded, streamPrepared, streamUnprepared, unprepared, unrealize, update, updateAudioMethods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, builder, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gnome.gdk.Paintable
computeConcreteSize, emitInvalidateContents, emitInvalidateSize, getCurrentImage, getFlags, getIntrinsicAspectRatio, getIntrinsicHeight, getIntrinsicWidth, invalidateContents, invalidateSize, onInvalidateContents, onInvalidateSize, snapshot
-
Constructor Details
-
MediaFile
Create a MediaFile proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
MediaFile
public MediaFile()Creates a new MediaFile.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type.- Overrides:
asParentin classMediaStream
-
forFile
-
forFilename
Creates a new media file for the given filename.This is a utility function that converts the given
filenameto aGFileand callsforFile(org.gnome.gio.File).- Parameters:
filename- filename to open- Returns:
- a new
GtkMediaFileplayingfilename
-
forInputStream
Creates a new media file to playstream.If you want the resulting media to be seekable, the stream should implement the
GSeekableinterface.- Parameters:
stream- The stream to play- Returns:
- a new
GtkMediaFile
-
forResource
Creates a new new media file for the given resource.This is a utility function that converts the given
resourceto aGFileand callsforFile(org.gnome.gio.File).- Parameters:
resourcePath- resource path to open- Returns:
- a new
GtkMediaFileplayingresourcePath
-
clear
public void clear()Resets the media file to be empty. -
getFile
Returns the file that this MediaFile is currently playing from.When this MediaFile is not playing or not playing from a file,
nullis returned.- Returns:
- The currently playing file
-
getInputStream
Returns the stream that this MediaFile is currently playing from.When this MediaFile is not playing or not playing from a stream,
nullis returned.- Returns:
- The currently playing stream
-
setFile
Sets theGtkMediaFileto play the given file.If any file is still playing, stop playing it.
- Parameters:
file- the file to play
-
setFilename
Sets theGtkMediaFileto play the given file.This is a utility function that converts the given
filenameto aGFileand callssetFile(org.gnome.gio.File).- Parameters:
filename- name of file to play
-
setInputStream
Sets theGtkMediaFileto play the given stream.If anything is still playing, stop playing it.
Full control about the
streamis assumed for the duration of playback. The stream will not be closed.- Parameters:
stream- the stream to play from
-
setResource
Sets theGtkMediaFileto play the given resource.This is a utility function that converts the given
resourcePathto aGFileand callssetFile(org.gnome.gio.File).- Parameters:
resourcePath- path to resource to play
-
close
protected void close() -
open
protected void open()
-