JSFiddle - React, Tailwind, and code Playground
by velo_ninja
HTML
<iframe id="myFrame" src="https://example.com" allow="microphone"></iframe>
JavaScript
document.getElementById('myFrame').addEventListener('load', function () {
// iFrame geladen
var iFrameContentWindow = document.getElementById('myFrame').contentWindow;
// Mikrofonzugriff anfordern
iFrameContentWindow.navigator.mediaDevices.getUserMedia({ audio: true })
.then(function (stream) {
console.log('Mikrofonzugriff erhalten:', stream);
})
.catch(function (error) {
console.error('Fehler beim Zugriff auf das Mikrofon:', error);
});
});