mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 00:10:32 +05:30
seek increment option
This commit is contained in:
parent
7cff959ae7
commit
7f7ff4fae4
@ -811,7 +811,9 @@ class PlayerFragment : Fragment() {
|
|||||||
private fun createExoPlayer(view: View) {
|
private fun createExoPlayer(view: View) {
|
||||||
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext())
|
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext())
|
||||||
val playbackSpeed = sharedPreferences.getString("playback_speed", "1F")?.toFloat()
|
val playbackSpeed = sharedPreferences.getString("playback_speed", "1F")?.toFloat()
|
||||||
val bufferingGoal = sharedPreferences.getString("buffering_goal", "50")?.toInt()!!
|
// multiply by thousand: s -> ms
|
||||||
|
val bufferingGoal = sharedPreferences.getString("buffering_goal", "50")?.toInt()!! * 1000
|
||||||
|
val seekIncrement = sharedPreferences.getString("seek_increment", "5")?.toLong()!! * 1000
|
||||||
|
|
||||||
val cronetEngine: CronetEngine = CronetHelper.getCronetEngine()
|
val cronetEngine: CronetEngine = CronetHelper.getCronetEngine()
|
||||||
val cronetDataSourceFactory: CronetDataSource.Factory =
|
val cronetDataSourceFactory: CronetDataSource.Factory =
|
||||||
@ -834,7 +836,7 @@ class PlayerFragment : Fragment() {
|
|||||||
.setBackBuffer(1000 * 60 * 3, true)
|
.setBackBuffer(1000 * 60 * 3, true)
|
||||||
.setBufferDurationsMs(
|
.setBufferDurationsMs(
|
||||||
DefaultLoadControl.DEFAULT_MIN_BUFFER_MS,
|
DefaultLoadControl.DEFAULT_MIN_BUFFER_MS,
|
||||||
bufferingGoal * 1000, // buffering goal, s -> ms
|
bufferingGoal,
|
||||||
DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_MS,
|
DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_MS,
|
||||||
DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS
|
DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS
|
||||||
)
|
)
|
||||||
@ -843,8 +845,8 @@ class PlayerFragment : Fragment() {
|
|||||||
exoPlayer = ExoPlayer.Builder(view.context)
|
exoPlayer = ExoPlayer.Builder(view.context)
|
||||||
.setMediaSourceFactory(DefaultMediaSourceFactory(dataSourceFactory))
|
.setMediaSourceFactory(DefaultMediaSourceFactory(dataSourceFactory))
|
||||||
.setLoadControl(loadControl)
|
.setLoadControl(loadControl)
|
||||||
.setSeekBackIncrementMs(5000)
|
.setSeekBackIncrementMs(seekIncrement)
|
||||||
.setSeekForwardIncrementMs(5000)
|
.setSeekForwardIncrementMs(seekIncrement)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
exoPlayer.setAudioAttributes(audioAttributes, true)
|
exoPlayer.setAudioAttributes(audioAttributes, true)
|
||||||
|
@ -5,6 +5,7 @@ import android.widget.TextView
|
|||||||
import androidx.preference.ListPreference
|
import androidx.preference.ListPreference
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
|
import androidx.preference.SwitchPreference
|
||||||
import com.github.libretube.R
|
import com.github.libretube.R
|
||||||
import com.github.libretube.requireMainActivityRestart
|
import com.github.libretube.requireMainActivityRestart
|
||||||
import com.github.libretube.util.ThemeHelper
|
import com.github.libretube.util.ThemeHelper
|
||||||
@ -42,5 +43,11 @@ class AppearanceSettings : PreferenceFragmentCompat() {
|
|||||||
requireMainActivityRestart = true
|
requireMainActivityRestart = true
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val hideTrending = findPreference<SwitchPreference>("hide_trending_page")
|
||||||
|
hideTrending?.setOnPreferenceChangeListener { _, _ ->
|
||||||
|
requireMainActivityRestart = true
|
||||||
|
true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
11
app/src/main/res/drawable/ic_skip.xml
Normal file
11
app/src/main/res/drawable/ic_skip.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="32"
|
||||||
|
android:viewportHeight="32"
|
||||||
|
android:tint="?android:attr/colorControlNormal">
|
||||||
|
<path
|
||||||
|
android:fillColor="#111918"
|
||||||
|
android:pathData="M20.164,16 L5.098,28.555V3.445ZM12.631,3.445V8.088L22.125,16 12.631,23.912v4.643L27.697,16Z"
|
||||||
|
android:strokeWidth="1" />
|
||||||
|
</vector>
|
@ -635,6 +635,7 @@
|
|||||||
<item>1.25x</item>
|
<item>1.25x</item>
|
||||||
<item>1.5x</item>
|
<item>1.5x</item>
|
||||||
<item>2x</item>
|
<item>2x</item>
|
||||||
|
<item>4x</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="playbackSpeedValues">
|
<string-array name="playbackSpeedValues">
|
||||||
<item>0.25F</item>
|
<item>0.25F</item>
|
||||||
@ -644,6 +645,7 @@
|
|||||||
<item>1.25F</item>
|
<item>1.25F</item>
|
||||||
<item>1.5F</item>
|
<item>1.5F</item>
|
||||||
<item>2F</item>
|
<item>2F</item>
|
||||||
|
<item>4F</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="downloadLocation">
|
<string-array name="downloadLocation">
|
||||||
@ -660,6 +662,13 @@
|
|||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="bufferingGoal">
|
<string-array name="bufferingGoal">
|
||||||
|
<item>50s</item>
|
||||||
|
<item>100s</item>
|
||||||
|
<item>200s</item>
|
||||||
|
<item>300s</item>
|
||||||
|
<item>450s</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="bufferingGoalValues">
|
||||||
<item>50</item>
|
<item>50</item>
|
||||||
<item>100</item>
|
<item>100</item>
|
||||||
<item>200</item>
|
<item>200</item>
|
||||||
@ -672,4 +681,17 @@
|
|||||||
<item>MPEG_4</item>
|
<item>MPEG_4</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="seekIncrement">
|
||||||
|
<item>5s</item>
|
||||||
|
<item>10s</item>
|
||||||
|
<item>20s</item>
|
||||||
|
<item>30s</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="seekIncrementValues">
|
||||||
|
<item>5</item>
|
||||||
|
<item>10</item>
|
||||||
|
<item>20</item>
|
||||||
|
<item>30</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -195,4 +195,5 @@
|
|||||||
<string name="quality">Quality</string>
|
<string name="quality">Quality</string>
|
||||||
<string name="behavior">Behavior</string>
|
<string name="behavior">Behavior</string>
|
||||||
<string name="player_summary">Quality and player behavior</string>
|
<string name="player_summary">Quality and player behavior</string>
|
||||||
|
<string name="seek_increment">Seek increment</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -35,11 +35,20 @@
|
|||||||
app:title="@string/playback_speed"
|
app:title="@string/playback_speed"
|
||||||
app:useSimpleSummaryProvider="true" />
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:icon="@drawable/ic_skip"
|
||||||
|
app:defaultValue="5"
|
||||||
|
app:entries="@array/seekIncrement"
|
||||||
|
app:entryValues="@array/seekIncrementValues"
|
||||||
|
app:key="seek_increment"
|
||||||
|
app:title="@string/seek_increment"
|
||||||
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:icon="@drawable/ic_time"
|
android:icon="@drawable/ic_time"
|
||||||
app:defaultValue="50"
|
app:defaultValue="50"
|
||||||
app:entries="@array/bufferingGoal"
|
app:entries="@array/bufferingGoal"
|
||||||
app:entryValues="@array/bufferingGoal"
|
app:entryValues="@array/bufferingGoalValues"
|
||||||
app:key="buffering_goal"
|
app:key="buffering_goal"
|
||||||
app:summary="@string/buffering_goal_summary"
|
app:summary="@string/buffering_goal_summary"
|
||||||
app:title="@string/buffering_goal" />
|
app:title="@string/buffering_goal" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user