Recorder class handles video capture from a Chrome DevTools Protocol (CDP) client. It manages frame capture, encoding, and output generation.
Constructor
Width of the output video in pixels
Height of the output video in pixels
Sound effects configuration for click and key events
Target frames per second for recording
Constant Rate Factor for video encoding quality (0-51, lower is better)
Optional directory to save individual frame images during recording
Methods
start()
Begin recording from a CDP client.Chrome DevTools Protocol client instance
Path where the video will be saved (.mp4, .webm, or .gif)
Optional recording context for tracking cursor and interactions
stop()
Stop recording and finalize the output video.- Stops frame capture
- Closes the ffmpeg encoding process
- Applies sound effects if configured
- Finalizes the output file in the requested format
- Cleans up temporary files
setTimeline()
Attach an interaction timeline to the recorder.Timeline instance to track cursor movements and events
getTimeline()
Retrieve the currently attached timeline.The attached timeline, or null if none is set
getTimelineData()
Get the timeline data as a serializable JSON object.Timeline data including frames, events, and theme configuration
addEvent()
Manually add a sound event to the recording.Type of interaction event
getTempVideoPath()
Get the path to the temporary video file being created.Absolute path to the temporary video file
Usage Example
Advanced: Timeline-Based Recording
For precise control over cursor animations and overlays, use a timeline:Output Formats
The recorder supports multiple output formats based on file extension:.mp4- H.264 video with optional audio (recommended).webm- VP9 video with optional audio.gif- Animated GIF (no audio)
sfx is configured and interaction events are recorded.