* Creates a hidden mirror canvas to receive frames from worker for main-thread recording * @param {number} width - Canvas width * @param {number} height - Canvas height * @returns {HTMLCanvasElement} Mirror canvas
(width, height)
| 1211 | * @returns {HTMLCanvasElement} Mirror canvas |
| 1212 | */ |
| 1213 | function createMirrorCanvas(width, height) { |
| 1214 | console.log('Creating mirror canvas:', width, 'x', height); |
| 1215 | |
| 1216 | // Create canvas element |
| 1217 | const canvas = document.createElement('canvas'); |
| 1218 | canvas.id = 'mirror-canvas'; |
| 1219 | canvas.width = width; |
| 1220 | canvas.height = height; |
| 1221 | |
| 1222 | // Hide canvas (not displayed, only used for recording) |
| 1223 | canvas.style.position = 'absolute'; |
| 1224 | canvas.style.left = '-9999px'; |
| 1225 | canvas.style.top = '-9999px'; |
| 1226 | canvas.style.pointerEvents = 'none'; |
| 1227 | |
| 1228 | // Add to DOM (required for MediaRecorder) |
| 1229 | document.body.appendChild(canvas); |
| 1230 | |
| 1231 | console.log('Mirror canvas created and added to DOM'); |
| 1232 | |
| 1233 | return canvas; |
| 1234 | } |
| 1235 | |
| 1236 | /** |
| 1237 | * Sets up message listener for frame updates from worker |
no test coverage detected