Member Junction
    Preparing search index...

    LIVE REMOTE-BROWSER surface (mj-realtime-remote-browser-surface) — the Browser channel tab's pane. It renders the SERVER-hosted browser the agent drives: a refreshing screenshot <img> with the current URL above it and a small "live" indicator. The agent's browser_* tools mutate the page through the channel plugin; this surface only PERCEIVES it, polling its Fetch callback every SNAPSHOT_POLL_MS ms while bound.

    The surface is transport-agnostic — it never touches GraphQL directly. The channel plugin wires the Fetch callback (closing over the session id + provider) in BindSurface before the surface's first change detection, so the ngOnInit poll has it. Polling stops in ngOnDestroy (pane collapsed / overlay torn down) so no traffic continues after unbind. View-only in v1 — there is no takeover input.

    When the backend advertises the ScreenStreaming capability, the server PUSHES encoded CDP frames and the channel plugin sets Streaming = true. In that mode the surface paints each frame onto a <canvas> via RenderFrame and DOES NOT start the poll. When streaming is off (capability absent or start failed) the original behavior is unchanged: the surface polls Fetch every SNAPSHOT_POLL_MS ms and renders the screenshot <img>.

    Implements

    • OnInit
    • OnDestroy
    Index

    Constructors

    Properties

    AudioAvailable: boolean = false

    Whether the live tab-audio stream is available — the channel sets this true when the server confirms it is pushing audio. Drives whether the speaker toggle renders in the live-view bar.

    AudioMuted: boolean = false

    Whether tab audio is currently muted. Two-way: the channel sets the initial value (un-muted when audio starts) and the toggle updates it; AudioMutedChange relays each user change to the channel, which mutes/unmutes the player.

    AudioMutedChange: EventEmitter<boolean> = ...

    Emits the new muted state each time the user toggles the speaker (two-way AudioMuted).

    CurrentUrl: string | null = null

    The current page URL reported by the server, or null when none.

    Fetch: RemoteBrowserSnapshotFetcher | null = null

    Snapshot fetcher supplied by the channel plugin (closes over the session id + provider).

    FetchSelection: RemoteBrowserSelectionFetcher | null = null

    Selection fetcher for copy-out, supplied by the channel plugin (closes over the session id + provider). On a local copy / Cmd+C over the live canvas the surface calls this to read the remote page's selection, then writes it to the local clipboard. Best-effort: when unset or it resolves to '', the copy is a no-op (the local clipboard is left untouched).

    HasFrame: boolean = false

    Whether at least one pushed screencast frame has been painted (drives the canvas placeholder).

    HumanInput: EventEmitter<RemoteBrowserHumanInputEvent> = ...

    Emits each human-takeover input (pointer move/click, key) the user performs on the live canvas.

    ScreenshotDataUrl: string | null = null

    The current screenshot as a data: URL, or null before the first snapshot arrives.

    Accessors

    Methods

    • Paints one PUSHED screencast frame (base64 JPEG) onto the canvas. Called by the channel plugin for each frame the server pushes while Streaming. Coalesces a burst of frames to one paint per animation frame (the newest wins) so a fast stream never floods the main thread, and reuses a single Image decode target to avoid per-frame allocation. No-op after destroy or when not in streaming mode.

      Parameters

      • dataBase64: string

        The frame image as raw base64 JPEG (no data: prefix).

      Returns void

    • Updates the URL shown above the live view. In streaming (canvas) mode the snapshot poll is stopped, so the channel pushes the current URL here after a navigation/action reports one — otherwise the bar would stay stuck on "No page loaded yet" even though the page is live. No-op for an unchanged / empty value.

      Parameters

      • url: string | null | undefined

        The current page URL, or null/empty to leave the bar unchanged.

      Returns void