video.js plugin for skip to next/previous chapter buttons.
Built for video.js 5.x and above.
@import "~videojs-chapter-nav/src/plugin";
require('videojs-chapter-nav')
videojs(element, {
plugins: {
chapterNav: {}
}
})
MIT
video.js plugin for skip to next/previous chapter buttons
For a clean interface I would'nt include the ControlBar's ChaptersButton component to the player. In this case, the plugin won't work, because it's depends on it.
My suggestion:
// Get all text tracks for the current player.
var tracks = player.textTracks();
for (var i = 0; i < tracks.length; i++) {
var track = tracks[i];
// Find the chapters track.
if (track.kind === 'chapters') {
// Chapters track found.
break;
}
}
player.controlBar.chapterPrev = player.controlBar.addChild('ChapterNavButton', {
direction: 'prev'
}, 1);
player.controlBar.chapterNext = player.controlBar.addChild('ChapterNavButton', {
direction: 'next'
}, 2);
Or before the ControlBar if no PlayToggle present.
Now the plugin only skips to the previous chapter's startTime if no more than 4 sec is passed in the current chapter. Otherwise it jumps to the current chapter's startTime. Am I right?
For faster navigation, it would be nice to add an option like this:
chapterNav: {
instantPrev: true
}
The default would be false.
I think the proper behaviour would be always skip to the next chapter's startTime instead of the actual chapter's endTime. Except the last chapter of course.
Example chapter file:
WEBVTT
1
00:00:01.000 --> 00:00:10.000
This is the first line of text
2
00:00:15.000 --> 00:00:20.000
And the second line of text
BTW, thank you for your work!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.