Skip to content

Commit 50a1813

Browse files
committed
Enable/disable loading state (closes #78)
1 parent aa17da7 commit 50a1813

4 files changed

Lines changed: 19 additions & 3 deletions

File tree

conf.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,6 @@ player.mixerSearchKeywords=
4242
# Use CDN to download tracks
4343
player.tracks.useCdn=true
4444
# Use CDN to download episodes
45-
player.episodes.useCdn=false
45+
player.episodes.useCdn=false
46+
# Enable loading state (useful for slow connections)
47+
player.enableLoadingState=true

core/src/main/java/xyz/gianlu/librespot/DefaultConfiguration.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ public boolean useCdnForEpisodes() {
6363
return false;
6464
}
6565

66+
@Override
67+
public boolean enableLoadingState() {
68+
return true;
69+
}
70+
6671
@Override
6772
public boolean preloadEnabled() {
6873
return true;

core/src/main/java/xyz/gianlu/librespot/FileConfiguration.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ public boolean useCdnForEpisodes() {
164164
return getBoolean("player.episodes.useCdn", defaults.useCdnForTracks());
165165
}
166166

167+
@Override
168+
public boolean enableLoadingState() {
169+
return getBoolean("player.enableLoadingState", defaults.enableLoadingState());
170+
}
171+
167172
@Override
168173
public @Nullable String deviceName() {
169174
return properties.getProperty("deviceName", null);

core/src/main/java/xyz/gianlu/librespot/player/Player.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,10 @@ else if (context.startsWith("spotify:show:") || context.startsWith("spotify:epis
306306
@Override
307307
public void startedLoading(@NotNull TrackHandler handler) {
308308
if (handler == trackHandler) {
309-
state.setStatus(Spirc.PlayStatus.kPlayStatusLoading);
310-
stateUpdated();
309+
if (conf.enableLoadingState()) {
310+
state.setStatus(Spirc.PlayStatus.kPlayStatusLoading);
311+
stateUpdated();
312+
}
311313
}
312314
}
313315

@@ -576,6 +578,8 @@ public interface Configuration {
576578
boolean useCdnForTracks();
577579

578580
boolean useCdnForEpisodes();
581+
582+
boolean enableLoadingState();
579583
}
580584

581585
private class StateWrapper {

0 commit comments

Comments
 (0)