Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jbramsden opened this issue Mar 3, 2025 · 0 comments
Open

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

jbramsden opened this issue Mar 3, 2025 · 0 comments

Comments

@jbramsden
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant