Use modal video for source switching

This commit is contained in:
thePR0M3TH3AN committed 2026-01-15 11:37:02 -05:00
1 parent a6cfd3c540
commit f74ebfe6f4
1 file changed
+34 -11
+34 -11
View File
@@ -400,18 +400,41 @@ class Application {
if (!source) {
return;
}
if (this.currentVideo) {
this.playVideoWithFallback({
url: this.currentVideo.url,
magnet: this.currentVideo.magnet,
forcedSource: source,
}).catch((error) => {
devLogger.warn(
"[app] Failed to switch playback source:",
error,
);
});
const modalVideo = detail?.video || null;
const fallbackVideo = this.currentVideo || null;
const video = {
...(fallbackVideo || {}),
...(modalVideo || {}),
};
if (!modalVideo && !fallbackVideo) {
devLogger.warn("[app] Playback source switch missing video data.");
return;
}
const magnetAvailable =
typeof video.magnet === "string" && video.magnet.trim();
if (source === "torrent" && !magnetAvailable) {
userLogger.warn(
"[app] Unable to switch to torrent playback: missing magnet.",
);
this.showError(
"Torrent playback is unavailable for this video. No magnet was provided.",
);
return;
}
this.playVideoWithFallback({
url: video.url,
magnet: video.magnet,
forcedSource: source,
}).catch((error) => {
devLogger.warn(
"[app] Failed to switch playback source:",
error,
);
});
});
}
});