show video thumbnail on link

This commit is contained in:
MarconLP 2023-08-12 11:11:12 +02:00
parent 24389ee0a7
commit 20fef9d176
No known key found for this signature in database
GPG key ID: A08A9C8B623F5EA5
2 changed files with 13 additions and 1 deletions

View file

@ -86,6 +86,10 @@ const VideoList: NextPage = () => {
<title> <title>
{video?.title ?? "Snapify | The Open Source Loom Alternative"} {video?.title ?? "Snapify | The Open Source Loom Alternative"}
</title> </title>
<meta property="og:image" content={video?.thumbnailUrl} />
<meta property="og:image:type" content="image/png" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="600" />
<meta <meta
name="description" name="description"
content="Share high-quality videos asynchronously and collaborate on your own schedule" content="Share high-quality videos asynchronously and collaborate on your own schedule"

View file

@ -93,7 +93,15 @@ export const videoRouter = createTRPCRouter({
const signedUrl = await getSignedUrl(s3, getObjectCommand); const signedUrl = await getSignedUrl(s3, getObjectCommand);
return { ...video, video_url: signedUrl }; const thumbnailUrl = await getSignedUrl(
s3,
new GetObjectCommand({
Bucket: env.AWS_BUCKET_NAME,
Key: video.userId + "/" + video.id + "-thumbnail",
})
);
return { ...video, video_url: signedUrl, thumbnailUrl };
}), }),
getUploadUrl: protectedProcedure getUploadUrl: protectedProcedure
.input(z.object({ key: z.string() })) .input(z.object({ key: z.string() }))