mirror of
https://github.com/JonasunderscoreJones/ZtereoMUSIC.git
synced 2025-10-25 13:39:19 +02:00
new: attempt fix at infinite loading (retry only once)
This commit is contained in:
parent
833669a7fb
commit
3959b82dcf
1 changed files with 7 additions and 7 deletions
|
|
@ -19,6 +19,7 @@ import java.util.List;
|
||||||
public class TrackManager extends AudioEventAdapter {
|
public class TrackManager extends AudioEventAdapter {
|
||||||
public final List<AudioTrack> trackQueue = new ArrayList<>();
|
public final List<AudioTrack> trackQueue = new ArrayList<>();
|
||||||
private final @Getter AudioPlayer player;
|
private final @Getter AudioPlayer player;
|
||||||
|
private String hasRetriedId;
|
||||||
private @Getter @Setter MessageChannel infoChannel;
|
private @Getter @Setter MessageChannel infoChannel;
|
||||||
|
|
||||||
public TrackManager(AudioPlayerManager playerManager, MessageChannel infoChannel) {
|
public TrackManager(AudioPlayerManager playerManager, MessageChannel infoChannel) {
|
||||||
|
|
@ -89,7 +90,6 @@ public class TrackManager extends AudioEventAdapter {
|
||||||
|
|
||||||
//todo: warning: this will create an infinite loop if a specific video has issues...
|
//todo: warning: this will create an infinite loop if a specific video has issues...
|
||||||
case LOAD_FAILED -> {
|
case LOAD_FAILED -> {
|
||||||
infoChannel.sendMessage("Loading failed, retrying...").queue();
|
|
||||||
String identifier;
|
String identifier;
|
||||||
String trackTitle = track.getInfo().title;
|
String trackTitle = track.getInfo().title;
|
||||||
|
|
||||||
|
|
@ -101,9 +101,11 @@ public class TrackManager extends AudioEventAdapter {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZtereoMUSIC.getInstance()
|
if (!hasRetriedId.equals(identifier)) {
|
||||||
.getPlayerManager()
|
hasRetriedId = identifier;
|
||||||
.loadItem(identifier, new CustomAudioLoadResultHandler(this, infoChannel));
|
infoChannel.sendMessage("Loading failed, retrying...").queue();
|
||||||
|
ZtereoMUSIC.getInstance().getPlayerManager().loadItem(identifier, new CustomAudioLoadResultHandler(this, infoChannel));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -115,9 +117,7 @@ public class TrackManager extends AudioEventAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void onTrackException(AudioPlayer player, AudioTrack track, FriendlyException exception) {
|
@Override public void onTrackException(AudioPlayer player, AudioTrack track, FriendlyException exception) {
|
||||||
infoChannel.sendMessage(
|
// infoChannel.sendMessage("Uh oh, a track did something strange. Ask the owner to check for errors in console. ").queue();
|
||||||
"Uh oh, a track did something strange. Ask the owner to check for errors in console. Skpping...")
|
|
||||||
.queue();
|
|
||||||
System.out.println(exception.getCause().getMessage());
|
System.out.println(exception.getCause().getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue