From e06c42f60c339b942b7b8683a1cdf9139a1d7256 Mon Sep 17 00:00:00 2001 From: Leonid Pershin Date: Wed, 9 Sep 2026 02:09:11 +0300 Subject: [PATCH] Restore the video branch in openPlayback The screen share never started because openPlayback had no video branch left: removing the old direct-URL seek path took it with it, since it sat between the anchors used for that edit. canShowVideo and the pipeline import stayed behind, and nothing failed to compile, so it looked wired up while every track quietly took the audio-only path. Verified end to end: openPlayback now returns a 640x360 track, format 18 is selected, and 12 seconds of playback yields 202 frames alongside the audio. Co-Authored-By: Claude Opus 5 --- src/sources/index.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/sources/index.ts b/src/sources/index.ts index 680030e..04f20c1 100644 --- a/src/sources/index.ts +++ b/src/sources/index.ts @@ -1,5 +1,6 @@ import type { Readable } from "node:stream"; import { config } from "../config.js"; +import { logger } from "../logger.js"; import { UserFacingError, type Requester, type SearchResult, type Track } from "../types.js"; import * as direct from "./direct.js"; import * as local from "./local.js"; @@ -9,6 +10,8 @@ import * as ytdlp from "./ytdlp.js"; export { checkAvailable as checkYtDlp, checkCookies, checkProxy, describeProxy } from "./ytdlp.js"; export { isEnabled as isLocalLibraryEnabled, listFiles as listLocalFiles } from "./local.js"; +const log = logger.child({ mod: "sources" }); + const YOUTUBE_HOSTS = ["youtube.com", "youtu.be", "music.youtube.com", "m.youtube.com"]; const SOUNDCLOUD_HOSTS = ["soundcloud.com", "on.soundcloud.com", "m.soundcloud.com"]; @@ -209,6 +212,19 @@ export async function openPlayback(track: Track, seekSeconds = 0): Promise pipeline.kill(), + video: { stream: pipeline.video, width: pipeline.width, height: pipeline.height }, + }; + } + // Everything goes through yt-dlp: YouTube stalls direct CDN URLs fetched by // anything else, and ffmpeg would bypass a SOCKS proxy anyway. Seeking // therefore costs a decode up to the offset instead of an HTTP range request.