Created
March 8, 2024 03:06
-
-
Save jmercouris/fca7cba9d8e6b30a2f861268a3180cff to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
browser window | |
const { app, net, protocol, BrowserWindow } = require('electron') | |
const path = require('path') | |
const { pathToFileURL } = require('url') | |
protocol.registerSchemesAsPrivileged([ | |
{ | |
scheme: 'a', | |
privileges: { | |
standard: true, | |
stream: true, | |
} | |
} | |
]); | |
protocol.registerSchemesAsPrivileged([ | |
{ | |
scheme: 'b', | |
privileges: { | |
standard: false, | |
stream: false, | |
} | |
} | |
]); | |
app.whenReady().then(() => { | |
protocol.handle('a', (req) => { | |
const { host, pathname } = new URL(req.url); | |
return new Response('<audio controls src="https://www.learningcontainer.com/wp-content/uploads/2020/02/Kalimba.mp3"></audio>', { | |
headers: { 'content-type': 'text/html' } | |
}) | |
}) | |
}); | |
app.whenReady().then(() => { | |
protocol.handle('b', (req) => { | |
const { host, pathname } = new URL(req.url); | |
return new Response('<audio controls src="https://www.learningcontainer.com/wp-content/uploads/2020/02/Kalimba.mp3"></audio>', { | |
headers: { 'content-type': 'text/html' } | |
}) | |
}) | |
}); | |
function createWindow() { | |
const aWindow = new BrowserWindow() | |
aWindow.loadURL('a:') | |
const bWindow = new BrowserWindow() | |
bWindow.loadURL('b:') | |
} | |
app.whenReady().then(() => { | |
createWindow() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment