播放音频内容的接口
实现复古/老式设计的音频播放器组件,具有响应效果和深色主题支持。
<div class="flex items-center justify-center min-h-screen p-4 bg-gray-100 dark:bg-gray-900" > <div class="w-full max-w-md p-6 rounded-lg shadow-xl bg-white dark:bg-gray-800 transform transition-all duration-300 hover:scale-105" > <div class="flex items-center justify-between mb-6"> <div class="text-2xl font-bold text-gray-800 dark:text-gray-200">Now Playing</div> <button class="p-2 rounded-full text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500" > <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" > <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6" /> </svg> </button> </div> <div class="flex items-center mb-6"> <img class="w-16 h-16 rounded-md mr-4 object-cover" src="https://picsum.photos/id/1011/150/150" alt="Album Art" /> <div> <div class="text-xl font-semibold text-gray-800 dark:text-gray-200">Song Title</div> <div class="text-gray-600 dark:text-gray-400">Artist Name</div> </div> </div> <div class="mb-4"> <div class="w-full h-2 bg-gray-300 rounded-full mb-2 overflow-hidden"> <div class="h-full bg-blue-500" style="width: 50%"></div> </div> <div class="flex justify-between text-sm text-gray-600 dark:text-gray-400"> <span>2:30</span> <span>4:50</span> </div> </div> <div class="flex items-center justify-center space-x-6"> <button class="p-3 rounded-full text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500" > <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" > <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8" /> </svg> </button> <button class="p-4 rounded-full bg-blue-500 text-white hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 transform transition-transform duration-200 hover:scale-110" > <svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8" fill="none" viewBox="0 0 24 24" stroke="currentColor" > <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.752 11.168l-3.197 2.132A1 1 0 0110 13.803V9.197a1 1 0 011.555-.832l3.197 2.132a1 1 0 010 1.664z" /> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /> </svg> </button> <button class="p-3 rounded-full text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500" > <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 rotate-180" fill="none" viewBox="0 0 24 24" stroke="currentColor" > <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8" /> </svg> </button> </div> </div> </div>
一个响应式的音频播放器组件,采用玻璃形态设计,具有磨砂玻璃般的外观,并支持黑暗模式。
<div class="flex justify-center items-center min-h-screen bg-gray-200 dark:bg-gray-800"> <div class="bg-white dark:bg-gray-900 rounded-lg shadow-lg p-6 backdrop-blur-lg bg-opacity-30 border border-gray-300 dark:border-gray-600"> <img src="https://picsum.photos/200/100" alt="Album Art" class="rounded-lg mb-4"> <div class="flex flex-col items-center"> <h2 class="text-lg font-semibold text-gray-800 dark:text-white">Song Title</h2> <p class="text-sm text-gray-600 dark:text-gray-400">Artist Name</p> </div> <div class="w-full my-4"> <input type="range" class="w-full h-1 bg-gray-300 rounded-lg appearance-none cursor-pointer dark:bg-gray-600" min="0" max="100" value="50"> </div> <div class="flex justify-between"> <button class="bg-blue-500 text-white font-semibold py-2 px-4 rounded-lg focus:outline-none">Play</button> <button class="bg-red-500 text-white font-semibold py-2 px-4 rounded-lg focus:outline-none">Stop</button> </div> </div> </div>
一个使用 Tailwind CSS 设计的响应式音频播放器组件,采用深色模式。它支持深色主题,提供清晰的音频播放界面。
<div class="bg-gray-800 text-white p-6 rounded-lg shadow-md max-w-lg mx-auto"> <div class="flex items-center mb-4"> <img src="https://picsum.photos/80/80" alt="Album Art" class="rounded-full border-2 border-gray-600"> <div class="ml-4"> <h2 class="text-lg font-semibold">Song Title</h2> <p class="text-gray-400">Artist Name</p> </div> </div> <audio controls class="w-full mb-4"> <source src="path_to_your_audio_file.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio> <div class="flex items-center justify-between"> <button class="text-gray-300 hover:text-white"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 20 20"> <path d="M10 3l7 7-7 7-7-7 7-7z" /> </svg> </button> <div class="flex items-center"> <button class="text-gray-300 hover:text-white mx-2"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 20 20"> <path d="M10 3l7 7-7 7-7-7 7-7z" /> </svg> </button> <input type="range" class="w-32 mx-2 accent-gray-600" value="50" /> <button class="text-gray-300 hover:text-white mx-2"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 20 20"> <path d="M10 3l7 7-7 7-7-7 7-7z" /> </svg> </button> </div> <button class="text-gray-300 hover:text-white"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 20 20"> <path d="M10 3l7 7-7 7-7-7 7-7z" /> </svg> </button> </div> </div>