Force document visibility state (seems to help Twitch)

This commit is contained in:
Max Goodhart
2025-07-04 16:17:58 -07:00
parent cc8baead06
commit 23bd6b9340

View File

@@ -135,6 +135,17 @@ const viewStateMachine = setup({
ensureValidURL(content.url)
const wc = view.webContents
wc.audioMuted = true
wc.executeJavaScript(`
Object.defineProperty(document, 'visibilityState', {
value: 'visible',
writable: true
});
Object.defineProperty(document, 'hidden', {
value: false,
writable: true
});
document.dispatchEvent(new Event('visibilitychange'));
`)
if (/\.m3u8?$/.test(content.url)) {
loadHTML(wc, 'playHLS', { query: { src: content.url } })