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: improve subtitle picking logic - persist subtitle language selection #527

Merged
merged 3 commits into from
Jan 3, 2025

Conversation

huynhsontung
Copy link
Owner

@huynhsontung huynhsontung commented Dec 31, 2024

When users select a subtitle, they will likely want the same subtitle language for the next media, similar to how YouTube operates. Since there is no standard method to detect the language of a subtitle track, we attempt to retain and compare both the language tag and the language label of the track. If both methods fail, we will select based on the preferred system language.

The logic is as follows:

  • When the user opens the subtitle track picker and selects a subtitle, the app tries to guess what language the subtitle track is and remembers that information.
  • When opening another media file, if the persistent value is not empty
    • Select the first subtitle track if there is only one.
    • Try to find the first subtitle track in the same language if there is more than one.
  • Reset the persistent value to empty when the user opens the track picker and disable the subtitle.

Closes #515

@huynhsontung huynhsontung marked this pull request as ready for review December 31, 2024 08:23
@huynhsontung huynhsontung merged commit 43b1e97 into main Jan 3, 2025
4 checks passed
@huynhsontung huynhsontung deleted the improve-subtitle-picking branch January 3, 2025 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting for switching subs on by default
1 participant