{"id":51155510,"url":"https://github.com/dkprog/webrtc-grid-demo-livekit","last_synced_at":"2026-06-26T10:01:22.871Z","repository":{"id":362373450,"uuid":"1258745680","full_name":"dkprog/webrtc-grid-demo-livekit","owner":"dkprog","description":"WebRTC fan-out demo supporting N producers and N consumers using LiveKit as an SFU, with a GStreamer example for injecting video into the session.","archived":false,"fork":false,"pushed_at":"2026-06-03T22:10:20.000Z","size":2520,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-06-04T00:07:39.138Z","etag":null,"topics":["gstreamer","livekit","livekit-sdk","nextjs","python","video-streaming","webrtc","webrtc-sfu"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dkprog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-03T22:02:27.000Z","updated_at":"2026-06-03T22:45:17.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/dkprog/webrtc-grid-demo-livekit","commit_stats":null,"previous_names":["dkprog/webrtc-grid-demo-livekit"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/dkprog/webrtc-grid-demo-livekit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkprog%2Fwebrtc-grid-demo-livekit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkprog%2Fwebrtc-grid-demo-livekit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkprog%2Fwebrtc-grid-demo-livekit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkprog%2Fwebrtc-grid-demo-livekit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dkprog","download_url":"https://codeload.github.com/dkprog/webrtc-grid-demo-livekit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkprog%2Fwebrtc-grid-demo-livekit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34811922,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-26T02:00:06.560Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gstreamer","livekit","livekit-sdk","nextjs","python","video-streaming","webrtc","webrtc-sfu"],"created_at":"2026-06-26T10:01:22.112Z","updated_at":"2026-06-26T10:01:22.858Z","avatar_url":"https://github.com/dkprog.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webrtc-grid-demo-livekit\n\n## What it is\n\nA WebRTC fan-out demo built with Next.js, GStreamer and [LiveKit](https://livekit.io/). It shows how to inject external video into the browser via WebRTC, supporting N producers and N consumers.\n\nThis is a fork of [webrtc-grid-demo](https://github.com/dkprog/webrtc-grid-demo). The original wires every peer together in a WebRTC mesh; this version instead uses **LiveKit as an SFU** (Selective Forwarding Unit). My goal was to learn LiveKit.\n\n### What changed from the original\n\n- **No signaling server.** LiveKit handles signaling, ICE and the media routing, so the agnostic socket.io server is gone.\n- **`gst-producer` got much simpler.** The mesh version had to spin up a `webrtcbin` branch and renegotiate for *each consumer* that connected. With an SFU the producer publishes a single track once; the SFU fans it out to every consumer. No per-consumer branches, no `tee`, no dynamic linking.\n- **Still N producers and N consumers.** But now thanks to the SFU instead of a full mesh.\n\n## Components\n\n### Next.js app\n\n![overview](doc/webrtc-grid-demo-livekit.png)\n\n- Consumer: initial screen for consumers (`/`). Subscribes to the room and renders every published camera track in a grid.\n- Producer (`/producer`): open in another tab to publish a browser webcam into the room.\n\nBoth roles join the same LiveKit room and fetch their access token from the LiveKit token server.\n\n### gst-producer\n\nPython process using GStreamer and the [LiveKit Python SDK](https://github.com/livekit/python-sdks) (`livekit==1.1.9`) to publish a synthetic video track into the room.\n\nThe LiveKit Python SDK at this version does **not** accept already-encoded payloads, so the pipeline produces raw **RGBA** frames and pushes them as `rtc.VideoFrame` into a `rtc.VideoSource`. LiveKit then handles encoding and publishing. GStreamer runs on a `GLib.MainLoop` while the LiveKit room runs on an asyncio loop in a separate thread.\n\n`docker-compose.yml` starts three of these, each with a different `videotestsrc` pattern (`ball`, `smpte`, `spokes`) to populate the consumer grid.\n\n![pipeline](doc/pipeline.png)\n\n## Configuration\n\nBoth services get their access tokens from a [LiveKit Cloud](https://cloud.livekit.io/) project's **token server**. Enable it in the dashboard under **Settings → Options → Token server** and copy its ID into the variables below.\n\nBoth services then read their LiveKit connection details from environment files. Create them before running:\n\n`gst-producer/.env`\n\n```sh\nLIVEKIT_URL=wss://\u003cyour-project\u003e.livekit.cloud\nLIVEKIT_TOKEN_SERVER_ID=\u003cyour-token-server-id\u003e\n```\n\n`web/.env`\n\n```sh\nNEXT_PUBLIC_LIVEKIT_URL=wss://\u003cyour-project\u003e.livekit.cloud\nNEXT_PUBLIC_LIVEKIT_TOKEN_SERVER_ID=\u003cyour-token-server-id\u003e\n```\n\n## How to run\n\n```sh\ndocker compose build\ndocker compose up\n```\n\nThen open http://localhost:3000 for the consumer grid and http://localhost:3000/producer for the browser producer.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkprog%2Fwebrtc-grid-demo-livekit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdkprog%2Fwebrtc-grid-demo-livekit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkprog%2Fwebrtc-grid-demo-livekit/lists"}