new api: speed

This commit is contained in:
DIYgod 2018-01-11 16:18:03 +08:00
parent 3b675ea48a
commit b7dcba30d8
No known key found for this signature in database
GPG Key ID: EC0B76A252D3EF67
7 changed files with 10 additions and 6 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/DPlayer.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -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",

View File

@ -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();

View File

@ -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();
});
}