Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(player): Add a setting to adjust player seek duration #1724

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion app/src/main/java/com/futo/platformplayer/Settings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,22 @@ class Settings : FragmentedStorageFileJson() {

@FormField(R.string.delete_watchlist_on_finish, FieldForm.TOGGLE, R.string.delete_watchlist_on_finish_description, 22)
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)
Expand Down Expand Up @@ -981,4 +997,4 @@ class Settings : FragmentedStorageFileJson() {
}
}
//endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -628,12 +628,12 @@ class GestureControlView : LinearLayout {
private fun fastForwardTick() {
_fastForwardCounter++;

val seekOffset: Long = 10000;
val seekOffset: Long = Settings.instance.playback.getSeekOffset();
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);
} else {
_textFastForward.text = "${_fastForwardCounter * 10} " + context.getString(R.string.seconds);
_textFastForward.text = "${_fastForwardCounter * seekOffset / 1_000} " + context.getString(R.string.seconds);
onSeek.emit(seekOffset);
}
}
Expand Down Expand Up @@ -807,4 +807,4 @@ class GestureControlView : LinearLayout {
const val EXIT_DURATION_FAST_FORWARD: Long = 600;
const val TAG = "GestureControlView";
}
}
}
8 changes: 8 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,14 @@
<item>Continuer la lecture</item>
<item>Superposition du lecteur</item>
</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">
<item>Reprendre depuis le début</item>
<item>Reprendre après 10s</item>
Expand Down
12 changes: 11 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@
<string name="allow_full_screen_portrait">Allow full-screen portrait</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="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_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>
Expand Down Expand Up @@ -1026,6 +1028,14 @@
<item>Within 30 seconds of loss</item>
<item>Always</item>
</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">
<item>15</item>
<item>30</item>
Expand All @@ -1039,4 +1049,4 @@
<item>1500</item>
<item>2000</item>
</string-array>
</resources>
</resources>