diff --git a/prisma/seed.ts b/prisma/seed.ts index 436a664ca..6f41bda93 100644 --- a/prisma/seed.ts +++ b/prisma/seed.ts @@ -140,6 +140,24 @@ async function seedContent() { parentId: folderId, commentsCount: 0, }, + { + type: 'video', + title: 'test video 2 for week 1', + hidden: false, + thumbnail: + 'https://appx-recordings.s3.ap-south-1.amazonaws.com/drm/100x/images/week-1-orientation.jpg', + parentId: folderId, + commentsCount: 0, + }, + { + type: 'video', + title: 'test video-3 for week 1', + hidden: false, + thumbnail: + 'https://appx-recordings.s3.ap-south-1.amazonaws.com/drm/100x/images/week-1-orientation.jpg', + parentId: folderId, + commentsCount: 0, + }, ]; const createdContent = await db.content.createMany({ data: contentData }); @@ -181,37 +199,147 @@ async function seedNotionMetadata() { async function seedVideoMetadata() { try { - await db.videoMetadata.create({ - data: { - id: 1, - contentId: 3, - video_1080p_mp4_1: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_1080p_mp4_2: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_1080p_mp4_3: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_1080p_mp4_4: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_1080p_1: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_1080p_2: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_1080p_3: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_1080p_4: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_720p_mp4_1: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_720p_mp4_2: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_720p_mp4_3: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_720p_mp4_4: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_720p_1: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_720p_2: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_720p_3: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_720p_4: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_360p_mp4_1: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_360p_mp4_2: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_360p_mp4_3: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_360p_mp4_4: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_360p_1: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_360p_2: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_360p_3: 'https://www.w3schools.com/html/mov_bbb.mp4', - video_360p_4: 'https://www.w3schools.com/html/mov_bbb.mp4', - slides: - 'https://appx-recordings.s3.ap-south-1.amazonaws.com/drm/100x/slides/Loops%2C+callbacks.pdf', - }, + await db.videoMetadata.createMany({ + data: [ + { + id: 1, + contentId: 3, + video_1080p_mp4_1: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_1080p_mp4_2: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_1080p_mp4_3: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_1080p_mp4_4: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_1080p_1: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_1080p_2: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_1080p_3: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_1080p_4: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_720p_mp4_1: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_720p_mp4_2: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_720p_mp4_3: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_720p_mp4_4: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_720p_1: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_720p_2: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_720p_3: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_720p_4: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_360p_mp4_1: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_360p_mp4_2: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_360p_mp4_3: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_360p_mp4_4: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_360p_1: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_360p_2: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_360p_3: 'https://www.w3schools.com/html/mov_bbb.mp4', + video_360p_4: 'https://www.w3schools.com/html/mov_bbb.mp4', + slides: + 'https://appx-recordings.s3.ap-south-1.amazonaws.com/drm/100x/slides/Loops%2C+callbacks.pdf', + }, + { + id: 2, + contentId: 4, + video_1080p_mp4_1: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_1080p_mp4_2: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_1080p_mp4_3: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_1080p_mp4_4: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_1080p_1: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_1080p_2: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_1080p_3: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_1080p_4: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_720p_mp4_1: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_720p_mp4_2: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_720p_mp4_3: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_720p_mp4_4: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_720p_1: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_720p_2: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_720p_3: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_720p_4: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_360p_mp4_1: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_360p_mp4_2: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_360p_mp4_3: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_360p_mp4_4: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_360p_1: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_360p_2: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_360p_3: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + video_360p_4: + 'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8', + slides: + 'https://appx-recordings.s3.ap-south-1.amazonaws.com/drm/100x/slides/Loops%2C+callbacks.pdf', + }, + { + id: 3, + contentId: 5, + video_1080p_mp4_1: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_1080p_mp4_2: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_1080p_mp4_3: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_1080p_mp4_4: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_1080p_1: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_1080p_2: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_1080p_3: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_1080p_4: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_720p_mp4_1: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_720p_mp4_2: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_720p_mp4_3: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_720p_mp4_4: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_720p_1: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_720p_2: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_720p_3: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_720p_4: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_360p_mp4_1: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_360p_mp4_2: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_360p_mp4_3: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_360p_mp4_4: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_360p_1: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_360p_2: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_360p_3: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + video_360p_4: + 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd', + slides: + 'https://appx-recordings.s3.ap-south-1.amazonaws.com/drm/100x/slides/Loops%2C+callbacks.pdf', + }, + ], }); } catch (error) { console.error('Error seeding video metadata:', error); diff --git a/src/actions/videopreview/videoPreview.tsx b/src/actions/videopreview/videoPreview.tsx index 3e0611227..86db32902 100644 --- a/src/actions/videopreview/videoPreview.tsx +++ b/src/actions/videopreview/videoPreview.tsx @@ -4,15 +4,24 @@ import db from '@/db'; export default async function VideoPreview({ contentId, }: { - contentId: number; + contentId: number | undefined; }) { + if (!contentId) return null; const videoMetadata = await db.videoMetadata.findFirst({ where: { contentId }, - select: { video_360p_1: true }, + select: { + video_360p_1: true, + video_360p_2: true, + video_360p_3: true, + video_360p_4: true, + }, }); + if (!videoMetadata) return null; + const videoUrl = + videoMetadata.video_360p_1 || + videoMetadata.video_360p_2 || + videoMetadata.video_360p_3 || + videoMetadata.video_360p_4; - if (videoMetadata) { - return videoMetadata.video_360p_1; - } - return null; + return videoUrl; } diff --git a/src/components/ContentCard.tsx b/src/components/ContentCard.tsx index b816c93ac..362e44743 100644 --- a/src/components/ContentCard.tsx +++ b/src/components/ContentCard.tsx @@ -70,7 +70,8 @@ export const ContentCard = ({ {type === 'video' && (