GithubHelp home page GithubHelp logo

videojs-chapter-nav's Introduction

videojs-chapter-nav

video.js plugin for skip to next/previous chapter buttons.

Built for video.js 5.x and above.

Usage

@import "~videojs-chapter-nav/src/plugin";
require('videojs-chapter-nav')
videojs(element, {
  plugins: {
    chapterNav: {}
  }
})

License

MIT

videojs-chapter-nav's People

Contributors

tmm1 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

videojs-chapter-nav's Issues

Do not depend on the ControlBar's ChaptersButton component

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:

  • Skip checking the ChaptersButton's visibility to show/hide the plugin buttons. Or check differently if there is a chapters Text Track:
// 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;
	}
}
  • Add the plugin buttons next to the PlayToggle component:
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.

Option to skip to the previous chapter always instantly

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.

Chapter where the endTime is not the next chapter's startTime

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.