Skip to content

Commit 4cf8ebc

Browse files
committed
try to load vdevice when windows is showed
1 parent 5b99981 commit 4cf8ebc

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

main.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,15 @@ function createWindow(env) {
247247
win.webContents.on('did-finish-load', () => {
248248
win.show();
249249
startCriticalHandlers(env);
250+
251+
try {
252+
let da3 = fs.readFileSync(path.join(env.paths.ffmpeg, 'virtual_device.wvd'), { encoding: "binary" })
253+
let buf = Buffer.from(da3, 'binary')
254+
pyodide.FS.writeFile("/device.wvd", buf, { encoding: "binary" });
255+
} catch (e) {
256+
win.webContents.openDevTools();
257+
setTimeout(console.log, 1000, 'no virtual device file detected in binaries directory : please consider donation on\nhttps://donorbox.org/youtube-dl-gui')
258+
}
250259
});
251260
}
252261

@@ -281,13 +290,6 @@ app.on('ready', async () => {
281290

282291
createWindow(env);
283292

284-
try {
285-
let da3 = fs.readFileSync(path.join(env.paths.ffmpeg, 'virtual_device.wvd'), { encoding: "binary" })
286-
let buf = Buffer.from(da3, 'binary')
287-
pyodide.FS.writeFile("/device.wvd", buf, { encoding: "binary" });
288-
} catch (e) {
289-
console.error('no virtual devices detected in binaries directory : please consider donation')
290-
}
291293
})
292294

293295
app.on('before-quit', async () => {

0 commit comments

Comments
 (0)