Media player maturity (on Mac)

Robert Krüger krueger at
Wed Mar 11 10:42:27 UTC 2015

No, thanks for the hint. I just did and the behavior is a bit better in the
sense that the sample start is not cut off on subsequent play invocations
(behaves more or less line instantiating a new mediaplayer for each
invocation, which is good) but when I loop using setCycleCount the sample
start is also not clean (seams to be varying, though).

For my uses case I will probably need both MediaPlayer and Audioclip,
because I have typical cases for AudioClip (e.g. short notification sounds)
and long looping background samples.

Wow, I just discovered, that the behavior with the sample start sounding
different on the first invocation also happens when I play the sample using
the player integrated in Finder, so I owe you a big apology. I am sorry! I
can also no longer reproduce the looping failure after my last reboot :-S.

Btw. the latency of AudioClip on the Mac (2012 MBP) is not quite low enough
to implement something like a drum kit using the keyboard. I don't know if
that is the benchmark you are after or if that is also a limitation of the
hosting system. I need to test that with other applications. The latency I
get with AudioClip is good enough for my current use case, though.

@Joe: I am using 10.10.1, just realized I never answered that

Best regards,


On Wed, Mar 11, 2015 at 2:51 AM, David DeHaven <david.dehaven at>

> > anyone doing serious work with the media player on the Mac? I am
> > experimenting and so far I am not getting the impression, this is really
> > something very solid.
> >
> > The first Audio-Sample I tried playing plays fine the first time but
> when I
> > play it for a second time by either issuing stop() followed by play() or
> > seek(new Duration(0) and then play, the playback cuts off a few samples
> at
> > the start (does not happen when I instantiate a new Player for each time
> I
> > want to play it, which does not feel right). You need a suitable audio
> file
> > like a drum beat that starts immediately in the file to notice the
> > difference.
> >
> > If one was to implement simple sample-player-like functionality (not a
> full
> > fledged music sequencer but something that allows timed playback to
> arrange
> > sounds on a timeline a bit) in JavaFX, should Mediaplayer be the tool to
> > use or do I have to use native APIs? Last time I checked JavaSound, it
> was
> > still an abandoned toy usable only for educational purposes but not for
> > anything else. Don't know if that has changed or if this is even the
> Audio
> > strategy for JFX.
> >
> > Would be great if someone could share experience/opinions in this area.
> Have you tried AudioClip instead of MediaPlayer?
> -DrD-

Robert Krüger
Managing Partner
Lesspain GmbH & Co. KG

More information about the openjfx-dev mailing list