Skip to content

Remove subtitle from mpv when all lines are deleted#11659

Merged
niksedk merged 1 commit into
mainfrom
fix/mpv-refresh-on-delete-all
Jun 16, 2026
Merged

Remove subtitle from mpv when all lines are deleted#11659
niksedk merged 1 commit into
mainfrom
fix/mpv-refresh-on-delete-all

Conversation

@niksedk

@niksedk niksedk commented Jun 16, 2026

Copy link
Copy Markdown
Member

Problem

Fixes #11658.

When the user deletes all subtitle lines, the deleted subtitles still appear burned on the video (mpv player).

Root cause

MpvReloader.RefreshMpv returned early when the subtitle had zero paragraphs:

if (subtitle.Paragraphs.Count == 0 && subtitleSecondary == null)
{
    return;
}

Deleting all lines correctly marks the preview dirty and the timer calls RefreshMpv, but this early return means mpv is never told to drop the previously loaded subtitle file — so the last-shown lines stay visible.

(Deleting some lines already worked, because the non-empty path regenerated and reloaded the subtitle file.)

Fix

Before returning on an empty subtitle, if a subtitle was previously loaded into mpv, call SubRemove() to clear it from the video and reset the cached state (temp file, hash, old text, prev subtitle). The guard ensures SubRemove() only runs when something was actually loaded, so it doesn't fire on every 400 ms timer tick when nothing is present.

Testing

  • dotnet build src/ui/UI.csproj — 0 warnings / 0 errors.

🤖 Generated with Claude Code

RefreshMpv returned early when the subtitle had zero paragraphs, so
deleting all lines never told mpv to drop the previously loaded
subtitle file - the last shown lines stayed visible on the video.

Now clear the subtitle from mpv (SubRemove) and reset cached state when
the subtitle becomes empty.

Fixes #11658

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@niksedk niksedk merged commit db27f07 into main Jun 16, 2026
1 of 3 checks passed
@niksedk niksedk deleted the fix/mpv-refresh-on-delete-all branch June 16, 2026 10:04
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.

[Bug] Potential bug when you delete subtitles they still show on the video

1 participant