Media class represents a media resource. It is instantiated
from the string form of a source URI. Information about the media such as
duration, metadata, tracks, and video resolution may be obtained from a
Media instance. The media information is obtained asynchronously
and so not necessarily available immediately after instantiation of the class.
All information should however be available if the instance has been
associated with a MediaPlayer and that player has transitioned to
MediaPlayer.Status#READY status. To be notified when metadata or
Tracks are added, observers may be registered with the collections
returned by getMetadata()and getTracks(), respectively.
The same Media object may be shared among multiple
MediaPlayer objects. Such a shared instance might manage a single
copy of the source media data to be used by all players, or it might require a
separate copy of the data for each player. The choice of implementation will
not however have any effect on player behavior at the interface level.
MediaPlayer, MediaException
| Modifier and Type | Class and Description |
|---|---|
| private class | |
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private ReadOnlyObjectWrapper | duration
The duration in seconds of the source media. |
| private ReadOnlyObjectWrapper | error
A property set to a MediaException value when an error occurs. |
| private ReadOnlyIntegerWrapper | height
The height in pixels of the source media. |
| private final Locator | jfxLocator
Locator used by the jfxmedia player, MediaPlayer needs access to this |
| private MetadataParser | |
| private ObservableMap | markers
The markers defined on this media source. |
| private ObservableMap | metadata
An |
| private final ObservableMap | |
| private MetadataListener | |
| private ObjectProperty | onError
Event handler called when an error occurs. |
| private final String | source
The source URI of the media; |
| private ObservableList | tracks
An |
| private final ObservableList | |
| private ReadOnlyIntegerWrapper | width
The width in pixels of the source media. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| pack-priv void | |
| public ReadOnlyObjectProperty | |
| private ReadOnlyObjectWrapper | |
| public ReadOnlyObjectProperty | |
| private ReadOnlyObjectWrapper | |
| public final Duration | Returns: the duration of the media,Duration#UNKNOWN if unknown or Duration#INDEFINITE for live streamsRetrieve the duration in seconds of the media. |
| public final MediaException | |
| public final int | Returns: the media height or zero if the height is undefined or unknown.Retrieve the height in pixels of the media. |
| public final ObservableMap | Returns: the markers defined on this media source.Retrieve the markers defined on this |
| public final ObservableMap | Returns: the metadata contained in this media source.Retrieve the metadata contained in this media source. |
| public final Runnable | Returns: the error handler ornull if none is defined.Retrieve the error handler to be called if an error occurs. |
| public String | |
| public final ObservableList | Returns: the tracks contained in this media source.Retrieve the tracks contained in this media source. |
| private Track | |
| public final int | Returns: the media width or zero if the width is undefined or unknown.Retrieve the width in pixels of the media. |
| public ReadOnlyIntegerProperty | |
| private ReadOnlyIntegerWrapper | |
| public ObjectProperty | |
| pack-priv Locator | |
| private void | |
| pack-priv final void | |
| private void | |
| pack-priv final void | |
| public final void | setOnError(Runnable
the error event handler. value)Set the event handler to be called when an error occurs. |
| pack-priv final void | |
| private synchronized void | |
| public ReadOnlyIntegerProperty | |
| private ReadOnlyIntegerWrapper |
| duration | back to summary |
|---|---|
| private ReadOnlyObjectWrapper<Duration> duration The duration in seconds of the source media. If the media duration is
unknown then this property value will be | |
| error | back to summary |
|---|---|
| private ReadOnlyObjectWrapper<MediaException> error A property set to a MediaException value when an error occurs.
If
| |
| height | back to summary |
|---|---|
| private ReadOnlyIntegerWrapper height The height in pixels of the source media. This may be zero if the media has no height, e.g., when playing audio, or if the height is currently unknown which may occur with streaming media.
| |
| jfxLocator | back to summary |
|---|---|
| private final Locator jfxLocator Locator used by the jfxmedia player, MediaPlayer needs access to this | |
| jfxParser | back to summary |
|---|---|
| private MetadataParser jfxParser | |
| markers | back to summary |
|---|---|
| private ObservableMap<String, Duration> markers The markers defined on this media source. A marker is defined to be a mapping from a name to a point in time between the beginning and end of the media. | |
| metadata | back to summary |
|---|---|
| private ObservableMap<String, Object> metadata An | |
| metadataBacking | back to summary |
|---|---|
| private final ObservableMap<String, Object> metadataBacking | |
| metadataListener | back to summary |
|---|---|
| private MetadataListener metadataListener | |
| onError | back to summary |
|---|---|
| private ObjectProperty<Runnable> onError Event handler called when an error occurs. This will happen if a malformed or invalid URL is passed to the constructor or there is a problem accessing the URL. | |
| source | back to summary |
|---|---|
| private final String source The source URI of the media; | |
| tracks | back to summary |
|---|---|
| private ObservableList<Track> tracks An
| |
| tracksBacking | back to summary |
|---|---|
| private final ObservableList<Track> tracksBacking | |
| width | back to summary |
|---|---|
| private ReadOnlyIntegerWrapper width The width in pixels of the source media. This may be zero if the media has no width, e.g., when playing audio, or if the width is currently unknown which may occur with streaming media.
| |
| Media | back to summary |
|---|---|
| public Media(String source) Constructs a If the source uses a non-blocking protocol such as FILE, then any
problems which can be detected immediately will cause a Constraints:
See java.net.URI for more information about URI formatting in general. JAR URL syntax is specified in java.net.JarURLConnection.
| |
| _setError | back to summary |
|---|---|
| pack-priv void _setError(MediaException. | |
| _updateMedia | back to summary |
|---|---|
| pack-priv void _updateMedia(Media _media) | |
| durationProperty | back to summary |
|---|---|
| public ReadOnlyObjectProperty | |
| durationPropertyImpl | back to summary |
|---|---|
| private ReadOnlyObjectWrapper | |
| errorProperty | back to summary |
|---|---|
| public ReadOnlyObjectProperty | |
| errorPropertyImpl | back to summary |
|---|---|
| private ReadOnlyObjectWrapper | |
| getDuration | back to summary |
|---|---|
| public final Duration getDuration() Retrieve the duration in seconds of the media.
| |
| getError | back to summary |
|---|---|
| public final MediaException getError() Return any error encountered in the media.
| |
| getHeight | back to summary |
|---|---|
| public final int getHeight() Retrieve the height in pixels of the media.
| |
| getMarkers | back to summary |
|---|---|
| public final ObservableMap Retrieve the markers defined on this
| |
| getMetadata | back to summary |
|---|---|
| public final ObservableMap Retrieve the metadata contained in this media source. If there are
no metadata, the returned
| |
| getOnError | back to summary |
|---|---|
| public final Runnable getOnError() Retrieve the error handler to be called if an error occurs.
| |
| getSource | back to summary |
|---|---|
| public String getSource() Retrieve the source URI of the media. | |
| getTracks | back to summary |
|---|---|
| public final ObservableList Retrieve the tracks contained in this media source. If there are
no tracks, the returned
| |
| getTrackWithID | back to summary |
|---|---|
| private Track getTrackWithID(long trackID) | |
| getWidth | back to summary |
|---|---|
| public final int getWidth() Retrieve the width in pixels of the media.
| |
| heightProperty | back to summary |
|---|---|
| public ReadOnlyIntegerProperty heightProperty() | |
| heightPropertyImpl | back to summary |
|---|---|
| private ReadOnlyIntegerWrapper heightPropertyImpl() | |
| onErrorProperty | back to summary |
|---|---|
| public ObjectProperty | |
| retrieveJfxLocator | back to summary |
|---|---|
| pack-priv Locator retrieveJfxLocator() | |
| runMetadataParser | back to summary |
|---|---|
| private void runMetadataParser() | |
| setDuration | back to summary |
|---|---|
| pack-priv final void setDuration(Duration value) | |
| setError | back to summary |
|---|---|
| private void setError(MediaException value) | |
| setHeight | back to summary |
|---|---|
| pack-priv final void setHeight(int value) | |
| setOnError | back to summary |
|---|---|
| public final void setOnError(Runnable value) Set the event handler to be called when an error occurs.
| |
| setWidth | back to summary |
|---|---|
| pack-priv final void setWidth(int value) | |
| updateMetadata | back to summary |
|---|---|
| private synchronized void updateMetadata(Map<String, Object> metadata) | |
| widthProperty | back to summary |
|---|---|
| public ReadOnlyIntegerProperty widthProperty() | |
| widthPropertyImpl | back to summary |
|---|---|
| private ReadOnlyIntegerWrapper widthPropertyImpl() | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | onMetadata(final Map<String, Object> metadata)
Implements com. The metadata notification indicates a metadata has been reached or metadata value was changed during playback. |
| _MetadataListener | back to summary |
|---|---|
| private _MetadataListener() | |
| onMetadata | back to summary |
|---|---|
| public void onMetadata(final Map<String, Object> metadata) Implements com. Doc from com. The metadata notification indicates a metadata has been reached or metadata value was changed during playback.
| |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| InitLocator | back to summary |
|---|---|
| private InitLocator() | |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation.
| |