Spaces:
Running
Running
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Single File Iframe with Microphone Access</title> | |
</head> | |
<body> | |
<h1>Main Page with Iframe</h1> | |
<!-- Iframe with microphone permission --> | |
<iframe | |
srcdoc=" | |
<!DOCTYPE html> | |
<html lang='en'> | |
<head> | |
<meta charset='UTF-8'> | |
<meta name='viewport' content='width=device-width, initial-scale=1.0'> | |
<title>Iframe Content</title> | |
<script> | |
async function requestMicrophoneAccess() { | |
try { | |
const stream = await navigator.mediaDevices.getUserMedia({ audio: true }); | |
document.getElementById('status').innerText = 'Microphone access granted.'; | |
} catch (error) { | |
console.error('Microphone access denied:', error); | |
document.getElementById('status').innerText = 'Microphone access denied.'; | |
} | |
} | |
window.addEventListener('load', requestMicrophoneAccess); | |
</script> | |
</head> | |
<body> | |
<h2>Iframe Content</h2> | |
<p id='status'>Requesting microphone access...</p> | |
</body> | |
</html> | |
" | |
allow="microphone" | |
width="600" | |
height="400" | |
title="Iframe with Microphone Access"> | |
</iframe> | |
</body> | |
</html> | |