-
-
Notifications
You must be signed in to change notification settings - Fork 345
/
Copy pathjmpInputPlugin.js
38 lines (33 loc) · 1.06 KB
/
jmpInputPlugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const remap = {
"play_pause": "playpause",
"seek_forward": "fastforward",
"seek_backward": "rewind",
"host:fullscreen": "togglefullscreen",
"cycle_audio": "changeaudiotrack",
"cycle_subtitles": "changesubtitletrack",
"increase_volume": "volumeup",
"decrease_volume": "volumedown",
"step_backward": "previouschapter",
"step_forward": "nextchapter",
"enter": "select",
}
class jmpInputPlugin {
constructor({ inputManager }) {
this.name = 'JMP Input Plugin';
this.type = 'input';
this.id = 'jmpInputPlugin';
(async () => {
const api = await window.apiPromise;
api.input.hostInput.connect((actions) => {
actions.forEach(action => {
if (remap.hasOwnProperty(action)) {
action = remap[action];
}
inputManager.handleCommand(action, {});
});
});
api.system.hello("jmpInputPlugin");
})();
}
}
window._jmpInputPlugin = jmpInputPlugin;