feat: add subtitle toggle hotkey#961
feat: add subtitle toggle hotkey#961schembriaiden wants to merge 3 commits intoDonutWare:developfrom
Conversation
| _vDragLastValue = null; | ||
| } | ||
|
|
||
| void _toggleSubtitles() { |
There was a problem hiding this comment.
I'm not entirely sure about the logic here. Does it make sense for the user to press the "toggle" button to all of a sudden ask what subtitles they want to toggle in-between?
Would it make more sense to just do nothing if the subtitles are already disabled and only allow toggling when a subtitle is enabled?
No strong opinion on my end just thinking out loud.
There was a problem hiding this comment.
I am not against the idea, but I think this might lead users to open issues on GitHub saying that the toggle key is not working, when in fact it would be working. Then from experience I know that most people don't check previous issues before opening one which would lead to a bunch of duplicate issues regarding this.
| VideoHotKeys.takeScreenshot => KeyCombination(key: LogicalKeyboardKey.keyG), | ||
| VideoHotKeys.takeScreenshotClean => | ||
| KeyCombination(key: LogicalKeyboardKey.keyG, modifier: LogicalKeyboardKey.controlLeft), | ||
| VideoHotKeys.toggleSubtitles => KeyCombination(key: LogicalKeyboardKey.keyT), |
There was a problem hiding this comment.
Silly question but why T? Youtube for instance uses the C button for "Captions"
There was a problem hiding this comment.
I was initially going to go with C to mirror Youtube's logic, but since the request suggested T I just went with that, we can do whatever I don't mind.
Pull Request Description
This pull request introduces a new "toggle subtitles" hotkey feature to the video player, allowing users to quickly enable or disable subtitles using a keyboard shortcut. The implementation includes localization, hotkey mapping, and logic for toggling subtitles, including handling multiple subtitle tracks and remembering the user's last selection.
New Subtitle Toggle Feature:
toggleSubtitleshotkey to theVideoHotKeysenum, mapped by default to the "T" key (LogicalKeyboardKey.keyT)._toggleSubtitlesmethod in_DesktopControlsStateto handle toggling subtitles on/off, supporting both single and multiple subtitle tracks and remembering the last selected subtitle.Localization:
toggleSubtitlesstring to the English localization file (app_en.arb) for display in the UI and settings.VideoHotKeyslabel mapping to include the newtoggleSubtitleskey for proper display in settings menus.Codebase Maintenance:
media_streams_model.dartto support subtitle toggling logic._lastSelectedSubtitleIndexstate variable to remember the user's last subtitle choice across toggles.Logic is as follow:
Press toggle:
Issue Being Fixed
Resolves #957
Screenshots / Recordings
Tested On
Checklist