Skip to content

How to use the Plugin Canvas WebRTC Record correctly? #1661

Open
@jbramsden

Description

@jbramsden

Can anyone provide guidance into how to use the Plugin Canvas Web correctly?
I also have rrweb working correctly, so that it sends all the information it collects to a Golang server that dumps the information into a SQLite database. But I want to test out the Plugin for Canvas record, however the examples provided in the Readme file of the Plugin seems to be very specific in sending the data straight to Replay.

This is what I have so far: `<script type="module">
import rrweb from 'https://cdn.jsdelivr.net/npm/rrweb@latest/dist/rrweb.min.js';
import rrwebPluginCanvasWebRTCRecord from 'https://cdn.jsdelivr.net/npm/rrweb-plugin-canvas-webrtc-record@latest/dist/index.es.js';

let events = [];

// Initialize the plugin correctly
const canvasWebRTCPlugin = rrwebPluginCanvasWebRTCRecord();

// Start recording
let stopRecording = rrweb.record({
emit(event) {
events.push(event);
},
plugins: [canvasWebRTCPlugin], // Register the plugin
recordCanvas: false, // Enable canvas recording
checkoutEveryNth: 200, // Optional: helps segment recordings
});

// Function to send recorded events to backend
function save() {
const body = JSON.stringify({ events });
events = [];
fetch('/rrwcapture', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body,
});
}

// Save every 5 seconds
setInterval(save, 5000);
</script>`

Anyone have the correct way of using this plugin?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions