use of com.sedmelluq.discord.lavaplayer.container.mp3.Mp3AudioTrack in project lavaplayer by sedmelluq.
the class SoundCloudAudioTrack method attemptLoadStream.
private boolean attemptLoadStream(LocalAudioTrackExecutor localExecutor, HttpInterface httpInterface, boolean checkUnauthorized) throws Exception {
String trackUrl = sourceManager.getTrackUrlFromId(trackInfo.identifier);
log.debug("Starting SoundCloud track from URL: {}", trackUrl);
try (PersistentHttpStream stream = new PersistentHttpStream(httpInterface, new URI(trackUrl), null)) {
if (checkUnauthorized) {
int statusCode = stream.checkStatusCode();
if (statusCode == 401) {
return false;
} else if (statusCode < 200 && statusCode >= 300) {
throw new IOException("Invalid status code for soundcloud stream: " + statusCode);
}
}
processDelegate(new Mp3AudioTrack(trackInfo, stream), localExecutor);
}
return true;
}
use of com.sedmelluq.discord.lavaplayer.container.mp3.Mp3AudioTrack in project lavaplayer by sedmelluq.
the class BandcampAudioTrack method process.
@Override
public void process(LocalAudioTrackExecutor localExecutor) throws Exception {
try (HttpInterface httpInterface = sourceManager.getHttpInterface()) {
log.debug("Loading Bandcamp track page from URL: {}", trackInfo.identifier);
String trackMediaUrl = getTrackMediaUrl(httpInterface);
log.debug("Starting Bandcamp track from URL: {}", trackMediaUrl);
try (PersistentHttpStream stream = new PersistentHttpStream(httpInterface, new URI(trackMediaUrl), null)) {
processDelegate(new Mp3AudioTrack(trackInfo, stream), localExecutor);
}
}
}
Aggregations