Transform YouTube videos into interactive learning experiences—completely free, completely private.
Chat with any video, generate quizzes, and test your understanding using Gemini Nano running entirely on your device.
No servers. No API costs. No data leaves your browser.
submissao.mp4
I previously built videolearnai.com but ran into frustrating limitations: proxies needed for YouTube transcripts, expensive API costs, and a clunky user experience. When Gemini Nano became available locally in Chrome, I saw an opportunity to rebuild the entire concept—no backend, no bills, just a browser extension that runs AI directly on your machine.
Built in 12 days for the Google Chrome Built-in AI Challenge.
Ask questions about any YouTube video and get instant, context-aware answers based on the transcript. Gemini Nano understands the content and provides accurate responses—even for long-form videos.
Smart RAG Pipeline: For longer videos, the extension automatically uses embeddings and vector search to retrieve the most relevant sections, ensuring answers stay accurate even when transcripts exceed the model's context window.
Note: The quiz feature is an experimental prototype currently in active development.
- AI-Powered Concept Extraction: Automatically identifies key concepts from video transcripts
- True/False Questions: Generates 5-8 contextual questions for each concept with explanations
- Progress Tracking: Track completion and scores across concepts
- Editable Concepts: Review, edit, or remove concepts before starting quizzes
- Persistent Storage: Concepts and quiz results are saved locally per video
- 100% local processing—all AI computations happen on your device
- No API keys required—no OpenAI, no external services
- No data transmission—transcripts, embeddings, and chats never leave Chrome
- Works offline after initial model download
- Local-first caching: Instant revisits with zero network calls
- WebGPU-accelerated embeddings: Fast semantic search using Transformers.js v3
- Lightweight RAG: Only activates chunking and embeddings when needed
- Persistent vector store: IndexedDB-backed HNSW search for efficient retrieval
Before installing, ensure you have:
-
Chrome Dev/Canary 128+ (download here)
-
Chrome AI Enabled:
- Navigate to
chrome://flags/#optimization-guide-on-device-model - Set to "Enabled BypassPerfRequirement"
- Navigate to
chrome://flags/#prompt-api-for-gemini-nano - Set to "Enabled"
- Restart Chrome
- Navigate to
-
pnpm Package Manager:
npm install -g pnpm
-
Node.js 18+ (recommended)
- Download or clone this repository
- Install dependencies:
pnpm install
- Build the extension:
pnpm build
- Load the extension in Chrome:
- Open
chrome://extensions/ - Enable Developer mode (toggle in top-right corner)
- Click Load unpacked
- Select the
build/chrome-mv3-proddirectory
- Open
pnpm install
pnpm devLoad build/chrome-mv3-dev into Chrome as an unpacked extension. Edit any component (e.g., src/sidepanel.tsx) and Plasmo will hot-reload changes.
When you first use the Chat or Quiz feature:
- Gemini Nano will download automatically (~1-2GB, one-time only)
- Wait for the download and extraction to complete (progress shown in UI)
- Once ready, the extension will work offline
- Navigate to any YouTube video with captions
- Click the Chat button (appears inline with Like/Share buttons)
- Chrome's side panel opens with video context loaded
- Ask questions about the video content
- Get AI-powered answers based on the transcript
Example questions:
- "What are the main points discussed?"
- "Summarize the section about X"
- "What did they say about Y?"
- Navigate to any YouTube video with captions
- Click the Quiz button (next to the Chat button)
- Wait as AI extracts key concepts in real-time (streaming)
- Review the concept list—edit titles/descriptions or delete irrelevant ones
- Click Start Quiz to begin
- Answer True/False questions for each concept
- View explanations and your score after each quiz
- Retake quizzes or return to concept selection
Quiz sessions and concepts are saved locally per video.
-
Current approach: A first-pass, intentionally naive implementation used to test GPU-backed embeddings in the browser. It works for demos but will be replaced by a more robust retrieval strategy.
-
Embedding timing (Chrome on GPU):
- 6 min video → 5.2s total (chunking 0.01s · embedding 5.2s · 45 chunks ≈ 116ms each)
- 2h 28min video → 46s total (chunking 0.26s · embedding 45.9s · 729 chunks ≈ 63ms each)
This extension uses multiple storage systems to manage transcripts, embeddings, and session state. Everything lives inside the user's Chrome profile.
- Storage Type: Browser Cache Storage API
- Location: Automatically managed by
@huggingface/transformers - Stored Assets: ONNX model files for text embeddings
- Lifecycle: Downloaded on first use, then cached for reuse
- Inspect via: Chrome DevTools → Application → Cache Storage
-
Data:
videoContext_${videoId}objects (title, transcript, channel, URL) -
Capacity: ~10 MB (enough for ~100–200 videos)
-
Lifecycle: Persistent cache with automatic LRU cleanup (drops oldest 10 when limit reached)
-
Disk Path:
C:\Users\{Username}\AppData\Local\Google\Chrome\User Data\Default\Extensions\{extension-id}\
- Data: Temporary tab → video mapping (
${tabId}→videoId) plusembeddingProgress-${videoId}entries - Lifecycle: In-memory; cleared when the browser closes
-
Stores:
TranscriptChunk[]items (text + metadata) and 384-dim embeddings for HNSW similarity search -
Chunking: 512 characters with 100-character overlap (
{videoId}-chunk-{index}) -
Benefits: Fast semantic lookups with persistent storage
-
Disk Path:
C:\Users\{Username}\AppData\Local\Google\Chrome\User Data\Default\IndexedDB\chrome-extension_{extension-id}_0.indexeddb.leveldb\
-
Usage: Accessed via the
LanguageModelPrompt API; extension cannot read files directly -
Disk Path (approx):
C:\Users\{Username}\AppData\Local\Google\Chrome\User Data\OptimizationGuide\models\
| Component | Storage Type | Location | What's Stored | Persistent? |
|---|---|---|---|---|
| Embedding Model | Cache Storage API | Browser cache | ONNX model files | Yes |
| Video Context | chrome.storage.local |
Extension storage | Video metadata + transcripts | Yes |
| Tab ↔ Video & Progress | chrome.storage.session |
RAM | Session mappings | No |
| Transcript Chunks & Vectors | IndexedDB | Browser database | 512-char chunks + 384D vectors (HNSW) | Yes |
| Gemini Nano | Chrome managed | Internal | Language model | Yes |
- Decision Stage: On session start, transcripts are compared against 80% of the model's context window (
RAG_CONFIG.threshold). - Full Transcript Mode: For smaller transcripts—typically up to ~30 minutes of video when the token density stays reasonable—Gemini Nano can ingest the entire transcript in the system prompt, so no embeddings or extra storage hops are needed.
- RAG Mode: Longer or denser transcripts are chunked (512 chars · 100 char overlap), embedded, stored in IndexedDB, and queried through an HNSW index.
- First Message Retrieval: Only the initial user prompt triggers a vector search. Available tokens are split 50/50 between chunk budget and assistant responses, yielding deterministic chunk counts.
- Follow-up Messages: Skip retrieval and rely on established context.
Expect upcoming iterations to incorporate better chunk selection, re-ranking, and conversational memory.
Bundling @huggingface/transformers@3 into a Manifest V3 service worker requires a few workarounds:
- URL resolution patches:
postbuild/sed.jsreplacesnew URL(import.meta.url)withnew URL(self.location.href)so ONNX assets resolve inside the service worker sandbox. - Manifest cleanup:
postbuild/fix-manifest.jsstrips the generatedside_panelentry that conflicts with Chrome's side panel permission model in this setup. - Dev convenience:
scripts/dev-with-fix.jswrapsplasmo dev, waits for the first build, applies the manifest patch, and keeps watching for regenerations.
These scripts keep the build stable today, but upstream improvements or a different bundler strategy could remove the need for manual patches.
- Transformers v3 inside Plasmo: The combination works, but only after patching URL resolution and pruning Plasmo's generated manifest. Without the post-build script, model assets fail to resolve in the service worker.
- Plasmo side panel ergonomics: Plasmo treats the side panel as a global definition, so the generated manifest always declares it. To keep the extension scoped to YouTube we rely on a
manifest.jsonfix script—otherwise the side panel surfaces everywhere.
- Each video stores one persistent context record (
videoContext_${videoId}) for instant reloads. - Session storage tracks which tab belongs to which video, so duplicate tabs skip re-processing.
- Everything stays on-device; nothing leaves the Chrome profile.
pnpm dev- Start development server with hot reloadpnpm build- Production buildpnpm test- Run tests (if configured)
- Content Scripts: Inject Chat and Quiz buttons into YouTube's DOM
- Side Panel: React-based chat interface using Chrome's native side panel API
- Background Service Worker: Manages Transformers.js embeddings, storage, and session state
- Quiz Components: Modal-based UI for concept extraction and quiz generation
- Ensure you're on a YouTube video page (not the homepage)
- Check that the video has captions available
- Refresh the page after installing the extension
- Verify Chrome flags are enabled (see Prerequisites)
- Restart Chrome after enabling flags
- Ensure you're on Chrome 128+ Dev/Canary
- Check your internet connection
- Wait a few minutes—download is ~1-2GB
- Check
chrome://on-device-internals/for model status
- The video must have auto-generated or manual captions
- Check YouTube's CC button—if unavailable there, the extension can't use it
- ✅
Chat with video transcripts - ✅
True/False quiz generation (prototype) - ✅
Local embeddings with Transformers.js v3 - 🚧 Improved RAG with re-ranking and conversational memory
- 🚧 Token-level streaming (currently object-level streaming)
- Enhanced Quiz Formats: Multiple choice, fill-in-the-blank, open-ended questions
- Visual Context: Extract and analyze key frames from videos
- Voice Interaction: Speak questions instead of typing
- Hybrid AI Options: Allow users to opt into cloud models for advanced features
- Progress Dashboard: Track learning across multiple videos
- Spaced Repetition: Smart quiz scheduling based on retention curves
Distributed under the MIT License.
Built with Gemini Nano, Plasmo, and Transformers.js v3