SkyNX/SkyNX-Streamer/js/console.js

44 lines
1.6 KiB
JavaScript
Raw Normal View History

2020-04-22 22:53:59 +00:00
var logTimeout
ipcRenderer.on('log', function (event, genHtml) {
$("#consoleContainer").append(genHtml);
2020-04-22 23:00:27 +00:00
// $("#statusbartext").html("Console: " + genHtml);
if (genHtml.includes("fps=")) {
var fps = 0;
if (genHtml.includes("fps= ")) {
fps = genHtml.split("fps= ")[1].split(" ")[0];
} else {
fps = genHtml.split("fps=")[1].split(" ")[0];
}
var bitrate = genHtml.split("bitrate=")[1].split(" ")[0];
$("#statusbartext").html("Framrate: " + fps + " Bitrate: " + bitrate);
2020-04-23 22:03:26 +00:00
fpsChartData.datasets[0].data.push(parseInt(fps));
if (fpsChartData.datasets[0].data.length > 20) {
fpsChartData.datasets[0].data.shift();
}
if ($("#stats").is(":visible")) {
fpsChartData.labels = genrateLabelList("FPS", fpsChartData.datasets[0].data.length);
fpsChart.update(0);
}
2020-04-23 21:40:30 +00:00
} else if (genHtml.includes("Connection timed out") || genHtml.includes("Waiting for connection")) {
$("#statusbartext").html("Waiting for connection...");
} else if (genHtml.includes("streamerProcess process exited")) {
$("#statusbartext").html("Streamer stopped.");
}
2020-04-22 22:53:59 +00:00
clearTimeout(logTimeout);
logTimeout = setTimeout(function () {
$("#consoleContainer").animate({ scrollTop: $('#consoleContainer').prop("scrollHeight") }, 300);
}, 300);
});
ipcRenderer.send('registerForHTMLLogging');
function consoleCommand(command) {
ipcRenderer.send('consoleCommand', command);
}
$("#console-btn").click(function () {
$(".contentArea").hide();
$("#console").fadeIn(400);
$('#console-btn').tooltip('hide');
});