Skip to content

startVideoStream function to live stream a client screen#43

Open
SuperCraft3M wants to merge 1 commit into
itschip:mainfrom
SuperCraft3M:main
Open

startVideoStream function to live stream a client screen#43
SuperCraft3M wants to merge 1 commit into
itschip:mainfrom
SuperCraft3M:main

Conversation

@SuperCraft3M

Copy link
Copy Markdown

This pull request introduces a new "live relay" streaming mode for video capture, allowing real-time streaming of WebM segments directly to a callback without writing to disk. This enables low-latency, gap-free playback via MediaSource Extensions (MSE) on the client side. The implementation adds a new startVideoStream export, updates capture options to support chunk size tuning for latency, and introduces new logic for segmenting and relaying live WebM streams. Documentation and type definitions are updated accordingly.

Live relay streaming support:

  • Added startVideoStream server-side export, which starts a continuous video capture and relays live MSE-appendable WebM segments (init + media) to a provided onSegment callback, supporting real-time streaming use cases. [1] [2] [3] [4] [5] [6] [7] [8]
  • Introduced new types (StreamSegment, StreamSegmentFn) and extended StreamUploadData and CaptureOptions to support relay mode, segment callbacks, and chunk size configuration. [1] [2] [3] [4]

WebM segment framing and relay logic:

  • Added new file webm-stream.ts implementing logic to split the continuous WebM byte stream into MSE-appendable segments (init and media) and invoke the onSegment callback in real time.
  • Integrated the relay logic into both HTTP and NUI streaming handlers so that relay streams forward segments live, while non-relay streams continue to assemble files on disk. [1] [2] [3] [4] [5]

Capture options and configuration:

  • Added streamChunkSize option to capture requests (client and server), allowing tuning of WebM output chunk size to trade off latency versus overhead. Defaults to 800 KiB if not specified. [1] [2] [3] [4]

Documentation:

  • Updated README.md with detailed documentation and usage examples for the new startVideoStream export, including explanation of segment structure, options, and integration with MediaSource Extensions. Also updated stopVideoCapture docs to reference the new streaming mode. [1] [2]

Every comment on the files an this description is made by AI btw. All the code is done by myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant