-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Hotkeys Plugin * Add init and destroy methods * Add options * Fix bind of onKeydown * Improve conditions of hokeys if-else * Refactor options * Rename pluginParameter type * Add doc * Add elements * Typo * Improve conditions * Add Vlitejs * Doc * Doc * Update HTML5 example * Fix keydown for multiple check --------- Co-authored-by: Yoriiis <2563298+yoriiis@users.noreply.github.com>
- Loading branch information
Showing
9 changed files
with
214 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Plugin: Hotkeys | ||
|
||
Supports for hotkeys to add keyboard shortcuts. | ||
|
||
The player accepts the following keyboard shortcuts. | ||
|
||
| Key | Action | | ||
| :---------------: | ------------------------ | | ||
| <kbd>space</kbd> | Toggle playback | | ||
| <kbd>Esc</kbd> | Exit the fullscreen | | ||
| <kbd>←</kbd> | Seek backward of `5s` | | ||
| <kbd>→</kbd> | Seek forward of `5s` | | ||
| <kbd>↑</kbd> | Increase volume of `10%` | | ||
| <kbd>↓</kbd> | Decrease volume of `10%` | | ||
|
||
## Overview | ||
|
||
| <!-- --> | <!-- --> | | ||
| ---------------- | -------------------------------------------- | | ||
| Name | `hotkeys` | | ||
| Path | `vlitejs/plugins/hotkeys` | | ||
| Entry point | `vlitejs/plugins/hotkeys/hotkeys.js` | | ||
| Provider² | `'html5', 'youtube', 'vimeo', 'dailymotion'` | | ||
| Media type³ | `'video', 'audio'` | | ||
|
||
## Usage | ||
|
||
### HTML | ||
|
||
```html | ||
<video id="player" src="<path_to_video_mp4>"></video> | ||
``` | ||
|
||
### JavaScript | ||
|
||
```js | ||
import 'vlitejs/vlite.css'; | ||
import Vlitejs from 'vlitejs'; | ||
import VlitejsHotkeys from 'vlitejs/plugins/hotkeys.js'; | ||
|
||
Vlitejs.registerPlugin('hotkeys', VlitejsHotkeys); | ||
|
||
new Vlitejs('#player', { | ||
plugins: ['hotkeys'] | ||
}); | ||
``` | ||
|
||
## Configuration | ||
|
||
The plugin allows customization with an optional object as the third parameter of the `registerPlugin` function. | ||
|
||
| Event Type | Type | Default | Description | | ||
| ------------ | :--------: | :-----: | ---------------------------------------------------------------------------- | | ||
| `seekTime` | `Number` | `5` | Set seek time seconds of the backward and forward shortcuts | | ||
| `volumeStep` | `Number` | `0.1` | Set the volume step (between 0 and 1) of the increase and decrease shortcuts | | ||
|
||
```js | ||
Vlitejs.registerPlugin('hotkeys', VlitejsHotkeys, { | ||
seekTime: 3, | ||
volumeStep: 0.2 | ||
}); | ||
``` |
Oops, something went wrong.