cdpfleet Docs GitHub Dashboard

Live view

Three ways to see a remote browser: stream its frames into your own code, open a live view that a person can watch — or take over — from the dashboard or any page with noVNC, or launch a browser straight into live view with no code at all.

Playwright 1.60's page.screencast streams a JPEG frame to your code every time the page changes, over the session's own connection — no extra port, no extra service, nothing to enable at launch. Forward the frames to your own UI, log them, or save them.

Stream frames

Start the screencast after opening the page and stop it before closing. Tick screencast in the code builder to get this for any browser.

// npm install [email protected]
// Browsers run on cdpfleet, so no `npx playwright install` is needed.
import { chromium } from 'playwright';

const KEY = process.env.CDPFLEET_API_KEY;

// 1. Launch the browser
const res = await fetch('https://starter.cdpfleet.com/chromium/session', {
  method: 'POST',
  headers: { 'x-api-key': KEY, 'content-type': 'application/json' },
  body: JSON.stringify({
    proxy: 'http://user:[email protected]:8080',
    headless: 'new',
  }),
});
if (!res.ok) throw new Error(`launch failed: ${res.status} ${await res.text()}`);
const { wsUrl } = await res.json();

// 2. Connect and drive it
const browser = await chromium.connect(wsUrl, { headers: { 'x-api-key': KEY } });
const page = await browser.newPage();
// Live view: JPEG frames whenever the page changes (Playwright 1.60+)
await page.screencast.start({ quality: 60, onFrame: ({ data }) => {
  console.log(`frame: ${data.length} bytes`); // send it to your UI, a websocket, a file…
} });
await page.goto('https://example.com');
console.log(await page.title());
await page.screencast.stop();
await browser.close(); // ends the session and stops billing

Show it in a browser

A minimal relay in Node.js: every frame goes to the browsers watching ws://localhost:8080, which draw it into an <img>.

// npm install ws
import { WebSocketServer } from 'ws';
const viewers = new WebSocketServer({ port: 8080 });

await page.screencast.start({ quality: 60, onFrame: ({ data }) => {
  for (const v of viewers.clients) if (v.readyState === 1) v.send(data);
} });

// viewer page:
// const img = document.querySelector('img'); const ws = new WebSocket('ws://localhost:8080');
// ws.binaryType = 'blob'; ws.onmessage = (e) => { img.src = URL.createObjectURL(e.data); };

What to expect

Measured on the fleet through connect() at 640×360, quality 60, on a page that was changing. Chromium-based browsers and WebKit send frames only when pixels change — nothing at all while a page sits still. Firefox and Camoufox keep streaming (about 20 frames a second even on a static page), so throttle in your callback if you only need a preview. Details in the live view case.

BrowserFrames per secondPer frame
Camoufox~1912 KB
Firefox~1213 KB
Chromium (headless)~910–11 KB
Chromium (headful)~510–11 KB
Chrome~411 KB
WebKit~324 KB

Watch or take control from outside

To show a session to someone else — a teammate, a support agent, a person who has to solve a captcha or type a one-time code — ask for a live link. It works without your code's help, and in control mode the person's mouse and keyboard reach the browser while your code keeps running.

POST https://router01.cdpfleet.com/admin/session/live
x-api-key: <your key>
{ "session_id": "…", "mode": "view" }            // or "control"

→ { "live_url": "wss://router01.cdpfleet.com/session/…/live?token=…",
    "protocol": "vnc", "mode": "view", "expires_in_s": 300, "viewers": 0 }

"protocol": "vnc" — headful sessions (the default): VNC over WebSocket, the whole browser window. Open it with noVNC:

import RFB from 'https://cdn.jsdelivr.net/npm/@novnc/[email protected]/core/rfb.js';
const rfb = new RFB(document.getElementById('screen'), live_url);
rfb.viewOnly = mode === 'view';
rfb.scaleViewport = true;

"protocol": "screencast" — headless Chromium-based sessions launched with "live_view": true: a WebSocket with one JPEG per binary message (~12 fps while the page changes, nothing when it doesn't), JSON {"type":"pages"} and {"type":"meta"} messages, and in control mode you send {"type":"mouse"}, {"type":"key"} and {"type":"text"} messages in the page's CSS pixels, plus navigate, back, forward and reload (see Launch interactive). Headless sessions without live_view answer 409.

Launch interactive

Try a browser before you write code. In your dashboard, the code generator has Try it live below the form: pick the browser, proxy and options, enter a start page and click Launch interactive. The browser opens on that page in a live view with full mouse and keyboard control — headless sessions get an address bar with back, forward and reload — and the code next to it launches exactly the same browser.

Over the API it's one launch option, start_url: the server opens the page itself, so no client has to connect, and you drive the session through a live link in control mode:

POST https://starter.cdpfleet.com/chrome/session
{ "proxy": "…", "headless": "new", "live_view": true, "start_url": "https://example.com" }

POST https://router01.cdpfleet.com/admin/session/live      // the host of wsUrl
{ "session_id": "…", "mode": "control" }

Good to know