       // Optionally, download the audio file.
                const link = document.createElement('a');
                link.href = audioUrl;
                link.download = 'recording.wav';
                link.innerText = message;
                d.appendChild(link);

                // Create an audio element to play the recording
                const audio = document.createElement('audio');
                audio.src = audioUrl;
                audio.controls = true;
                d.appendChild(audio