Skip to content

feat(stream): stream tokens, error reasons, labels and mic/camera - #8

Merged
lutz-grex merged 22 commits into
mainfrom
lucius/s3-react
Nov 24, 2026
Merged

lutz-grex merged 22 commits into
mainfrom
lucius/s3-react

Conversation

@lutz-grex

Copy link
Copy Markdown
Contributor

Summary

DeviceStream now connects with short-lived, single-use stream tokens that your backend mints with @mobilerun/sdk 6.3.0, reports why a connection failed, lets you replace every visible string and theme it without global CSS, and can send the user's microphone and camera to the device.

Changes

  • tokenProvider: called on every connect for a fresh token; your backend mints it with client.streamTokens.create({ deviceId, ttlSeconds, allowedOrigins }). The static streamToken prop keeps working for existing integrations and is deprecated.
  • onError({ reason, message, attempt, final }) with reasons credentials_unavailable, connection_refused, disconnected, unknown; messages are fixed SDK text.
  • labels for every visible string; --mr-* CSS variables scoped to the component, nothing on :root.
  • Network-aware reconnect: waits while the browser is offline and retries when it is back.
  • Microphone and camera: startPublish({ audio, video? }), stopPublish(), onPublishStateChange. Capture starts only after the device accepts; reasons publish_not_allowed, publish_unsupported, permission_denied, publish_busy, publish_failed, publish_timeout, publish_cancelled, disconnected. A built-in control at the bottom of the stream appears when publishCapabilities says the device supports it; hide it with hidePublishControls.
  • skills/mobilerun-device-stream/SKILL.md: an agent skill for integrating the component; README and guides updated.

Testing

  • bun run typecheck, bun test, bun run build and the example build pass.
  • Unit tests cover token use per connect, reason mapping, labels, scoped styles, reconnect and the publish state machine incl. cleanup on stop, disconnect and remount.
  • Checked that removing the key reuse guard, the reason mapping, the credential-free error text or the publish cleanup makes the tests fail.

Runtime

Verified against a live device: stream with single-use tokens, reconnect with a fresh token, origin binding, microphone and camera publish (accepted → active, outbound audio and video), stop and remount cleanup.

Rollout

Release as the next minor version after merge.

@lutz-grex
lutz-grex merged commit a38e934 into main Nov 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants