Player: leave Bilibili's danmaku out of yt-dlp subtitles (it stalled playback)

The danmaku XML is served raw-deflate; ffmpeg fails to inflate it on
every read, logging a warning each time (millions, drained on the UI
thread) while the video waits on the track: a frame every few seconds.
mpv's hook now asks yt-dlp for sub-langs all,-danmaku.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
foxyzandClaude Opus 5.5 committed 2026-10-11 01:53:36 +03:00
1 parent 6d388483ef
commit 1b0a3db439
2 files changed
+15 -5

No files matched your search

+12 -4
View File
@@ -7,6 +7,12 @@ import 'package:sync_relay_core/core.dart';
/// mpv's `ytdl-format` for links every player opens itself.
const ytdlFormat = 'bv*[height<=1080]+ba/b';
/// yt-dlp's `--sub-langs` for mpv's hook (its default is `all`), without
/// Bilibili's danmaku: an XML comment feed served raw-deflate, which
/// ffmpeg fails to inflate on every read (a warning each time) while the
/// video waits on it.
const ytdlSubLangs = 'all,-danmaku';
/// The app's yt-dlp (see [YtDlp]): in the app-support folder, shared with
/// the hosted server. [probe] remembers what pasted links are for a while,
/// so the Link preview and the swap ask once.
@@ -28,13 +34,15 @@ class AppYtDlp {
/// update check afterwards).
void warmUp() => unawaited(ytDlp.then((y) => y.ensure()).catchError((_) => null));
/// mpv's `ytdl-raw-options` for the cookies in the yt-dlp folder ('' for
/// none; see [YtDlpCookies]).
/// mpv's `ytdl-raw-options`: [ytdlSubLangs] and the cookies in the
/// yt-dlp folder (see [YtDlpCookies]).
Future<String> mpvRawOptions() async {
const subs = 'sub-langs=%${ytdlSubLangs.length}%$ytdlSubLangs';
try {
return (await ytDlp).cookies.mpvRawOptions();
final cookies = (await ytDlp).cookies.mpvRawOptions();
return cookies.isEmpty ? subs : '$subs,$cookies';
} catch (_) {
return '';
return subs;
}
}