Repository navigation
feat(connection): add device stream session - #2
Merged
Merged
Conversation
lutz-grex
force-pushed
the
feat/connection
branch
from
November 14, 2026 01:16
84aaf27 to
b2ccc70
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.
Summary
DeviceStreamSessionconnects the package to a Mobilerun cloud device the way@mobilerun/reactdoes: WebSocket signalling plus WebRTC, session status, raw control sending, and recovery through the reconnect controller. A closed signalling socket ends the session on the server, so it is treated as a failure that rebuilds the socket and the peer connection, like a failed or closed peer connection.Changes
DeviceStreamSession(credentials:, config:)withstatus,videoSize,start(),retry(),close(),setMuted(),sendControl(),sendHover()(hover channel only),openUrl(),screenshot(); plusStreamCredentials,StreamCredentialsProvider,StreamConfig,StreamStatus,VideoSizeandStreamSessionException. Noflutter_webrtctype and no transport seam is exported; the video stream andwithTransportsare@internaluntil the video widget lands.lib/src/core/: the session (API and reconnect wiring),StreamAttempt(one connect attempt: negotiation, refresh and grace window, keepAlive, frame requests, size poll), the transport interfaces, the video codec order helper (VP9, H.265, H.264, rest; H.264 plus rtx/red/ulpfec/flexfec only when there is no H.265 decoder).lib/src/webrtc/:web_socket_channelsignalling andflutter_webrtcpeer implementations.maxRetransmits: 0of the hover channel is passed explicitly becauseflutter_webrtcdrops a value of 0, which would make the channel reliable. A fallback media stream (a track without stream ids) is owned and disposed with the peer.retry(). A socket that opens whileclose()runs is closed.example/: sample app (lib/main.dart, public constructor),lib/stream_view.dart(renders the stream), and a scripted emulator run (lib/e2e_main.dart,tool/e2e_android.sh,tool/png_check.py).Testing
flutter analyze,dart format --set-exit-if-changed .,flutter testare green (302 tests).signalling/sequence.jsonwith fake transports and a virtual clock: sent frames, order and timing (request frames, keepAlive, candidate buffering), mid-session refresh with the 15 s grace window, socket close and peer failure rebuilds, token rejection (401) asking for credentials again, open and configuration timeouts, unavailable after six attempts and manual retry, the retired attempt after exhaustion, a socket opening duringclose(), screenshot success / error / timeout / ids, sends dropped while a channel is not open,setMuted, andclose()releasing every timer.Runtime
Android emulator (arm64, Android 16) against a dev cloud Android device, scripted run of the example:
sendControl: the device screenshot changes and so do 80 % of the pixels in the video rectangle.RTCVideoViewreadsrenderVideoonce per build, so the view has to be rebuilt when the renderer changes. The session was not involved.