Skip to content

Commit

Permalink
show video thumbnail on link
Browse files Browse the repository at this point in the history
  • Loading branch information
MarconLP committed Aug 12, 2023
1 parent 24389ee commit 20fef9d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/pages/share/[videoId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ const VideoList: NextPage = () => {
<title>
{video?.title ?? "Snapify | The Open Source Loom Alternative"}
</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
name="description"
content="Share high-quality videos asynchronously and collaborate on your own schedule"
Expand Down
10 changes: 9 additions & 1 deletion src/server/api/routers/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,15 @@ export const videoRouter = createTRPCRouter({

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
.input(z.object({ key: z.string() }))
Expand Down

1 comment on commit 20fef9d

@vercel
Copy link

@vercel vercel bot commented on 20fef9d Aug 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.