Emulator streaming#3211
Open
LoneAngelFayt wants to merge 2 commits into
Open
Conversation
Contributor
Author
|
here is the broker that goes into the pcsx2 container if you want to take a look at the api inside |
Contributor
Author
|
I've finished setting up the integration for dolphin as well, I'm going to split it out into a different PR for each integration There is thankfully minimal changes but I turn some hardcoding into variables Once you get done looking through this I'll adapt the others and put them in as I have them completed |
9c8da66 to
6a0e5ff
Compare
Contributor
Author
|
@gantoine I changed my mind, and just added all the emulators I've gotten working along with their respective changes. I recruited Claude to help make my PR description a little better as well. Should outline everything I've touched and how it all works. |
b44b7dc to
6818507
Compare
Add /api/streaming endpoints for session claim/release, ROM launch, save states, volume control, and save-and-exit against per-platform emulator broker containers. Sessions are stored in Redis with atomic SET NX claims, owner-bound, and admin force-releasable. Config comes from config.yml (streaming.enabled + containers list) with a STREAMING_SAVE_TIMEOUT env override for slow-saving brokers. Includes 19 endpoint tests covering auth scopes, claim races, ownership, broker failure paths, and force-release.
Add a Pinia streaming store (config fetch, session lifecycle, broker controls), a v1 player view at rom/:rom/stream with save state and volume controls, and a cast button on PlayBtn for platforms with a configured streaming container. The route registers a v2 named view via v2For so the v2 fallback screen shows until a v2 player lands.
6818507 to
d94c5b6
Compare
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.
Description
This PR adds a streaming framework to RomM that enables launching games directly from the RomM UI into a native emulator running in a separate container, with full session management, save state control, and volume control, all without leaving the browser.
The emulator runs in a linuxserver Docker container with a Selkies WebRTC stream. A small HTTP broker sidecar inside that container handles game launch, extraction, and I/O. RomM communicates with the broker via a new
/api/streamingbackend endpoint and displays the stream in an embedded player.This initial PR covers four emulators. Additional integrations (PS3/rpcs3, etc.) will follow in separate PRs once the framework is established.
Supported emulators
ps2ngc,wii,wiiuxboxswitchArchitecture
Configuration (
config.yml)Each emulator is its own container entry. Multiple platforms can share a container (e.g.
ngc/wii/wiiuall pointing at the same Dolphin instance) or use separate ones. Thehostis the URL the browser loads the stream from;broker_hostis the server-side URL RomM uses to send commands.Two optional env vars:
BROKER_SECRETauthenticates broker API calls (set on both the RomM container and the emulator container), andSTREAMING_SAVE_TIMEOUTraises the save-and-exit wait for brokers that save slowly (default 45s).Changes
Backend
backend/endpoints/streaming.py- new router: session management, broker proxy, config endpoint. Sessions are claimed by ROM id (the filesystem path is derived server-side from the database, never taken from the client), stored in Redis via atomicSET NX(multi-worker safe), and bound to the claiming user; only the owner or an admin can control or release one.backend/tests/endpoints/test_streaming.py- 19 endpoint tests: auth scopes, claim races, ownership, broker failure paths, force-release.backend/config/config_manager.py-STREAMING_ENABLED+STREAMING_CONTAINERSconfig fieldsbackend/main.py- registers streaming routerFrontend
frontend/src/stores/streaming.ts- Pinia store: config, session lifecycle, per-platform capabilitiesfrontend/src/views/Player/Stream/Player.vue- streaming player view: Selkies iframe, loading overlay, save state controls, volume/mutefrontend/src/components/common/Game/PlayBtn.vue- "Play on [label]" button appears when a streaming container is configured for the platformfrontend/src/layouts/Main.vue- streaming config fetched on app startfrontend/src/plugins/router.ts-rom/:rom/streamrouteConfig
examples/config.example.yml- streaming config example with commentsenv.template-BROKER_SECRETandSTREAMING_SAVE_TIMEOUTvariablesThe player view follows the existing v1 player pattern (same shape as the EmulatorJS/Ruffle views). The route also registers a v2 named view via
v2For, so v2 users get the standard "not ready yet" fallback; a native v2 player is planned as a follow-up once this framework lands.Broker containers
Each emulator has a companion Docker mod repo with the broker sidecar (stdlib-only Python, no extra dependencies):
Each repo includes a
docker-compose.ymlshowing the full setup.UX flow
AI assistance disclosure
This PR was developed with substantial AI assistance (Claude Code). I designed the architecture, made the design decisions, and tested everything against real emulator containers on my own hardware; the majority of the code was written by the AI under my direction and review, and the branch went through multiple AI-assisted review passes before submission.
Checklist
Please check all that apply.
Screenshots (if applicable)