Download index.html from wolfangus/soundboad: direct link, hf CLI and curl.
- Browser
- Download file 33.7 kB
-
https://huggingface.co/spaces/wolfangus/soundboad/resolve/main/index.html
- Command line
-
hf download hf://spaces/wolfangus/soundboad/index.html
-
curl -L -o index.html https://huggingface.co/spaces/wolfangus/soundboad/resolve/main/index.html
33.7 kB
| <html lang="fr"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>YouTube DJ Remix Station</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <script src="https://www.youtube.com/iframe_api"></script> | |
| <style> | |
| @keyframes spin { | |
| 0% { transform: rotate(0deg); } | |
| 100% { transform: rotate(360deg); } | |
| } | |
| .vinyl-spin { | |
| animation: spin 2s linear infinite; | |
| } | |
| .knob { | |
| -webkit-appearance: none; | |
| width: 100%; | |
| height: 15px; | |
| background: #4b5563; | |
| outline: none; | |
| opacity: 0.7; | |
| transition: opacity .2s; | |
| border-radius: 10px; | |
| } | |
| .knob:hover { | |
| opacity: 1; | |
| } | |
| .knob::-webkit-slider-thumb { | |
| -webkit-appearance: none; | |
| appearance: none; | |
| width: 25px; | |
| height: 25px; | |
| border-radius: 50%; | |
| background: #3b82f6; | |
| cursor: pointer; | |
| } | |
| .crossfader { | |
| -webkit-appearance: none; | |
| height: 10px; | |
| background: linear-gradient(to right, #ef4444, #3b82f6); | |
| outline: none; | |
| border-radius: 5px; | |
| } | |
| .crossfader::-webkit-slider-thumb { | |
| -webkit-appearance: none; | |
| appearance: none; | |
| width: 30px; | |
| height: 30px; | |
| border-radius: 50%; | |
| background: white; | |
| cursor: pointer; | |
| box-shadow: 0 0 5px rgba(0,0,0,0.5); | |
| } | |
| .eq-slider { | |
| -webkit-appearance: slider-vertical; | |
| width: 10px; | |
| height: 100px; | |
| background: #4b5563; | |
| outline: none; | |
| border-radius: 5px; | |
| } | |
| .eq-slider::-webkit-slider-thumb { | |
| -webkit-appearance: none; | |
| appearance: none; | |
| width: 20px; | |
| height: 20px; | |
| border-radius: 50%; | |
| background: #3b82f6; | |
| cursor: pointer; | |
| } | |
| .waveform { | |
| height: 60px; | |
| background: linear-gradient(90deg, #3b82f6, #3b82f6 0%, transparent 0%); | |
| transition: background 0.1s; | |
| } | |
| .deck-active { | |
| box-shadow: 0 0 20px rgba(59, 130, 246, 0.5); | |
| } | |
| .search-loading { | |
| position: relative; | |
| } | |
| .search-loading::after { | |
| content: ""; | |
| position: absolute; | |
| top: 50%; | |
| left: 50%; | |
| transform: translate(-50%, -50%); | |
| width: 20px; | |
| height: 20px; | |
| border: 2px solid rgba(255,255,255,0.3); | |
| border-radius: 50%; | |
| border-top-color: #3b82f6; | |
| animation: spin 1s linear infinite; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-900 text-white min-h-screen font-sans"> | |
| <div class="container mx-auto px-4 py-8"> | |
| <!-- Header --> | |
| <header class="text-center mb-8"> | |
| <h1 class="text-4xl md:text-5xl font-bold mb-2 bg-gradient-to-r from-blue-400 to-purple-600 bg-clip-text text-transparent"> | |
| YouTube DJ Remix Station | |
| </h1> | |
| <p class="text-lg text-gray-300"> | |
| Mix and remix YouTube tracks like a pro DJ | |
| </p> | |
| </header> | |
| <!-- Main DJ Interface --> | |
| <div class="bg-gray-800 rounded-xl p-6 mb-8 shadow-xl"> | |
| <!-- Crossfader --> | |
| <div class="mb-6"> | |
| <div class="flex justify-between items-center mb-2"> | |
| <span class="text-red-400 font-medium"><i class="fas fa-volume-up mr-2"></i>Deck A</span> | |
| <span class="text-blue-400 font-medium">Deck B<i class="fas fa-volume-up ml-2"></i></span> | |
| </div> | |
| <input type="range" min="0" max="100" value="50" class="crossfader w-full" id="crossfader"> | |
| </div> | |
| <!-- Dual Decks --> | |
| <div class="grid grid-cols-1 lg:grid-cols-2 gap-6"> | |
| <!-- Deck A --> | |
| <div class="bg-gray-700 rounded-lg p-4 deck" id="deckA"> | |
| <div class="flex items-center mb-4"> | |
| <div class="relative w-24 h-24 mr-4"> | |
| <div class="absolute inset-0 bg-gray-900 rounded-full flex items-center justify-center vinyl-spin" id="vinylA"> | |
| <div class="w-8 h-8 bg-gray-800 rounded-full"></div> | |
| </div> | |
| <div class="absolute inset-0 flex items-center justify-center"> | |
| <i class="fas fa-compact-disc text-4xl text-blue-400 opacity-70"></i> | |
| </div> | |
| </div> | |
| <div class="flex-1"> | |
| <h3 class="text-xl font-bold" id="trackTitleA">No track loaded</h3> | |
| <div class="waveform bg-gray-600 rounded my-2" id="waveformA"></div> | |
| <div class="flex justify-between text-sm text-gray-400"> | |
| <span id="timeA">0:00</span> | |
| <span id="durationA">0:00</span> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="grid grid-cols-3 gap-4 mb-4"> | |
| <div> | |
| <label class="block text-sm text-gray-400 mb-1">BPM</label> | |
| <input type="range" min="50" max="200" value="120" class="knob w-full" id="bpmA"> | |
| <div class="text-center mt-1 text-sm" id="bpmValueA">120</div> | |
| </div> | |
| <div> | |
| <label class="block text-sm text-gray-400 mb-1">Pitch</label> | |
| <input type="range" min="-12" max="12" value="0" class="knob w-full" id="pitchA"> | |
| <div class="text-center mt-1 text-sm" id="pitchValueA">0</div> | |
| </div> | |
| <div> | |
| <label class="block text-sm text-gray-400 mb-1">Volume</label> | |
| <input type="range" min="0" max="100" value="80" class="knob w-full" id="volumeA"> | |
| <div class="text-center mt-1 text-sm" id="volumeValueA">80</div> | |
| </div> | |
| </div> | |
| <div class="grid grid-cols-4 gap-2 mb-4"> | |
| <button class="bg-blue-600 hover:bg-blue-700 text-white p-2 rounded" id="playA"> | |
| <i class="fas fa-play"></i> | |
| </button> | |
| <button class="bg-gray-600 hover:bg-gray-500 text-white p-2 rounded" id="pauseA"> | |
| <i class="fas fa-pause"></i> | |
| </button> | |
| <button class="bg-gray-600 hover:bg-gray-500 text-white p-2 rounded" id="stopA"> | |
| <i class="fas fa-stop"></i> | |
| </button> | |
| <button class="bg-red-600 hover:bg-red-700 text-white p-2 rounded" id="cueA"> | |
| <i class="fas fa-undo"></i> | |
| </button> | |
| </div> | |
| <div class="grid grid-cols-3 gap-2"> | |
| <button class="effect-btn bg-purple-600 hover:bg-purple-700 text-white p-2 rounded text-sm" data-effect="filter"> | |
| <i class="fas fa-filter mr-1"></i> Filter | |
| </button> | |
| <button class="effect-btn bg-purple-600 hover:bg-purple-700 text-white p-2 rounded text-sm" data-effect="echo"> | |
| <i class="fas fa-echo mr-1"></i> Echo | |
| </button> | |
| <button class="effect-btn bg-purple-600 hover:bg-purple-700 text-white p-2 rounded text-sm" data-effect="flanger"> | |
| <i class="fas fa-wave-square mr-1"></i> Flanger | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Deck B --> | |
| <div class="bg-gray-700 rounded-lg p-4 deck" id="deckB"> | |
| <div class="flex items-center mb-4"> | |
| <div class="relative w-24 h-24 mr-4"> | |
| <div class="absolute inset-0 bg-gray-900 rounded-full flex items-center justify-center" id="vinylB"> | |
| <div class="w-8 h-8 bg-gray-800 rounded-full"></div> | |
| </div> | |
| <div class="absolute inset-0 flex items-center justify-center"> | |
| <i class="fas fa-compact-disc text-4xl text-blue-400 opacity-70"></i> | |
| </div> | |
| </div> | |
| <div class="flex-1"> | |
| <h3 class="text-xl font-bold" id="trackTitleB">No track loaded</h3> | |
| <div class="waveform bg-gray-600 rounded my-2" id="waveformB"></div> | |
| <div class="flex justify-between text-sm text-gray-400"> | |
| <span id="timeB">0:00</span> | |
| <span id="durationB">0:00</span> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="grid grid-cols-3 gap-4 mb-4"> | |
| <div> | |
| <label class="block text-sm text-gray-400 mb-1">BPM</label> | |
| <input type="range" min="50" max="200" value="120" class="knob w-full" id="bpmB"> | |
| <div class="text-center mt-1 text-sm" id="bpmValueB">120</div> | |
| </div> | |
| <div> | |
| <label class="block text-sm text-gray-400 mb-1">Pitch</label> | |
| <input type="range" min="-12" max="12" value="0" class="knob w-full" id="pitchB"> | |
| <div class="text-center mt-1 text-sm" id="pitchValueB">0</div> | |
| </div> | |
| <div> | |
| <label class="block text-sm text-gray-400 mb-1">Volume</label> | |
| <input type="range" min="0" max="100" value="80" class="knob w-full" id="volumeB"> | |
| <div class="text-center mt-1 text-sm" id="volumeValueB">80</div> | |
| </div> | |
| </div> | |
| <div class="grid grid-cols-4 gap-2 mb-4"> | |
| <button class="bg-blue-600 hover:bg-blue-700 text-white p-2 rounded" id="playB"> | |
| <i class="fas fa-play"></i> | |
| </button> | |
| <button class="bg-gray-600 hover:bg-gray-500 text-white p-2 rounded" id="pauseB"> | |
| <i class="fas fa-pause"></i> | |
| </button> | |
| <button class="bg-gray-600 hover:bg-gray-500 text-white p-2 rounded" id="stopB"> | |
| <i class="fas fa-stop"></i> | |
| </button> | |
| <button class="bg-red-600 hover:bg-red-700 text-white p-2 rounded" id="cueB"> | |
| <i class="fas fa-undo"></i> | |
| </button> | |
| </div> | |
| <div class="grid grid-cols-3 gap-2"> | |
| <button class="effect-btn bg-purple-600 hover:bg-purple-700 text-white p-2 rounded text-sm" data-effect="filter"> | |
| <i class="fas fa-filter mr-1"></i> Filter | |
| </button> | |
| <button class="effect-btn bg-purple-600 hover:bg-purple-700 text-white p-2 rounded text-sm" data-effect="echo"> | |
| <i class="fas fa-echo mr-1"></i> Echo | |
| </button> | |
| <button class="effect-btn bg-purple-600 hover:bg-purple-700 text-white p-2 rounded text-sm" data-effect="flanger"> | |
| <i class="fas fa-wave-square mr-1"></i> Flanger | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Track Search and Load --> | |
| <div class="bg-gray-800 rounded-xl p-6 mb-8 shadow-xl"> | |
| <h2 class="text-2xl font-bold mb-4">Load YouTube Tracks</h2> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-6"> | |
| <!-- Deck A Load --> | |
| <div> | |
| <h3 class="text-xl font-medium mb-2 text-blue-400">Deck A</h3> | |
| <div class="flex mb-4"> | |
| <input type="text" id="searchA" placeholder="Search YouTube..." class="flex-1 bg-gray-700 text-white px-4 py-2 rounded-l focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| <button class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-r" id="searchBtnA"> | |
| <i class="fas fa-search"></i> | |
| </button> | |
| </div> | |
| <div class="h-64 overflow-y-auto bg-gray-700 rounded p-2 mb-2" id="resultsA"> | |
| <p class="text-gray-400 text-center py-20">Search for YouTube tracks to load</p> | |
| </div> | |
| <button class="w-full bg-green-600 hover:bg-green-700 text-white py-2 rounded" id="loadA"> | |
| <i class="fas fa-arrow-down mr-2"></i> Load to Deck A | |
| </button> | |
| </div> | |
| <!-- Deck B Load --> | |
| <div> | |
| <h3 class="text-xl font-medium mb-2 text-blue-400">Deck B</h3> | |
| <div class="flex mb-4"> | |
| <input type="text" id="searchB" placeholder="Search YouTube..." class="flex-1 bg-gray-700 text-white px-4 py-2 rounded-l focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| <button class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-r" id="searchBtnB"> | |
| <i class="fas fa-search"></i> | |
| </button> | |
| </div> | |
| <div class="h-64 overflow-y-auto bg-gray-700 rounded p-2 mb-2" id="resultsB"> | |
| <p class="text-gray-400 text-center py-20">Search for YouTube tracks to load</p> | |
| </div> | |
| <button class="w-full bg-green-600 hover:bg-green-700 text-white py-2 rounded" id="loadB"> | |
| <i class="fas fa-arrow-down mr-2"></i> Load to Deck B | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- EQ Controls --> | |
| <div class="bg-gray-800 rounded-xl p-6 shadow-xl"> | |
| <h2 class="text-2xl font-bold mb-4">Equalizer</h2> | |
| <div class="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-6"> | |
| <!-- Deck A EQ --> | |
| <div class="bg-gray-700 rounded-lg p-4"> | |
| <h3 class="text-lg font-medium mb-3 text-center text-blue-400">Deck A</h3> | |
| <div class="flex justify-around"> | |
| <div class="flex flex-col items-center"> | |
| <label class="text-sm text-gray-400 mb-2">Low</label> | |
| <input type="range" min="0" max="100" value="50" class="eq-slider" id="eqLowA"> | |
| </div> | |
| <div class="flex flex-col items-center"> | |
| <label class="text-sm text-gray-400 mb-2">Mid</label> | |
| <input type="range" min="0" max="100" value="50" class="eq-slider" id="eqMidA"> | |
| </div> | |
| <div class="flex flex-col items-center"> | |
| <label class="text-sm text-gray-400 mb-2">High</label> | |
| <input type="range" min="0" max="100" value="50" class="eq-slider" id="eqHighA"> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Deck B EQ --> | |
| <div class="bg-gray-700 rounded-lg p-4"> | |
| <h3 class="text-lg font-medium mb-3 text-center text-blue-400">Deck B</h3> | |
| <div class="flex justify-around"> | |
| <div class="flex flex-col items-center"> | |
| <label class="text-sm text-gray-400 mb-2">Low</label> | |
| <input type="range" min="0" max="100" value="50" class="eq-slider" id="eqLowB"> | |
| </div> | |
| <div class="flex flex-col items-center"> | |
| <label class="text-sm text-gray-400 mb-2">Mid</label> | |
| <input type="range" min="0" max="100" value="50" class="eq-slider" id="eqMidB"> | |
| </div> | |
| <div class="flex flex-col items-center"> | |
| <label class="text-sm text-gray-400 mb-2">High</label> | |
| <input type="range" min="0" max="100" value="50" class="eq-slider" id="eqHighB"> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Master EQ --> | |
| <div class="bg-gray-700 rounded-lg p-4 col-span-2 md:col-span-4 lg:col-span-2"> | |
| <h3 class="text-lg font-medium mb-3 text-center text-purple-400">Master Output</h3> | |
| <div class="flex justify-around"> | |
| <div class="flex flex-col items-center"> | |
| <label class="text-sm text-gray-400 mb-2">Low</label> | |
| <input type="range" min="0" max="100" value="50" class="eq-slider" id="eqLowMaster"> | |
| </div> | |
| <div class="flex flex-col items-center"> | |
| <label class="text-sm text-gray-400 mb-2">Mid</label> | |
| <input type="range" min="0" max="100" value="50" class="eq-slider" id="eqMidMaster"> | |
| </div> | |
| <div class="flex flex-col items-center"> | |
| <label class="text-sm text-gray-400 mb-2">High</label> | |
| <input type="range" min="0" max="100" value="50" class="eq-slider" id="eqHighMaster"> | |
| </div> | |
| <div class="flex flex-col items-center"> | |
| <label class="text-sm text-gray-400 mb-2">Volume</label> | |
| <input type="range" min="0" max="100" value="80" class="eq-slider" id="eqVolumeMaster"> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Footer --> | |
| <footer class="mt-12 text-center text-gray-400 text-sm"> | |
| <p>© 2023 YouTube DJ Remix Station - For educational purposes only</p> | |
| <p class="mt-2">Made with <i class="fas fa-heart text-red-500"></i> for music lovers</p> | |
| </footer> | |
| </div> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // YouTube API setup | |
| let youtubePlayers = { | |
| A: null, | |
| B: null | |
| }; | |
| let currentDeck = 'A'; | |
| let crossfaderValue = 50; | |
| let searchResults = { | |
| A: [], | |
| B: [] | |
| }; | |
| let selectedTrack = { | |
| A: null, | |
| B: null | |
| }; | |
| let trackProgress = { | |
| A: 0, | |
| B: 0 | |
| }; | |
| let trackDuration = { | |
| A: 0, | |
| B: 0 | |
| }; | |
| let isPlaying = { | |
| A: false, | |
| B: false | |
| }; | |
| // Sample music database for demo purposes | |
| const musicDatabase = [ | |
| { | |
| id: 'dQw4w9WgXcQ', | |
| title: 'Never Gonna Give You Up - Rick Astley', | |
| thumbnail: 'https://i.ytimg.com/vi/dQw4w9WgXcQ/default.jpg', | |
| duration: '3:32' | |
| }, | |
| { | |
| id: '9bZkp7q19f0', | |
| title: 'Gangnam Style - PSY', | |
| thumbnail: 'https://i.ytimg.com/vi/9bZkp7q19f0/default.jpg', | |
| duration: '4:13' | |
| }, | |
| { | |
| id: 'kJQP7kiw5Fk', | |
| title: 'Despacito - Luis Fonsi ft. Daddy Yankee', | |
| thumbnail: 'https://i.ytimg.com/vi/kJQP7kiw5Fk/default.jpg', | |
| duration: '3:47' | |
| }, | |
| { | |
| id: 'JGwWNGJdvx8', | |
| title: 'Shape of You - Ed Sheeran', | |
| thumbnail: 'https://i.ytimg.com/vi/JGwWNGJdvx8/default.jpg', | |
| duration: '3:53' | |
| }, | |
| { | |
| id: 'RgKAFK5djSk', | |
| title: 'See You Again - Wiz Khalifa ft. Charlie Puth', | |
| thumbnail: 'https://i.ytimg.com/vi/RgKAFK5djSk/default.jpg', | |
| duration: '3:49' | |
| }, | |
| { | |
| id: 'OPf0YbXqDm0', | |
| title: 'Uptown Funk - Mark Ronson ft. Bruno Mars', | |
| thumbnail: 'https://i.ytimg.com/vi/OPf0YbXqDm0/default.jpg', | |
| duration: '4:30' | |
| }, | |
| { | |
| id: 'AJtDXIazrMo', | |
| title: 'Blinding Lights - The Weeknd', | |
| thumbnail: 'https://i.ytimg.com/vi/AJtDXIazrMo/default.jpg', | |
| duration: '3:20' | |
| }, | |
| { | |
| id: 'kXAvbHPdTZ0', | |
| title: 'Dance Monkey - Tones and I', | |
| thumbnail: 'https://i.ytimg.com/vi/kXAvbHPdTZ0/default.jpg', | |
| duration: '3:29' | |
| }, | |
| { | |
| id: '2Vv-BfVoq4g', | |
| title: 'Perfect - Ed Sheeran', | |
| thumbnail: 'https://i.ytimg.com/vi/2Vv-BfVoq4g/default.jpg', | |
| duration: '4:23' | |
| }, | |
| { | |
| id: 'pRpeEdMmmQ0', | |
| title: 'Closer - The Chainsmokers ft. Halsey', | |
| thumbnail: 'https://i.ytimg.com/vi/pRpeEdMmmQ0/default.jpg', | |
| duration: '4:04' | |
| } | |
| ]; | |
| // Initialize YouTube API | |
| function onYouTubeIframeAPIReady() { | |
| // Players will be created when tracks are loaded | |
| } | |
| // Create YouTube player for a deck | |
| function createPlayer(deckId, videoId) { | |
| if (youtubePlayers[deckId]) { | |
| youtubePlayers[deckId].destroy(); | |
| } | |
| youtubePlayers[deckId] = new YT.Player(`player${deckId}`, { | |
| height: '0', | |
| width: '0', | |
| videoId: videoId, | |
| playerVars: { | |
| 'autoplay': 0, | |
| 'controls': 0, | |
| 'disablekb': 1, | |
| 'enablejsapi': 1, | |
| 'fs': 0, | |
| 'iv_load_policy': 3, | |
| 'modestbranding': 1, | |
| 'rel': 0 | |
| }, | |
| events: { | |
| 'onReady': onPlayerReady.bind(null, deckId), | |
| 'onStateChange': onPlayerStateChange.bind(null, deckId) | |
| } | |
| }); | |
| } | |
| function onPlayerReady(deckId, event) { | |
| console.log(`Player ${deckId} ready`); | |
| trackDuration[deckId] = youtubePlayers[deckId].getDuration(); | |
| updateDurationDisplay(deckId); | |
| // Set initial volume based on crossfader | |
| updateVolume(deckId); | |
| } | |
| function onPlayerStateChange(deckId, event) { | |
| if (event.data == YT.PlayerState.PLAYING) { | |
| isPlaying[deckId] = true; | |
| document.getElementById(`vinyl${deckId}`).classList.add('vinyl-spin'); | |
| document.getElementById(`deck${deckId}`).classList.add('deck-active'); | |
| updateProgress(deckId); | |
| } else if (event.data == YT.PlayerState.PAUSED) { | |
| isPlaying[deckId] = false; | |
| document.getElementById(`vinyl${deckId}`).classList.remove('vinyl-spin'); | |
| document.getElementById(`deck${deckId}`).classList.remove('deck-active'); | |
| } else if (event.data == YT.PlayerState.ENDED) { | |
| isPlaying[deckId] = false; | |
| document.getElementById(`vinyl${deckId}`).classList.remove('vinyl-spin'); | |
| document.getElementById(`deck${deckId}`).classList.remove('deck-active'); | |
| } | |
| } | |
| // Update track progress | |
| function updateProgress(deckId) { | |
| if (isPlaying[deckId]) { | |
| trackProgress[deckId] = youtubePlayers[deckId].getCurrentTime(); | |
| updateTimeDisplay(deckId); | |
| // Update waveform visualization | |
| const progressPercent = (trackProgress[deckId] / trackDuration[deckId]) * 100; | |
| document.getElementById(`waveform${deckId}`).style.background = | |
| `linear-gradient(90deg, #3b82f6, #3b82f6 ${progressPercent}%, transparent ${progressPercent}%)`; | |
| requestAnimationFrame(() => updateProgress(deckId)); | |
| } | |
| } | |
| // Format time (seconds to MM:SS) | |
| function formatTime(seconds) { | |
| const mins = Math.floor(seconds / 60); | |
| const secs = Math.floor(seconds % 60); | |
| return `${mins}:${secs < 10 ? '0' : ''}${secs}`; | |
| } | |
| function updateTimeDisplay(deckId) { | |
| document.getElementById(`time${deckId}`).textContent = formatTime(trackProgress[deckId]); | |
| } | |
| function updateDurationDisplay(deckId) { | |
| document.getElementById(`duration${deckId}`).textContent = formatTime(trackDuration[deckId]); | |
| } | |
| // Update volume based on crossfader | |
| function updateVolume(deckId) { | |
| if (!youtubePlayers[deckId]) return; | |
| const volumeControl = parseInt(document.getElementById(`volume${deckId}`).value); | |
| let volume; | |
| if (deckId === 'A') { | |
| volume = volumeControl * (crossfaderValue / 100); | |
| } else { | |
| volume = volumeControl * ((100 - crossfaderValue) / 100); | |
| } | |
| youtubePlayers[deckId].setVolume(volume); | |
| document.getElementById(`volumeValue${deckId}`).textContent = Math.round(volume); | |
| } | |
| // Search YouTube (simulated with our music database) | |
| async function searchYouTube(query, deckId) { | |
| if (!query) { | |
| document.getElementById(`results${deckId}`).innerHTML = | |
| '<p class="text-gray-400 text-center py-20">Please enter a search term</p>'; | |
| return; | |
| } | |
| // Show loading indicator | |
| const resultsContainer = document.getElementById(`results${deckId}`); | |
| resultsContainer.innerHTML = '<div class="search-loading"></div>'; | |
| // Simulate API delay | |
| setTimeout(() => { | |
| // Filter our music database for matching tracks | |
| const filteredResults = musicDatabase.filter(track => | |
| track.title.toLowerCase().includes(query.toLowerCase()) | |
| ); | |
| searchResults[deckId] = filteredResults; | |
| displayResults(deckId); | |
| }, 800); | |
| } | |
| // Display search results | |
| function displayResults(deckId) { | |
| const resultsContainer = document.getElementById(`results${deckId}`); | |
| if (searchResults[deckId].length === 0) { | |
| resultsContainer.innerHTML = ` | |
| <p class="text-gray-400 text-center py-20"> | |
| No results found for your search.<br> | |
| Try different keywords. | |
| </p> | |
| `; | |
| return; | |
| } | |
| let html = ''; | |
| searchResults[deckId].forEach((result, index) => { | |
| html += ` | |
| <div class="flex items-center p-2 mb-2 bg-gray-600 rounded cursor-pointer hover:bg-gray-500 result-item" | |
| data-index="${index}" data-deck="${deckId}"> | |
| <img src="${result.thumbnail}" alt="${result.title}" class="w-16 h-12 mr-3"> | |
| <div class="flex-1"> | |
| <h4 class="font-medium text-sm line-clamp-1">${result.title}</h4> | |
| <p class="text-gray-400 text-xs">${result.duration}</p> | |
| </div> | |
| <i class="fas fa-music text-gray-400 ml-2"></i> | |
| </div> | |
| `; | |
| }); | |
| resultsContainer.innerHTML = html; | |
| // Add click handlers to result items | |
| document.querySelectorAll(`#results${deckId} .result-item`).forEach(item => { | |
| item.addEventListener('click', function() { | |
| const index = this.getAttribute('data-index'); | |
| const deck = this.getAttribute('data-deck'); | |
| selectTrack(index, deck); | |
| }); | |
| }); | |
| } | |
| // Select a track from search results | |
| function selectTrack(index, deckId) { | |
| selectedTrack[deckId] = searchResults[deckId][index]; | |
| // Update UI | |
| document.getElementById(`trackTitle${deckId}`).textContent = selectedTrack[deckId].title; | |
| // Highlight selected track | |
| document.querySelectorAll(`#results${deckId} .result-item`).forEach(item => { | |
| item.classList.remove('bg-blue-600'); | |
| }); | |
| document.querySelector(`#results${deckId} .result-item[data-index="${index}"]`).classList.add('bg-blue-600'); | |
| } | |
| // Load selected track to deck | |
| function loadTrack(deckId) { | |
| if (!selectedTrack[deckId]) { | |
| alert('Please select a track first'); | |
| return; | |
| } | |
| createPlayer(deckId, selectedTrack[deckId].id); | |
| // Reset track progress | |
| trackProgress[deckId] = 0; | |
| trackDuration[deckId] = 0; | |
| document.getElementById(`waveform${deckId}`).style.background = 'linear-gradient(90deg, #3b82f6, #3b82f6 0%, transparent 0%)'; | |
| document.getElementById(`time${deckId}`).textContent = '0:00'; | |
| document.getElementById(`duration${deckId}`).textContent = '0:00'; | |
| // Enable deck controls | |
| document.getElementById(`deck${deckId}`).querySelectorAll('button, input').forEach(el => { | |
| el.disabled = false; | |
| }); | |
| } | |
| // Event listeners for deck controls | |
| document.getElementById('playA').addEventListener('click', () => { | |
| if (youtubePlayers.A) youtubePlayers.A.playVideo(); | |
| }); | |
| document.getElementById('pauseA').addEventListener('click', () => { | |
| if (youtubePlayers.A) youtubePlayers.A.pauseVideo(); | |
| }); | |
| document.getElementById('stopA').addEventListener('click', () => { | |
| if (youtubePlayers.A) { | |
| youtubePlayers.A.stopVideo(); | |
| trackProgress.A = 0; | |
| updateTimeDisplay('A'); | |
| document.getElementById('waveformA').style.background = 'linear-gradient(90deg, #3b82f6, #3b82f6 0%, transparent 0%)'; | |
| } | |
| }); | |
| document.getElementById('cueA').addEventListener('click', () => { | |
| if (youtubePlayers.A) { | |
| youtubePlayers.A.seekTo(0); | |
| trackProgress.A = 0; | |
| updateTimeDisplay('A'); | |
| document.getElementById('waveformA').style.background = 'linear-gradient(90deg, #3b82f6, #3b82f6 0%, transparent 0%)'; | |
| } | |
| }); | |
| document.getElementById('playB').addEventListener('click', () => { | |
| if (youtubePlayers.B) youtubePlayers.B.playVideo(); | |
| }); | |
| document.getElementById('pauseB').addEventListener('click', () => { | |
| if (youtubePlayers.B) youtubePlayers.B.pauseVideo(); | |
| }); | |
| document.getElementById('stopB').addEventListener('click', () => { | |
| if (youtubePlayers.B) { | |
| youtubePlayers.B.stopVideo(); | |
| trackProgress.B = 0; | |
| updateTimeDisplay('B'); | |
| document.getElementById('waveformB').style.background = 'linear-gradient(90deg, #3b82f6, #3b82f6 0%, transparent 0%)'; | |
| } | |
| }); | |
| document.getElementById('cueB').addEventListener('click', () => { | |
| if (youtubePlayers.B) { | |
| youtubePlayers.B.seekTo(0); | |
| trackProgress.B = 0; | |
| updateTimeDisplay('B'); | |
| document.getElementById('waveformB').style.background = 'linear-gradient(90deg, #3b82f6, #3b82f6 0%, transparent 0%)'; | |
| } | |
| }); | |
| // Crossfader control | |
| document.getElementById('crossfader').addEventListener('input', function() { | |
| crossfaderValue = parseInt(this.value); | |
| updateVolume('A'); | |
| updateVolume('B'); | |
| }); | |
| // Volume controls | |
| document.getElementById('volumeA').addEventListener('input', function() { | |
| document.getElementById('volumeValueA').textContent = this.value; | |
| updateVolume('A'); | |
| }); | |
| document.getElementById('volumeB').addEventListener('input', function() { | |
| document.getElementById('volumeValueB').textContent = this.value; | |
| updateVolume('B'); | |
| }); | |
| // BPM controls | |
| document.getElementById('bpmA').addEventListener('input', function() { | |
| document.getElementById('bpmValueA').textContent = this.value; | |
| // In a real app, you would adjust playback rate here | |
| }); | |
| document.getElementById('bpmB').addEventListener('input', function() { | |
| document.getElementById('bpmValueB').textContent = this.value; | |
| // In a real app, you would adjust playback rate here | |
| }); | |
| // Pitch controls | |
| document.getElementById('pitchA').addEventListener('input', function() { | |
| document.getElementById('pitchValueA').textContent = this.value; | |
| // In a real app, you would adjust pitch here | |
| }); | |
| document.getElementById('pitchB').addEventListener('input', function() { | |
| document.getElementById('pitchValueB').textContent = this.value; | |
| // In a real app, you would adjust pitch here | |
| }); | |
| // Search controls | |
| document.getElementById('searchBtnA').addEventListener('click', () => { | |
| const query = document.getElementById('searchA').value; | |
| searchYouTube(query, 'A'); | |
| }); | |
| document.getElementById('searchBtnB').addEventListener('click', () => { | |
| const query = document.getElementById('searchB').value; | |
| searchYouTube(query, 'B'); | |
| }); | |
| // Also search when pressing Enter in search fields | |
| document.getElementById('searchA').addEventListener('keypress', function(e) { | |
| if (e.key === 'Enter') { | |
| const query = this.value; | |
| searchYouTube(query, 'A'); | |
| } | |
| }); | |
| document.getElementById('searchB').addEventListener('keypress', function(e) { | |
| if (e.key === 'Enter') { | |
| const query = this.value; | |
| searchYouTube(query, 'B'); | |
| } | |
| }); | |
| // Load controls | |
| document.getElementById('loadA').addEventListener('click', () => loadTrack('A')); | |
| document.getElementById('loadB').addEventListener('click', () => loadTrack('B')); | |
| // Effect buttons | |
| document.querySelectorAll('.effect-btn').forEach(btn => { | |
| btn.addEventListener('click', function() { | |
| const effect = this.getAttribute('data-effect'); | |
| const deckId = this.closest('.deck').id.replace('deck', ''); | |
| alert(`Applying ${effect} effect to Deck ${deckId}`); | |
| // In a real app, you would apply audio effects here | |
| }); | |
| }); | |
| // Initialize with disabled deck controls | |
| document.querySelectorAll('.deck button, .deck input').forEach(el => { | |
| el.disabled = true; | |
| }); | |
| // Enable search controls | |
| document.querySelectorAll('#searchA, #searchB, #searchBtnA, #searchBtnB').forEach(el => { | |
| el.disabled = false; | |
| }); | |
| }); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=wolfangus/soundboad" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |