- java.lang.Object
-
- java.lang.Enum<MediaPlayer.Status>
-
- javafx.scene.media.MediaPlayer.Status
-
- All Implemented Interfaces:
Serializable
,Comparable<MediaPlayer.Status>
- Enclosing class:
- MediaPlayer
public static enum MediaPlayer.Status extends Enum<MediaPlayer.Status>
Enumeration describing the different status values of aMediaPlayer
.The principal
MediaPlayer
status transitions are given in the following table:MediaPlayer Status Transition Table Current \ Next READY PAUSED PLAYING STALLED STOPPED UNKNOWN pre-roll READY autoplay; play() PAUSED play() stop() PLAYING pause() buffering data stop() STALLED pause() data buffered stop() STOPPED pause() play() 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 to and fromHALTED
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.HALTED
is a terminal status entered when an error occurs and may be transitioned into from any other status but not exited.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 fromPLAYING
. 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
-
-
Enum Constant Summary
Enum Constants 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
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MediaPlayer.Status
valueOf(String name)
Returns the enum constant of this type with the specified name.static MediaPlayer.Status[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
UNKNOWN
public static final MediaPlayer.Status UNKNOWN
State of the player immediately after creation. While in this state, property values are not reliable and should not be considered. Additionally, commands sent to the player while in this state will be buffered until the media is fully loaded and ready to play.
-
READY
public static final MediaPlayer.Status READY
State of the player once it is prepared to play. This state is entered only once when the movie is loaded and pre-rolled.
-
PAUSED
public static final MediaPlayer.Status PAUSED
State of the player when playback is paused. Requesting the player to play again will cause it to continue where it left off.
-
PLAYING
public static final MediaPlayer.Status PLAYING
State of the player when it is currently playing.
-
STOPPED
public static final MediaPlayer.Status STOPPED
State of the player when playback has stopped. Requesting the player to play again will cause it to start playback from the beginning.
-
STALLED
public static final MediaPlayer.Status 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. Playback will continue automatically when enough data are buffered to resume playback. If paused or stopped in this state, then buffering will continue but playback will not resume automatically when sufficient data are buffered.
-
HALTED
public static final MediaPlayer.Status HALTED
State of the player when a critical error has occurred. This state indicates playback can never continue again with this player. The player is no longer functional and a new player should be created.
-
DISPOSED
public static final MediaPlayer.Status DISPOSED
State of the player after dispose() method is invoked. This state indicates player is disposed, all resources are free and player SHOULD NOT be used again.Media
andMediaView
objects associated with disposed player can be reused.- Since:
- JavaFX 8.0
-
-
Method Detail
-
values
public static MediaPlayer.Status[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (MediaPlayer.Status c : MediaPlayer.Status.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static MediaPlayer.Status valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
-