Skip to content

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

Python

Docked video v2: separate muted follower <video> (no teleport) synced to the main player

Murtaza Nasird56f92c98042
diff --git a/static/css/styles.css b/static/css/styles.css
index 8365fcd6..e74ad961 100644
--- a/static/css/styles.css
+++ b/static/css/styles.css
@@ -4399,6 +4399,40 @@ select:disabled {
}
/* ===== Video Fullscreen Overlay ===== */
+/* Docked video panel (desktop). A flex-shrink-0 strip at the bottom of the
+ transcript column; the flex-1 transcript scroller above shrinks to make
+ room (content pushed up, not overlaid). Holds a separate muted <video>
+ that mirrors the main player. */
+.video-dock {
+ flex-shrink: 0;
+ display: flex;
+ flex-direction: column;
+ height: clamp(160px, 32vh, 380px);
+ border-top: var(--border-hairline) solid var(--border-primary);
+ background: var(--bg-secondary);
+}
+.video-dock__bar {
+ display: flex;
+ align-items: center;
+ gap: var(--sp-2);
+ padding: var(--sp-1) var(--sp-2) var(--sp-1) var(--sp-3);
+ border-bottom: var(--border-hairline) solid var(--border-primary);
+ flex-shrink: 0;
+}
+.video-dock__title {
+ font-size: var(--fs-label);
+ font-weight: 600;
+ color: var(--text-secondary);
+}
+.video-dock__video {
+ flex: 1;
+ min-height: 0;
+ width: 100%;
+ object-fit: contain;
+ background: #000;
+ cursor: pointer;
+}
+
.video-fullscreen-overlay {
position: fixed;
inset: 0;
diff --git a/static/js/app.modular.js b/static/js/app.modular.js
index dbb3f9b4..a89ca644 100644
--- a/static/js/app.modular.js
+++ b/static/js/app.modular.js
@@ -1128,6 +1128,19 @@ document.addEventListener('DOMContentLoaded', async () => {
const showModalVolumeSlider = ref(false);
const showDuplicatesModal = ref(false);
const videoCollapsed = ref(false);
+ // Desktop docked-video panel: shows the video in a strip across
+ // the bottom of the transcript column via a SEPARATE muted
+ // <video id="dockVideoElement"> that follows the main player
+ // (no teleport — that crashed Vue's patcher previously).
+ // In-memory ref: off on fresh load, sticky across video
+ // recordings during the session.
+ const videoDockEnabled = ref(false);
+ const isVideoRecording = computed(() =>
+ !!(selectedRecording.value
+ && selectedRecording.value.mime_type
+ && selectedRecording.value.mime_type.startsWith('video/'))
+ );
+ const toggleVideoDock = () => { videoDockEnabled.value = !videoDockEnabled.value; };
const videoFullscreen = ref(false);
const fullscreenControlsVisible = ref(true);
const fullscreenControlsTimer = ref(null);
@@ -1582,6 +1595,7 @@ document.addEventListener('DOMContentLoaded', async () => {
modalAudioCurrentTime, modalAudioDuration, modalAudioIsPlaying, modalPlaybackRate,
playbackRate, showSpeedMenu, playbackSpeeds, speedMenuPosition, showVolumeSlider, showModalVolumeSlider,
videoFullscreen, fullscreenControlsVisible, fullscreenControlsTimer, videoCollapsed,
+ videoDockEnabled, isVideoRecording, toggleVideoDock,
// Column Resizing
leftColumnWidth, rightColumnWidth, isResizing,
diff --git a/static/js/modules/composables/ui.js b/static/js/modules/composables/ui.js
index ace85b55..483038d8 100644
--- a/static/js/modules/composables/ui.js
+++ b/static/js/modules/composables/ui.js
@@ -959,11 +959,14 @@ export function useUI(state, utils, processedTranscription) {
if (context === 'modal') {
audioPlayer = document.querySelector('audio.speaker-modal-transcript') || document.querySelector('video.speaker-modal-transcript');
} else {
- audioPlayer = document.querySelector('.main-content-area audio') || document.querySelector('.main-content-area video');
+ // Prefer the main player by id so we never seek the muted dock follower.
+ audioPlayer = document.getElementById('mainPlayerMedia')
+ || document.querySelector('.main-content-area audio')
+ || document.querySelector('.main-content-area video');
}
if (!audioPlayer) {
- audioPlayer = document.querySelector('audio') || document.querySelector('video');
+ audioPlayer = document.querySelector('audio') || document.querySelector('video:not(#dockVideoElement)');
}
if (audioPlayer && isFinite(time)) {
@@ -1008,13 +1011,43 @@ export function useUI(state, utils, processedTranscription) {
if (modalMedia) {
return modalMedia;
}
- // Fall back to main player in right column (desktop) or detail view (mobile)
+ // The main player element, addressed by id so it is never confused
+ // with the muted docked-video follower (#dockVideoElement), which
+ // must NOT be driven by the playback controls.
+ const mainMedia = document.getElementById('mainPlayerMedia');
+ if (mainMedia) return mainMedia;
+ // Fall back to main player in right column (desktop) or detail view
+ // (mobile). All generic matches exclude the dock follower.
return document.querySelector('#rightMainColumn audio') ||
document.querySelector('#rightMainColumn video') ||
- document.querySelector('.detail-view audio') ||
- document.querySelector('.detail-view video') ||
+ document.querySelector('.detail-view audio:not(#dockVideoElement)') ||
+ document.querySelector('.detail-view video:not(#dockVideoElement)') ||
document.querySelector('audio') ||
- document.querySelector('video');
+ document.querySelector('video:not(#dockVideoElement)');
+ };
+
+ // Keep the muted docked-video follower (#dockVideoElement, rendered in
+ // the transcript column when the user enables it) in step with the main
+ // player. It carries no audio — the main element is the single audio
+ // source — and just mirrors time / rate / play-state, correcting drift
+ // past a small threshold. No-op when the dock isn't mounted.
+ const syncDockVideo = () => {
+ const dock = document.getElementById('dockVideoElement');
+ if (!dock) return;
+ const main = getAudioElement();
+ if (!main || main === dock) return;
+ try {
+ if (!dock.muted) dock.muted = true;
+ if (Math.abs((dock.currentTime || 0) - (main.currentTime || 0)) > 0.3) {
+ dock.currentTime = main.currentTime;
+ }
+ if (dock.playbackRate !== main.playbackRate) dock.playbackRate = main.playbackRate;
+ if (main.paused) {
+ if (!dock.paused) dock.pause();
+ } else if (dock.paused) {
+ dock.play().catch(() => {});
+ }
+ } catch (e) { /* ignore transient media state errors */ }
};
const toggleAudioPlayback = () => {
@@ -1124,6 +1157,7 @@ export function useUI(state, utils, processedTranscription) {
const handleAudioPlayPause = (event) => {
audioIsPlaying.value = !event.target.paused;
+ syncDockVideo();
};
const handleAudioLoadedMetadata = (event) => {
@@ -1150,6 +1184,8 @@ export function useUI(state, utils, processedTranscription) {
const handleCustomAudioTimeUpdate = (event) => {
audioCurrentTime.value = event.target.currentTime;
+ // Keep the docked-video follower in step (drift-corrected; no-op when off).
+ syncDockVideo();
// Fallback: if duration wasn't set yet, try to get it now
if (!audioDuration.value || audioDuration.value === 0) {
@@ -2185,6 +2221,7 @@ export function useUI(state, utils, processedTranscription) {
// Audio player
seekAudio,
seekAudioFromEvent,
+ syncDockVideo,
onPlayerVolumeChange,
handleAudioTimeUpdate,
toggleFollowPlayerMode,
diff --git a/templates/components/detail/desktop-bottom-player.html b/templates/components/detail/desktop-bottom-player.html
index 969783bf..81b8babf 100644
--- a/templates/components/detail/desktop-bottom-player.html
+++ b/templates/components/detail/desktop-bottom-player.html
@@ -29,6 +29,7 @@
<component :is="selectedRecording.mime_type && selectedRecording.mime_type.startsWith('video/') ? 'video' : 'audio'"
ref="audioPlayerElement"
+ id="mainPlayerMedia"
:src="'/audio/' + selectedRecording.id"
:volume="playerVolume"
@play="handleAudioPlayPause"
@@ -139,6 +140,17 @@
style="box-shadow: 0 2px 6px rgba(0,0,0,0.3);"></div>
</div>
+ <!-- Video toggle (video files only): shows/hides the docked
+ video strip at the bottom of the transcript column. Accent
+ when on. -->
+ <button v-if="isVideoRecording"
+ @click="toggleVideoDock"
+ class="btn btn--icon flex-shrink-0"
+ :style="videoDockEnabled ? 'color: var(--text-accent);' : ''"
+ :title="videoDockEnabled ? t('tooltips.hideVideo') : t('tooltips.showVideo')">
+ <i :class="videoDockEnabled ? 'fas fa-video' : 'fas fa-video-slash'" class="text-sm"></i>
+ </button>
+
<!-- Playback speed -->
<div class="relative flex-shrink-0">
<button ref="speedButtonDesktop"
diff --git a/templates/components/detail/desktop-transcription-panel.html b/templates/components/detail/desktop-transcription-panel.html
index fc6febcd..b94788dc 100644
--- a/templates/components/detail/desktop-transcription-panel.html
+++ b/templates/components/detail/desktop-transcription-panel.html
@@ -277,4 +277,34 @@
</div>
</div>
</div>
+
+ <!-- Docked video (desktop). A SEPARATE muted <video> that mirrors the
+ main player (synced in ui.js syncDockVideo) — NOT a teleported copy
+ of the player element, which previously crashed Vue's patcher. It
+ carries no audio; the bottom player remains the single audio source.
+ As a flex-shrink-0 child after the flex-1 transcript scroller it
+ pushes the transcript up rather than overlaying it. v-if so it (and
+ its second video download) only exist while enabled. -->
+ <div v-if="isVideoRecording && videoDockEnabled && !videoFullscreen" class="video-dock">
+ <div class="video-dock__bar">
+ <i class="fas fa-video text-[var(--text-muted)]" style="font-size: 11px;"></i>
+ <span class="video-dock__title" v-text="t('tooltips.video')"></span>
+ <div class="flex-1"></div>
+ <button @click="enterVideoFullscreen" class="btn btn--icon btn--sm" :title="t('tooltips.enterFullscreen')">
+ <i class="fas fa-expand" style="font-size: 11px;"></i>
+ </button>
+ <button @click="toggleVideoDock" class="btn btn--icon btn--sm" :title="t('tooltips.hideVideo')">
+ <i class="fas fa-times text-xs"></i>
+ </button>
+ </div>
+ <video id="dockVideoElement"
+ class="video-dock__video"
+ :src="'/audio/' + selectedRecording.id"
+ muted
+ playsinline
+ preload="auto"
+ @loadedmetadata="syncDockVideo"
+ @canplay="syncDockVideo"
+ @click="toggleAudioPlayback()"></video>
+ </div>
</div>