Stream screencast video and cursor events
computers.retrieve_screencast(strid)
GET/computers/{id}/screencast
Server-Sent Events stream carrying the video + cursor traffic for a live session. The event shapes depend on session kind:
- Browser sessions emit default (unnamed) SSE events whose
datais a JSON object with a base64-encoded JPEG frame inimage_dataand ametadataobject containing timestamp and viewport dimensions. - Desktop sessions emit three named event types:
event: h264carries a JSON object whosenalu_datafield is a base64-encoded raw H.264 NAL-unit blob suitable for feeding into a WebCodecsVideoDecoder;event: cursor_updatecarries a cursor-sprite bitmap and hotspot, emitted only when the cursor shape changes;event: cursor_positioncarriesx/ycoordinates, emitted once per video frame while the cursor is moving.
A : heartbeat SSE comment is sent every 30 seconds to keep intermediaries from closing the connection. Action responses and command output are delivered on /computers/{id}/events instead and are deliberately excluded from this stream.
Parameters
id: str
Stream screencast video and cursor events
import os
from tzafon import Lightcone
client = Lightcone(
api_key=os.environ.get("TZAFON_API_KEY"), # This is the default and can be omitted
)
client.computers.retrieve_screencast(
"id",
)