fix audio notification for Gradio 4 (#1208)

the AUDIO element is now in the shadow DOM, so access it there to
trigger playback
This commit is contained in:
chocolateboy
2024-08-17 03:33:57 +00:00
committed by GitHub
parent 5fa8c6d414
commit fc0c03b793

View File

@@ -26,7 +26,7 @@ onAfterUiUpdate(function() {
lastHeadImg = headImg;
// play notification sound if available
const notificationAudio = gradioApp().querySelector('#audio_notification audio');
const notificationAudio = gradioApp().querySelector('#audio_notification #waveform > div')?.shadowRoot?.querySelector('audio');
if (notificationAudio) {
notificationAudio.volume = opts.notification_volume / 100.0 || 1.0;
notificationAudio.play();