Update hotkey.js

This commit is contained in:
Harvey committed 2019-11-22 17:48:13 +08:00
1 parent 15f6f2759a
commit 48b81536a8
1 file changed
+15 -9
+15 -9
View File
@@ -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();