Skip to content

Commit d48995c

Browse files
committed
minor fixes
1 parent de54cd4 commit d48995c

File tree

9 files changed

+85753
-84997
lines changed

9 files changed

+85753
-84997
lines changed

electron.html

Lines changed: 100 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -543,13 +543,22 @@
543543
});
544544
listed=true;
545545
audioOutputSelect.focus();
546-
547-
}).catch(function(){
548-
document.getElementById("messageDiv").innerHTML = "Failed to list available output devices\n\nPlease ensure you allowed the microphone permissions.";
546+
547+
}).catch(function(err){
548+
var errorMessage = "Failed to list available audio devices\n\n";
549+
if (err && err.name === "NotFoundError") {
550+
errorMessage += "No microphone detected. Please connect a microphone and refresh.";
551+
} else if (err && err.name === "NotAllowedError") {
552+
errorMessage += "Microphone permission denied. Please allow microphone access.";
553+
} else if (err && err.name === "NotReadableError") {
554+
errorMessage += "Microphone is in use by another application.";
555+
} else {
556+
errorMessage += "Please ensure you have a microphone connected and allowed permissions.";
557+
}
558+
document.getElementById("messageDiv").innerHTML = errorMessage;
549559
document.getElementById("messageDiv").style.display="block";
550560
setTimeout(function(){document.getElementById("messageDiv").style.opacity="1.0";},0);
551-
552-
});
561+
});
553562
}
554563

555564
function gotDevices(deviceInfos) {
@@ -637,6 +646,77 @@
637646
};
638647
}
639648

649+
function checkForAsioDevices() {
650+
if (navigator.userAgent.toLowerCase().indexOf(' electron/') > -1) {
651+
try {
652+
// Try async first (works in sandbox mode)
653+
if (window.electronApi && window.electronApi.isAsioAvailableAsync) {
654+
window.electronApi.isAsioAvailableAsync().then(function(available) {
655+
if (!available) return;
656+
window.electronApi.getAsioDevicesAsync().then(function(asioDevices) {
657+
if (asioDevices && asioDevices.length > 0) {
658+
createAsioNotice(asioDevices);
659+
}
660+
}).catch(function(e) { console.warn("ASIO devices check failed:", e); });
661+
}).catch(function(e) { console.warn("ASIO availability check failed:", e); });
662+
}
663+
// Fallback to sync (works when --node flag used)
664+
else if (window.electronApi && window.electronApi.isAsioAvailable && window.electronApi.isAsioAvailable()) {
665+
var asioDevices = window.electronApi.getAsioDevices();
666+
if (asioDevices && asioDevices.length > 0) {
667+
createAsioNotice(asioDevices);
668+
}
669+
}
670+
} catch (e) {
671+
console.warn("ASIO detection check failed:", e);
672+
}
673+
}
674+
}
675+
676+
function createAsioNotice(asioDevices) {
677+
var noticeText = asioDevices.length === 1
678+
? "ASIO: " + asioDevices[0].name
679+
: "ASIO: " + asioDevices.length + " devices";
680+
681+
var notice = document.createElement('div');
682+
notice.id = 'asioNotice';
683+
notice.style.position = 'fixed';
684+
notice.style.bottom = '45px';
685+
notice.style.left = '50%';
686+
notice.style.transform = 'translateX(-50%)';
687+
notice.style.backgroundColor = 'rgba(0, 40, 0, 0.8)';
688+
notice.style.color = '#6f6';
689+
notice.style.padding = '8px 12px';
690+
notice.style.borderRadius = '20px';
691+
notice.style.fontSize = '14px';
692+
notice.style.textDecoration = 'none';
693+
notice.style.opacity = '0';
694+
notice.style.transition = 'opacity 2s ease-in-out';
695+
notice.style.boxShadow = '0 2px 5px rgba(0,0,0,0.2)';
696+
notice.style.fontFamily = 'Arial, sans-serif';
697+
notice.title = "Professional low-latency audio input available via ASIO";
698+
699+
var textSpan = document.createElement('span');
700+
textSpan.textContent = noticeText;
701+
702+
var linkSpan = document.createElement('span');
703+
linkSpan.textContent = ' - ';
704+
705+
var link = document.createElement('a');
706+
link.href = 'https://github.com/steveseguin/electroncapture#asio-audio-capture-windows-only';
707+
link.target = '_blank';
708+
link.textContent = 'Low-latency pro audio available';
709+
link.style.color = '#0ff';
710+
711+
notice.appendChild(textSpan);
712+
notice.appendChild(linkSpan);
713+
notice.appendChild(link);
714+
715+
document.body.appendChild(notice);
716+
setTimeout(() => notice.style.opacity = '1', 100);
717+
718+
console.log("ASIO devices available:", asioDevices.map(function(d) { return d.name; }));
719+
}
640720
function normalizeDeviceLabel(deviceName) {
641721
return String(deviceName).replace(/[\W]+/g, "_").toLowerCase();
642722
}
@@ -654,9 +734,19 @@
654734
});
655735
listed=true;
656736
audioOutputSelect.focus();
657-
658-
}).catch(function(){
659-
document.getElementById("messageDiv").innerHTML = "Failed to list available audio devices\n\nPlease ensure you allowed the microphone permissions.";
737+
738+
}).catch(function(err){
739+
var errorMessage = "Failed to list available audio devices\n\n";
740+
if (err && err.name === "NotFoundError") {
741+
errorMessage += "No microphone detected. Please connect a microphone and refresh.";
742+
} else if (err && err.name === "NotAllowedError") {
743+
errorMessage += "Microphone permission denied. Please allow microphone access.";
744+
} else if (err && err.name === "NotReadableError") {
745+
errorMessage += "Microphone is in use by another application.";
746+
} else {
747+
errorMessage += "Please ensure you have a microphone connected and allowed permissions.";
748+
}
749+
document.getElementById("messageDiv").innerHTML = errorMessage;
660750
document.getElementById("messageDiv").style.display="block";
661751
setTimeout(function(){document.getElementById("messageDiv").style.opacity="1.0";},0);
662752
});
@@ -687,6 +777,7 @@
687777
document.addEventListener('DOMContentLoaded', () => {
688778
getPermssions();
689779
checkForSpecialVideoDevices();
780+
checkForAsioDevices();
690781
setTimeout(lazyPreloadCSS, 2000);
691782
});
692783
}
@@ -814,4 +905,4 @@
814905
getPermssions();
815906
</script>
816907
</body>
817-
</html>
908+
</html>

