# Streaming Simplification Rollout And Rollback

## Rollout intent

`SIMPLE_STREAMING` enables the new WebRTC-only control path:
- direct `stream:requested` fan-out to the camera
- no media-provider session requirement for request/accept/end
- no `stream:frame` relay in the backend gateway
- web client uses only WebRTC offer/answer/candidate signaling

## Migration notes

1. Native mobile is not yet on the WebRTC path.
2. `MobileApp/package.json` does not include a native WebRTC dependency such as `react-native-webrtc`.
3. `MobileApp/README.md` documents that the mobile app still relies on legacy `stream:frame` relay.
4. Because of this, `SIMPLE_STREAMING` defaults to `false`.
5. Web and backend are prepared for the simplified path now.

## Safe enablement sequence

1. Deploy backend and web changes with `SIMPLE_STREAMING=false`.
2. Validate legacy mobile behavior still works.
3. Validate web camera/client behavior with `SIMPLE_STREAMING=true` in a controlled environment.
4. Add native mobile WebRTC support before changing the default flag value.

## Runtime checks when enabling

1. Request a stream from a web client to a web camera.
2. Confirm the camera receives `stream:requested`.
3. Confirm `stream:started` is emitted after accept.
4. Confirm WebRTC offer/answer/candidate exchange succeeds.
5. Confirm `stream:ended` tears down both sides cleanly.
6. Confirm no `stream:frame` messages appear in gateway logs.

## Rollback checklist

1. Set `SIMPLE_STREAMING=false`.
2. Restart backend instances.
3. Verify `/streams/request` creates `start_stream` commands again.
4. Verify mobile frame-relay streaming resumes.
5. Re-run web and mobile smoke checks on the legacy path.

## Known blocker

Native mobile parity is blocked until a supported RN WebRTC stack is added and wired into `MobileApp/src/app-context.tsx`.
