Skip to content

fix(subtitle): handle VTT positioning directives in subtitle parsing#19

Open
abdelaziz-mahdy wants to merge 2 commits intodsc-uob:masterfrom
abdelaziz-mahdy:extra-fix-for-vtt
Open

fix(subtitle): handle VTT positioning directives in subtitle parsing#19
abdelaziz-mahdy wants to merge 2 commits intodsc-uob:masterfrom
abdelaziz-mahdy:extra-fix-for-vtt

Conversation

@abdelaziz-mahdy
Copy link
Copy Markdown
Contributor

This pull request improves the handling of VTT subtitle parsing in the SubtitleParser class to better support VTT-specific directives. The main change is to ensure that positioning and styling directives in VTT subtitle lines are skipped, so only the actual subtitle text is extracted.

Subtitle parsing improvements:

  • Updated SubtitleParser logic to detect VTT directives (e.g., line, align, position, etc.) in group 10 and, when present, extract subtitle text from group 11 instead. This prevents directives from being misinterpreted as subtitle text.

Test case update:

  • Modified the VTT subtitle test input to include a line: 20% directive, ensuring the parser correctly skips the directive and extracts only the subtitle text.

Subtitle load failures used to vanish into zone error handlers — the
provider fire-and-forgets `initial()`, so a bad URL, non-200, or
unsupported extension produced silent "no subs rendered" with no
breadcrumbs.

Now every fetch logs url/scheme/host/extension/header-keys, every
response logs status + body head, every exception logs with stack,
every zero-match parse logs body head + detected type, and
UnsupportedSubtitleFormat logs the rejected extension.

Uses `dart:developer.log(name: 'subtitle')` so nothing new shows up for
consumers by default — only when they attach DevTools or tail
`flutter run` output.
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.

1 participant