What a Live Stream Is

A live stream is a real-time connection to your phones. It carries two things:
  • Video of each phone’s screen, as it changes.
  • Live input going the other way: touch, typing and keys, sent the moment they happen.

When to use it

Connecting

Live streams use WebRTC through LiveKit, an open-source standard with client libraries for JavaScript, Python, Swift, Kotlin, Go, Rust and others.
  1. Call Open Live Stream with the phones you want. It returns a url and a token.
  2. Connect to the url with the token using a LiveKit client library.
  3. Each phone appears in the connection as a participant whose identity is phone: followed by the phone’s id.
Choose an organization with the optional organization header when your login belongs to several. Organization streams are isolated from other organizations. An administrator who leaves the selection out can open the fleet preview, still scoped to the requested phones. A token is valid for one hour and only for the phones you asked for. Call Open Live Stream again for a new one.
A stream token lets its holder watch those phones and, while they have a session, control them. Create it on your server and hand it only to the viewer who should have that access. Never put your API key in a browser.

Video

Each phone publishes one H.264 video track of its screen. Subscribe to a phone’s track to watch it; video for a phone is only sent while someone is subscribed.
  • Watching does not need a session. A phone without a session usually has its screen off, so there is little to see.
  • A phone sends a new frame when its screen changes. A still screen sends nothing new, and the last frame stays current.
  • Positions in the video map to screenshot pixels by scale: the video shows the whole screen, so a point halfway across the video is at half the phone’s screen.width.

Live Input

Send input as data messages over the same connection. A message is a JSON object encoded as UTF-8, sent reliably, addressed to the phone it is for.
Live input needs an active session owned by the user who opened this stream. The user’s API keys and web login share that session; another user’s session returns in_use.

Messages

A touch message has one of four phases: x and y are screenshot pixels. Live touch is one finger, like Touch. If the connection drops while a finger is down, the phone lifts it by itself.

Errors

When a phone cannot act on a message, it sends a message back to you:
The codes are the phone error codes listed in Response.