@@ -6,7 +6,7 @@ This module implements a video-based onboarding system for applicants with seque
66
77- ** Sequential Video Watching** : Users must complete videos in order (1 → 2 → 3 → 4)
88- ** Progress Tracking** : Real-time tracking of video watch progress
9- - ** Validation** : Users must watch at least 90 % of each video to unlock the next one
9+ - ** Validation** : Users must watch at least 98 % of each video to unlock the next one
1010- ** Visual Progress** : Stepper UI showing completion status
1111- ** Database Persistence** : All progress is saved to the database
1212
@@ -26,34 +26,25 @@ Or use Supabase Dashboard:
2626
2727## Video Setup
2828
29- ### Option 1: Supabase Storage (Recommended)
29+ Onboarding videos are hosted as ** unlisted YouTube videos** and embedded via the
30+ YouTube IFrame Player API. They are ** not** stored on Supabase Storage — doing so
31+ generated excessive cached egress and repeatedly restricted the whole project.
3032
31- 1 . Create a storage bucket named ` onboarding-videos ` in Supabase
32- 2 . Upload your 4 videos with the following naming convention:
33- - ` onboarding-1.mp4 ` - Introduction
34- - ` onboarding-2.mp4 ` - Company Culture
35- - ` onboarding-3.mp4 ` - Tools & Processes
36- - ` onboarding-4.mp4 ` - Getting Started
33+ Each video is referenced by its ** YouTube ID** through environment variables:
3734
38- 3 . Update the ` VIDEO_URLS ` in ` _components/OnboardingClient.tsx ` :
39- ``` typescript
40- const VIDEO_URLS = {
41- 1 : " https://your-project.supabase.co/storage/v1/object/public/onboarding-videos/onboarding-1.mp4" ,
42- 2 : " https://your-project.supabase.co/storage/v1/object/public/onboarding-videos/onboarding-2.mp4" ,
43- 3 : " https://your-project.supabase.co/storage/v1/object/public/onboarding-videos/onboarding-3.mp4" ,
44- 4 : " https://your-project.supabase.co/storage/v1/object/public/onboarding-videos/onboarding-4.mp4" ,
45- };
35+ ``` bash
36+ NEXT_PUBLIC_ONBOARDING_VIDEO_ID_1=< id> # Introduction - About Codebility
37+ NEXT_PUBLIC_ONBOARDING_VIDEO_ID_2=< id> # Benefits, Culture & Expectations
38+ NEXT_PUBLIC_ONBOARDING_VIDEO_ID_3=< id> # Roadmaps, Milestones & Tech Stack
39+ NEXT_PUBLIC_ONBOARDING_VIDEO_ID_4=< id> # Portal Tour - Gamification & Workflow
4640```
4741
48- ### Option 2: Public Folder
49-
50- 1 . Create a ` public/videos ` folder in the root of your Next.js app
51- 2 . Add your 4 videos with the naming convention above
52- 3 . The current URLs in ` OnboardingClient.tsx ` are already configured for this option
53-
54- ### Option 3: External Video Hosting
42+ ` OnboardingClient.tsx ` reads these into ` VIDEO_IDS ` and passes them to
43+ ` VideoPlayer.tsx ` . To swap a video, upload a new ** Unlisted** (not Private) video
44+ to YouTube and update the matching env var — no code change needed. Remember that
45+ ` NEXT_PUBLIC_* ` vars are inlined at build time, so production must be rebuilt.
5546
56- Use any video hosting service (Vimeo, YouTube, AWS S3, etc.) and update the URLs accordingly .
47+ See ` apps/codebility/docs/VIDEO_UPLOAD_GUIDE.md ` for full upload steps .
5748
5849## Flow
5950
@@ -65,7 +56,7 @@ Use any video hosting service (Vimeo, YouTube, AWS S3, etc.) and update the URLs
65562 . ** Video Watching** (` /applicant/onboarding ` - Step 1-4):
6657 - Shows progress stepper with 5 steps
6758 - Displays current video with player controls
68- - Tracks watch progress (must watch 90 %+ to complete)
59+ - Tracks watch progress (must watch 98 %+ to complete)
6960 - Next video unlocks only after completing previous one
7061 - "Proceed to Quiz" button appears after all 4 videos
7162
@@ -124,9 +115,9 @@ Main client component that manages the complete onboarding flow:
124115
125116### ` VideoPlayer.tsx `
126117Video player component with:
127- - HTML5 video controls
128- - Progress tracking
129- - Watch validation (90 % threshold)
118+ - YouTube IFrame Player API embed (unlisted videos)
119+ - Progress tracking (polls playback position)
120+ - Watch validation (98 % threshold)
130121- Locked state for sequential videos
131122- Auto-save progress to database
132123
@@ -186,10 +177,8 @@ const VIDEO_DESCRIPTIONS = {
186177### Watch Threshold
187178Change the completion percentage in ` VideoPlayer.tsx ` :
188179``` typescript
189- // Current: 90% threshold
190- if (percentWatched >= 90 && ! hasWatched ) {
191- // Change 90 to your desired percentage
192- }
180+ // Current: 98% threshold
181+ const COMPLETION_THRESHOLD = 98 ; // change to your desired percentage
193182```
194183
195184### Styling
@@ -198,17 +187,16 @@ All components use Tailwind CSS and can be customized by modifying the className
198187## Security Features
199188
200189- Row Level Security (RLS) policies ensure users can only access their own progress
201- - Video right-click disabled to prevent easy downloading
202- - Download controls disabled
190+ - Videos are unlisted on YouTube (not indexed/searchable) and embedded without a direct download path
203191- Progress validation on server-side
204192
205193## Troubleshooting
206194
207195### Videos not loading
208- - Check video URLs in ` VIDEO_URLS `
209- - Ensure videos are in correct format (MP4 recommended)
210- - Check browser console for network errors
211- - Verify Supabase storage bucket permissions (if using Supabase)
196+ - Check the YouTube IDs in the ` NEXT_PUBLIC_ONBOARDING_VIDEO_ID_* ` env vars (IDs, not URLs)
197+ - Ensure each YouTube video is ** Unlisted ** (not Private) and allows embedding
198+ - In production, confirm you rebuilt after setting/changing the env vars
199+ - Check browser console for IFrame API errors
212200
213201### Progress not saving
214202- Check database connection
0 commit comments