|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavafx.scene.media.MediaPlayer
public final class MediaPlayer
The MediaPlayer
class provides the controls for playing media.
It is used in combination with the Media
and MediaView
classes to display and control media playback. Note that MediaPlayer
does not contain any visual elements so must be used with the MediaView
class to view the media.
The operation of a MediaPlayer
is inherently asynchronous and
a player is not prepared to respond to commands quasi-immediately until
its status has transitioned to MediaPlayer.Status.READY
, which in
effect generally occurs when media pre-roll completes. Some requests made of
a player prior to its status being READY
will however take
effect when that status is entered. These include invoking play()
without an intervening invocation of pause()
or stop()
before the READY
transition, as well as setting any of the
autoPlay
, balance
, mute
, rate
,
startTime
, stopTime
, and volume
properties.
The status
property may be monitored to make the application aware of player status
changes, and callback functions may be registered via properties such as
onReady
if an action should be taken when a particular status is
entered. There are also error
and onError
properties which
respectively enable monitoring when an error occurs and taking a specified
action in response.
Media
,
MediaView
Property Summary | |
---|---|
audioSpectrumInterval
The interval between spectrum updates in seconds. |
|
audioSpectrumListener
A listener for audio spectrum updates. |
|
audioSpectrumNumBands
The number of bands in the audio spectrum. |
|
audioSpectrumThreshold
The sensitivity threshold in decibels; must be non-positive. |
|
autoPlay
If autoPlay is true , playing will start as soon
as possible, which occurs once the player has reached the READY state. |
|
balance
Defines the balance, or left-right setting, of the audio output. |
|
bufferProgressTime
For a bufferred stream, the current buffer position which indicating how much media can be played without stalling the MediaPlayer . |
|
currentCount
This property indicates the number of completed cycles. |
|
currentRate
The current rate of playback regardless of settings. |
|
currentTime
The current media playback time; read-only. |
|
cycleCount
Property indicating how many times the media will be played. |
|
cycleDuration
Read-only property indicating the amount of time between this player's |
|
error
Observable property set to a MediaException if an error occurs. |
|
mute
true when the player audio is muted, false otherwise. |
|
onEndOfMedia
Event handler invoked when the player currentTime reaches
stopTime and is not repeating.. |
|
onError
Event handler that is invoked when an error occurs. |
|
onHalted
Event handler invoked when the status changes to HALTED . |
|
onMarker
Event handler invoked when a marker is encountered. |
|
onPaused
Event handler invoked when the status changes to PAUSED . |
|
onPlaying
Event handler invoked when the status changes to PLAYING . |
|
onReady
Event handler invoked when the status changes to READY . |
|
onRepeat
Event handler invoked when the player currentTime reaches
stopTime and will be repeating. |
|
onStalled
Event handler invoked when the status changes to STALLED . |
|
onStopped
Event handler invoked when the status changes to STOPPED |
|
rate
Defines the rate at which the media is being played. |
|
startTime
Defines the time offset where media should start playing, or restart from when repeating. |
|
status
Reflects the current state of the MediaPlayer. |
|
stopTime
Defines the time offset where media should stop playing or restart when repeating. |
|
totalDuration
Read-only property indicating the total amount of play time if allowed to play until finished. |
|
volume
Defines the volume at which the media is being played. |
Nested Class Summary | |
---|---|
static class |
MediaPlayer.Status
Enumeration describing different states of a MediaPlayer . |
Field Summary | |
---|---|
static int |
INDEFINITE
When cycleCount is set to this value, the player
will repeat playback of the Media until stopped or paused. |
Constructor Summary | |
---|---|
MediaPlayer(Media media)
Create a player for a specific media. |
Method Summary | |
---|---|
DoubleProperty |
audioSpectrumIntervalProperty()
The interval between spectrum updates in seconds. |
ObjectProperty<AudioSpectrumListener> |
audioSpectrumListenerProperty()
A listener for audio spectrum updates. |
IntegerProperty |
audioSpectrumNumBandsProperty()
The number of bands in the audio spectrum. |
IntegerProperty |
audioSpectrumThresholdProperty()
The sensitivity threshold in decibels; must be non-positive. |
BooleanProperty |
autoPlayProperty()
If autoPlay is true , playing will start as soon
as possible, which occurs once the player has reached the READY state. |
DoubleProperty |
balanceProperty()
Defines the balance, or left-right setting, of the audio output. |
ObjectProperty<Duration> |
bufferProgressTimeProperty()
For a bufferred stream, the current buffer position which indicating how much media can be played without stalling the MediaPlayer . |
IntegerProperty |
currentCountProperty()
This property indicates the number of completed cycles. |
DoubleProperty |
currentRateProperty()
The current rate of playback regardless of settings. |
ObjectProperty<Duration> |
currentTimeProperty()
The current media playback time; read-only. |
IntegerProperty |
cycleCountProperty()
Property indicating how many times the media will be played. |
ObjectProperty<Duration> |
cycleDurationProperty()
Read-only property indicating the amount of time between this player's |
ObjectProperty<MediaException> |
errorProperty()
Observable property set to a MediaException if an error occurs. |
AudioEqualizer |
getAudioEqualizer()
Retrieve the AudioEqualizer associated with this player. |
double |
getAudioSpectrumInterval()
Retrieves the value of the audio spectrum notification interval in seconds. |
AudioSpectrumListener |
getAudioSpectrumListener()
Retrieves the listener of the audio spectrum. |
int |
getAudioSpectrumNumBands()
Retrieves the number of bands in the audio spectrum. |
int |
getAudioSpectrumThreshold()
Retrieves the audio spectrum threshold in decibels. |
double |
getBalance()
Retrieves the audio balance. |
Duration |
getBufferProgressTime()
Retrieves the bufferProgressTime value. |
int |
getCurrentCount()
Retrieves the index of the current cycle. |
double |
getCurrentRate()
Retrieves the current playback rate. |
Duration |
getCurrentTime()
Retrieves the current media time. |
int |
getCycleCount()
Retrieves the cycle count. |
Duration |
getCycleDuration()
Retrieves the cycle duration in seconds. |
MediaException |
getError()
Retrieve the value of the error property or null
if there is no error. |
Media |
getMedia()
Retrieves the parent Media instance. |
java.lang.Runnable |
getOnEndOfMedia()
Retrieves the end of media event handler. |
java.lang.Runnable |
getOnError()
Retrieves the event handler for errors. |
java.lang.Runnable |
getOnHalted()
Retrieves the MediaPlayer.Status.HALTED event handler. |
MarkerListener |
getOnMarker()
Retrieves the marker event handler. |
java.lang.Runnable |
getOnPaused()
Retrieves the MediaPlayer.Status.PAUSED event handler. |
java.lang.Runnable |
getOnPlay()
Retrieves the MediaPlayer.Status.PLAYING event handler. |
java.lang.Runnable |
getOnReady()
Retrieves the MediaPlayer.Status.READY event handler. |
java.lang.Runnable |
getOnRepeat()
Retrieves the repeat event handler. |
java.lang.Runnable |
getOnStalled()
Retrieves the MediaPlayer.Status.STALLED event handler. |
java.lang.Runnable |
getOnStopped()
Retrieves the MediaPlayer.Status.STOPPED event handler. |
double |
getRate()
Retrieves the playback rate. |
Duration |
getStartTime()
Retrieves the start time. |
MediaPlayer.Status |
getStatus()
Retrieves the current player status |
Duration |
getStopTime()
Retrieves the start time. |
Duration |
getTotalDuration()
Retrieves the total playback duration including all cycles (repetitions). |
double |
getVolume()
Retrieves the audio playback volume. |
boolean |
isAutoPlay()
Retrieves the autoPlay property value. |
boolean |
isMute()
Retrieves the mute value. |
BooleanProperty |
muteProperty()
true when the player audio is muted, false otherwise. |
ObjectProperty<java.lang.Runnable> |
onEndOfMediaProperty()
Event handler invoked when the player currentTime reaches
stopTime and is not repeating.. |
ObjectProperty<java.lang.Runnable> |
onErrorProperty()
Event handler that is invoked when an error occurs. |
ObjectProperty<java.lang.Runnable> |
onHaltedProperty()
Event handler invoked when the status changes to HALTED . |
ObjectProperty<MarkerListener> |
onMarkerProperty()
Event handler invoked when a marker is encountered. |
ObjectProperty<java.lang.Runnable> |
onPausedProperty()
Event handler invoked when the status changes to PAUSED . |
ObjectProperty<java.lang.Runnable> |
onPlayingProperty()
Event handler invoked when the status changes to PLAYING . |
ObjectProperty<java.lang.Runnable> |
onReadyProperty()
Event handler invoked when the status changes to READY . |
ObjectProperty<java.lang.Runnable> |
onRepeatProperty()
Event handler invoked when the player currentTime reaches
stopTime and will be repeating. |
ObjectProperty<java.lang.Runnable> |
onStalledProperty()
Event handler invoked when the status changes to STALLED . |
ObjectProperty<java.lang.Runnable> |
onStoppedProperty()
Event handler invoked when the status changes to STOPPED |
void |
pause()
Pauses the player. |
void |
play()
Starts playing the media. |
DoubleProperty |
rateProperty()
Defines the rate at which the media is being played. |
void |
seek(Duration seekTime)
Seeks the player to a new playback time. |
void |
setAudioSpectrumInterval(double value)
Sets the value of the audio spectrum notification interval in seconds. |
void |
setAudioSpectrumListener(AudioSpectrumListener listener)
Sets the listener of the audio spectrum. |
void |
setAudioSpectrumNumBands(int value)
Sets the number of bands in the audio spectrum. |
void |
setAudioSpectrumThreshold(int value)
Sets the audio spectrum threshold in decibels. |
void |
setAutoPlay(boolean value)
Sets the autoPlay property value. |
void |
setBalance(double value)
Sets the audio balance. |
void |
setCycleCount(int value)
Sets the cycle count. |
void |
setMute(boolean value)
Sets the value of mute . |
void |
setOnEndOfMedia(java.lang.Runnable value)
Sets the end of media event handler. |
void |
setOnError(java.lang.Runnable value)
Sets the event handler to be called when an error occurs. |
void |
setOnHalted(java.lang.Runnable value)
Sets the MediaPlayer.Status.HALTED event handler. |
void |
setOnMarker(MarkerListener value)
Sets the marker event handler. |
void |
setOnPaused(java.lang.Runnable value)
Sets the MediaPlayer.Status.PAUSED event handler. |
void |
setOnPlay(java.lang.Runnable value)
Sets the MediaPlayer.Status.PLAYING event handler. |
void |
setOnReady(java.lang.Runnable value)
Sets the MediaPlayer.Status.READY event handler. |
void |
setOnRepeat(java.lang.Runnable value)
Sets the repeat event handler. |
void |
setOnStalled(java.lang.Runnable value)
Sets the MediaPlayer.Status.STALLED event handler. |
void |
setOnStopped(java.lang.Runnable value)
Sets the MediaPlayer.Status.STOPPED event handler. |
void |
setRate(double value)
Sets the playback rate to the supplied value. |
void |
setStartTime(Duration value)
Sets the start time startTime . |
void |
setStopTime(Duration value)
Sets the stop time stopTime . |
void |
setVolume(double value)
Sets the audio playback volume. |
ObjectProperty<Duration> |
startTimeProperty()
Defines the time offset where media should start playing, or restart from when repeating. |
ObjectProperty<MediaPlayer.Status> |
statusProperty()
Reflects the current state of the MediaPlayer. |
void |
stop()
Stops playing the media. |
ObjectProperty<Duration> |
stopTimeProperty()
Defines the time offset where media should stop playing or restart when repeating. |
ObjectProperty<Duration> |
totalDurationProperty()
Read-only property indicating the total amount of play time if allowed to play until finished. |
DoubleProperty |
volumeProperty()
Defines the volume at which the media is being played. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Property Detail |
---|
MediaException
if an error occurs.
getError()
,
setError(MediaException)
getOnError()
,
setOnError(Runnable)
autoPlay
is true
, playing will start as soon
as possible, which occurs once the player has reached the READY state.
isAutoPlay()
,
setAutoPlay(boolean)
1.0
plays the media at its normal playback rate, 2.0
plays back at twice the normal rate, etc. The currently supported range
of rates is [0.0, 8.0]
.
getRate()
,
setRate(double)
getCurrentRate()
,
setCurrentRate(double)
1.0
is full volume, which is the default. A value of 0.0
effectively mutes the audio.
getVolume()
,
setVolume(double)
-1.0
being full left,
0.0
center, and 1.0
full right.
getBalance()
,
setBalance(double)
Constraints: 0 ≤ startTime < stopTime
getStartTime()
,
setStartTime(Duration)
Constraints: startTime
< stopTime ≤ Media.duration
getStopTime()
,
setStopTime(Duration)
getCycleDuration()
,
setCycleDuration(Duration)
cycleCount
is set to INDEFINITE
then this will be also INDEFINITE. If the Media duration is UNKNOWN, then
this will likewise be UNKNOWN. Otherwise, total duration will be the
multiplicative product of cycleDuration and cycleCount.
getTotalDuration()
,
setTotalDuration(Duration)
getCurrentTime()
,
setCurrentTime(Duration)
getStatus()
,
setStatus(MediaPlayer.Status)
MediaPlayer
.
Seeking to a value beyond bufferProgressTime
will may cause a slight
pause in playback until buffering reaches the desired position in the stream.
getBufferProgressTime()
,
setBufferProgressTime(Duration)
cycleCount
is set to 1
meaning the media will only be played once. Setting cycleCount
to more than 1 will cause the media to play the given number of times
or until stopped. If set to INDEFINITE
,
playback will repeat until stop() or pause() is called.
constraints: cycleCount ≥ 1
getCycleCount()
,
setCycleCount(int)
startTime
.
getCurrentCount()
,
setCurrentCount(int)
true
when the player audio is muted, false
otherwise.
isMute()
,
setMute(boolean)
currentTime
reaches
stopTime
and is not repeating..
getOnEndOfMedia()
,
setOnEndOfMedia(Runnable)
READY
.
getOnReady()
,
setOnReady(Runnable)
PLAYING
.
PAUSED
.
getOnPaused()
,
setOnPaused(Runnable)
STOPPED
getOnStopped()
,
setOnStopped(Runnable)
HALTED
.
getOnHalted()
,
setOnHalted(Runnable)
currentTime
reaches
stopTime
and will be repeating. This callback is made
prior to seeking back to startTime
.
getOnRepeat()
,
setOnRepeat(Runnable)
STALLED
.
getOnStalled()
,
setOnStalled(Runnable)
getOnMarker()
,
setOnMarker(MarkerListener)
[0.0, 22050]
Hz. If the
number of spectral bands were in this case set to 10, the width of each
frequency bin in the spectrum would be 2205
Hz with the
lower bound of the lowest frequency bin equal to 0.0
.
getAudioSpectrumNumBands()
,
setAudioSpectrumNumBands(int)
0.1
seconds.
getAudioSpectrumInterval()
,
setAudioSpectrumInterval(double)
getAudioSpectrumThreshold()
,
setAudioSpectrumThreshold(int)
An AudioSpectrumListener
may be useful for example to
plot the frequency spectrum of the audio being played or to generate the
waveforms of a music visualizer.
getAudioSpectrumListener()
,
setAudioSpectrumListener(AudioSpectrumListener)
Field Detail |
---|
public static final int INDEFINITE
cycleCount
is set to this value, the player
will repeat playback of the Media
until stopped or paused.
Constructor Detail |
---|
public MediaPlayer(Media media)
error
property to be set and
consequently any onError
callback to be invoked.
When create, the status
of the player will be MediaPlayer.Status.UNKNOWN
.
Once the status
has transitioned to MediaPlayer.Status.READY
the
player will be in a usable condition.
media
- The media to play.
java.lang.NullPointerException
- if media is null
.
MediaException
- if any synchronous errors occur within the
constructor.Method Detail |
---|
public final AudioEqualizer getAudioEqualizer()
AudioEqualizer
associated with this player.
AudioEqualizer
.public final MediaException getError()
error
property or null
if there is no error.
MediaException
or null
.public ObjectProperty<MediaException> errorProperty()
MediaException
if an error occurs.
getError()
,
setError(MediaException)
public final void setOnError(java.lang.Runnable value)
value
- the event handler or null
.public final java.lang.Runnable getOnError()
public ObjectProperty<java.lang.Runnable> onErrorProperty()
getOnError()
,
setOnError(Runnable)
public final Media getMedia()
Media
instance.
Media
object.public final void setAutoPlay(boolean value)
autoPlay
property value.
value
- whether to enable auto-playbackpublic final boolean isAutoPlay()
autoPlay
property value.
public BooleanProperty autoPlayProperty()
autoPlay
is true
, playing will start as soon
as possible, which occurs once the player has reached the READY state.
isAutoPlay()
,
setAutoPlay(boolean)
public void play()
startTime
. When playing actually starts the
status
will be set to MediaPlayer.Status.PLAYING
.
public void pause()
status
will be set to MediaPlayer.Status.PAUSED
.
public void stop()
startTime
, and resets
currentCount
to zero. Once the player is actually
stopped, the status
will be set to MediaPlayer.Status.STOPPED
.
public final void setRate(double value)
[0.0, 8.0]
.
value
- the playback ratepublic final double getRate()
public DoubleProperty rateProperty()
1.0
plays the media at its normal playback rate, 2.0
plays back at twice the normal rate, etc. The currently supported range
of rates is [0.0, 8.0]
.
getRate()
,
setRate(double)
public final double getCurrentRate()
public DoubleProperty currentRateProperty()
getCurrentRate()
,
setCurrentRate(double)
public final void setVolume(double value)
[0.0, 1.0]
.
value
- the volumepublic final double getVolume()
1.0
.
public DoubleProperty volumeProperty()
1.0
is full volume, which is the default. A value of 0.0
effectively mutes the audio.
getVolume()
,
setVolume(double)
public final void setBalance(double value)
[-1.0, 1.0]
.
value
- the balancepublic final double getBalance()
public DoubleProperty balanceProperty()
-1.0
being full left,
0.0
center, and 1.0
full right.
getBalance()
,
setBalance(double)
public final void setStartTime(Duration value)
startTime
. Its effect will be clamped to
the range [Duration.ZERO
, stopTime
).
- Parameters:
value
- the start time
public final Duration getStartTime()
Duration.ZERO
.
public ObjectProperty<Duration> startTimeProperty()
Constraints: 0 ≤ startTime < stopTime
getStartTime()
,
setStartTime(Duration)
public final void setStopTime(Duration value)
stopTime
. Its effect will be clamped to
the range (startTime
, Media.duration
].
- Parameters:
value
- the start time
public final Duration getStopTime()
getMedia()
.getDuration()
. Note that
Media.duration
may have the value
Duration.UNKNOWN
if media initialization is not complete.
public ObjectProperty<Duration> stopTimeProperty()
Constraints: startTime
< stopTime ≤ Media.duration
getStopTime()
,
setStopTime(Duration)
public final Duration getCycleDuration()
public ObjectProperty<Duration> cycleDurationProperty()
getCycleDuration()
,
setCycleDuration(Duration)
public final Duration getTotalDuration()
public ObjectProperty<Duration> totalDurationProperty()
cycleCount
is set to INDEFINITE
then this will be also INDEFINITE. If the Media duration is UNKNOWN, then
this will likewise be UNKNOWN. Otherwise, total duration will be the
multiplicative product of cycleDuration and cycleCount.
getTotalDuration()
,
setTotalDuration(Duration)
public final Duration getCurrentTime()
public ObjectProperty<Duration> currentTimeProperty()
getCurrentTime()
,
setCurrentTime(Duration)
public void seek(Duration seekTime)
The behavior of seek()
is constrained as follows where
start time and stop time indicate the effective lower and
upper bounds, respectively, of media playback:
seekTime | seek position |
---|---|
null | no change |
Duration.UNKNOWN | no change |
Duration.INDEFINITE | stop time |
seekTime < start time | start time |
seekTime > stop time | stop time |
start time ≤ seekTime ≤ stop time | seekTime |
seekTime
- the requested playback timepublic final MediaPlayer.Status getStatus()
public ObjectProperty<MediaPlayer.Status> statusProperty()
getStatus()
,
setStatus(MediaPlayer.Status)
public final Duration getBufferProgressTime()
bufferProgressTime
value.
public ObjectProperty<Duration> bufferProgressTimeProperty()
MediaPlayer
.
Seeking to a value beyond bufferProgressTime
will may cause a slight
pause in playback until buffering reaches the desired position in the stream.
getBufferProgressTime()
,
setBufferProgressTime(Duration)
public final void setCycleCount(int value)
[1,Integer.MAX_VALUE
]
.
value
- the cycle countpublic final int getCycleCount()
public IntegerProperty cycleCountProperty()
cycleCount
is set to 1
meaning the media will only be played once. Setting cycleCount
to more than 1 will cause the media to play the given number of times
or until stopped. If set to INDEFINITE
,
playback will repeat until stop() or pause() is called.
constraints: cycleCount ≥ 1
getCycleCount()
,
setCycleCount(int)
public final int getCurrentCount()
public IntegerProperty currentCountProperty()
startTime
.
getCurrentCount()
,
setCurrentCount(int)
public final void setMute(boolean value)
mute
.
the
- mute
settingpublic final boolean isMute()
mute
value.
public BooleanProperty muteProperty()
true
when the player audio is muted, false
otherwise.
isMute()
,
setMute(boolean)
public final void setOnEndOfMedia(java.lang.Runnable value)
value
- the event handler or null
.public final java.lang.Runnable getOnEndOfMedia()
null
.public ObjectProperty<java.lang.Runnable> onEndOfMediaProperty()
currentTime
reaches
stopTime
and is not repeating..
getOnEndOfMedia()
,
setOnEndOfMedia(Runnable)
public final void setOnReady(java.lang.Runnable value)
MediaPlayer.Status.READY
event handler.
value
- the event handler or null
.public final java.lang.Runnable getOnReady()
MediaPlayer.Status.READY
event handler.
null
.public ObjectProperty<java.lang.Runnable> onReadyProperty()
READY
.
getOnReady()
,
setOnReady(Runnable)
public final void setOnPlay(java.lang.Runnable value)
MediaPlayer.Status.PLAYING
event handler.
value
- the event handler or null
.public final java.lang.Runnable getOnPlay()
MediaPlayer.Status.PLAYING
event handler.
null
.public ObjectProperty<java.lang.Runnable> onPlayingProperty()
PLAYING
.
public final void setOnPaused(java.lang.Runnable value)
MediaPlayer.Status.PAUSED
event handler.
value
- the event handler or null
.public final java.lang.Runnable getOnPaused()
MediaPlayer.Status.PAUSED
event handler.
null
.public ObjectProperty<java.lang.Runnable> onPausedProperty()
PAUSED
.
getOnPaused()
,
setOnPaused(Runnable)
public final void setOnStopped(java.lang.Runnable value)
MediaPlayer.Status.STOPPED
event handler.
value
- the event handler or null
.public final java.lang.Runnable getOnStopped()
MediaPlayer.Status.STOPPED
event handler.
null
.public ObjectProperty<java.lang.Runnable> onStoppedProperty()
STOPPED
getOnStopped()
,
setOnStopped(Runnable)
public final void setOnHalted(java.lang.Runnable value)
MediaPlayer.Status.HALTED
event handler.
value
- the event handler or null
.public final java.lang.Runnable getOnHalted()
MediaPlayer.Status.HALTED
event handler.
null
.public ObjectProperty<java.lang.Runnable> onHaltedProperty()
HALTED
.
getOnHalted()
,
setOnHalted(Runnable)
public final void setOnRepeat(java.lang.Runnable value)
value
- the event handler or null
.public final java.lang.Runnable getOnRepeat()
null
.public ObjectProperty<java.lang.Runnable> onRepeatProperty()
currentTime
reaches
stopTime
and will be repeating. This callback is made
prior to seeking back to startTime
.
getOnRepeat()
,
setOnRepeat(Runnable)
public final void setOnStalled(java.lang.Runnable value)
MediaPlayer.Status.STALLED
event handler.
value
- the event handler or null
.public final java.lang.Runnable getOnStalled()
MediaPlayer.Status.STALLED
event handler.
null
.public ObjectProperty<java.lang.Runnable> onStalledProperty()
STALLED
.
getOnStalled()
,
setOnStalled(Runnable)
public final void setOnMarker(MarkerListener value)
value
- the event handler or null
.public final MarkerListener getOnMarker()
null
.public ObjectProperty<MarkerListener> onMarkerProperty()
getOnMarker()
,
setOnMarker(MarkerListener)
public final void setAudioSpectrumNumBands(int value)
value
- the number of spectral bands; value
must be ≥ 2public final int getAudioSpectrumNumBands()
public IntegerProperty audioSpectrumNumBandsProperty()
[0.0, 22050]
Hz. If the
number of spectral bands were in this case set to 10, the width of each
frequency bin in the spectrum would be 2205
Hz with the
lower bound of the lowest frequency bin equal to 0.0
.
getAudioSpectrumNumBands()
,
setAudioSpectrumNumBands(int)
public final void setAudioSpectrumInterval(double value)
value
- a positive value specifying the spectral update intervalpublic final double getAudioSpectrumInterval()
public DoubleProperty audioSpectrumIntervalProperty()
0.1
seconds.
getAudioSpectrumInterval()
,
setAudioSpectrumInterval(double)
public final void setAudioSpectrumThreshold(int value)
the
- spectral threshold in dB; must be ≤ 0
.public final int getAudioSpectrumThreshold()
public IntegerProperty audioSpectrumThresholdProperty()
getAudioSpectrumThreshold()
,
setAudioSpectrumThreshold(int)
public final void setAudioSpectrumListener(AudioSpectrumListener listener)
listener
- the spectral listener or null
.public final AudioSpectrumListener getAudioSpectrumListener()
null
public ObjectProperty<AudioSpectrumListener> audioSpectrumListenerProperty()
An AudioSpectrumListener
may be useful for example to
plot the frequency spectrum of the audio being played or to generate the
waveforms of a music visualizer.
getAudioSpectrumListener()
,
setAudioSpectrumListener(AudioSpectrumListener)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |