use of com.sedmelluq.discord.lavaplayer.track.TrackMarker in project FredBoat by Frederikam.
the class AbstractPlayer method playTrack.
/**
* Plays the provided track.
* <p>
* Silently playing a track will not trigger the onPlayHook (which announces the track usually)
*/
private void playTrack(AudioTrackContext trackContext, boolean... silent) {
log.trace("playTrack({})", trackContext.getEffectiveTitle());
context = trackContext;
player.playTrack(trackContext.getTrack());
trackContext.getTrack().setPosition(trackContext.getStartPosition());
if (trackContext instanceof SplitAudioTrackContext) {
// Ensure we don't step over our bounds
log.info("Start: " + trackContext.getStartPosition() + " End: " + (trackContext.getStartPosition() + trackContext.getEffectiveDuration()));
trackContext.getTrack().setMarker(new TrackMarker(trackContext.getStartPosition() + trackContext.getEffectiveDuration(), new TrackEndMarkerHandler(this, trackContext)));
}
if (silent.length < 1 || !silent[0]) {
if (onPlayHook != null)
onPlayHook.accept(trackContext);
}
}
Aggregations