mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-15 09:06:16 -08:00
Update hotkey.js
This commit is contained in:
1 parent
15f6f2759a
commit
48b81536a8
1 file changed
+15
-9
@@ -1,35 +1,41 @@
|
||||
export default class Hotkey {
|
||||
constructor(art) {
|
||||
this.keys = {};
|
||||
if (art.option.hotkey) {
|
||||
|
||||
const {
|
||||
option,
|
||||
player,
|
||||
events: { proxy },
|
||||
} = art;
|
||||
|
||||
if (option.hotkey) {
|
||||
art.on('ready', () => {
|
||||
this.add(27, () => {
|
||||
if (art.player.fullscreenWeb) {
|
||||
art.player.fullscreenWeb = false;
|
||||
if (player.fullscreenWeb) {
|
||||
player.fullscreenWeb = false;
|
||||
}
|
||||
});
|
||||
|
||||
this.add(32, () => {
|
||||
art.player.toggle = true;
|
||||
player.toggle = true;
|
||||
});
|
||||
|
||||
this.add(37, () => {
|
||||
art.player.seek = art.player.currentTime - 5;
|
||||
player.seek = player.currentTime - 5;
|
||||
});
|
||||
|
||||
this.add(38, () => {
|
||||
art.player.volume += 0.1;
|
||||
player.volume += 0.1;
|
||||
});
|
||||
|
||||
this.add(39, () => {
|
||||
art.player.seek = art.player.currentTime + 5;
|
||||
player.seek = player.currentTime + 5;
|
||||
});
|
||||
|
||||
this.add(40, () => {
|
||||
art.player.volume -= 0.1;
|
||||
player.volume -= 0.1;
|
||||
});
|
||||
|
||||
const { proxy } = art.events;
|
||||
proxy(window, 'keydown', event => {
|
||||
if (art.isFocus) {
|
||||
const tag = document.activeElement.tagName.toUpperCase();
|
||||
|
||||
Reference in new issue
Block a user