perf(webrtc): Fix data channels and add mouse input reliability features#140
Open
perf(webrtc): Fix data channels and add mouse input reliability features#140
Conversation
…ty features including server-cu
Co-authored-by: Capy <capy@capy.ai>
- Add cursor overlay canvas to StreamView component - Implement cursor rendering in video styles.css with mix-blend-mode - Add cursor state to StreamDiagnostics (cursorVisible, cursorX, cursorY, cursorType) - Parse cursor visibility/type from server cursor_channel messages - Hide Windows cursor when server cursor is visible - Support multiple cursor types: arrow, ibeam, hand, crosshair, wait Fixes black cursor issue by rendering cursor as overlay on top of video Co-authored-by: Capy <capy@capy.ai>
The cursor_channel sends real cursor image data from the server (base64-encoded ICO format), not just position updates. The previous implementation used hardcoded cursor shapes. Changes: - Parse JSON cursor messages containing base64 image data (AAABAAEAICACAA... format) - Support for cursor hotspots (click points within the cursor image) - Render actual cursor images using img element instead of canvas drawing - Auto-detect image format from base64 header (ICO, PNG, GIF, JPEG) - Add cursorImageUrl, cursorHotspotX, cursorHotspotY to StreamDiagnostics The server-rendered cursor now displays correctly on top of the video stream, fixing the black cursor issue. Co-authored-by: Capy <capy@capy.ai>
The cursor_channel sends binary messages per vendor_beautified.js Jf() function: - Byte 0: Message type (0=set cursor+pos, 1=define cursor, 10=visibility) - Byte 1: Cursor ID - Byte 2: Hotspot X (click point within cursor image) - Byte 3: Hotspot Y - Byte 4: Style name length - Next N bytes: Style name (UTF-8) - Next 2 bytes: Image data length (16-bit LE) - Next M bytes: Base64 cursor image data (ICO format) - Next 4 bytes (optional): Position X, Y (16-bit LE each) This fixes the cursor image rendering by: 1. Properly parsing the binary message format 2. Caching cursor images by ID (server sends type 1 first, then type 0) 3. Extracting the embedded base64 ICO image data 4. Setting the correct hotspot for accurate clicking 5. Supporting visibility control (type 10 messages) Previously expected JSON but server sends binary format. Co-authored-by: Capy <capy@capy.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes critical data channel configuration issues and implements advanced mouse input reliability features based on analysis of the official GeForce NOW web client.
Data Channel Fixes:
cursor_channelto useordered: true, reliable: truefor accurate server-rendered cursor positioningstats_channelto use fire-and-forget mode (ordered: false, reliable: false, maxRetransmits: 0)Mouse Input Improvements:
mouseSubPixelX/Y) for preserving fractional delta precision between framesserverTimebaseOffsetMsandremapTimestampToServer()mouseEventQueue[](max size 8) that coalesces events when fullhandleCursorMessage()andhandleServerStatsMessage()data channel handlers