use of com.sedmelluq.discord.lavaplayer.track.DecodedTrackHolder in project lavaplayer by sedmelluq.
the class MusicController method deserialize.
@BotCommandHandler
private void deserialize(Message message, String content) throws IOException {
outputChannel.set((TextChannel) message.getChannel());
connectToFirstVoiceChannel(guild.getAudioManager());
byte[] bytes = Base64.decode(content);
MessageInput inputStream = new MessageInput(new ByteArrayInputStream(bytes));
DecodedTrackHolder holder;
while ((holder = manager.decodeTrack(inputStream)) != null) {
if (holder.decodedTrack != null) {
scheduler.addToQueue(holder.decodedTrack);
}
}
}
use of com.sedmelluq.discord.lavaplayer.track.DecodedTrackHolder in project lavaplayer by sedmelluq.
the class DefaultAudioPlayerManager method decodeTrack.
@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);
}
Aggregations