public void goToTime(Long millis) { player.getPlayingTrack().setPosition(millis); }
@Override public DecodedTrackHolder decodeTrack(MessageInput stream) throws IOException { DataInput input = stream.nextMessage(); if (input == null) { return null; } int version = (stream.getMessageFlags() & TRACK_INFO_VERSIONED) != 0 ? (input.readByte() & 0xFF) : 1; AudioTrackInfo trackInfo = new AudioTrackInfo(input.readUTF(), input.readUTF(), input.readLong(), input.readUTF(), input.readBoolean(), version >= 2 ? DataFormatTools.readNullableText(input) : null); AudioTrack track = decodeTrackDetails(trackInfo, input); long position = input.readLong(); if (track != null) { track.setPosition(position); } stream.skipRemainingBytes(); return new DecodedTrackHolder(track); }
time += Duration.ofSeconds(seconds).toMillis(); musicManager.getPlayer().getPlayingTrack().setPosition(time); context.reply("Jumped to the specified position. Use `{{prefix}}nowplaying` to see the current song & position.");
@Override public void on(Context context) { GuildAudioController musicManager = this.bot.getGuildsManager().get(context.getEvent().getGuild().getIdLong()); if (musicManager == null || musicManager.getPlayer().getPlayingTrack() == null) { context.reply("No music is playing on this guild! To play a song use `{{prefix}}play`"); return; } AudioTrack currentTrack = musicManager.getPlayer().getPlayingTrack(); currentTrack.setPosition(0); context.reply("Restarted **%s** by **%s** `[%s]`", currentTrack.getInfo().title, currentTrack.getInfo().author, formatTrackDuration(currentTrack)); } }
return; } else { t.getTrack().setPosition(millis); MessageUtils.sendSuccessMessage("The track has been skipped to: " + FormatUtils.formatJodaTime(new Duration(millis).toPeriod()), channel); return;