Video Learning Tool

Video Learning Tool

Watch a video and test your knowledge with an auto-generated quiz.

Enter YouTube Video URL

Video player will appear here

Comprehension Quiz

After loading a video, generate a quiz to test your understanding of the topic.

Quiz Results

Your results will be displayed here after you complete the quiz.

Explanation: ${q.explanation}

`; resultsContainer.appendChild(resultBlock); }); const scoreBlock = document.createElement('div'); scoreBlock.className = 'p-4 rounded-lg bg-blue-100 text-blue-800 text-center text-xl font-bold'; scoreBlock.textContent = `Your Final Score: ${score} out of ${quizData.length}`; resultsContainer.prepend(scoreBlock); pdfDownloadBtn.classList.remove('hidden'); }; const downloadPDF = async () => { const { jsPDF } = window.jspdf; const pdfOutput = document.getElementById('pdf-output'); const canvas = await html2canvas(pdfOutput, { scale: 2, backgroundColor: '#ffffff' }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'portrait', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const imgProps = pdf.getImageProperties(imgData); const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width; pdf.addImage(imgData, 'PNG', 40, 40, pdfWidth - 80, pdfHeight - 80); pdf.save('Video-Quiz-Results.pdf'); }; // --- Event Listeners --- loadVideoBtn.addEventListener('click', handleLoadVideo); generateQuizBtn.addEventListener('click', handleQuizGeneration); pdfDownloadBtn.addEventListener('click', downloadPDF); // --- Initial Load --- showTab('videoTab'); });
Scroll to Top