JSFiddle - React, Tailwind, and code Playground
by velo_ninja
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
/* Your existing styles here */
</style>
</head>
<body>
<div id="sound-control-bar">
<!-- Your existing HTML for sound control bar -->
</div>
<button id="grantPermissionsButton">Grant Permissions</button>
<script>
function getAllIframes(element, iframeArray) {
// Your existing function to get all iframes
}
async function check_devices() {
// Your existing function to check devices
}
function check_autoPlay() {
// Your existing function to check autoplay
}
document.getElementById("grantPermissionsButton").addEventListener("click", async function() {
try {
var allIframes = await getAllIframes(document.body);
for (const iframe of allIframes) {
// Set permissions for camera, sound, VR, and microphone
iframe.allow = 'camera; microphone; vr; speaker;';
}
console.log('Permissions granted for all iframes.');
} catch (error) {
console.error('Error granting permissions:', error);
}
});
var audioUrl = "https://static.wixstatic.com/mp3/57da6c_f8ce6176cb574458bc2dc760132e4a5a.mp3";
var audio = new Audio(audioUrl);
var playButton = document.getElementById("playButton");
var pauseButton = document.getElementById("pauseButton");
var stopButton = document.getElementById("stopButton");
var volumeControl = document.getElementById("volumeControl");
var progressBar = document.getElementById("progressBar");
var progressIndicator = document.getElementById("progressIndicator");
// Your existing event listeners and functions
</script>
</body>
</html>