Sesssion Replay supporting Video
Use case: video session replay for automated runs
I drive automated browser sessions with chromedp and want a video of each run as a "session replay" artifact to attach to CI failures and bug reports. This is doable today but entirely DIY: subscribe to Page.screencastFrame via chromedp.ListenTarget, ack each frame with Page.screencastFrameAck, buffer the base64 JPEGs, and mux with ffmpeg out of band. It works, but everyone reimplements the same boilerplate, and there are sharp edges:
Frame cadence is uneven (frames emit only on paint), so naive fixed-framerate muxing drifts — you have to honor each frame's metadata.timestamp. Frame acking / backpressure has to be handled correctly or the stream stalls. There's no clean way to start/stop a recording around a tasks list. Would there be interest in a convenience helper in chromedp itself — e.g. a Screencast / RecordVideo action that:
starts/stops the screencast around a chromedp.Tasks block, handles frame acking and timestamp-aware buffering internally, writes frames to an io.Writer or directory, with an optional ffmpeg-backed MP4 muxer kept behind an interface/build tag so the core stays dependency-free? Audio is out of scope here (CDP screencast is frames-only, tracked in https://github.com/chromedp/chromedp/issues/1285), so this would be video-only — which is fine for the replay use case.
Happy to open a PR for the frame-capture + writer half if a maintainer can sanity-check the proposed API shape first.
Source: chromedp/chromedp