MCPcopy Index your code
hub / github.com/microsoft/playwright-python / start

Method start

playwright/async_api/_generated.py:7803–7846  ·  view source on GitHub ↗

Screencast.start Starts the screencast. When `path` is provided, it saves video recording to the specified file. When `onFrame` is provided, delivers JPEG-encoded frames to the callback. Both can be used together. **Usage** Parameters ---------- on_

(
        self,
        *,
        on_frame: typing.Optional[
            typing.Callable[[ScreencastFrame], typing.Any]
        ] = None,
        path: typing.Optional[typing.Union[pathlib.Path, str]] = None,
        quality: typing.Optional[int] = None,
        size: typing.Optional[ScreencastSize] = None,
    )

Source from the content-addressed store, hash-verified

7801class Screencast(AsyncBase):
7802
7803 async def start(
7804 self,
7805 *,
7806 on_frame: typing.Optional[
7807 typing.Callable[[ScreencastFrame], typing.Any]
7808 ] = None,
7809 path: typing.Optional[typing.Union[pathlib.Path, str]] = None,
7810 quality: typing.Optional[int] = None,
7811 size: typing.Optional[ScreencastSize] = None,
7812 ) -> "AsyncContextManager":
7813 """Screencast.start
7814
7815 Starts the screencast. When `path` is provided, it saves video recording to the specified file. When `onFrame` is
7816 provided, delivers JPEG-encoded frames to the callback. Both can be used together.
7817
7818 **Usage**
7819
7820 Parameters
7821 ----------
7822 on_frame : Union[Callable[[{data: bytes, timestamp: float, viewportWidth: int, viewportHeight: int}], Any], None]
7823 Callback that receives JPEG-encoded frame data along with the page viewport size at the time of capture.
7824 path : Union[pathlib.Path, str, None]
7825 Path where the video should be saved when the screencast is stopped. When provided, video recording is started.
7826 quality : Union[int, None]
7827 The quality of the image, between 0-100.
7828 size : Union[{width: int, height: int}, None]
7829 Specifies the dimensions of screencast frames. The actual frame is scaled to preserve the page's aspect ratio and
7830 may be smaller than these bounds. If a screencast is already active (e.g. started by tracing or video recording),
7831 the existing configuration takes precedence and the frame size may exceed these bounds or this option may be
7832 ignored. If not specified the size will be equal to page viewport scaled down to fit into 800×800.
7833
7834 Returns
7835 -------
7836 AsyncContextManager
7837 """
7838
7839 return mapping.from_impl(
7840 await self._impl_obj.start(
7841 onFrame=self._wrap_handler(on_frame),
7842 path=path,
7843 quality=quality,
7844 size=size,
7845 )
7846 )
7847
7848 async def stop(self) -> None:
7849 """Screencast.stop

Callers

nothing calls this directly

Calls 3

from_implMethod · 0.80
startMethod · 0.45
_wrap_handlerMethod · 0.45

Tested by

no test coverage detected