https://github.com/dds05/videojs-quiz
Interactive quiz for videojs
https://github.com/dds05/videojs-quiz
videojs videojs-plugin videojs-quiz
Last synced: 5 months ago
JSON representation
Interactive quiz for videojs
- Host: GitHub
- URL: https://github.com/dds05/videojs-quiz
- Owner: dds05
- License: other
- Created: 2025-03-15T11:05:35.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-15T06:19:57.000Z (11 months ago)
- Last Synced: 2025-10-15T03:16:44.409Z (8 months ago)
- Topics: videojs, videojs-plugin, videojs-quiz
- Language: JavaScript
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# videojs-quiz
Interactive quiz for video.js player.
This plugin brings interactive quizzes to videos, allowing users to answer multiple-choice questions directly within the player.
It ensures active participation by requiring users to complete the quiz before continuing playback, making it ideal for e-learning, training, and interactive engagement.
## Installation
`npm i videojs-quiz`
## Getting Started
Post installation, import and use the package like shown below:-
```
import 'videojs-quiz';
var quizData = [
{
questionId: '1',
time: 5, // Time (in seconds) to pause for the quiz
question: 'What is the capital of France?',
answers: ['Berlin', 'Madrid', 'Paris'],
correctAnswer: 2, // Index of the correct answer
},
{
questionId: '2',
time: 10,
question: 'Which planet is known as the Red Planet?',
answers: ['Earth', 'Mars', 'Jupiter', 'Venus'],
correctAnswer: 1,
}
];
const player = videojs(playerId,options); //initialise videojs player
player.on('ready', () => {
// initialise quiz data
player.quiz({
quizData: quizData
});
// listener for answer selection
player.on('quizAnswer', (e) => {
console.log('Selection: ', e.detail);
})
})
```