feat: implemented streaming buffering strategy

This commit is contained in:
antonio 2023-11-26 19:10:21 +01:00
parent 9fde629233
commit 0a5983e32b
5 changed files with 36 additions and 3 deletions

View file

@ -42,6 +42,7 @@ object Preferences {
private const val SHARE = "share"
private const val SCROBBLING = "scrobbling"
private const val ESTIMATE_CONTENT_LENGTH = "estimate_content_length"
private const val BUFFERING_STRATEGY = "buffering_strategy"
@JvmStatic
fun getServer(): String? {
@ -331,4 +332,10 @@ object Preferences {
fun askForEstimateContentLength(): Boolean {
return App.getInstance().preferences.getBoolean(ESTIMATE_CONTENT_LENGTH, false)
}
@JvmStatic
fun getBufferingStrategy(): Double {
return App.getInstance().preferences.getString(BUFFERING_STRATEGY, "1")!!.toDouble()
}
}

View file

@ -211,4 +211,17 @@
<item>2</item>
<item>3</item>
</string-array>
<string-array name="buffering_strategy_titles">
<item>Minimum</item>
<item>Moderate</item>
<item>Aggressive</item>
<item>Extreme</item>
</string-array>
<string-array name="buffering_strategy_values">
<item>.1</item>
<item>1</item>
<item>2</item>
<item>4</item>
</string-array>
</resources>

View file

@ -236,6 +236,8 @@
<string name="settings_audio_transcode_priority_summary">If enabled, Tempo will not force stream the track with the transcode settings below.</string>
<string name="settings_audio_transcode_priority_title">Prioritize server transcode settings</string>
<string name="settings_audio_transcode_priority_toast">Priority on transcoding of track given to server</string>
<string name="settings_buffering_strategy">Buffering strategy</string>
<string name="settings_buffering_strategy_summary">For the change to take effect you must manually restart the app.</string>
<string name="settings_covers_cache">Size of artwork cache</string>
<string name="settings_data_saving_mode_summary">In order to reduce data consumption, avoid downloading covers.</string>
<string name="settings_data_saving_mode_title">Limit mobile data usage</string>

View file

@ -102,6 +102,16 @@
android:summary="@string/settings_sync_starred_tracks_for_offline_use_summary"
android:key="sync_starred_tracks_for_offline_use" />
<ListPreference
app:defaultValue="1"
app:dialogTitle="@string/settings_buffering_strategy"
app:entries="@array/buffering_strategy_titles"
app:entryValues="@array/buffering_strategy_values"
app:key="buffering_strategy"
app:title="@string/settings_buffering_strategy"
app:summary="@string/settings_buffering_strategy_summary"
app:useSimpleSummaryProvider="false" />
<Preference
android:key="download_storage"
app:title="@string/settings_download_storage_title" />