Add error handling to page visibility hack

Seems to sometimes be failing with "Current display surface not
available for capture".
This commit is contained in:
Max Goodhart
2025-06-14 23:00:21 +00:00
parent c0afcf1de3
commit 213325c543

View File

@@ -142,14 +142,18 @@ const viewStateMachine = setup({
const wc = view.webContents
wc.audioMuted = true
// Force page visibility
wc.capturePage(undefined, { stayAwake: true })
if (/\.m3u8?$/.test(content.url)) {
loadHTML(wc, 'playHLS', { query: { src: content.url } })
} else {
wc.loadURL(content.url)
}
try {
// Force page visibility
wc.capturePage(undefined, { stayAwake: true })
} catch (err) {
console.warn('Error calling capturePage:', err)
}
},
),
},