Skip to content

Commit 213325c

Browse files
committed
Add error handling to page visibility hack
Seems to sometimes be failing with "Current display surface not available for capture".
1 parent c0afcf1 commit 213325c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/streamwall/src/main/viewStateMachine.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,18 @@ const viewStateMachine = setup({
142142
const wc = view.webContents
143143
wc.audioMuted = true
144144

145-
// Force page visibility
146-
wc.capturePage(undefined, { stayAwake: true })
147-
148145
if (/\.m3u8?$/.test(content.url)) {
149146
loadHTML(wc, 'playHLS', { query: { src: content.url } })
150147
} else {
151148
wc.loadURL(content.url)
152149
}
150+
151+
try {
152+
// Force page visibility
153+
wc.capturePage(undefined, { stayAwake: true })
154+
} catch (err) {
155+
console.warn('Error calling capturePage:', err)
156+
}
153157
},
154158
),
155159
},

0 commit comments

Comments
 (0)