UNPKG

react-pro-audio-player

Version:

A React component for playing collection of audio files with controls for forward, backward, play, pause, loop, sound control, and playback speed.

214 lines (190 loc) 3.81 kB
/* Main container */ .custom-audio-player { width: 100%; color: #f3f4f6; overflow: hidden; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; transition: background 0.3s ease; position: relative; } /* Audio player inner container */ .audio-player { width: 100%; background: #111827; padding: 16px 16px 12px; display: flex; flex-direction: column; transition: background 0.3s ease; } /* Progress bar wrapper */ .progress-wrapper { display: flex; align-items: center; justify-content: space-between; gap: 8px; } .time { font-size: 0.85rem; min-width: 36px; text-align: center; color:#d1d5db } /* Progress bar styling */ .progress-bar { flex-grow: 1; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 3px; background: #d1d5db; /* fallback background */ cursor: pointer; transition: background 0.2s ease; } .progress-bar::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #e11d48; } .progress-bar::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #e11d48; } /* Controls wrapper */ .controls-wrapper { padding: 4px; width: 100%; display: flex; justify-content: space-between; align-items: center; } /* Left controls */ .left-controls{ width:35% } .song-details { padding: 4px 8px; border-radius: 4px; display: flex; align-items: center; gap: 1em; } .song-thumbnail img { width: 72px; border-radius: 6px; height: 56px; } .song-detail{ display: flex; flex-direction: column; gap:2vh } .song-title { font-size: 1.1rem; font-weight: 500; } .song-singer{ font-size: 0.875rem; color:#d1d5db; font-weight: 400; } /* Center controls for playback buttons */ .center-controls { width: 33%; display: flex; gap: 16px; align-items: center; justify-content: center; } .playback-btn { background: none; border: none; color: #f3f4f6; font-size: 1.25rem; cursor: pointer; padding: 4px; transition: transform 0.2s ease; } .play-pause-btn{ font-size: 1.875rem; } /* Right aligned controls */ .right-controls { width: 33%; display: flex; justify-content: end; align-items: center; gap: 12px; } .btn { background: none; border: none; color: #f3f4f6; cursor: pointer; padding: 4px; transition: transform 0.2s ease, color 0.2s ease; } .cancel-btn{ position: absolute; top: 2px; right: 2px; } /* Specific buttons */ .loop-btn, .mute-btn, .cancel-btn { font-size: 1.1rem; } .cancel-btn:hover{ color:#e11d48 } /* Volume slider styling */ .volume-slider { width: 80px; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 5px; background: #d1d5db; cursor: pointer; transition: background 0.2s ease; } .volume-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #f3f4f6; border: 2px solid #4b5563; } .volume-slider::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #f3f4f6; border: 2px solid #4b5563; } /* Playback speed selector */ .playback-speed { background: rgba(255, 255, 255, 0.15); color: #f3f4f6; padding: 2px 6px; border-radius: 4px; border: none; outline: none; font-size: 0.8rem; cursor: pointer; transition: background 0.2s ease; } .playback-speed:hover { background: rgba(255, 255, 255, 0.25); } .playback-speed option { color: #374151; }