mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 07:50:31 +05:30
add option to limit hls
This commit is contained in:
parent
c3b2f5baee
commit
b18bf98854
@ -77,6 +77,7 @@ object PreferenceKeys {
|
||||
const val PICTURE_IN_PICTURE = "picture_in_picture"
|
||||
const val PLAYER_RESIZE_MODE = "player_resize_mode"
|
||||
const val SB_SKIP_MANUALLY = "sb_skip_manually_key"
|
||||
const val LIMIT_HLS = "limit_hls"
|
||||
|
||||
/**
|
||||
* Background mode
|
||||
@ -101,8 +102,6 @@ object PreferenceKeys {
|
||||
const val CLEAR_WATCH_HISTORY = "clear_watch_history"
|
||||
const val CLEAR_WATCH_POSITIONS = "clear_watch_positions"
|
||||
const val SHARE_WITH_TIME_CODE = "share_with_time_code"
|
||||
const val BACKUP_SETTINGS = "backup_settings"
|
||||
const val RESTORE_SETTINGS = "restore_settings"
|
||||
|
||||
/**
|
||||
* History
|
||||
|
@ -1358,6 +1358,18 @@ class PlayerFragment : BaseFragment() {
|
||||
// control for the track sources like subtitles and audio source
|
||||
trackSelector = DefaultTrackSelector(requireContext())
|
||||
|
||||
// limit hls to full hd
|
||||
if (
|
||||
PreferenceHelper.getBoolean(
|
||||
PreferenceKeys.LIMIT_HLS,
|
||||
false
|
||||
)
|
||||
) {
|
||||
val newParams = trackSelector.buildUponParameters()
|
||||
.setMaxVideoSize(1920, 1080)
|
||||
trackSelector.setParameters(newParams)
|
||||
}
|
||||
|
||||
exoPlayer = ExoPlayer.Builder(requireContext())
|
||||
.setMediaSourceFactory(DefaultMediaSourceFactory(dataSourceFactory))
|
||||
.setLoadControl(loadControl)
|
||||
|
@ -333,6 +333,7 @@
|
||||
<string name="navigation_bar">Navigation bar</string>
|
||||
<string name="select_at_least_one">Please select at least one item</string>
|
||||
<string name="change_region">Trending seems to be unavailable for the current region. Please select another in the settings.</string>
|
||||
<string name="limit_hls">Limit HLS to 1080p</string>
|
||||
|
||||
<!-- Notification channel strings -->
|
||||
<string name="download_channel_name">Download Service</string>
|
||||
|
@ -66,6 +66,12 @@
|
||||
app:title="@string/playerAudioFormat"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:icon="@drawable/ic_play_filled"
|
||||
android:title="@string/limit_hls"
|
||||
app:key="limit_hls" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory app:title="@string/background_mode">
|
||||
|
Loading…
x
Reference in New Issue
Block a user