index.html

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,6 +1840,10 @@ <h2 title="Use this link in the OBS Browser Source to capture the video or audio
18401840
<i class="las la-compact-disc"></i>
18411841
<span data-translate="record-remote"> Record Remote</span>
18421842
</button>
1843+
<button data-action-type="restart-whip" class="hidden" title="Restart WHIP publishing connection (e.g., to Meshcast/MediaMTX)" onclick="restartWhipDirector(this)">
1844+
<i class="las la-broadcast-tower"></i>
1845+
<span data-translate="restart-whip">Restart WHIP</span>
1846+
</button>
18431847
<button data-action-type="recorder-google-drive-remote" title="The Remote Guest will record their local stream and upload it to your Google Drive. *experimental*" onclick="requestGoogleDriveRecord(this, null, null, event)">
18441848
<i class="las la-compact-disc"></i>
18451849
<span data-translate="google-drive-record"> Google Drive</span>
@@ -2571,14 +2575,14 @@ <h2 title="Use this link in the OBS Browser Source to capture the video or audio
25712575
<span data-translate="remote-hangup-connection">Remote Hang-up</span>
25722576
</a>
25732577
</li>
2574-
<li class="context-menu__item" id="RemoteReloadContextOption">
2575-
<a href="#" class="context-menu__link action" data-action="RemoteReload">
2576-
<i class="las la-sync"></i>
2577-
<span data-translate="remote-reload-connection">Remote Reload Page</span>
2578-
</a>
2579-
</li>
25802578
</ul>
25812579
</li>
2580+
<li class="context-menu__item hidden" id="RemoteReloadContextOption">
2581+
<a href="#" class="context-menu__link action" data-action="RemoteReload">
2582+
<i class="las la-sync"></i>
2583+
<span data-translate="remote-reload-connection">Remote Reload Page</span>
2584+
</a>
2585+
</li>
25822586
<li class="context-menu__item">
25832587
<a href="#" class="context-menu__link" data-action="ChangeBuffer">
25842588
<i class="las la-external-link"></i>
@@ -3252,8 +3256,8 @@ <h3>Assign to slot:</h3><br />
32523256
}
32533257
</script>
32543258

3255-
<script type="text/javascript" crossorigin="anonymous" id="lib-js" src="./lib.js?ver=1376"></script>
3256-
<script type="text/javascript" crossorigin="anonymous" id="main-js" src="./main.js?ver=1040"></script>
3259+
<script type="text/javascript" crossorigin="anonymous" id="lib-js" src="./lib.js?ver=1377"></script>
3260+
<script type="text/javascript" crossorigin="anonymous" id="main-js" src="./main.js?ver=1041"></script>
32573261
<script type="module" src="./podcast/bootstrap.js"></script>
32583262

32593263
</body>

0 commit comments

Comments
 (0)