1
0
Fork 0
mirror of https://gitlab.com/futo-org/fcast.git synced 2025-07-26 03:47:00 +00:00

Implemented main window with QR code for desktop receiver.

This commit is contained in:
Koen 2023-12-06 13:03:23 +01:00
parent 85530ca218
commit cefe19e9ff
18 changed files with 501 additions and 35 deletions

View file

@ -0,0 +1,45 @@
const options = {
textTrackSettings: false,
autoplay: true,
loop: true,
controls: false
};
const player = videojs("video-player", options, function onPlayerReady() {
player.src({ type: "video/mp4", src: "./c.mp4" });
});
window.electronAPI.onDeviceInfo((_event, value) => {
console.log("onDeviceInfo", value);
const ipsElement = document.getElementById('ips');
if (ipsElement) {
ipsElement.innerHTML = `IPs<br>${value.addresses.join('<br>')}`;
}
const fcastConfig = {
name: value.name,
addresses: value.addresses,
services: [
{ port: 46899, type: 0 },
{ port: 46898, type: 1 }
]
};
const json = JSON.stringify(fcastConfig);
let base64 = btoa(json);
base64 = base64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
const url = `fcast://r/${base64}`;
console.log("qr", {json, url, base64});
const qrCodeElement = document.getElementById('qr-code');
new QRCode(qrCodeElement, {
text: url,
width: 256,
height: 256,
colorDark : "#000000",
colorLight : "#ffffff",
correctLevel : QRCode.CorrectLevel.H
});
});