feat: implement screen recording via chrome.tabCapture with offscreen document

- Use chrome.tabCapture.getMediaStreamId() from service worker
- Pass stream ID to offscreen document for MediaRecorder
- Recording survives page navigation (unlike getDisplayMedia)
- Requires user to click extension icon first (activeTab permission)
- Add esbuild to build offscreen.ts separately
- Update prompt docs with recording instructions
This commit is contained in:
Tommy D. Rossi
2026-01-23 16:57:51 +01:00
parent e56e27e5e5
commit 74497c2a1a
8 changed files with 210 additions and 278 deletions
+8 -2
View File
@@ -2,7 +2,6 @@ import { fileURLToPath } from 'url';
import { dirname, resolve } from 'path';
import { defineConfig } from 'vite';
import { viteStaticCopy } from 'vite-plugin-static-copy';
import fs from 'node:fs';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
@@ -56,9 +55,16 @@ export default defineConfig({
input: {
background: resolve(__dirname, 'src/background.ts'),
welcome: resolve(__dirname, 'src/welcome.html'),
offscreen: resolve(__dirname, 'src/offscreen.html'),
},
output: {
entryFileNames: '[name].js',
entryFileNames: (chunkInfo) => {
if (chunkInfo.name === 'background') {
return 'lib/background.mjs';
}
return '[name].js';
},
format: 'es',
},
},
},