Merge pull request #1724 from AlexandrePicavet/feat/player-seek-offset

feat(player): Add a setting to adjust player seek duration
This commit is contained in:
koen-futo 2025-05-12 09:43:22 +02:00 committed by GitHub
commit 4da1e44fd1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 40 additions and 6 deletions

View file

@ -499,6 +499,22 @@ class Settings : FragmentedStorageFileJson() {
@FormField(R.string.delete_watchlist_on_finish, FieldForm.TOGGLE, R.string.delete_watchlist_on_finish_description, 22) @FormField(R.string.delete_watchlist_on_finish, FieldForm.TOGGLE, R.string.delete_watchlist_on_finish_description, 22)
var deleteFromWatchLaterAuto: Boolean = true; var deleteFromWatchLaterAuto: Boolean = true;
@FormField(R.string.seek_offset, FieldForm.DROPDOWN, R.string.seek_offset_description, 23)
@DropdownFieldOptionsId(R.array.seek_offset_duration)
var seekOffset: Int = 2;
fun getSeekOffset(): Long {
return when(seekOffset) {
0 -> 3_000L;
1 -> 5_000L;
2 -> 10_000L;
3 -> 20_000L;
4 -> 30_000L;
5 -> 60_000L;
else -> 10_000L;
}
}
} }
@FormField(R.string.comments, "group", R.string.comments_description, 6) @FormField(R.string.comments, "group", R.string.comments_description, 6)
@ -1019,4 +1035,4 @@ class Settings : FragmentedStorageFileJson() {
} }
} }
//endregion //endregion
} }

View file

@ -628,12 +628,12 @@ class GestureControlView : LinearLayout {
private fun fastForwardTick() { private fun fastForwardTick() {
_fastForwardCounter++; _fastForwardCounter++;
val seekOffset: Long = 10000; val seekOffset: Long = Settings.instance.playback.getSeekOffset();
if (_rewinding) { if (_rewinding) {
_textRewind.text = "${_fastForwardCounter * 10} " + context.getString(R.string.seconds); _textRewind.text = "${_fastForwardCounter * seekOffset / 1_000} " + context.getString(R.string.seconds);
onSeek.emit(-seekOffset); onSeek.emit(-seekOffset);
} else { } else {
_textFastForward.text = "${_fastForwardCounter * 10} " + context.getString(R.string.seconds); _textFastForward.text = "${_fastForwardCounter * seekOffset / 1_000} " + context.getString(R.string.seconds);
onSeek.emit(seekOffset); onSeek.emit(seekOffset);
} }
} }
@ -810,4 +810,4 @@ class GestureControlView : LinearLayout {
const val EXIT_DURATION_FAST_FORWARD: Long = 600; const val EXIT_DURATION_FAST_FORWARD: Long = 600;
const val TAG = "GestureControlView"; const val TAG = "GestureControlView";
} }
} }

View file

@ -688,6 +688,14 @@
<item>Continuer la lecture</item> <item>Continuer la lecture</item>
<item>Superposition du lecteur</item> <item>Superposition du lecteur</item>
</string-array> </string-array>
<string-array name="seek_offset_duration">
<item>3 secondes</item>
<item>5 secondes</item>
<item>10 secondes</item>
<item>20 secondes</item>
<item>30 secondes</item>
<item>60 secondes</item>
</string-array>
<string-array name="resume_after_preview"> <string-array name="resume_after_preview">
<item>Reprendre depuis le début</item> <item>Reprendre depuis le début</item>
<item>Reprendre après 10s</item> <item>Reprendre après 10s</item>

View file

@ -424,6 +424,8 @@
<string name="allow_full_screen_portrait">Allow full-screen portrait when watching horizontal videos</string> <string name="allow_full_screen_portrait">Allow full-screen portrait when watching horizontal videos</string>
<string name="delete_watchlist_on_finish">Delete from WatchLater when watched</string> <string name="delete_watchlist_on_finish">Delete from WatchLater when watched</string>
<string name="delete_watchlist_on_finish_description">After you leave a video that you mostly watched, it will be removed from watch later.</string> <string name="delete_watchlist_on_finish_description">After you leave a video that you mostly watched, it will be removed from watch later.</string>
<string name="seek_offset">Seek duration</string>
<string name="seek_offset_description">Fast-Forward / Fast-Rewind duration</string>
<string name="background_switch_audio">Switch to Audio in Background</string> <string name="background_switch_audio">Switch to Audio in Background</string>
<string name="background_switch_audio_description">Optimize bandwidth usage by switching to audio-only stream in background if available, may cause stutter</string> <string name="background_switch_audio_description">Optimize bandwidth usage by switching to audio-only stream in background if available, may cause stutter</string>
<string name="subscription_group_menu">Groups</string> <string name="subscription_group_menu">Groups</string>
@ -1076,6 +1078,14 @@
<item>Within 30 seconds of loss</item> <item>Within 30 seconds of loss</item>
<item>Always</item> <item>Always</item>
</string-array> </string-array>
<string-array name="seek_offset_duration">
<item>3 seconds</item>
<item>5 seconds</item>
<item>10 seconds</item>
<item>20 seconds</item>
<item>30 seconds</item>
<item>60 seconds</item>
</string-array>
<string-array name="rotation_zone"> <string-array name="rotation_zone">
<item>15</item> <item>15</item>
<item>30</item> <item>30</item>
@ -1089,4 +1099,4 @@
<item>1500</item> <item>1500</item>
<item>2000</item> <item>2000</item>
</string-array> </string-array>
</resources> </resources>