I’m not very strong in the front. I tried for 2 hours to remove the volume control, to remove at least something from the standard styling, but all in vain.
{% for audio in audios %}
<div class="col-7 audio-player" style="margin-top:10px;">
<span><b>{{ audio.audio.author }}</b> {{ audio.audio.title }}</span>
<div style="display: flex;">
<audio controls="false" class="audio-element" data-audio-id="{{ audio.audio.id }}">
<source src="{{ audio.audio.audio_file.url }}" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
{% comment %} <button class="btn btn-outline-primary play-audio" data-audio-id="{{ audio.audio.id }}">Play</button>
<button class="btn btn-outline-primary pause-audio" data-audio-id="{{ audio.audio.id }}">Pause</button> {% endcomment %}
<button class="btn btn-outline-danger delete-audio"
data-audio-id="{{ audio.audio.id }}">-</button>
</div>
</div>
{% endfor %}
.audio-player {
width: 500px; /* Ширина плеера */
}
.audio-player audio {
width: 100%;
height: 40px;
background-color: black;
}
js if it need:
var audioElements = document.querySelectorAll('audio');
var successMessage = $("#jq-notification");
audioElements.forEach(audio => {
audio.addEventListener('play', () => {
audioElements.forEach(element => {
if (element !== audio) {
element.pause();
element.currentTime = 0;
}
});
});
});
audioElements.forEach((audio, index) => {
audio.addEventListener('ended', () => {
const nextAudio = audioElements[index + 1];
if (nextAudio) {
nextAudio.play();
}
});
});
const volumeSlider = document.querySelector('.volume-slider');
volumeSlider.addEventListener('input', () => {
const volume = parseFloat(volumeSlider.value);
audioElements.forEach(audio => {
audio.volume = volume;
});
});
the best that was possible was to hide the entire element completely, but I needed some parts, a volume control for example, I was looking for answers, but I only found some super strange and complex approach in which there is no audio at all, and where there is, they have everything perfectly stylized, but for some reason I don’t have it
Help me please(