JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr{ gilour

File "handle-player-keybinds-20260314161951.ts"

Full Path: /home/markqprx/iniasli.pro/client/player/handle-player-keybinds-20260314161951.ts
File size: 750 bytes
MIME-type: text/plain
Charset: utf-8

import {PlayerState} from '@common/player/state/player-state';
import {isCtrlOrShiftPressed} from '@common/utils/keybinds/is-ctrl-or-shift-pressed';

export function handlePlayerKeybinds(
  e: KeyboardEvent,
  state: () => PlayerState
) {
  if (
    ['input', 'textarea'].includes(
      (e.target as HTMLElement)?.tagName.toLowerCase()
    )
  )
    return;

  if (e.key === ' ' || e.key === 'k') {
    e.preventDefault();
    if (state().isPlaying) {
      state().pause();
    } else {
      state().play();
    }
  }

  if (e.key === 'ArrowRight' && isCtrlOrShiftPressed(e)) {
    e.preventDefault();
    state().playNext();
  }

  if (e.key === 'ArrowLeft' && isCtrlOrShiftPressed(e)) {
    e.preventDefault();
    state().playPrevious();
  }
}