Skip to content

feat: add dual subtitle support for language learning (desktop only)#1286

Open
lakshayrastogi wants to merge 1 commit into
Stremio:developmentfrom
lakshayrastogi:feature/dual-subtitles
Open

feat: add dual subtitle support for language learning (desktop only)#1286
lakshayrastogi wants to merge 1 commit into
Stremio:developmentfrom
lakshayrastogi:feature/dual-subtitles

Conversation

@lakshayrastogi
Copy link
Copy Markdown

@lakshayrastogi lakshayrastogi commented May 21, 2026

Summary

Adds a "Secondary Subtitle" section to the player subtitles menu, allowing users to select a second subtitle track that renders simultaneously with the primary one. Gated to desktop only (platform.shell.active) since it relies on mpv's secondary-sid. Primary subtitle selection behavior is completely unchanged.

Motivation

Enables language learning workflows - e.g., watching French content with French as primary and English as secondary subtitles simultaneously.

Changes

src/routes/Player/useVideo.js

  • Added selectedSecondarySubtitlesTrackId to video state
  • Added setSecondarySubtitlesTrack(id) function (does NOT nullify primary)
  • Exported from hook

src/routes/Player/useSubtitles.ts

  • Added selectSecondaryTrack callback
  • disableSubtitles() also clears secondary track
  • Added isShellActive and secondary track info to menuProps
  • Updated toggleSubtitles shortcut to include secondary track state
  • Updated all dependency arrays

src/routes/Player/SubtitlesMenu/SubtitlesMenu.js

  • Added secondary subtitle section (renders only when: primary is selected + isShellActive + callback exists)
  • Separate language list for secondary selection (excludes primary language)
  • Click handlers: select a language or click "Off" to disable
  • Secondary indicator: hollow circle icon vs filled circle for primary
  • "Secondary Subtitle" header with separator line
  • All existing click handlers preserved (no interference)

src/routes/Player/SubtitlesMenu/styles.less

  • Added .secondary-header, .secondary-selected, .secondary-icon styles

src/routes/Player/SubtitlesMenu/SubtitleVariant/SubtitleVariant.less

  • Added .secondary-icon style only (variant component itself is unchanged)

src/routes/Player/useSubtitles.d.ts

  • Updated type definitions for new fields

Platform Gating

The secondary section only appears when:

  1. A primary subtitle is selected
  2. Running in desktop shell (platform.shell.active - established pattern)
  3. Callback is provided

Invisible on web, mobile, and TV platforms.

Translation

PLAYER_SUBTITLES_SECONDARY key used with defaultValue: 'Secondary Subtitle' fallback.

Related

  • stremio-video: adds mpv secondary-sid bridge
  • stremio-translations: adds translation key

Related PRs

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 21, 2026

CLA assistant check
All committers have signed the CLA.

…p only)

Adds a "Secondary Subtitle" section to the player subtitles menu,
allowing users to select a second subtitle track that renders
simultaneously with the primary one. Gated to desktop only via
platform.shell.active since it relies on mpv's secondary-sid.

- Add setSecondarySubtitlesTrack to useVideo hook
- Add selectSecondaryTrack callback and menuProps in useSubtitles
- Build secondary subtitle section in SubtitlesMenu (appears when
  primary selected + desktop shell active)
- Secondary section has own language list, click handlers, OFF button
- Hollow circle indicator for secondary vs filled for primary
- All existing subtitle selection behavior preserved (no interference)
- Platform guard: invisible on web, mobile, and TV platforms
- Translation: PLAYER_SUBTITLES_SECONDARY key with defaultValue fallback
@kKaskak
Copy link
Copy Markdown
Member

kKaskak commented May 22, 2026

how can you learn a language with double subs? :D I cannot comprehend why would somebody want to read in a non native lang when learning it. this is super hard to do, the subs are usually so fast that for the person who learns a language its the opposite, you actually choose a non native audio and native subs to get the hear and understand that lang you are learning, for most people its impossible to read so fast in the lang you are learning. im sorry but i feel like this feature is pointless and it adds uneccessary complexity to the Player and the app itself.

@lakshayrastogi
Copy link
Copy Markdown
Author

lakshayrastogi commented May 22, 2026 via email

@mrcanelas
Copy link
Copy Markdown
Contributor

I think this could be easily implemented as an add-on, which would work on all platforms.

@lakshayrastogi
Copy link
Copy Markdown
Author

I think this could be easily implemented as an add-on, which would work on all platforms.

@mrcanelas thanks for the suggestion, I tried this - the problem is that finding the two subtitles that work together from the lists returned by opensubtitles is a hard problem and it really needs a user to compare and decide if the timing and lyrics match. For now I have made the addon return all combinations (little clunky but will do for now) but the ideal solution would give controls to the user in the player to select a second language from the same list of subtitles as the first.

@mrcanelas
Copy link
Copy Markdown
Contributor

I think this could be easily implemented as an add-on, which would work on all platforms.

@mrcanelas thanks for the suggestion, I tried this - the problem is that finding the two subtitles that work together from the lists returned by opensubtitles is a hard problem and it really needs a user to compare and decide if the timing and lyrics match. For now I have made the addon return all combinations (little clunky but will do for now) but the ideal solution would give controls to the user in the player to select a second language from the same list of subtitles as the first.

Can you send the code? Did you compare the subtitle names? Ideally, you should use the existing OpenSubtitle add-on and combine the subtitles it returns for each IMDb ID. You can also analyze the timing of the dialogues within the subtitles to synchronize them.

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.

4 participants