diff --git a/prisma/migrations/20241130091016_added_appx_video_id_mapping_with_appx_video_json/migration.sql b/prisma/migrations/20241130091016_added_appx_video_id_mapping_with_appx_video_json/migration.sql new file mode 100644 index 000000000..cabfaf250 --- /dev/null +++ b/prisma/migrations/20241130091016_added_appx_video_id_mapping_with_appx_video_json/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "VideoMetadata" ADD COLUMN "appxVideoJSON" JSONB; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 90d2d78a1..ca8e4431c 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -88,6 +88,7 @@ model VideoMetadata { id Int @id @default(autoincrement()) contentId Int appxVideoId String? + appxVideoJSON Json? video_1080p_mp4_1 String? // Link to 1080p mp4 quality video variant 1 video_1080p_mp4_2 String? // Link to 1080p mp4 quality video variant 2 video_1080p_mp4_3 String? // Link to 1080p mp4 quality video variant 3 diff --git a/src/actions/user/index.ts b/src/actions/user/index.ts index 73680e434..7f6f960a7 100644 --- a/src/actions/user/index.ts +++ b/src/actions/user/index.ts @@ -70,13 +70,9 @@ export const GetAppxVideoPlayerUrl = async (courseId: string, videoId: string): 'User-Id': appxUserId, }, }; - console.log(config); - console.log(url); const res = await axios.request(config); const { video_player_token, video_player_url } = res.data.data; - console.log(video_player_token); - console.log(video_player_url); const full_video_url = `${video_player_url}${video_player_token}&watermark=${name}%0A${email}`; return full_video_url; }; diff --git a/src/app/api/admin/content/route.ts b/src/app/api/admin/content/route.ts index acd30502b..dbc4e39c8 100644 --- a/src/app/api/admin/content/route.ts +++ b/src/app/api/admin/content/route.ts @@ -60,19 +60,6 @@ export const POST = async (req: NextRequest) => { discordChecked: boolean; } = await req.json(); - console.log({ - type, - thumbnail, - title, - courseId, - parentContentId, - metadata, - adminPassword, - courseTitle, - rest, - discordChecked, - }); - if (adminPassword !== process.env.ADMIN_SECRET) { return NextResponse.json({}, { status: 403 }); } @@ -113,7 +100,7 @@ export const POST = async (req: NextRequest) => { } else if (type === 'appx') { await db.videoMetadata.create({ data: { - appxVideoId: metadata.appxVideoId, + appxVideoJSON: JSON.parse(metadata.appxVideoJSON), contentId: content.id, }, }); @@ -181,7 +168,6 @@ export const POST = async (req: NextRequest) => { mediaId: content.id, }; - console.log(data); await sendUpdateToDiscord(data); } diff --git a/src/components/AppxVideoPlayer.tsx b/src/components/AppxVideoPlayer.tsx index d2b5c0082..33158780e 100644 --- a/src/components/AppxVideoPlayer.tsx +++ b/src/components/AppxVideoPlayer.tsx @@ -36,7 +36,9 @@ export const AppxVideoPlayer = ({ if (!url.length) { return
Loading...
; } - - return ; + return ; }; - diff --git a/src/components/CourseView.tsx b/src/components/CourseView.tsx index 30094a0db..da5928bad 100644 --- a/src/components/CourseView.tsx +++ b/src/components/CourseView.tsx @@ -66,6 +66,7 @@ export const CourseView = ({ markAsCompleted: courseContent?.value?.videoProgress?.markAsCompleted || false, bookmark: courseContent?.value.bookmark || null, + courseId: course.id, }} /> ) : null} diff --git a/src/components/FolderView.tsx b/src/components/FolderView.tsx index c9f24c430..61839d191 100644 --- a/src/components/FolderView.tsx +++ b/src/components/FolderView.tsx @@ -45,8 +45,8 @@ export const FolderView = ({ {courseContent.map((content) => { const videoProgressPercent = content.type === 'video' && - content.videoFullDuration && - content.duration + content.videoFullDuration && + content.duration ? (content.duration / content.videoFullDuration) * 100 : 0; return ( diff --git a/src/components/VideoPlayer2.tsx b/src/components/VideoPlayer2.tsx index 7257173ab..6cbdd4684 100644 --- a/src/components/VideoPlayer2.tsx +++ b/src/components/VideoPlayer2.tsx @@ -26,6 +26,7 @@ interface VideoPlayerProps { subtitles?: string; contentId: number; appxVideoId?: string; + appxCourseId?: string; onVideoEnd: () => void; } @@ -40,18 +41,13 @@ export const VideoPlayer: FunctionComponent