Add video calls and P2P file sharing via WebRTC#21
Closed
Conversation
Co-authored-by: falbue <64151271+falbue@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add video button for user video sharing in call
Add video calls and P2P file sharing via WebRTC
Mar 10, 2026
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.
Adds two features: in-call video (camera or screen share) with multi-peer grid display, and serverless file sharing over WebRTC DataChannels — no file data ever touches the server.
Video
media.js—enableCamera(),startScreenShare(),switchCamera(),disableVideo(). Shared_bindEndedHandlercovers browser-initiated "stop sharing".rtc.js—onnegotiationneededon everyRTCPeerConnectionfor automatic renegotiation when tracks are added/removed. Race-condition guard checkssignalingState === 'stable'before and aftercreateOffer.replaceVideoTrackInAll()/removeVideoTrackFromAll()helpers.ui.js—updateLocalVideo(track)renders a muted local PiP tile;createMediaElementsForPeer()handles bothaudioandvideokind tracks, deduplicating by peer ID.controls.js— Video toggle opens a source picker (Camera / Screen). Switch-camera button visible only when camera is active (not screen share).#videoButton(hidden until in call),#switchCameraButton(hidden until camera active),#videoSourcePanelpicker.aspect-ratio: 16/9), local PiP tile distinguished with a purple border.File sharing
fileShare.js(new) — Manages local and remote file lists. Transfer protocol over DataChannel: 16 KB chunks with back-pressure (bufferedAmount > 512 KB→ poll 50 ms). Chunk framing: JSONfile_chunk_headermessage immediately precedes the binaryArrayBuffer, carryingtransferIdto demux concurrent transfers. Download triggered only on explicit user click; if sender disconnects the DataChannel closes and the transfer halts.filePanel.js(new) — Drag-and-drop zone + file input. Local files listed with remove button; remote files with download button and live%progress. On DataChannel open, announces all already-queued local files to the new peer.rtc.js— Offer side creates a"files"ordered DataChannel on everyRTCPeerConnection; answer side receives viaondatachannel.app.py— Two new socket events (file_announce,file_remove) broadcast metadata only (name, size, MIME, sender SID) to the room. No file bytes pass through the server.🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.