Basics
Guides
API Reference
Basics
Guides
API Reference
[12:7] extends: FxObj
Wraps JavaFX Media, which represents a media resource (audio or video) loaded from a URI for playback through a MediaPlayer. The source must be a fully qualified URI string using the file:// scheme for local files or http:// for network streams. Once constructed, pass this object to a MediaPlayer to control playback.
Media (string Source)
Creates a new Media object from the given URI string.
Source is a string with the media URI, e.g., file:///path/to/file.mp4.this objectgetSource ()
Returns the source URI string used to create this Media object.
A string with the source URI.getWidth ()
Returns the width in pixels of the video, or 0 for audio-only media.
An int with the video width.getHeight ()
Returns the height in pixels of the video, or 0 for audio-only media.
An int with the video height.getDuration ()
Returns the duration of the media in milliseconds.
A double with the duration in milliseconds.getError ()
Returns the most recent media error, or null when no error has been reported.
An AJO holding the javafx.scene.media.MediaException, or null.errorProperty ()
Returns the read-only property holding the most recent media error.
A ReadOnlyObjectProperty AJO holding the MediaException.setOnError (callback Cb)
Sets a callback that fires when an error occurs while loading or processing the media.
Cb is a callback invoked with no arguments.this objectgetOnError ()
Returns the current onError handler.
An AJO holding the Runnable, or null when none is set.onErrorProperty ()
Returns the property holding the onError handler.
An ObjectProperty AJO holding the Runnable.getMetadata ()
Returns the live ObservableMap of metadata key/value pairs read from the media source.
An ObservableMap AJO from String to Object.widthProperty ()
Returns the read-only property holding the media width in pixels.
A ReadOnlyIntegerProperty AJO.heightProperty ()
Returns the read-only property holding the media height in pixels.
A ReadOnlyIntegerProperty AJO.durationProperty ()
Returns the read-only property holding the media duration.
A ReadOnlyObjectProperty AJO holding the Duration.getTracks ()
Returns the live ObservableList of tracks that compose this media resource.
An ObservableList AJO of Track elements.getMarkers ()
Returns the live ObservableMap of named markers defined on this media, keyed by name with Duration values.
An ObservableMap AJO from String to Duration.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.