Skip to content

Commit

Permalink
Buffering indicator is now displayed when trying to reconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
jamal2362 committed Sep 27, 2023
1 parent a962d93 commit 6362b75
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
10 changes: 10 additions & 0 deletions app/src/main/java/com/jamal2367/urlradio/PlayerFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,16 @@ class PlayerFragment : Fragment(),
// playback is active
layout.showPlayer(activity as Context)
layout.showBufferingIndicator(buffering = false)
} else {
// playback is paused or stopped
// check if buffering (playback is not active but playWhenReady is true)
if (controller?.playWhenReady == true) {
// playback is buffering, show the buffering indicator
layout.showBufferingIndicator(buffering = true)
} else {
// playback is not buffering, hide the buffering indicator
layout.showBufferingIndicator(buffering = false)
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/jamal2367/urlradio/PlayerService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ class PlayerService : MediaLibraryService() {
}
// buffering - data needs to be loaded
Player.STATE_BUFFERING -> {
Toast.makeText(applicationContext, R.string.toastmessage_reconnect, Toast.LENGTH_LONG).show()
// todo
}
// player finished playing all media
Player.STATE_ENDED -> {
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@
<string name="toastmessage_install_file_helper">Bitte installiere einen Dateimanager</string>
<string name="toastmessage_preview_playback_failed">Die Vorschauwiedergabe ist nicht möglich.</string>
<string name="toastmessage_preview_playback_started">Die Vorschauwiedergabe wurde gestartet.</string>
<string name="toastmessage_reconnect">Es wird versucht, die Verbindung wiederherzustellen.</string>
<string name="toastmessage_restored">Stationen wurden erfolgreich wiederhergestellt.</string>
<string name="toastmessage_save_m3u">Radiosender als M3U gespeichert…</string>
<string name="toastmessage_save_pls">Radiosender als PLS gespeichert…</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-uk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
<string name="toastmessage_install_file_helper">Будь ласка, встановіть менеджер файлів.</string>
<string name="toastmessage_preview_playback_failed">Попереднє відтворення неможливе.</string>
<string name="toastmessage_preview_playback_started">Розпочалося попереднє відтворення.</string>
<string name="toastmessage_reconnect">Спроба відновлення з\'єднання.</string>
<string name="toastmessage_restored">Станції були успішно відновлені.</string>
<string name="toastmessage_save_m3u">Збереження радіостанцій як М3U…</string>
<string name="toastmessage_save_pls">Збереження радіостанцій як PLS…</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@
<string name="toastmessage_install_file_helper">Please install a file manager.</string>
<string name="toastmessage_preview_playback_failed">Preview playback not possible.</string>
<string name="toastmessage_preview_playback_started">Preview playback was started.</string>
<string name="toastmessage_reconnect">The connection is attempted to be re-established.</string>
<string name="toastmessage_restored">Stations has been successfully restored.</string>
<string name="toastmessage_save_m3u">Saving radio stations as M3U…</string>
<string name="toastmessage_save_pls">Saving radio stations as PLS…</string>
Expand Down

0 comments on commit 6362b75

Please sign in to comment.