Add input processing. (#28)

This commit is contained in:
Ian Walton 2021-04-14 19:28:16 -04:00
parent b660f2c521
commit 1fe4ce50b9
2 changed files with 39 additions and 0 deletions

34
native/jmpInputPlugin.js Normal file
View File

@ -0,0 +1,34 @@
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';
window.api.input.hostInput.connect((actions) => {
actions.forEach(action => {
if (remap.hasOwnProperty(action)) {
action = remap[action];
}
inputManager.handleCommand(action, {});
});
});
window.api.system.hello("jmpInputPlugin");
}
}
window._jmpInputPlugin = jmpInputPlugin;

View File

@ -11,11 +11,16 @@ const features = [
"multiserver",
"remotecontrol",
"fullscreenchange",
"filedownload",
"remotevideo",
"displaymode",
"screensaver"
];
const plugins = [
'mpvVideoPlayer',
'mpvAudioPlayer',
'jmpInputPlugin'
];
function loadScript(src) {