mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-08-28 13:18:32 +00:00
feat(player): Add a setting to adjust player seek duration
Create a seekOffset dropdown setting defaulting to 10 seconds. Update the fastForwardTick method of the GestureControlView to take the seekOffset setting into account and update the view accordingly.
This commit is contained in:
parent
2cd01eb1fe
commit
daf1d42a0f
4 changed files with 40 additions and 6 deletions
|
@ -486,6 +486,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)
|
||||||
|
@ -981,4 +997,4 @@ class Settings : FragmentedStorageFileJson() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//endregion
|
//endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -807,4 +807,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";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -403,6 +403,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>
|
||||||
|
@ -1026,6 +1028,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>
|
||||||
|
@ -1039,4 +1049,4 @@
|
||||||
<item>1500</item>
|
<item>1500</item>
|
||||||
<item>2000</item>
|
<item>2000</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue