Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
Identify Speakers modal: fix Next/Prev scroll jankiness + add collapsible video — two issues reported in the speaker modal; (1) jerky scroll + target speaker not visible after Next/Prev landed; root cause was scrollToSegmentIndex used 'smooth' behaviour against a virtual-scroll container, which is a fundamentally jerky combo because the browser animates scrollTop in 16ms steps and each step triggers a visibleRange recompute — rows in the destination region don't exist in the DOM yet so the user sees an empty band sliding past until the range catches up; ALSO no upward offset meant the navigated row landed flush at the viewport top edge (visually reading as 'cut off' even though it was technically visible); fix: switch to 'auto' (instant) which paints the new range in a single frame, AND offset upward by ~3 rows so the target lands a comfortable distance below the top with context segments above it; applies to both the speaker modal virtual scroller AND the main transcript virtual scroller (same root issue, just shows up most when speaker nav is the trigger); (2) video files take half the available vertical pane in the speaker modal so the transcript-with-context that Next/Prev relies on has almost no room — added speakerModalVideoCollapsed ref + toggleSpeakerModalVideo action, persisted via localStorage so the user only has to set it once; new button next to the speed control in the modal's audio-transport row (only shown when the recording is video) — fas-video / fas-video-slash icon toggle that flips the <video> element's class between 'w-full rounded-lg mb-2' and 'hidden'; element is always mounted so audio playback continues either way, only the visual rendering toggles, and the transcript pane gets back ~250 px of room when collapsed
Murtaza Nasir1ed4930a82fb
diff --git a/static/js/app.modular.js b/static/js/app.modular.jsindex e3a6404a..567500c0 100644--- a/static/js/app.modular.js+++ b/static/js/app.modular.js@@ -538,6 +538,21 @@ document.addEventListener('DOMContentLoaded', async () => {const showResetModal = ref(false);const showSpeakerModal = ref(false);const speakerModalTab = ref('speakers'); // 'speakers' or 'transcript' for mobile view+ // Whether the video player in the speaker modal is collapsed.+ // For video recordings the full <video> element by default eats+ // half the available vertical height in the right pane, leaving+ // very little room for the transcript-with-context that the+ // navigation buttons rely on. When collapsed the <video> hides+ // and only the audio-style transport controls remain, so the+ // transcript gets back ~250 px of room. Preference is persisted+ // to localStorage so the user only has to set it once.+ const speakerModalVideoCollapsed = ref(+ localStorage.getItem('speakerModalVideoCollapsed') === 'true'+ );+ const toggleSpeakerModalVideo = () => {+ speakerModalVideoCollapsed.value = !speakerModalVideoCollapsed.value;+ localStorage.setItem('speakerModalVideoCollapsed', String(speakerModalVideoCollapsed.value));+ };const showShareModal = ref(false);const showSharesListModal = ref(false);const showTextEditorModal = ref(false);@@ -1497,7 +1512,7 @@ document.addEventListener('DOMContentLoaded', async () => {// ModalsshowEditModal, showDeleteModal, showEditTagsModal, selectedNewTagId, tagSearchFilter,- showReprocessModal, showResetModal, showSpeakerModal, speakerModalTab, showShareModal, showSharesListModal,+ showReprocessModal, showResetModal, showSpeakerModal, speakerModalTab, speakerModalVideoCollapsed, toggleSpeakerModalVideo, showShareModal, showSharesListModal,showTextEditorModal, showAsrEditorModal, showCustomizeSummaryModal, customizeSummaryPrompt, customizeSummaryMode, editingRecording, editingTranscriptionContent,editingSegments, availableSpeakers, showEditSpeakersModal, editingSpeakersList,databaseSpeakers, editingSpeakerSuggestions,@@ -2222,12 +2237,31 @@ document.addEventListener('DOMContentLoaded', async () => {overscan: 10});- // Helper to scroll to a segment by index (for speaker navigation)+ // Helper to scroll to a segment by index (for speaker navigation).+ //+ // Two intentional choices here:+ //+ // 1. 'auto' (instant) behaviour, not 'smooth'. Smooth scrolling+ // a virtual-scroll container looks jerky in practice: the+ // browser animates the scrollTop in 16ms steps, each step+ // triggers a visibleRange recompute, and the rows in the+ // destination region don't exist yet so the user sees an+ // empty band sliding past until the range catches up. With+ // 'auto' the jump is instant and the new range paints in a+ // single frame.+ //+ // 2. Offset upward by ~3 rows so the target segment lands a+ // comfortable distance below the viewport top instead of+ // flush at the very top. Without the offset, the navigated+ // row touches the top edge of the container and the eye+ // reads it as "still cut off" — the user's confusion about+ // Adam "not being visible" after Next is this offset issue,+ // not the row genuinely missing.const scrollToSegmentIndex = (index) => {if (showSpeakerModal.value) {- speakerModalVirtualScroll.scrollToIndex(index, 'smooth');+ speakerModalVirtualScroll.scrollToIndex(Math.max(0, index - 3), 'auto');} else {- mainTranscriptVirtualScroll.scrollToIndex(index, 'smooth');+ mainTranscriptVirtualScroll.scrollToIndex(Math.max(0, index - 3), 'auto');}};diff --git a/templates/modals/speaker-modal.html b/templates/modals/speaker-modal.htmlindex 9c91aee0..499b2579 100644--- a/templates/modals/speaker-modal.html+++ b/templates/modals/speaker-modal.html@@ -132,11 +132,17 @@<i class="fas fa-user-secret"></i><span>Audio not stored in incognito mode</span></div>- <!-- Custom Audio/Video Player (Independent from main player) -->+ <!-- Custom Audio/Video Player (Independent from main player).+ The class chooses between three states: hidden (audio+ file — no video to show), hidden (video file but the+ user collapsed the panel via the toggle button below),+ or visible (video file, expanded). The element itself+ is always mounted so audio playback works regardless;+ only its visual rendering toggles. --><div v-else><component :is="selectedRecording.mime_type && selectedRecording.mime_type.startsWith('video/') ? 'video' : 'audio'"ref="speakerModalAudioRef"- :class="selectedRecording.mime_type && selectedRecording.mime_type.startsWith('video/') ? 'w-full rounded-lg mb-2' : 'hidden'"+ :class="(selectedRecording.mime_type && selectedRecording.mime_type.startsWith('video/') && !speakerModalVideoCollapsed) ? 'w-full rounded-lg mb-2' : 'hidden'":key="'speaker-modal-' + selectedRecording.id":src="'/audio/' + selectedRecording.id":volume="playerVolume"@@ -195,6 +201,18 @@title="Playback speed (tap to change)"><span class="text-[10px] font-semibold font-mono">${ formatPlaybackRate(modalPlaybackRate) }</span></button>+ <!-- Video collapse toggle — only shown when the+ current recording is video. Lets the user+ reclaim ~half the vertical pane for the+ transcript when they don't need to see the+ video frame; preference persists in+ localStorage. -->+ <button v-if="selectedRecording.mime_type && selectedRecording.mime_type.startsWith('video/')"+ @click="toggleSpeakerModalVideo"+ 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"+ :title="speakerModalVideoCollapsed ? 'Show video' : 'Hide video (audio-only view)'">+ <i :class="speakerModalVideoCollapsed ? 'fas fa-video' : 'fas fa-video-slash'" class="text-xs"></i>+ </button></div></div></div>