diff --git a/electron.html b/electron.html
index 489364b..bddbda9 100644
--- a/electron.html
+++ b/electron.html
@@ -543,13 +543,22 @@ function getPermssions(e=null){
});
listed=true;
audioOutputSelect.focus();
-
- }).catch(function(){
- document.getElementById("messageDiv").innerHTML = "Failed to list available output devices\n\nPlease ensure you allowed the microphone permissions.";
+
+ }).catch(function(err){
+ var errorMessage = "Failed to list available audio devices\n\n";
+ if (err && err.name === "NotFoundError") {
+ errorMessage += "No microphone detected. Please connect a microphone and refresh.";
+ } else if (err && err.name === "NotAllowedError") {
+ errorMessage += "Microphone permission denied. Please allow microphone access.";
+ } else if (err && err.name === "NotReadableError") {
+ errorMessage += "Microphone is in use by another application.";
+ } else {
+ errorMessage += "Please ensure you have a microphone connected and allowed permissions.";
+ }
+ document.getElementById("messageDiv").innerHTML = errorMessage;
document.getElementById("messageDiv").style.display="block";
setTimeout(function(){document.getElementById("messageDiv").style.opacity="1.0";},0);
-
- });
+ });
}
function gotDevices(deviceInfos) {
@@ -637,6 +646,77 @@ function createSpecialDeviceLink(deviceLabel) {
};
}
+function checkForAsioDevices() {
+ if (navigator.userAgent.toLowerCase().indexOf(' electron/') > -1) {
+ try {
+ // Try async first (works in sandbox mode)
+ if (window.electronApi && window.electronApi.isAsioAvailableAsync) {
+ window.electronApi.isAsioAvailableAsync().then(function(available) {
+ if (!available) return;
+ window.electronApi.getAsioDevicesAsync().then(function(asioDevices) {
+ if (asioDevices && asioDevices.length > 0) {
+ createAsioNotice(asioDevices);
+ }
+ }).catch(function(e) { console.warn("ASIO devices check failed:", e); });
+ }).catch(function(e) { console.warn("ASIO availability check failed:", e); });
+ }
+ // Fallback to sync (works when --node flag used)
+ else if (window.electronApi && window.electronApi.isAsioAvailable && window.electronApi.isAsioAvailable()) {
+ var asioDevices = window.electronApi.getAsioDevices();
+ if (asioDevices && asioDevices.length > 0) {
+ createAsioNotice(asioDevices);
+ }
+ }
+ } catch (e) {
+ console.warn("ASIO detection check failed:", e);
+ }
+ }
+}
+
+function createAsioNotice(asioDevices) {
+ var noticeText = asioDevices.length === 1
+ ? "ASIO: " + asioDevices[0].name
+ : "ASIO: " + asioDevices.length + " devices";
+
+ var notice = document.createElement('div');
+ notice.id = 'asioNotice';
+ notice.style.position = 'fixed';
+ notice.style.bottom = '45px';
+ notice.style.left = '50%';
+ notice.style.transform = 'translateX(-50%)';
+ notice.style.backgroundColor = 'rgba(0, 40, 0, 0.8)';
+ notice.style.color = '#6f6';
+ notice.style.padding = '8px 12px';
+ notice.style.borderRadius = '20px';
+ notice.style.fontSize = '14px';
+ notice.style.textDecoration = 'none';
+ notice.style.opacity = '0';
+ notice.style.transition = 'opacity 2s ease-in-out';
+ notice.style.boxShadow = '0 2px 5px rgba(0,0,0,0.2)';
+ notice.style.fontFamily = 'Arial, sans-serif';
+ notice.title = "Professional low-latency audio input available via ASIO";
+
+ var textSpan = document.createElement('span');
+ textSpan.textContent = noticeText;
+
+ var linkSpan = document.createElement('span');
+ linkSpan.textContent = ' - ';
+
+ var link = document.createElement('a');
+ link.href = 'https://github.com/steveseguin/electroncapture#asio-audio-capture-windows-only';
+ link.target = '_blank';
+ link.textContent = 'Low-latency pro audio available';
+ link.style.color = '#0ff';
+
+ notice.appendChild(textSpan);
+ notice.appendChild(linkSpan);
+ notice.appendChild(link);
+
+ document.body.appendChild(notice);
+ setTimeout(() => notice.style.opacity = '1', 100);
+
+ console.log("ASIO devices available:", asioDevices.map(function(d) { return d.name; }));
+}
function normalizeDeviceLabel(deviceName) {
return String(deviceName).replace(/[\W]+/g, "_").toLowerCase();
}
@@ -654,9 +734,19 @@ function getPermssions(e=null){
});
listed=true;
audioOutputSelect.focus();
-
- }).catch(function(){
- document.getElementById("messageDiv").innerHTML = "Failed to list available audio devices\n\nPlease ensure you allowed the microphone permissions.";
+
+ }).catch(function(err){
+ var errorMessage = "Failed to list available audio devices\n\n";
+ if (err && err.name === "NotFoundError") {
+ errorMessage += "No microphone detected. Please connect a microphone and refresh.";
+ } else if (err && err.name === "NotAllowedError") {
+ errorMessage += "Microphone permission denied. Please allow microphone access.";
+ } else if (err && err.name === "NotReadableError") {
+ errorMessage += "Microphone is in use by another application.";
+ } else {
+ errorMessage += "Please ensure you have a microphone connected and allowed permissions.";
+ }
+ document.getElementById("messageDiv").innerHTML = errorMessage;
document.getElementById("messageDiv").style.display="block";
setTimeout(function(){document.getElementById("messageDiv").style.opacity="1.0";},0);
});
@@ -687,6 +777,7 @@ if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(naviga
document.addEventListener('DOMContentLoaded', () => {
getPermssions();
checkForSpecialVideoDevices();
+ checkForAsioDevices();
setTimeout(lazyPreloadCSS, 2000);
});
}
@@ -814,4 +905,4 @@ if (lastUrls != undefined) {
getPermssions();