Enum Class MediaPlayer.Status
- All Implemented Interfaces:
-
Serializable,Comparable<MediaPlayer.Status>,Constable
- Enclosing class:
MediaPlayer
public static enum MediaPlayer.Status extends Enum<MediaPlayer.Status>
MediaPlayer. The principal MediaPlayer status transitions are given in the following table:
| Current \ Next | READY | PAUSED | PLAYING | STALLED | STOPPED | DISPOSED |
|---|---|---|---|---|---|---|
| UNKNOWN | pre-roll | dispose() | ||||
| READY | autoplay; play() | dispose() | ||||
| PAUSED | play() | stop() | dispose() | |||
| PLAYING | pause() | buffering data | stop() | dispose() | ||
| STALLED | pause() | data buffered | stop() | dispose() | ||
| STOPPED | pause() | play() | dispose() | |||
| HALTED | dispose() |
The table rows represent the current state of the player and the columns the next state of the player. The cell at the intersection of a given row and column lists the events which can cause a transition from the row state to the column state. An empty cell represents an impossible transition. The transitions to UNKNOWN and HALTED and from DISPOSED status are intentionally not tabulated. UNKNOWN is the initial status of the player before the media source is pre-rolled and cannot be entered once exited. DISPOSED is a terminal status entered after dispose() method is invoked and cannot be exited. HALTED status entered when a critical error occurs and may be transitioned into from any other status except DISPOSED.
The principal MediaPlayer status values and transitions are depicted in the following diagram:
Reaching the end of the media (or the stopTime if this is defined) while playing does not cause the status to change from PLAYING. Therefore, for example, if the media is played to its end and then a manual seek to an earlier time within the media is performed, playing will continue from the new media time.
- Since:
- JavaFX 2.0
Nested Class Summary
Nested classes/interfaces declared in class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
Enum Constant Summary
| Enum Constant | Description |
|---|---|
DISPOSED |
State of the player after dispose() method is invoked. |
HALTED |
State of the player when a critical error has occurred. |
PAUSED |
State of the player when playback is paused. |
PLAYING |
State of the player when it is currently playing. |
READY |
State of the player once it is prepared to play. |
STALLED |
State of the player when data coming into the buffer has slowed or stopped and the playback buffer does not have enough data to continue playing. |
STOPPED |
State of the player when playback has stopped. |
UNKNOWN |
State of the player immediately after creation. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
static MediaPlayer.Status |
valueOf |
Returns the enum constant of this class with the specified name. |
static MediaPlayer.Status[] |
values() |
Returns an array containing the constants of this enum class, in the order they are declared. |
Enum Constant Details
UNKNOWN
public static final MediaPlayer.Status UNKNOWN
READY
public static final MediaPlayer.Status READY
PAUSED
public static final MediaPlayer.Status PAUSED
PLAYING
public static final MediaPlayer.Status PLAYING
STOPPED
public static final MediaPlayer.Status STOPPED
STALLED
public static final MediaPlayer.Status STALLED
HALTED
public static final MediaPlayer.Status HALTED
DISPOSED
public static final MediaPlayer.Status DISPOSED
Media and MediaView objects associated with disposed player can be reused.- Since:
- JavaFX 8.0
Method Details
values
public static MediaPlayer.Status[] values()
- Returns:
- an array containing the constants of this enum class, in the order they are declared
valueOf
public static MediaPlayer.Status valueOf(String name)
- Parameters:
-
name- the name of the enum constant to be returned. - Returns:
- the enum constant with the specified name
- Throws:
-
IllegalArgumentException- if this enum class has no constant with the specified name -
NullPointerException- if the argument is null
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.