setOperational(false);
getController().addControllerListener(this);
}
private void init() {
Time d = getController().getDuration();
// If duration is unknown or unbounded, slider
// will not be operational.
boolean flg =
d != Duration.DURATION_UNBOUNDED &&
d != Duration.DURATION_UNKNOWN;
// We have some know duration, is it zero?
if (flg) {
duration = d.getNanoseconds();
flg = (duration != 0L);
}
setOperational(flg);
// Duration is known and non-zero, all is well...
if (flg) {
// Setup timer
controlTimer = new SourcedTimer(this, TIMER_TICK);
controlTimer.addSourcedTimerListener(this);
Time mTime = getController().getMediaTime();
long mediaTime = mTime.getNanoseconds();
setValue(mediaTime);
}
}