Prefer cached stills and stream first frames in the grid
This commit is contained in:
+10
-6
@@ -391,16 +391,20 @@ export class MediaService {
|
||||
const file = this.getMediaFile(scrapeId, itemId);
|
||||
if (file) return { kind: "file", ...file };
|
||||
|
||||
const item = this.getMediaItem(scrapeId, itemId);
|
||||
if (!item) return null;
|
||||
|
||||
return { kind: "remote", url: item.play_url ?? item.url };
|
||||
}
|
||||
|
||||
/** Re-fetch the source message for a fresh signed URL. Null when not possible. */
|
||||
async refreshMediaUrl(scrapeId: string, itemId: number): Promise<string | null> {
|
||||
const meta = this.engine.get(scrapeId);
|
||||
const item = this.getMediaItem(scrapeId, itemId);
|
||||
if (!meta || !item) return null;
|
||||
if (meta.backend !== "slopbot" || !meta.guildId || !this.bot) return null;
|
||||
|
||||
if (meta.backend === "slopbot" && meta.guildId && this.bot) {
|
||||
const refreshed = await this.refreshUrls(meta.id, meta.channelId, item);
|
||||
if (refreshed) return { kind: "remote", url: refreshed };
|
||||
}
|
||||
|
||||
return { kind: "remote", url: item.play_url ?? item.url };
|
||||
return this.refreshUrls(meta.id, meta.channelId, item);
|
||||
}
|
||||
|
||||
/** Re-fetch the source message and update expired URLs. Returns the fresh playable URL. */
|
||||
|
||||
Reference in New Issue
Block a user