Skip to content

Commit

Permalink
new api: speed
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Jan 11, 2018
1 parent 3b675ea commit b7dcba3
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/DPlayer.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/DPlayer.min.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/DPlayer.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/DPlayer.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dplayer",
"version": "1.17.5",
"version": "1.18.0",
"description": "Wow, such a lovely HTML5 danmaku video player",
"main": "dist/DPlayer.min.js",
"style": "dist/DPlayer.min.css",
Expand Down
4 changes: 4 additions & 0 deletions src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,10 @@ class DPlayer {
this.events.trigger('resize');
}

speed (rate) {
this.video.playbackRate = rate;
}

destroy () {
instances.splice(instances.indexOf(this), 1);
this.pause();
Expand Down
2 changes: 1 addition & 1 deletion src/js/setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Setting {
});
for (let i = 0; i < this.player.template.speedItem.length; i++) {
this.player.template.speedItem[i].addEventListener('click', () => {
this.player.video.playbackRate = this.player.template.speedItem[i].dataset.speed;
this.player.speed(this.player.template.speedItem[i].dataset.speed);
this.hide();
});
}
Expand Down

0 comments on commit b7dcba3

Please sign in to comment.