feat(stream): STREAM_BROWSER flag + make toolbar-hide/subtitles broadcast-wide

- Add STREAM_BROWSER (.env) gating screen-share/browser mode. false => the
  /자비스 stream command stays voice + API/MCP only (no Go-Live); true (default)
  => screen share as before. (Browser-driven info retrieval in true mode is a
  follow-up build; the bot has no browser-control tools yet.)
- Make the two test-time fixes broadcast-wide defaults via broadcast-helper.mjs:
  it now also watches every tab for HTML5 fullscreen and toggles Chrome window
  fullscreen so the address bar is hidden for ANY video (xfwm4 won't hide it on
  'f' alone), restoring on exit. Subtitles were already enforced per video.
  scenario.mjs drops its own fullscreen toggle and relies on the helper.
- Revert the test-settings env vars from .env.example (not wanted).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-06-10 16:17:29 +09:00
parent f93b241575
commit ef6f6ff57d
5 changed files with 51 additions and 34 deletions

View File

@@ -38,19 +38,6 @@ page.setDefaultTimeout(25000);
const read = (fn) => page.evaluate(fn);
const playerLoc = () => page.locator('#movie_player');
// Toggle Chrome-initiated browser fullscreen (hides the toolbar on this WM,
// which HTML5 'f' fullscreen alone does not). on=true -> fullscreen.
async function browserFullscreen(on) {
try {
const sess = await b.newBrowserCDPSession();
const { targetInfos } = await sess.send('Target.getTargets');
const t = targetInfos.find((x) => x.type === 'page' && x.url.startsWith('http'));
if (!t) return;
const { windowId } = await sess.send('Browser.getWindowForTarget', { targetId: t.targetId });
await sess.send('Browser.setWindowBounds', { windowId, bounds: { windowState: on ? 'fullscreen' : 'normal' } });
} catch { /* best-effort */ }
}
const fpsNow = () => read(() => {
try { const s = document.getElementById('movie_player').getStatsForNerds(); const m = (s.resolution || '').match(/@(\d+)/); return m ? +m[1] : null; } catch { return null; }
});
@@ -129,17 +116,16 @@ if ((await auto.count().catch(() => 0)) && (await auto.getAttribute('aria-checke
}
console.log('STEP watch-1080-windowed'); await sleep(WATCH_MS);
// 7) fullscreen: hide the browser toolbar (CDP), then the real 'f' key makes the
// video fill the now toolbar-free screen (innerHeight 1080).
await browserFullscreen(true); await sleep(800);
// 7) fullscreen with the real 'f' key. broadcast-helper.mjs detects the HTML5
// fullscreen and hides Chrome's toolbar (window fullscreen) broadcast-wide, so
// the address bar stays off the stream.
await humanHover(page, playerLoc());
await humanKey('f'); await sleep(1500);
if (!(await read(() => !!document.fullscreenElement))) { await humanHover(page, playerLoc()); await humanKey('f'); await sleep(1200); }
await humanKey('f'); await sleep(1800);
if (!(await read(() => !!document.fullscreenElement))) { await humanHover(page, playerLoc()); await humanKey('f'); await sleep(1500); }
console.log('STEP fullscreen', await read(() => ({ full: !!document.fullscreenElement, h: window.innerHeight }))); await sleep(WATCH_MS);
// 8) exit video fullscreen ('f'), then restore the browser toolbar
// 8) exit video fullscreen ('f'); the helper restores the toolbar
await humanKey('f'); await sleep(1500);
await browserFullscreen(false); await sleep(500);
// 9) Naver via the address bar, then really type the query
await navigateOmnibox('https://www.naver.com'); await sleep(2800);