Always embed Vimeo first; link out only on player error
Prefer on-site player.vimeo.com embeds. Use the Vimeo Player API to detect privacy blocks and fall back to Watch on Vimeo only then.
This commit is contained in:
@@ -273,38 +273,30 @@ export async function runVimeoImport(
|
||||
}
|
||||
}
|
||||
|
||||
// Embed only when Vimeo allows it (embed_privacy: anywhere / whitelist)
|
||||
const canEmbed =
|
||||
!video.embed_privacy ||
|
||||
video.embed_privacy === "anywhere" ||
|
||||
video.embed_privacy === "whitelist";
|
||||
// Always store player embed URL — UI embeds first; falls back to Vimeo
|
||||
// only if the player reports a privacy/error at runtime.
|
||||
if (video.embed_privacy && video.embed_privacy !== "anywhere") {
|
||||
log(
|
||||
lines,
|
||||
onLog,
|
||||
` note: Vimeo embed_privacy is “${video.embed_privacy}” — player will embed if allowed, else last-resort link`
|
||||
);
|
||||
}
|
||||
|
||||
await prisma.media.create({
|
||||
data: {
|
||||
projectId: project.id,
|
||||
type: "video",
|
||||
// Non-embeddable clips use the watch page URL (no player.vimeo.com iframe)
|
||||
url: canEmbed
|
||||
? `https://player.vimeo.com/video/${video.id}`
|
||||
: sourceUrl,
|
||||
url: `https://player.vimeo.com/video/${video.id}`,
|
||||
externalUrl: sourceUrl,
|
||||
videoSource: "vimeo",
|
||||
videoId: String(video.id),
|
||||
caption: canEmbed
|
||||
? title
|
||||
: `${title} (opens on Vimeo — embedding disabled by privacy settings)`,
|
||||
caption: title,
|
||||
sortOrder: 1,
|
||||
width: video.width,
|
||||
height: video.height,
|
||||
},
|
||||
});
|
||||
if (!canEmbed) {
|
||||
log(
|
||||
lines,
|
||||
onLog,
|
||||
` note: embed privacy “${video.embed_privacy}” — link-out card instead of iframe`
|
||||
);
|
||||
}
|
||||
|
||||
if (thumbnailId) {
|
||||
await prisma.project.update({
|
||||
|
||||
Reference in New Issue
Block a user