Class MediaPlayerBuilder
MediaPlayerBuilder
class constructs instances of the MediaPlayer
class
and offers a fluent interface for creating and configuring it.
This class includes a static create
method that accepts the same arguments as the original MediaPlayer
constructor
and returns an instance of the MediaPlayerBuilder
.
You can use method chaining to call the builder methods for configuring the MediaPlayer
.
Finally, invoke the build
method to generate an instance of the MediaPlayer
class.
Note that intermediate builder methods are not evaluated until the build
method
is called, meaning they are evaluated lazily.
- Author:
- Hidekazu Kubota <hidekazu.kubota@gmail.com>
-
Method Summary
Modifier and TypeMethodDescriptionapply
(Consumer<MediaPlayer> func) Applies a function to the MediaPlayer instance being constructed.audioSpectrumInterval
(double value) A builder method that invokes thesetAudioSpectrumInterval
method on the instance being constructed.Applies a function to theaudioSpectrumIntervalProperty
of the instance being constructed.audioSpectrumListener
(AudioSpectrumListener listener) A builder method that invokes thesetAudioSpectrumListener
method on the instance being constructed.Applies a function to theaudioSpectrumListenerProperty
of the instance being constructed.audioSpectrumNumBands
(int value) A builder method that invokes thesetAudioSpectrumNumBands
method on the instance being constructed.Applies a function to theaudioSpectrumNumBandsProperty
of the instance being constructed.audioSpectrumThreshold
(int value) A builder method that invokes thesetAudioSpectrumThreshold
method on the instance being constructed.Applies a function to theaudioSpectrumThresholdProperty
of the instance being constructed.autoPlay
(boolean value) A builder method that invokes thesetAutoPlay
method on the instance being constructed.Applies a function to theautoPlayProperty
of the instance being constructed.balance
(double value) A builder method that invokes thesetBalance
method on the instance being constructed.Applies a function to thebalanceProperty
of the instance being constructed.Applies a function to thebufferProgressTimeProperty
of the instance being constructed.build()
Builds and returns an instance of theMediaPlayer
class.static MediaPlayerBuilder
Accepts the constructor arguments ofMediaPlayer(Media)
and returns an instance ofMediaPlayerBuilder
.Applies a function to thecurrentCountProperty
of the instance being constructed.Applies a function to thecurrentRateProperty
of the instance being constructed.Applies a function to thecurrentTimeProperty
of the instance being constructed.cycleCount
(int value) A builder method that invokes thesetCycleCount
method on the instance being constructed.Applies a function to thecycleCountProperty
of the instance being constructed.Applies a function to thecycleDurationProperty
of the instance being constructed.Applies a function to theerrorProperty
of the instance being constructed.mute
(boolean value) A builder method that invokes thesetMute
method on the instance being constructed.Applies a function to themuteProperty
of the instance being constructed.onEndOfMedia
(Runnable value) A builder method that invokes thesetOnEndOfMedia
method on the instance being constructed.Applies a function to theonEndOfMediaProperty
of the instance being constructed.A builder method that invokes thesetOnError
method on the instance being constructed.Applies a function to theonErrorProperty
of the instance being constructed.A builder method that invokes thesetOnHalted
method on the instance being constructed.Applies a function to theonHaltedProperty
of the instance being constructed.onMarker
(EventHandler<MediaMarkerEvent> onMarker) A builder method that invokes thesetOnMarker
method on the instance being constructed.Applies a function to theonMarkerProperty
of the instance being constructed.A builder method that invokes thesetOnPaused
method on the instance being constructed.Applies a function to theonPausedProperty
of the instance being constructed.A builder method that invokes thesetOnPlaying
method on the instance being constructed.Applies a function to theonPlayingProperty
of the instance being constructed.A builder method that invokes thesetOnReady
method on the instance being constructed.Applies a function to theonReadyProperty
of the instance being constructed.A builder method that invokes thesetOnRepeat
method on the instance being constructed.Applies a function to theonRepeatProperty
of the instance being constructed.A builder method that invokes thesetOnStalled
method on the instance being constructed.Applies a function to theonStalledProperty
of the instance being constructed.A builder method that invokes thesetOnStopped
method on the instance being constructed.Applies a function to theonStoppedProperty
of the instance being constructed.rate
(double value) A builder method that invokes thesetRate
method on the instance being constructed.Applies a function to therateProperty
of the instance being constructed.A builder method that invokes thesetStartTime
method on the instance being constructed.Applies a function to thestartTimeProperty
of the instance being constructed.Applies a function to thestatusProperty
of the instance being constructed.A builder method that invokes thesetStopTime
method on the instance being constructed.Applies a function to thestopTimeProperty
of the instance being constructed.Applies a function to thetotalDurationProperty
of the instance being constructed.volume
(double value) A builder method that invokes thesetVolume
method on the instance being constructed.Applies a function to thevolumeProperty
of the instance being constructed.
-
Method Details
-
create
Accepts the constructor arguments ofMediaPlayer(Media)
and returns an instance ofMediaPlayerBuilder
.- Returns:
- an instance of the
MediaPlayerBuilder
.
-
build
Builds and returns an instance of theMediaPlayer
class.Intermediate builder methods are not evaluated until the
build
method is called; in other words, they are evaluated lazily.- Returns:
- new instance of the
MediaPlayer
class
-
apply
Applies a function to the MediaPlayer instance being constructed. Most operations on the instance can be performed using this method.- Returns:
- builder instance
-
audioSpectrumInterval
A builder method that invokes thesetAudioSpectrumInterval
method on the instance being constructed.- Returns:
- builder instance
-
audioSpectrumListener
A builder method that invokes thesetAudioSpectrumListener
method on the instance being constructed.- Returns:
- builder instance
-
audioSpectrumNumBands
A builder method that invokes thesetAudioSpectrumNumBands
method on the instance being constructed.- Returns:
- builder instance
-
audioSpectrumThreshold
A builder method that invokes thesetAudioSpectrumThreshold
method on the instance being constructed.- Returns:
- builder instance
-
autoPlay
A builder method that invokes thesetAutoPlay
method on the instance being constructed.- Returns:
- builder instance
-
balance
A builder method that invokes thesetBalance
method on the instance being constructed.- Returns:
- builder instance
-
cycleCount
A builder method that invokes thesetCycleCount
method on the instance being constructed.- Returns:
- builder instance
-
mute
A builder method that invokes thesetMute
method on the instance being constructed.- Returns:
- builder instance
-
onEndOfMedia
A builder method that invokes thesetOnEndOfMedia
method on the instance being constructed.- Returns:
- builder instance
-
onError
A builder method that invokes thesetOnError
method on the instance being constructed.- Returns:
- builder instance
-
onHalted
A builder method that invokes thesetOnHalted
method on the instance being constructed.- Returns:
- builder instance
-
onMarker
A builder method that invokes thesetOnMarker
method on the instance being constructed.- Returns:
- builder instance
-
onPaused
A builder method that invokes thesetOnPaused
method on the instance being constructed.- Returns:
- builder instance
-
onPlaying
A builder method that invokes thesetOnPlaying
method on the instance being constructed.- Returns:
- builder instance
-
onReady
A builder method that invokes thesetOnReady
method on the instance being constructed.- Returns:
- builder instance
-
onRepeat
A builder method that invokes thesetOnRepeat
method on the instance being constructed.- Returns:
- builder instance
-
onStalled
A builder method that invokes thesetOnStalled
method on the instance being constructed.- Returns:
- builder instance
-
onStopped
A builder method that invokes thesetOnStopped
method on the instance being constructed.- Returns:
- builder instance
-
rate
A builder method that invokes thesetRate
method on the instance being constructed.- Returns:
- builder instance
-
startTime
A builder method that invokes thesetStartTime
method on the instance being constructed.- Returns:
- builder instance
-
stopTime
A builder method that invokes thesetStopTime
method on the instance being constructed.- Returns:
- builder instance
-
volume
A builder method that invokes thesetVolume
method on the instance being constructed.- Returns:
- builder instance
-
audioSpectrumIntervalPropertyApply
Applies a function to theaudioSpectrumIntervalProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.audioSpectrumIntervalProperty().bind(anotherProperty)) // Use shorthand form .audioSpectrumIntervalPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
audioSpectrumListenerPropertyApply
public MediaPlayerBuilder audioSpectrumListenerPropertyApply(Consumer<ObjectProperty<AudioSpectrumListener>> op) Applies a function to theaudioSpectrumListenerProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.audioSpectrumListenerProperty().bind(anotherProperty)) // Use shorthand form .audioSpectrumListenerPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
audioSpectrumNumBandsPropertyApply
Applies a function to theaudioSpectrumNumBandsProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.audioSpectrumNumBandsProperty().bind(anotherProperty)) // Use shorthand form .audioSpectrumNumBandsPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
audioSpectrumThresholdPropertyApply
Applies a function to theaudioSpectrumThresholdProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.audioSpectrumThresholdProperty().bind(anotherProperty)) // Use shorthand form .audioSpectrumThresholdPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
autoPlayPropertyApply
Applies a function to theautoPlayProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.autoPlayProperty().bind(anotherProperty)) // Use shorthand form .autoPlayPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
balancePropertyApply
Applies a function to thebalanceProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.balanceProperty().bind(anotherProperty)) // Use shorthand form .balancePropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
bufferProgressTimePropertyApply
public MediaPlayerBuilder bufferProgressTimePropertyApply(Consumer<ReadOnlyObjectProperty<Duration>> op) Applies a function to thebufferProgressTimeProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.bufferProgressTimeProperty().bind(anotherProperty)) // Use shorthand form .bufferProgressTimePropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
currentCountPropertyApply
Applies a function to thecurrentCountProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.currentCountProperty().bind(anotherProperty)) // Use shorthand form .currentCountPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
currentRatePropertyApply
Applies a function to thecurrentRateProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.currentRateProperty().bind(anotherProperty)) // Use shorthand form .currentRatePropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
currentTimePropertyApply
Applies a function to thecurrentTimeProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.currentTimeProperty().bind(anotherProperty)) // Use shorthand form .currentTimePropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
cycleCountPropertyApply
Applies a function to thecycleCountProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.cycleCountProperty().bind(anotherProperty)) // Use shorthand form .cycleCountPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
cycleDurationPropertyApply
Applies a function to thecycleDurationProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.cycleDurationProperty().bind(anotherProperty)) // Use shorthand form .cycleDurationPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
errorPropertyApply
Applies a function to theerrorProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.errorProperty().bind(anotherProperty)) // Use shorthand form .errorPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
mutePropertyApply
Applies a function to themuteProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.muteProperty().bind(anotherProperty)) // Use shorthand form .mutePropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
onEndOfMediaPropertyApply
Applies a function to theonEndOfMediaProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.onEndOfMediaProperty().bind(anotherProperty)) // Use shorthand form .onEndOfMediaPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
onErrorPropertyApply
Applies a function to theonErrorProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.onErrorProperty().bind(anotherProperty)) // Use shorthand form .onErrorPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
onHaltedPropertyApply
Applies a function to theonHaltedProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.onHaltedProperty().bind(anotherProperty)) // Use shorthand form .onHaltedPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
onMarkerPropertyApply
public MediaPlayerBuilder onMarkerPropertyApply(Consumer<ObjectProperty<EventHandler<MediaMarkerEvent>>> op) Applies a function to theonMarkerProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.onMarkerProperty().bind(anotherProperty)) // Use shorthand form .onMarkerPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
onPausedPropertyApply
Applies a function to theonPausedProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.onPausedProperty().bind(anotherProperty)) // Use shorthand form .onPausedPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
onPlayingPropertyApply
Applies a function to theonPlayingProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.onPlayingProperty().bind(anotherProperty)) // Use shorthand form .onPlayingPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
onReadyPropertyApply
Applies a function to theonReadyProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.onReadyProperty().bind(anotherProperty)) // Use shorthand form .onReadyPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
onRepeatPropertyApply
Applies a function to theonRepeatProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.onRepeatProperty().bind(anotherProperty)) // Use shorthand form .onRepeatPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
onStalledPropertyApply
Applies a function to theonStalledProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.onStalledProperty().bind(anotherProperty)) // Use shorthand form .onStalledPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
onStoppedPropertyApply
Applies a function to theonStoppedProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.onStoppedProperty().bind(anotherProperty)) // Use shorthand form .onStoppedPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
ratePropertyApply
Applies a function to therateProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.rateProperty().bind(anotherProperty)) // Use shorthand form .ratePropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
startTimePropertyApply
Applies a function to thestartTimeProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.startTimeProperty().bind(anotherProperty)) // Use shorthand form .startTimePropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
statusPropertyApply
public MediaPlayerBuilder statusPropertyApply(Consumer<ReadOnlyObjectProperty<MediaPlayer.Status>> op) Applies a function to thestatusProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.statusProperty().bind(anotherProperty)) // Use shorthand form .statusPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
stopTimePropertyApply
Applies a function to thestopTimeProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.stopTimeProperty().bind(anotherProperty)) // Use shorthand form .stopTimePropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
totalDurationPropertyApply
Applies a function to thetotalDurationProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.totalDurationProperty().bind(anotherProperty)) // Use shorthand form .totalDurationPropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-
volumePropertyApply
Applies a function to thevolumeProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.volumeProperty().bind(anotherProperty)) // Use shorthand form .volumePropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-