feat: Add streaming support (#125)

This adds:
- [x] Keyboard and mouse handling on the frontend
- [x] Video and audio streaming from the backend to the frontend
- [x] Input server that works with Websockets

Update - 17/11
- [ ] Master docker container to run this
- [ ] Steam runtime
- [ ] Entrypoint.sh

---------

Co-authored-by: Kristian Ollikainen <14197772+DatCaptainHorse@users.noreply.github.com>
Co-authored-by: Kristian Ollikainen <DatCaptainHorse@users.noreply.github.com>
This commit is contained in:
Wanjohi
2024-12-08 14:54:56 +03:00
committed by GitHub
parent 5eb21eeadb
commit 379db1c87b
137 changed files with 12737 additions and 5234 deletions

113
packages/input/src/codes.ts Normal file
View File

@@ -0,0 +1,113 @@
export const keyCodeToLinuxEventCode: { [key: string]: number } = {
'KeyA': 30,
'KeyB': 48,
'KeyC': 46,
'KeyD': 32,
'KeyE': 18,
'KeyF': 33,
'KeyG': 34,
'KeyH': 35,
'KeyI': 23,
'KeyJ': 36,
'KeyK': 37,
'KeyL': 38,
'KeyM': 50,
'KeyN': 49,
'KeyO': 24,
'KeyP': 25,
'KeyQ': 16,
'KeyR': 19,
'KeyS': 31,
'KeyT': 20,
'KeyU': 22,
'KeyV': 47,
'KeyW': 17,
'KeyX': 45,
'KeyY': 21,
'KeyZ': 44,
'Digit1': 2,
'Digit2': 3,
'Digit3': 4,
'Digit4': 5,
'Digit5': 6,
'Digit6': 7,
'Digit7': 8,
'Digit8': 9,
'Digit9': 10,
'Digit0': 11,
'Enter': 28,
'Escape': 1,
'Backspace': 14,
'Tab': 15,
'Space': 57,
'Minus': 12,
'Equal': 13,
'BracketLeft': 26,
'BracketRight': 27,
'Backslash': 43,
'Semicolon': 39,
'Quote': 40,
'Backquote': 41,
'Comma': 51,
'Period': 52,
'Slash': 53,
'CapsLock': 58,
'F1': 59,
'F2': 60,
'F3': 61,
'F4': 62,
'F5': 63,
'F6': 64,
'F7': 65,
'F8': 66,
'F9': 67,
'F10': 68,
'F11': 87,
'F12': 88,
'Insert': 110,
'Delete': 111,
'ArrowUp': 103,
'ArrowDown': 108,
'ArrowLeft': 105,
'ArrowRight': 106,
'Home': 102,
'End': 107,
'PageUp': 104,
'PageDown': 109,
'NumLock': 69,
'ScrollLock': 70,
'Pause': 119,
'Numpad0': 82,
'Numpad1': 79,
'Numpad2': 80,
'Numpad3': 81,
'Numpad4': 75,
'Numpad5': 76,
'Numpad6': 77,
'Numpad7': 71,
'Numpad8': 72,
'Numpad9': 73,
'NumpadDivide': 98,
'NumpadMultiply': 55,
'NumpadSubtract': 74,
'NumpadAdd': 78,
'NumpadEnter': 96,
'NumpadDecimal': 83,
'ControlLeft': 29,
'ControlRight': 97,
'ShiftLeft': 42,
'ShiftRight': 54,
'AltLeft': 56,
'AltRight': 100,
//'MetaLeft': 125, // Disabled as will break input
//'MetaRight': 126, // Disabled as will break input
'ContextMenu': 127,
};
export const mouseButtonToLinuxEventCode: { [button: number]: number } = {
0: 272,
2: 273,
1: 274,
3: 275,
4: 276
};