echo-demo

command
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Command echo-demo is the browser demo for the media worker. It runs two media workers, A and B, on one shared UDP socket and serves a page that calls them: the page publishes camera and microphone (or a generated test pattern) through the WHIP-style signaling endpoint, plays the echo, and exposes WebRTC stats for automated checks (window.relaisStats and the #stats element). Calls start on worker A; the page's "Move call" button (POST /calls/{id}/move) hands the live call over to the other worker, and the page records what the browser saw of each move (see handover.go and web/handover.js).

Browsers allow getUserMedia only in a secure context, which http://localhost is, so the page is meant to be opened on localhost. Chrome does not gather loopback ICE candidates, so it cannot reach a worker on 127.0.0.1. The worker's media socket, which is also the single host candidate in every answer, therefore defaults to this machine's primary LAN IPv4 address.

With -relay, a relay owns that media address instead, and one media worker sits behind it on a private loopback socket: callers see only the relay's address, and the page works the same, except that "Move call" reports that moving a call through the relay is not supported yet (see relay.go).

Usage:

go run ./cmd/echo-demo [-http localhost:9101] [-media-ip 192.168.1.20] [-media-port 9150] [-relay]

Each flag can also be set in the environment: RELAIS_DEMO_HTTP_ADDR, RELAIS_DEMO_MEDIA_IP, RELAIS_DEMO_MEDIA_PORT and RELAIS_DEMO_RELAY=1. Then open http://localhost:9101/ for camera and microphone, or http://localhost:9101/?source=test for the test pattern (no permission prompt).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址