Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

Add volume slider popups and mute visual indicators to all audio players

Murtaza Nasirab8da04b1b02
diff --git a/static/css/styles.css b/static/css/styles.css
index 0e279e02..0ec00fad 100644
--- a/static/css/styles.css
+++ b/static/css/styles.css
@@ -3069,6 +3069,62 @@ body {
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}
+/* Vertical volume slider (popup) */
+.volume-slider-vertical {
+ -webkit-appearance: none;
+ appearance: none;
+ background: transparent;
+ cursor: pointer;
+ writing-mode: vertical-lr;
+ direction: rtl;
+ width: 20px;
+}
+
+.volume-slider-vertical::-webkit-slider-runnable-track {
+ background: var(--border-accent);
+ opacity: 0.5;
+ width: 6px;
+ border-radius: 3px;
+}
+
+.dark .volume-slider-vertical::-webkit-slider-runnable-track {
+ background: var(--border-accent);
+ opacity: 0.6;
+}
+
+.volume-slider-vertical::-webkit-slider-thumb {
+ -webkit-appearance: none;
+ appearance: none;
+ width: 14px;
+ height: 14px;
+ border-radius: 50%;
+ background: var(--text-accent);
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
+ cursor: pointer;
+}
+
+.volume-slider-vertical::-moz-range-track {
+ background: var(--border-accent);
+ opacity: 0.5;
+ width: 6px;
+ border-radius: 3px;
+}
+
+.dark .volume-slider-vertical::-moz-range-track {
+ background: var(--border-accent);
+ opacity: 0.6;
+}
+
+.volume-slider-vertical::-moz-range-thumb {
+ width: 14px;
+ height: 14px;
+ border-radius: 50%;
+ background: var(--text-accent);
+ border: none;
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
+ cursor: pointer;
+}
+
/* Player play button - accent colored with proper contrast */
.player-play-button {
background-color: var(--text-accent);
diff --git a/static/js/app.modular.js b/static/js/app.modular.js
index 60aa63e6..b7016b4e 100644
--- a/static/js/app.modular.js
+++ b/static/js/app.modular.js
@@ -533,6 +533,8 @@ document.addEventListener('DOMContentLoaded', async () => {
const showSpeedMenu = ref(false);
const playbackSpeeds = [0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0];
const speedMenuPosition = ref({});
+ const showVolumeSlider = ref(false);
+ const showModalVolumeSlider = ref(false);
// --- Modal Audio Player State (Independent from main) ---
const modalAudioCurrentTime = ref(0);
@@ -709,7 +711,7 @@ document.addEventListener('DOMContentLoaded', async () => {
// Audio Player
playerVolume, audioIsPlaying, audioCurrentTime, audioDuration, audioIsMuted, audioIsLoading, asrEditorAudio,
modalAudioCurrentTime, modalAudioDuration, modalAudioIsPlaying, modalPlaybackRate,
- playbackRate, showSpeedMenu, playbackSpeeds, speedMenuPosition,
+ playbackRate, showSpeedMenu, playbackSpeeds, speedMenuPosition, showVolumeSlider, showModalVolumeSlider,
// Column Resizing
leftColumnWidth, rightColumnWidth, isResizing,
diff --git a/templates/components/detail/audio-player.html b/templates/components/detail/audio-player.html
index d7f3db7e..2d847fb6 100644
--- a/templates/components/detail/audio-player.html
+++ b/templates/components/detail/audio-player.html
@@ -91,12 +91,31 @@
<!-- Spacer -->
<div class="flex-1"></div>
- <!-- Volume Button -->
- <button @click="toggleAudioMute"
- class="w-8 h-8 flex items-center justify-center rounded-lg hover:bg-[var(--bg-primary)] text-[var(--text-accent)] hover:opacity-80 transition-all flex-shrink-0"
- :title="audioIsMuted ? t('tooltips.unmute') : t('tooltips.mute')">
- <i :class="audioIsMuted || playerVolume === 0 ? 'fas fa-volume-mute' : 'fas fa-volume-up'" class="text-sm"></i>
- </button>
+ <!-- Volume Control -->
+ <div class="relative flex items-center flex-shrink-0 group/vol"
+ @mouseenter="showVolumeSlider = true"
+ @mouseleave="showVolumeSlider = false">
+ <button @click="toggleAudioMute"
+ class="w-8 h-8 flex items-center justify-center rounded-lg hover:bg-[var(--bg-primary)] transition-all"
+ :class="audioIsMuted || playerVolume === 0 ? 'text-[var(--text-muted)]' : 'text-[var(--text-accent)]'"
+ :title="audioIsMuted ? t('tooltips.unmute') : t('tooltips.mute')">
+ <i :class="audioIsMuted || playerVolume === 0 ? 'fas fa-volume-mute' : playerVolume < 0.5 ? 'fas fa-volume-down' : 'fas fa-volume-up'" class="text-sm"></i>
+ </button>
+ <!-- Volume Slider (expands on hover, outer div is invisible hover bridge) -->
+ <div class="absolute top-full left-1/2 -translate-x-1/2 pt-2 z-50 transition-all duration-200"
+ :class="showVolumeSlider ? 'opacity-100 pointer-events-auto scale-100' : 'opacity-0 pointer-events-none scale-95'"
+ @mouseenter="showVolumeSlider = true"
+ @mouseleave="showVolumeSlider = false">
+ <div class="px-3 py-2 bg-[var(--bg-tertiary)] border border-[var(--border-accent)] rounded-lg shadow-xl flex flex-col items-center gap-1">
+ <span class="text-[10px] font-mono text-[var(--text-muted)]">${ Math.round(playerVolume * 100) }</span>
+ <input type="range" min="0" max="1" step="0.05"
+ :value="audioIsMuted ? 0 : playerVolume"
+ @input="(e) => setAudioVolume(parseFloat(e.target.value))"
+ class="volume-slider-vertical"
+ style="height: 80px;">
+ </div>
+ </div>
+ </div>
<!-- Download Button -->
<a :href="'/audio/' + selectedRecording.id + '?download=true'"
diff --git a/templates/components/detail/desktop-right-panel.html b/templates/components/detail/desktop-right-panel.html
index 610482ae..4b77bfe7 100644
--- a/templates/components/detail/desktop-right-panel.html
+++ b/templates/components/detail/desktop-right-panel.html
@@ -95,12 +95,13 @@
<!-- Volume Control - hidden on very narrow screens -->
<div class="hidden sm:flex items-center gap-1 flex-shrink-0">
<button @click="toggleAudioMute"
- class="w-8 h-8 flex items-center justify-center rounded-lg hover:bg-[var(--bg-primary)] text-[var(--text-accent)] hover:opacity-80 transition-all"
+ class="w-8 h-8 flex items-center justify-center rounded-lg hover:bg-[var(--bg-primary)] hover:opacity-80 transition-all"
+ :class="audioIsMuted || playerVolume === 0 ? 'text-[var(--text-muted)]' : 'text-[var(--text-accent)]'"
:title="audioIsMuted ? t('tooltips.unmute') : t('tooltips.mute')">
<i :class="audioIsMuted || playerVolume === 0 ? 'fas fa-volume-mute' : playerVolume < 0.5 ? 'fas fa-volume-down' : 'fas fa-volume-up'" class="text-sm"></i>
</button>
<input type="range" min="0" max="1" step="0.05"
- :value="playerVolume"
+ :value="audioIsMuted ? 0 : playerVolume"
@input="(e) => setAudioVolume(parseFloat(e.target.value))"
class="volume-slider w-16">
</div>
diff --git a/templates/modals/speaker-modal.html b/templates/modals/speaker-modal.html
index beb87b82..fb7c29d8 100644
--- a/templates/modals/speaker-modal.html
+++ b/templates/modals/speaker-modal.html
@@ -172,11 +172,30 @@
:style="{ width: modalAudioProgressPercent + '%' }">
</div>
</div>
- <!-- Volume -->
- <button @click="$refs.speakerModalAudioRef && ($refs.speakerModalAudioRef.muted = !$refs.speakerModalAudioRef.muted)"
- class="w-7 h-7 flex items-center justify-center rounded hover:bg-[var(--bg-tertiary)] text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-all flex-shrink-0">
- <i :class="playerVolume === 0 ? 'fas fa-volume-mute' : 'fas fa-volume-up'" class="text-xs"></i>
- </button>
+ <!-- Volume Control -->
+ <div class="relative flex items-center flex-shrink-0"
+ @mouseenter="showModalVolumeSlider = true"
+ @mouseleave="showModalVolumeSlider = false">
+ <button @click="if ($refs.speakerModalAudioRef) { $refs.speakerModalAudioRef.muted = !$refs.speakerModalAudioRef.muted; audioIsMuted = $refs.speakerModalAudioRef.muted; }"
+ class="w-7 h-7 flex items-center justify-center rounded hover:bg-[var(--bg-tertiary)] transition-all flex-shrink-0"
+ :class="audioIsMuted || playerVolume === 0 ? 'text-[var(--text-muted)]' : 'text-[var(--text-primary)]'">
+ <i :class="audioIsMuted || playerVolume === 0 ? 'fas fa-volume-mute' : playerVolume < 0.5 ? 'fas fa-volume-down' : 'fas fa-volume-up'" class="text-xs"></i>
+ </button>
+ <!-- Volume Slider Popup (outer div is invisible hover bridge) -->
+ <div class="absolute top-full left-1/2 -translate-x-1/2 pt-2 z-[9999] transition-all duration-200"
+ :class="showModalVolumeSlider ? 'opacity-100 pointer-events-auto scale-100' : 'opacity-0 pointer-events-none scale-95'"
+ @mouseenter="showModalVolumeSlider = true"
+ @mouseleave="showModalVolumeSlider = false">
+ <div class="px-2.5 py-2 bg-[var(--bg-tertiary)] border border-[var(--border-accent)] rounded-lg shadow-xl flex flex-col items-center gap-1">
+ <span class="text-[9px] font-mono text-[var(--text-muted)]">${ Math.round(playerVolume * 100) }</span>
+ <input type="range" min="0" max="1" step="0.05"
+ :value="audioIsMuted ? 0 : playerVolume"
+ @input="(e) => setAudioVolume(parseFloat(e.target.value))"
+ class="volume-slider-vertical"
+ style="height: 70px;">
+ </div>
+ </div>
+ </div>
<!-- Speed Control (compact - tap to cycle) -->
<button @click="cycleModalPlaybackRate(); if ($refs.speakerModalAudioRef) $refs.speakerModalAudioRef.playbackRate = modalPlaybackRate"
class="w-7 h-7 flex items-center justify-center rounded hover:bg-[var(--bg-tertiary)] text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-all flex-shrink-0"