{"_id":"@candle-analytics/rrweb-plugin-canvas-webrtc-record","name":"@candle-analytics/rrweb-plugin-canvas-webrtc-record","dist-tags":{"latest":"2.0.0"},"versions":{"2.0.0":{"name":"@candle-analytics/rrweb-plugin-canvas-webrtc-record","version":"2.0.0","description":"Plugin that live streams contents of canvas elements via webrtc","type":"module","main":"./dist/rrweb-plugin-canvas-webrtc-record.umd.cjs","module":"./dist/rrweb-plugin-canvas-webrtc-record.js","unpkg":"./dist/rrweb-plugin-canvas-webrtc-record.umd.cjs","typings":"dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/rrweb-plugin-canvas-webrtc-record.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/rrweb-plugin-canvas-webrtc-record.cjs"}}},"scripts":{"dev":"vite build --watch","build":"yarn turbo run prepublish","check-types":"tsc -noEmit","prepublish":"tsc -noEmit && vite build"},"repository":{"type":"git","url":"git+https://github.com/rrweb-io/rrweb.git"},"keywords":["rrweb"],"author":{"name":"justin@recordonce.com"},"license":"MIT","bugs":{"url":"https://github.com/rrweb-io/rrweb/issues"},"homepage":"https://github.com/rrweb-io/rrweb#readme","devDependencies":{"@candle-analytics/rrweb":"^2.0.0","typescript":"^5.4.5","vite":"^5.3.1","vite-plugin-dts":"^3.9.1"},"peerDependencies":{"@candle-analytics/rrweb":"^2.0.0"},"_id":"@candle-analytics/rrweb-plugin-canvas-webrtc-record@2.0.0","gitHead":"b7d790983495abb41b2cd0d7cc5699654447cd26","_nodeVersion":"20.19.4","_npmVersion":"10.8.2","dist":{"integrity":"sha512-uiElucspNXu30Z7Iay6I/lv6+N7HSncxiGF034pxUBkTsumT3weyQEDkB993CM99saHbl+KD+r6C12P3CCW6ug==","shasum":"4e7c45ecfcc38f05450dba15027555302101f4fb","tarball":"https://registry.npmjs.org/@candle-analytics/rrweb-plugin-canvas-webrtc-record/-/rrweb-plugin-canvas-webrtc-record-2.0.0.tgz","fileCount":12,"unpackedSize":412615,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDZXCcYABlEeZCKLYuKA/SKAjAdY7icAgD5UEcWeS8qXgIhAN54f+8V9oOnc0xmyouB9tiFL3a5gdkxjD+2LW/qmlxW"}]},"_npmUser":{"name":"elsbree","email":"renegadelsbree@gmail.com"},"directories":{},"maintainers":[{"name":"elsbree","email":"renegadelsbree@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/rrweb-plugin-canvas-webrtc-record_2.0.0_1756831968595_0.2570661325322807"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-02T16:52:48.514Z","2.0.0":"2025-09-02T16:52:48.793Z","modified":"2025-09-02T16:52:49.083Z"},"maintainers":[{"name":"elsbree","email":"renegadelsbree@gmail.com"}],"description":"Plugin that live streams contents of canvas elements via webrtc","homepage":"https://github.com/rrweb-io/rrweb#readme","keywords":["rrweb"],"repository":{"type":"git","url":"git+https://github.com/rrweb-io/rrweb.git"},"author":{"name":"justin@recordonce.com"},"bugs":{"url":"https://github.com/rrweb-io/rrweb/issues"},"license":"MIT","readme":"# rrweb canvas webrtc plugin\n\nPlugin that live streams contents of canvas elements via webrtc\n\n## Example of live streaming via `yarn live-stream`\n\nhttps://user-images.githubusercontent.com/4106/186701616-fd71a107-5d53-423c-ba09-0395a3a0252f.mov\n\n## Instructions\n\n### Record side\n\n```js\n// Record side\n\nimport rrweb from 'rrweb';\nimport { RRWebPluginCanvasWebRTCRecord } from 'rrweb-plugin-canvas-webrtc-record';\n\nconst webRTCRecordPlugin = new RRWebPluginCanvasWebRTCRecord({\n  signalSendCallback: (msg) => {\n    // provides webrtc sdp offer signal & connect message\n    // make sure you send this to the replayer's `webRTCReplayPlugin.signalReceive(signal)`\n    sendSignalToReplayer(msg); // example of function that sends the signal to the replayer\n  },\n});\n\nrrweb.record({\n  emit: (event) => {\n    // send these events to the `replayer.addEvent(event)`, how you do that is up to you\n    // you can send them to a server for example which can then send them to the replayer\n    sendEventToReplayer(event); // example of function that sends the event to the replayer\n  },\n  plugins: [\n    // add the plugin to the list of plugins, and initialize it via `.initPlugin()`\n    webRTCRecordPlugin.initPlugin(),\n  ],\n  recordCanvas: false, // we don't want canvas recording turned on, we're going to do that via the plugin\n});\n```\n\n### Replay Side\n\n```js\n// Replay side\nimport rrweb from 'rrweb';\nimport { RRWebPluginCanvasWebRTCReplay } from 'rrweb-plugin-canvas-webrtc-replay';\n\nconst webRTCReplayPlugin = new RRWebPluginCanvasWebRTCReplay({\n  canvasFoundCallback(canvas, context) {\n    console.log('canvas', canvas);\n    // send the canvas id to `webRTCRecordPlugin.setupStream(id)`, how you do that is up to you\n    // you can send them to a server for example which can then send them to the replayer\n    sendCanvasIdToRecordScript(context.id); // example of function that sends the id to the record script\n  },\n  signalSendCallback(signal) {\n    // provides webrtc sdp offer signal & connect message\n    // make sure you send this to the record script's `webRTCRecordPlugin.signalReceive(signal)`\n    sendSignalToRecordScript(signal); // example of function that sends the signal to the record script\n  },\n});\n\nconst replayer = new rrweb.Replayer([], {\n  UNSAFE_replayCanvas: true, // turn canvas replay on!\n  liveMode: true, // live mode is needed to stream events to the replayer\n  plugins: [webRTCReplayPlugin.initPlugin()],\n});\nreplayer.startLive(); // start the replayer in live mode\n\nreplayer.addEvent(event); // call this whenever an event is received from the record script\n```\n\n## More info\n\nhttps://github.com/rrweb-io/rrweb/pull/976\n","readmeFilename":"Readme.md","_rev":"1-80b8658869f99c79a91dc23fdeb53dd5"}