MCPcopy Create free account
hub / github.com/agent0ai/agent-zero / start

Method start

plugins/_browser/helpers/runtime.py:326–350  ·  view source on GitHub ↗
(
        self,
        *,
        quality: int,
        every_nth_frame: int,
        viewport: dict[str, int],
    )

Source from the content-addressed store, hash-verified

324 self._expected_height = 0
325
326 async def start(
327 self,
328 *,
329 quality: int,
330 every_nth_frame: int,
331 viewport: dict[str, int],
332 ) -> None:
333 self.session.on("Page.screencastFrame", self._on_frame)
334 width = max(320, min(4096, int(viewport.get("width") or DEFAULT_VIEWPORT["width"])))
335 height = max(200, min(4096, int(viewport.get("height") or DEFAULT_VIEWPORT["height"])))
336 self._expected_width = width
337 self._expected_height = height
338 with contextlib.suppress(Exception):
339 await self.session.send("Page.enable")
340 await self._apply_cdp_viewport_with_remount({"width": width, "height": height})
341 await self.session.send(
342 "Page.startScreencast",
343 {
344 "format": "jpeg",
345 "quality": max(20, min(95, int(quality))),
346 "maxWidth": SCREENCAST_MAX_WIDTH,
347 "maxHeight": SCREENCAST_MAX_HEIGHT,
348 "everyNthFrame": max(1, int(every_nth_frame)),
349 },
350 )
351
352 async def _apply_cdp_viewport_with_remount(self, viewport: dict[str, int]) -> None:
353 await self._apply_cdp_viewport(viewport)

Callers 11

_start_typingFunction · 0.45
executeMethod · 0.45
parse_resultFunction · 0.45
_startMethod · 0.45
start_screencastMethod · 0.45
handleRecordingStateMethod · 0.45
_start_log_readerFunction · 0.45

Calls 4

onMethod · 0.45
getMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected