# video-shortcut-controller

> Add keyboard shortcut to element.

Latest version **1.0.1** (published 2015-07-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install video-shortcut-controller
pnpm add video-shortcut-controller
yarn add video-shortcut-controller
bun add video-shortcut-controller
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2015-07-25 |
| First published | 2015-07-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | azu |
| Maintainers | azu |
| Keywords | video, shortcut, keyboard |

## Links

- npm: https://www.npmjs.com/package/video-shortcut-controller
- Repository: https://github.com/azu/video-shortcut-controller
- Issues: https://github.com/azu/video-shortcut-controller/issues
- npm.io page: https://npm.io/package/video-shortcut-controller

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2015-07-25

## README

# video-shortcut-controller

Add keyboard shortcut to `<video>` element.

## Installation

    npm install video-shortcut-controller

## Usage

```js
var container = document.body;
var video = document.getElementById("video");
var VideoShortcutController = require("video-shortcut-controller");
var controller = new VideoShortcutController(container, video);
controller.start();
```

See [example/](example/)

### Default Keyboard chortcut

- Space
    - toggle play/pause
- ↑ Up
    - volume up
- ↓ Down
    - volume down
- → Right
    - seek forward
- ← Left
    - seek backward
- S
    - toggle track(subs)
- F
    - toggle FullScreen
    

### Custom Keyboard shortcut

```js
import VideoShortcutController from "video-shortcut-controller";
class MyShortcutController extends VideoShortcutController{
    onKeyCode(event, keyCode) {
    // define custom key
        switch (keyCode) {
            case 32:
                this.setPosition(100, 'forward');
                return
        }
        return super.onKeyCode(event, keyCode);
    }
    super(event, keyCode);
}
```

## Contributing

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

## License

MIT

---
_Source: https://npm.io/package/video-shortcut-controller · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
