mirror of
https://github.com/jellyfin/jellyfin-media-player.git
synced 2024-11-27 08:10:25 +00:00
Add input processing. (#28)
This commit is contained in:
parent
b660f2c521
commit
1fe4ce50b9
34
native/jmpInputPlugin.js
Normal file
34
native/jmpInputPlugin.js
Normal 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;
|
@ -11,11 +11,16 @@ const features = [
|
||||
"multiserver",
|
||||
"remotecontrol",
|
||||
"fullscreenchange",
|
||||
"filedownload",
|
||||
"remotevideo",
|
||||
"displaymode",
|
||||
"screensaver"
|
||||
];
|
||||
|
||||
const plugins = [
|
||||
'mpvVideoPlayer',
|
||||
'mpvAudioPlayer',
|
||||
'jmpInputPlugin'
|
||||
];
|
||||
|
||||
function loadScript(src) {
|
||||
|
Loading…
Reference in New Issue
Block a user