Synchronized viewing, theater, live streaming, video, long-distance relationship
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Go to file
zijiren 63c370876d
feat(web): add client-aware playback and reproducible UI (#433)
## Summary

- add a versioned playback client profile for browser/runtime protocol,
container, codec, header, proxy, insecure-media, and P2P-loader
capabilities
- generate compatible direct and proxy resources inside each provider
and return a structured incompatibility error when route policy leaves
no viable result
- force provider proxy delivery for browser-forbidden headers, including
affected Bilibili variants, while preserving explicit direct-only
failures
- keep legacy clients compatible and isolate capability-aware playback
cache entries
- serve `/oauth2/callback` through the same Flutter SPA entry point and
keep public discovery anonymous

## Reproducible Web UI

- move Flutter acquisition/build, source configuration, asset manifests,
Brotli/gzip compression, and compile-time embedding into the independent
`synctv-web-ui` crate
- support prebuilt distributions, local projects, and Git sources pinned
to an immutable full commit, with an ignored local override
- fingerprint source, Flutter version, build arguments, dart-defines,
builder generation, output, and compression settings
- validate cached Git repository/revision/commit identity, support
offline cache reuse, and rebuild only when relevant inputs change
- pin and checksum the Flutter SDK in the Docker Web asset stage;
backend-only builds require no Flutter, Git fetch, or network
- serve embedded assets with ETags, compression negotiation, CSP, cache
policy, Origin/CORS handling, and SPA fallback outside API/media routes

## Verification

- `cargo fmt --all -- --check`
- workspace `cargo check`, test/doc-test, and all-targets Clippy with
warnings denied
- provider tests: 200 passed, 1 ignored
- OAuth core/API tests: 72 + 16 passed
- `synctv-web-ui`: 10 passed
- `synctv-api-http --features web-ui`: 12 passed
- default Git source cold build from the pinned App commit, followed by
offline hot-cache reuse in about 1.1 seconds
- `cargo check -p synctv --features web-ui` and `docker buildx build
--check .`
- real Chrome playback, P2P, OAuth/Casdoor, multi-user sync, chat,
media, playlist, upload, settings, and playback-history flows

Companion frontend PR: https://github.com/synctv-org/synctv-app/pull/52

Release pin validation:
https://github.com/synctv-org/synctv-release/pull/9
1 month ago
.cargo chore: replace synctv-org backend with SyncTV v1.0.0 2 months ago
.config chore: replace synctv-org backend with SyncTV v1.0.0 2 months ago
.github feat(web): add client-aware playback and reproducible UI (#433) 1 month ago
.sqlx feat: add playback history management (#431) 1 month ago
docs release: prepare v1.0.3 (#430) 1 month ago
helm/synctv release: prepare v1.0.3 (#430) 1 month ago
migrations feat: add personal user blocking (#429) 1 month ago
scripts release: prepare v1.0.3 (#430) 1 month ago
synctv feat(web): add client-aware playback and reproducible UI (#433) 1 month ago
synctv-adapter feat(web): add client-aware playback and reproducible UI (#433) 1 month ago
synctv-api feat(web): add client-aware playback and reproducible UI (#433) 1 month ago
synctv-api-common feat(web): add client-aware playback and reproducible UI (#433) 1 month ago
synctv-api-grpc feat(web): add client-aware playback and reproducible UI (#433) 1 month ago
synctv-api-http feat(web): add client-aware playback and reproducible UI (#433) 1 month ago
synctv-cluster refactor: remove low-value thin wrappers (#426) 1 month ago
synctv-common refactor: remove low-value thin wrappers (#426) 1 month ago
synctv-core feat(web): add client-aware playback and reproducible UI (#433) 1 month ago
synctv-livestream refactor: remove low-value thin wrappers (#426) 1 month ago
synctv-management feat: add personal user blocking (#429) 1 month ago
synctv-media-providers refactor: remove low-value thin wrappers (#426) 1 month ago
synctv-proto feat(web): add client-aware playback and reproducible UI (#433) 1 month ago
synctv-proto-build feat(web): add client-aware playback and reproducible UI (#433) 1 month ago
synctv-proto-main refactor: remove low-value thin wrappers (#426) 1 month ago
synctv-proto-playback-provider feat(playlist): add browse access controls (#423) 1 month ago
synctv-proto-providers refactor: remove low-value thin wrappers (#426) 1 month ago
synctv-proxy refactor: remove low-value thin wrappers (#426) 1 month ago
synctv-realtime refactor: remove low-value thin wrappers (#426) 1 month ago
synctv-web-ui feat(web): add client-aware playback and reproducible UI (#433) 1 month ago
synctv-xiu refactor: remove low-value thin wrappers (#426) 1 month ago
.dockerignore feat(web): add client-aware playback and reproducible UI (#433) 1 month ago
.env.postgres.example chore: replace synctv-org backend with SyncTV v1.0.0 2 months ago
.env.redis.example chore: replace synctv-org backend with SyncTV v1.0.0 2 months ago
.env.synctv.example fix(webrtc): use public STUN by default (#427) 1 month ago
.gitattributes feat: add recoverable resource deletion lifecycle (#394) 2 months ago
.gitignore feat(web): add client-aware playback and reproducible UI (#433) 1 month ago
CONTRIBUTING.md chore: replace synctv-org backend with SyncTV v1.0.0 2 months ago
Cargo.lock feat(web): add client-aware playback and reproducible UI (#433) 1 month ago
Cargo.toml feat(web): add client-aware playback and reproducible UI (#433) 1 month ago
Dockerfile feat(web): add client-aware playback and reproducible UI (#433) 1 month ago
LICENSE chore: replace synctv-org backend with SyncTV v1.0.0 2 months ago
Makefile feat(web): add client-aware playback and reproducible UI (#433) 1 month ago
README.md feat(web): add client-aware playback and reproducible UI (#433) 1 month ago
README.zh-CN.md chore(dev): remove background server targets (#407) 1 month ago
SECURITY.md chore: replace synctv-org backend with SyncTV v1.0.0 2 months ago
deny.toml chore: replace synctv-org backend with SyncTV v1.0.0 2 months ago
docker-compose.dev.yml fix(bilibili): restore subtitles and dynamic live danmaku (#415) 1 month ago
docker-compose.yml fix(webrtc): use public STUN by default (#427) 1 month ago
rust-toolchain.toml feat(web): add client-aware playback and reproducible UI (#433) 1 month ago
synctv.example.yaml fix(webrtc): use public STUN by default (#427) 1 month ago

README.md

SyncTV

SyncTV

简体中文 · Website

Rust Tokio Axum gRPC PostgreSQL Redis Docker Helm Kubernetes OpenAPI Astro Starlight License

SyncTV is a Rust implementation of a real-time synchronized video watching platform with media provider integration, livestreaming, HTTP/gRPC APIs, and Kubernetes-ready horizontal scaling.

SyncTV synchronized room playback

Highlights

  • Synchronized room playback with real-time state updates.
  • Media providers for Bilibili, Twitch, YouTube, Douyin, TikTok, Huya, Douyu, AcFun, CCTV, Alist, Cloudreve, Emby/Jellyfin, FNOS, QNAP, Synology, Nextcloud, Seafile, TrueNAS, direct URLs, and livestream sources.
  • RTMP push/pull, HLS, and HTTP-FLV livestream support.
  • RTSP external pull with TCP/UDP transport and live HLS/HTTP-FLV remuxing.
  • HTTP REST, public gRPC, WebSocket, management gRPC, metrics, RTMP, and STUN runtime surfaces.
  • PostgreSQL-backed durable storage with optional Redis shared state, cache, rate limiting, and cluster coordination.
  • Docker Compose and Helm deployment templates.
  • Built-in management CLI and optional OpenAPI/Swagger UI.
  • Astro Starlight documentation site with English and Simplified Chinese content.

Discussion and Contributors

Join the SyncTV Telegram discussion to talk with users and contributors about deployment, operations, media providers, client development, and the product roadmap.

SyncTV contributors

Quick Start

Development environment from a full repository checkout:

# Starts PostgreSQL and Redis, then runs SyncTV locally with development settings.
make dev-serve

# Starts optional media/auth/storage dependencies too.
make dev-stack

# Runs real CLI/curl provider smoke tests through the Makefile dev startup path.
make dev-smoke

Production Compose uses generated PostgreSQL, Redis, and application secrets:

# Requires Docker Compose and openssl.
make compose-init

# Edit SYNCTV_BOOTSTRAP_ROOT_PASSWORD in .env.synctv before starting.
make compose-up

Validate configuration:

cargo +nightly run -p synctv --bin synctv -- config validate

Optional migration preflight. The server also runs embedded SQLx migrations automatically during startup:

cargo +nightly run -p synctv --bin synctv -- db migrate

Start locally:

cargo +nightly run -p synctv --bin synctv -- serve

Embedded Web client

The optional web-ui feature embeds a Flutter Web distribution in the HTTP server. The browser client always uses the page origin, so one deployed Web UI belongs to one SyncTV server. Build the configured Web distribution and server:

make web-ui-build
make web-release-build

synctv-web-ui/README.md documents prebuilt, local-project, and immutable Git sources together with cache and offline controls. The server provides SPA fallback, content types, ETags, Brotli/gzip variants, cache policy, and CSP. OAuth uses the normal SPA entry point, while provider verification uses its dedicated static page. API and media routes remain outside the application-shell cache.

Keep the app and server protobuf snapshots aligned. Browser playback sends a versioned PlaybackClientProfile; Providers use it with the configured proxy policy to select direct or proxy routes before returning playback output.

Documentation

Read the complete documentation at docs.syncs.tv.

Download the native client from the client downloads guide or SyncTV App releases. Store builds are distributed through the supported app stores.

License

MIT. See LICENSE.