mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-29 11:11:20 -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 {
|
export default class Hotkey {
|
||||||
constructor(art) {
|
constructor(art) {
|
||||||
this.keys = {};
|
this.keys = {};
|
||||||
if (art.option.hotkey) {
|
|
||||||
|
const {
|
||||||
|
option,
|
||||||
|
player,
|
||||||
|
events: { proxy },
|
||||||
|
} = art;
|
||||||
|
|
||||||
|
if (option.hotkey) {
|
||||||
art.on('ready', () => {
|
art.on('ready', () => {
|
||||||
this.add(27, () => {
|
this.add(27, () => {
|
||||||
if (art.player.fullscreenWeb) {
|
if (player.fullscreenWeb) {
|
||||||
art.player.fullscreenWeb = false;
|
player.fullscreenWeb = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add(32, () => {
|
this.add(32, () => {
|
||||||
art.player.toggle = true;
|
player.toggle = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add(37, () => {
|
this.add(37, () => {
|
||||||
art.player.seek = art.player.currentTime - 5;
|
player.seek = player.currentTime - 5;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add(38, () => {
|
this.add(38, () => {
|
||||||
art.player.volume += 0.1;
|
player.volume += 0.1;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add(39, () => {
|
this.add(39, () => {
|
||||||
art.player.seek = art.player.currentTime + 5;
|
player.seek = player.currentTime + 5;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add(40, () => {
|
this.add(40, () => {
|
||||||
art.player.volume -= 0.1;
|
player.volume -= 0.1;
|
||||||
});
|
});
|
||||||
|
|
||||||
const { proxy } = art.events;
|
|
||||||
proxy(window, 'keydown', event => {
|
proxy(window, 'keydown', event => {
|
||||||
if (art.isFocus) {
|
if (art.isFocus) {
|
||||||
const tag = document.activeElement.tagName.toUpperCase();
|
const tag = document.activeElement.tagName.toUpperCase();
|
||||||
|
|||||||
Reference in new issue
Block a user