Skip to content

Commit

Permalink
add playback rate adjustment and seek buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterjm authored and blakeblackshear committed Jun 5, 2021
1 parent 7b3abe3 commit 40c4ca3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
20 changes: 20 additions & 0 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"preact-async-route": "^2.2.1",
"preact-router": "^3.2.1",
"video.js": "^7.11.8",
"videojs-playlist": "^4.3.1"
"videojs-playlist": "^4.3.1",
"videojs-seek-buttons": "^2.0.0"
},
"devDependencies": {
"@babel/eslint-parser": "^7.12.13",
Expand Down
7 changes: 7 additions & 0 deletions web/src/components/VideoPlayer.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { h, Component } from 'preact';
import videojs from 'video.js';
import 'videojs-playlist';
import 'videojs-seek-buttons';
import 'video.js/dist/video-js.css';
import 'videojs-seek-buttons/dist/videojs-seek-buttons.css';

const defaultOptions = {
controls: true,
playbackRates: [0.5, 1, 2, 4, 8],
fluid: true,
};

Expand All @@ -18,6 +21,10 @@ export default class VideoPlayer extends Component {
this.player = videojs(this.videoNode, videoJsOptions, function onPlayerReady() {
onReady(this);
});
this.player.seekButtons({
forward: 30,
back: 15,
});
}

componentWillUnmount() {
Expand Down

0 comments on commit 40c4ca3

Please sign in to comment.