Package javafx.scene.media
Class MediaPlayer
java.lang.Object
javafx.scene.media.MediaPlayer
- Author:
- Bruno Salmon
-
Property Summary
TypePropertyDescriptionEvent handler invoked when the status changes toHALTED
.Event handler invoked when the status changes toPAUSED
.Event handler invoked when the status changes toPLAYING
.Event handler invoked when the status changes toREADY
.Event handler invoked when the playercurrentTime
reachesstopTime
and will be repeating.Event handler invoked when the status changes toSTALLED
.Event handler invoked when the status changes toSTOPPED
. -
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enumeration describing the different status values of aMediaPlayer
. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
final Duration
Gets the value of thecurrentTime
property.int
getMedia()
final Runnable
Retrieves the end of media event handler.final Runnable
Retrieves theMediaPlayer.Status.HALTED
event handler.final Runnable
Retrieves theMediaPlayer.Status.PAUSED
event handler.final Runnable
Retrieves theMediaPlayer.Status.PLAYING
event handler.final Runnable
Retrieves theMediaPlayer.Status.READY
event handler.final Runnable
Retrieves the repeat event handler.final Runnable
Retrieves theMediaPlayer.Status.STALLED
event handler.final Runnable
Retrieves theMediaPlayer.Status.STOPPED
event handler.getPeer()
Gets the value of thestatus
property.Event handler invoked when the status changes toHALTED
.Event handler invoked when the status changes toPAUSED
.Event handler invoked when the status changes toPLAYING
.Event handler invoked when the status changes toREADY
.Event handler invoked when the playercurrentTime
reachesstopTime
and will be repeating.Event handler invoked when the status changes toSTALLED
.Event handler invoked when the status changes toSTOPPED
.void
pause()
void
play()
void
final void
setAudioSpectrumInterval
(double value) Sets the value of the audio spectrum notification interval in seconds.final void
final void
setAudioSpectrumNumBands
(int value) Sets the number of bands in the audio spectrum.void
setCycleCount
(int cycleCount) final void
setMute
(boolean mute) final void
setOnEndOfMedia
(Runnable value) Sets the end of media event handler.final void
setOnHalted
(Runnable value) Sets theMediaPlayer.Status.HALTED
event handler.final void
setOnPaused
(Runnable value) Sets theMediaPlayer.Status.PAUSED
event handler.final void
setOnPlaying
(Runnable value) Sets theMediaPlayer.Status.PLAYING
event handler.final void
setOnReady
(Runnable value) Sets theMediaPlayer.Status.READY
event handler.final void
setOnRepeat
(Runnable value) Sets the repeat event handler.final void
setOnStalled
(Runnable value) Sets theMediaPlayer.Status.STALLED
event handler.final void
setOnStopped
(Runnable value) Sets theMediaPlayer.Status.STOPPED
event handler.void
setStatus
(MediaPlayer.Status status) Sets the value of thestatus
property.void
setVolume
(double volume) void
stop()
-
Property Details
-
currentTime
- See Also:
-
status
-
onEndOfMedia
-
onReady
Event handler invoked when the status changes toREADY
. -
onPlaying
Event handler invoked when the status changes toPLAYING
. -
onPaused
Event handler invoked when the status changes toPAUSED
. -
onStopped
Event handler invoked when the status changes toSTOPPED
. -
onHalted
Event handler invoked when the status changes toHALTED
. -
onRepeat
Event handler invoked when the playercurrentTime
reachesstopTime
and will be repeating. This callback is made prior to seeking back tostartTime
. -
onStalled
Event handler invoked when the status changes toSTALLED
.
-
-
Field Details
-
INDEFINITE
public static final int INDEFINITE- See Also:
-
-
Constructor Details
-
MediaPlayer
-
-
Method Details
-
getPeer
-
getMedia
-
setCycleCount
public void setCycleCount(int cycleCount) -
getCycleCount
public int getCycleCount() -
play
public void play() -
pause
public void pause() -
stop
public void stop() -
dispose
public void dispose() -
setVolume
public void setVolume(double volume) -
setMute
public final void setMute(boolean mute) -
getCurrentTime
Gets the value of thecurrentTime
property.- Property description:
- Returns:
- the value of the
currentTime
property - See Also:
-
setAudioSpectrumInterval
public final void setAudioSpectrumInterval(double value) Sets the value of the audio spectrum notification interval in seconds.- Parameters:
value
- a positive value specifying the spectral update interval
-
setAudioSpectrumNumBands
public final void setAudioSpectrumNumBands(int value) Sets the number of bands in the audio spectrum.- Parameters:
value
- the number of spectral bands;value
must be ≥ 2
-
setAudioSpectrumListener
-
currentTimeProperty
- Returns:
- the
currentTime
property - See Also:
-
seek
-
statusProperty
- Returns:
- the
status
property - See Also:
-
getStatus
Gets the value of thestatus
property.- Property description:
- Returns:
- the value of the
status
property - See Also:
-
setOnEndOfMedia
Sets the end of media event handler.- Parameters:
value
- the event handler ornull
.
-
getOnEndOfMedia
Retrieves the end of media event handler.- Returns:
- the event handler or
null
.
-
onEndOfMediaProperty
- Returns:
- the
onEndOfMedia
property - See Also:
-
setOnReady
Sets theMediaPlayer.Status.READY
event handler.- Parameters:
value
- the event handler ornull
.
-
getOnReady
Retrieves theMediaPlayer.Status.READY
event handler.- Returns:
- the event handler or
null
.
-
onReadyProperty
Event handler invoked when the status changes toREADY
.- Returns:
- the
onReady
property - See Also:
-
setOnPlaying
Sets theMediaPlayer.Status.PLAYING
event handler.- Parameters:
value
- the event handler ornull
.
-
getOnPlaying
Retrieves theMediaPlayer.Status.PLAYING
event handler.- Returns:
- the event handler or
null
.
-
onPlayingProperty
Event handler invoked when the status changes toPLAYING
.- Returns:
- the
onPlaying
property - See Also:
-
setOnPaused
Sets theMediaPlayer.Status.PAUSED
event handler.- Parameters:
value
- the event handler ornull
.
-
getOnPaused
Retrieves theMediaPlayer.Status.PAUSED
event handler.- Returns:
- the event handler or
null
.
-
onPausedProperty
Event handler invoked when the status changes toPAUSED
.- Returns:
- the
onPaused
property - See Also:
-
setOnStopped
Sets theMediaPlayer.Status.STOPPED
event handler.- Parameters:
value
- the event handler ornull
.
-
getOnStopped
Retrieves theMediaPlayer.Status.STOPPED
event handler.- Returns:
- the event handler or
null
.
-
onStoppedProperty
Event handler invoked when the status changes toSTOPPED
.- Returns:
- the
onStopped
property - See Also:
-
setOnHalted
Sets theMediaPlayer.Status.HALTED
event handler.- Parameters:
value
- the event handler ornull
.
-
getOnHalted
Retrieves theMediaPlayer.Status.HALTED
event handler.- Returns:
- the event handler or
null
.
-
onHaltedProperty
Event handler invoked when the status changes toHALTED
.- Returns:
- the
onHalted
property - See Also:
-
setOnRepeat
Sets the repeat event handler.- Parameters:
value
- the event handler ornull
.
-
getOnRepeat
Retrieves the repeat event handler.- Returns:
- the event handler or
null
.
-
onRepeatProperty
Event handler invoked when the playercurrentTime
reachesstopTime
and will be repeating. This callback is made prior to seeking back tostartTime
.- Returns:
- the
onRepeat
property - See Also:
-
setOnStalled
Sets theMediaPlayer.Status.STALLED
event handler.- Parameters:
value
- the event handler ornull
.
-
getOnStalled
Retrieves theMediaPlayer.Status.STALLED
event handler.- Returns:
- the event handler or
null
.
-
onStalledProperty
Event handler invoked when the status changes toSTALLED
.- Returns:
- the
onStalled
property - See Also:
-
setStatus
Sets the value of thestatus
property.- Property description:
- Parameters:
status
- the value for thestatus
property- See Also:
-