commit f6508eccdb23a7e4bdefa3a4fa7e0ef86df5447e Author: lingyunxsh Date: Mon Jun 15 22:46:12 2026 +0800 init diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..f05a008 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +.idea +client_flutter/build +server/bin +**/.dart_tool +**/.packages +**/node_modules diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..66a7fb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +.idea/ + +# Go +server/synctv-server +server/synctv-server.exe +server/bin/ + +# Local env +.env + +# Local toolchains and downloaded SDK archives +.tools/ +flutter_windows_*.zip + +# Python Windows client +windows_py_client/.venv/ +windows_py_client/build/ +windows_py_client/dist/ +windows_py_client/*.spec +windows_py_client/**/__pycache__/ +windows_py_client/**/*.pyc + +# HBuilder +hbuilder_app/unpackage/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..6601859 --- /dev/null +++ b/README.md @@ -0,0 +1,103 @@ +# SyncTV + +SyncTV is a no-account synchronized watching app. The first version keeps the server thin: room state, WebSocket signaling, Redis-backed temporary state, and optional streaming proxy when the room owner enables it. + +## Quick Start + +```bash +docker compose up --build +``` + +Server: + +- HTTP: `http://yuyun-us1.stormrain.cn:8088` +- WebSocket: `ws://yuyun-us1.stormrain.cn:8088/ws?roomCode=&deviceId=` +- Health: `GET /health` + +## Local Server + +```bash +cd server +$env:SYNCTV_CONFIG="../config/server.local.json" +go run ./cmd/synctv-server +``` + +Create a local config with Redis pointing at your local Redis instance. + +## HTTP API + +- `GET /health` +- `POST /api/rooms` +- `GET /api/rooms/{code}?deviceId={deviceId}` +- `POST /api/rooms/{code}/source` with `X-Device-Id` +- `GET /api/rooms/{code}/stream` for proxy mode playback + +## WebSocket + +Connect: + +```text +ws://yuyun-us1.stormrain.cn:8088/ws?roomCode=A7K29Q&deviceId=dev_xxx +``` + +Client events: + +- `setSource` +- `play` +- `pause` +- `seek` +- `syncProgress` +- `syncToLive` +- `heartbeat` + +Server events: + +- `roomSnapshot` +- `sourceChanged` +- `playbackChanged` +- `presenceChanged` +- `heartbeatAck` +- `error` + +## Clients + +The product is split by platform. + +### Windows + +Windows source lives in `windows_py_client`. + +Required tools: + +- Python 3.11+ +- VLC 64-bit runtime + +Run: + +```powershell +cd windows_py_client +python -m venv .venv +.\.venv\Scripts\pip install -r requirements.txt +.\.venv\Scripts\python synctv_client\main.py +``` + +Build exe: + +```powershell +.\build_exe.ps1 +``` + +The Windows client uses PySide6 + python-vlc. + +### App + +HBuilder/uni-app source lives in `hbuilder_app`. + +Open `hbuilder_app` in HBuilderX and run/build as an App project. + +Playback direction: + +- Development fallback: built-in `