Web SDK - StreamEvents

Home > @rainway/web > StreamEvents

StreamEvents interface


export interface StreamEvents 


"before-input"(input: RainwayInputEvent) => void | Promise<void>Raised when an input (keyboard, mouse, gamepad...) is about to be sent to the remote device.Only input attempts enabled by the stream's InputLevel cause beforeinput events.You can listen to this event and call event.preventDefault() to apply a fine-grained input filter, or respond to key combinations. Example:
myStream.addEventListener("beforeinput", (event) => {
    const { input, heldKeys } = event;
    if (input.type === "keyboard" && input.key === VirtualKey.Q) {
        // Block the input, but send a message instead.
        if (input.action === KeyboardAction.Down) {

This should not be used to prevent security-sensitive key combinations like Alt+Tab. Instead, the remote host can filter _incoming_ inputs. See https://docs.rainway.com/docs/input-filtering for more info. |
| close | () => void | Promise<void> | Raised when the remote closes the stream. |
| stats | (stats: StatsSummary) => void | Promise<void> | Raised periodically during the stream, and provides various statistics about stream performance. |