mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-22 16:19:53 +05:30
Add shortcuts for changing playbackRate
This commit is contained in:
parent
956dc382ea
commit
d85020079f
@ -79,9 +79,9 @@ var player = videojs("player", options, function() {
|
||||
seekStep: 5,
|
||||
enableModifiersForNumbers: false,
|
||||
customKeys: {
|
||||
// Toggle play with K Key
|
||||
play: {
|
||||
key: function(e) {
|
||||
// Toggle play with K Key
|
||||
return e.which === 75;
|
||||
},
|
||||
handler: function(player, options, e) {
|
||||
@ -92,23 +92,45 @@ var player = videojs("player", options, function() {
|
||||
}
|
||||
}
|
||||
},
|
||||
// Go backward 5 seconds
|
||||
backward: {
|
||||
key: function(e) {
|
||||
// Go backward 5 seconds
|
||||
return e.which === 74;
|
||||
},
|
||||
handler: function(player, options, e) {
|
||||
player.currentTime(player.currentTime() - 5);
|
||||
}
|
||||
},
|
||||
// Go forward 5 seconds
|
||||
forward: {
|
||||
key: function(e) {
|
||||
// Go forward 5 seconds
|
||||
return e.which === 76;
|
||||
},
|
||||
handler: function(player, options, e) {
|
||||
player.currentTime(player.currentTime() + 5);
|
||||
}
|
||||
},
|
||||
// Increase speed
|
||||
increase_speed: {
|
||||
key: function(e) {
|
||||
return e.which === 190;
|
||||
},
|
||||
handler: function(player, _, e) {
|
||||
size = options.playbackRates.length;
|
||||
index = options.playbackRates.indexOf(player.playbackRate());
|
||||
player.playbackRate(options.playbackRates[(index + 1) % size]);
|
||||
}
|
||||
},
|
||||
// Decrease speed
|
||||
decrease_speed: {
|
||||
key: function(e) {
|
||||
return e.which === 188;
|
||||
},
|
||||
handler: function(player, _, e) {
|
||||
size = options.playbackRates.length;
|
||||
index = options.playbackRates.indexOf(player.playbackRate());
|
||||
player.playbackRate(options.playbackRates[(size + index - 1) % size]);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user