Skip to content

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

Python

Docked video: movable to any of the 4 column tiles via contextual arrow buttons, position persisted

Murtaza Nasirb1aeb91fa72a
diff --git a/static/js/app.modular.js b/static/js/app.modular.js
index a89ca644..a4db8873 100644
--- a/static/js/app.modular.js
+++ b/static/js/app.modular.js
@@ -1141,6 +1141,28 @@ document.addEventListener('DOMContentLoaded', async () => {
&& selectedRecording.value.mime_type.startsWith('video/'))
);
const toggleVideoDock = () => { videoDockEnabled.value = !videoDockEnabled.value; };
+ // Which of the four column tiles the docked video parks in.
+ // Persisted to localStorage (unlike the on/off toggle, which is
+ // session-only). Validated against the known set so a stale/bad
+ // value can't render the dock into nowhere.
+ const _validDockPositions = ['left-top', 'left-bottom', 'right-top', 'right-bottom'];
+ const _storedDockPosition = (() => {
+ try { return localStorage.getItem('videoDockPosition'); } catch (e) { return null; }
+ })();
+ const videoDockPosition = ref(_validDockPositions.includes(_storedDockPosition) ? _storedDockPosition : 'left-bottom');
+ const _persistVideoDockPosition = () => {
+ try { localStorage.setItem('videoDockPosition', videoDockPosition.value); } catch (e) { /* ignore */ }
+ };
+ const cycleVideoDockColumn = () => {
+ const [col, vert] = videoDockPosition.value.split('-');
+ videoDockPosition.value = (col === 'left' ? 'right' : 'left') + '-' + vert;
+ _persistVideoDockPosition();
+ };
+ const cycleVideoDockVertical = () => {
+ const [col, vert] = videoDockPosition.value.split('-');
+ videoDockPosition.value = col + '-' + (vert === 'bottom' ? 'top' : 'bottom');
+ _persistVideoDockPosition();
+ };
const videoFullscreen = ref(false);
const fullscreenControlsVisible = ref(true);
const fullscreenControlsTimer = ref(null);
@@ -1596,6 +1618,7 @@ document.addEventListener('DOMContentLoaded', async () => {
playbackRate, showSpeedMenu, playbackSpeeds, speedMenuPosition, showVolumeSlider, showModalVolumeSlider,
videoFullscreen, fullscreenControlsVisible, fullscreenControlsTimer, videoCollapsed,
videoDockEnabled, isVideoRecording, toggleVideoDock,
+ videoDockPosition, cycleVideoDockColumn, cycleVideoDockVertical,
// Column Resizing
leftColumnWidth, rightColumnWidth, isResizing,
diff --git a/static/locales/de.json b/static/locales/de.json
index 11493874..2dd81f21 100644
--- a/static/locales/de.json
+++ b/static/locales/de.json
@@ -1517,6 +1517,10 @@
"exitFullscreen": "Vollbild beenden",
"video": "Video",
"enterFullscreen": "Vollbild",
+ "dockLeft": "In linke Spalte verschieben",
+ "dockRight": "In rechte Spalte verschieben",
+ "dockTop": "Nach oben verschieben",
+ "dockBottom": "Nach unten verschieben",
"expand": "Erweitern",
"followPlayerDisabled": "Automatisches Scrollen aktivieren - Transkript folgt der Audiowiedergabe",
"followPlayerEnabled": "Automatisches Scrollen deaktivieren - Transkript bleibt an Ort und Stelle",
diff --git a/static/locales/en.json b/static/locales/en.json
index d1cd0ca6..faa81745 100644
--- a/static/locales/en.json
+++ b/static/locales/en.json
@@ -1526,6 +1526,10 @@
"exitFullscreen": "Exit fullscreen",
"video": "Video",
"enterFullscreen": "Fullscreen",
+ "dockLeft": "Move to left column",
+ "dockRight": "Move to right column",
+ "dockTop": "Move to top",
+ "dockBottom": "Move to bottom",
"expand": "Expand",
"followPlayerDisabled": "Enable auto-scroll - transcript follows audio playback",
"followPlayerEnabled": "Disable auto-scroll - transcript stays in place",
diff --git a/static/locales/es.json b/static/locales/es.json
index 49181de6..e878d95c 100644
--- a/static/locales/es.json
+++ b/static/locales/es.json
@@ -1517,6 +1517,10 @@
"exitFullscreen": "Salir de pantalla completa",
"video": "Vídeo",
"enterFullscreen": "Pantalla completa",
+ "dockLeft": "Mover a la columna izquierda",
+ "dockRight": "Mover a la columna derecha",
+ "dockTop": "Mover arriba",
+ "dockBottom": "Mover abajo",
"expand": "Expandir",
"followPlayerDisabled": "Activar desplazamiento automático - la transcripción sigue la reproducción de audio",
"followPlayerEnabled": "Desactivar desplazamiento automático - la transcripción permanece en su lugar",
diff --git a/static/locales/fr.json b/static/locales/fr.json
index 363ccfeb..341f87c3 100644
--- a/static/locales/fr.json
+++ b/static/locales/fr.json
@@ -1517,6 +1517,10 @@
"exitFullscreen": "Quitter le plein écran",
"video": "Vidéo",
"enterFullscreen": "Plein écran",
+ "dockLeft": "Déplacer vers la colonne de gauche",
+ "dockRight": "Déplacer vers la colonne de droite",
+ "dockTop": "Déplacer en haut",
+ "dockBottom": "Déplacer en bas",
"expand": "Développer",
"followPlayerDisabled": "Activer le défilement automatique - la transcription suit la lecture audio",
"followPlayerEnabled": "Désactiver le défilement automatique - la transcription reste en place",
diff --git a/static/locales/pt-BR.json b/static/locales/pt-BR.json
index 5e3c8d0d..b0c9bca2 100644
--- a/static/locales/pt-BR.json
+++ b/static/locales/pt-BR.json
@@ -1517,6 +1517,10 @@
"exitFullscreen": "Sair da tela cheia",
"video": "Vídeo",
"enterFullscreen": "Tela cheia",
+ "dockLeft": "Mover para a coluna esquerda",
+ "dockRight": "Mover para a coluna direita",
+ "dockTop": "Mover para o topo",
+ "dockBottom": "Mover para baixo",
"expand": "Expandir",
"followPlayerDisabled": "Ativar deslocamento automático - transcrição acompanha reproducão de áudio",
"followPlayerEnabled": "Desativar deslocamento automático - transcrição fica no lugar",
diff --git a/static/locales/ru.json b/static/locales/ru.json
index 059f5541..a7432b42 100644
--- a/static/locales/ru.json
+++ b/static/locales/ru.json
@@ -1517,6 +1517,10 @@
"exitFullscreen": "Выйти из полноэкранного режима",
"video": "Видео",
"enterFullscreen": "Полный экран",
+ "dockLeft": "В левый столбец",
+ "dockRight": "В правый столбец",
+ "dockTop": "Наверх",
+ "dockBottom": "Вниз",
"expand": "Развернуть",
"followPlayerDisabled": "Включить автопрокрутку - транскрипт следует за воспроизведением аудио",
"followPlayerEnabled": "Отключить автопрокрутку - транскрипт остаётся на месте",
diff --git a/static/locales/zh.json b/static/locales/zh.json
index 9a47367d..470a5ab5 100644
--- a/static/locales/zh.json
+++ b/static/locales/zh.json
@@ -1517,6 +1517,10 @@
"exitFullscreen": "退出全屏",
"video": "视频",
"enterFullscreen": "全屏",
+ "dockLeft": "移到左栏",
+ "dockRight": "移到右栏",
+ "dockTop": "移到顶部",
+ "dockBottom": "移到底部",
"expand": "展开",
"followPlayerDisabled": "启用自动滚动 - 文字记录跟随音频播放",
"followPlayerEnabled": "禁用自动滚动 - 文字记录保持位置",
diff --git a/templates/components/detail/_video-dock.html b/templates/components/detail/_video-dock.html
new file mode 100644
index 00000000..5fda1e11
--- /dev/null
+++ b/templates/components/detail/_video-dock.html
@@ -0,0 +1,47 @@
+{# Reusable docked-video panel.
+ `dock_pos` (Jinja var, set by the caller via {% with %}) is one of:
+ 'left-top' | 'left-bottom' | 'right-top' | 'right-bottom'
+ This partial is included in all four column slots; only the one whose
+ dock_pos matches videoDockPosition actually renders (v-if), so a single
+ <video id="dockVideoElement"> exists at any time — no teleport, no
+ duplicate ids in the DOM. The video is a muted follower kept in step
+ with the main player by syncDockVideo() in ui.js.
+
+ The two arrow buttons are contextual:
+ - column button : move between the left and right columns
+ - vertical button: move between the top and bottom of the current column
+ so the dock can be parked in any of the four column tiles. The choice is
+ persisted to localStorage (videoDockPosition). #}
+<div v-if="isVideoRecording && videoDockEnabled && !videoFullscreen && videoDockPosition === '{{ dock_pos }}'"
+ 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>
+ <!-- Move to the other column (left <-> right) -->
+ <button @click="cycleVideoDockColumn" class="btn btn--icon btn--sm"
+ :title="videoDockPosition.startsWith('left') ? t('tooltips.dockRight') : t('tooltips.dockLeft')">
+ <i :class="videoDockPosition.startsWith('left') ? 'fas fa-arrow-right' : 'fas fa-arrow-left'" style="font-size: 11px;"></i>
+ </button>
+ <!-- Move within the column (top <-> bottom) -->
+ <button @click="cycleVideoDockVertical" class="btn btn--icon btn--sm"
+ :title="videoDockPosition.endsWith('bottom') ? t('tooltips.dockTop') : t('tooltips.dockBottom')">
+ <i :class="videoDockPosition.endsWith('bottom') ? 'fas fa-arrow-up' : 'fas fa-arrow-down'" style="font-size: 11px;"></i>
+ </button>
+ <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>
diff --git a/templates/components/detail/desktop-right-panel.html b/templates/components/detail/desktop-right-panel.html
index bb62ca2d..036498ab 100644
--- a/templates/components/detail/desktop-right-panel.html
+++ b/templates/components/detail/desktop-right-panel.html
@@ -3,6 +3,9 @@
spans the full content width and stays anchored at the bottom. -->
<div id="rightMainColumn" class="flex flex-col overflow-hidden" :style="{width: rightColumnWidth + '%'}">
+ <!-- Docked video, top-of-right-column slot (see _video-dock.html). -->
+ {% with dock_pos = 'right-top' %}{% include 'components/detail/_video-dock.html' %}{% endwith %}
+
<!-- Right-rail tab strip + per-tab action toolbar (design system v1).
One row carries tab navigation on the left and per-tab actions on
the right. No card chrome around the content — sections live
@@ -79,6 +82,9 @@
</div>
</div>
+ <!-- Docked video, bottom-of-right-column slot (see _video-dock.html). -->
+ {% with dock_pos = 'right-bottom' %}{% include 'components/detail/_video-dock.html' %}{% endwith %}
+
<!-- Chat is no longer inline — it lives in the floating dockable
panel (components/detail/floating-chat.html) which is mounted
at the detail-view level and teleported to <body>. -->
diff --git a/templates/components/detail/desktop-transcription-panel.html b/templates/components/detail/desktop-transcription-panel.html
index b94788dc..b6b141cd 100644
--- a/templates/components/detail/desktop-transcription-panel.html
+++ b/templates/components/detail/desktop-transcription-panel.html
@@ -1,5 +1,7 @@
<!-- Desktop Transcription Panel (Left Column) -->
<div id="leftMainColumn" class="flex flex-col overflow-hidden" :style="{width: leftColumnWidth + '%'}">
+ <!-- Docked video, top-of-left-column slot (see _video-dock.html). -->
+ {% with dock_pos = 'left-top' %}{% include 'components/detail/_video-dock.html' %}{% endwith %}
<!-- Transcription header (design system v1).
Matches the right-rail tab-bar pattern: 40px tab strip with the
title on the left and contextual toggles + action icons on the
@@ -278,33 +280,6 @@
</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>
+ <!-- Docked video, bottom-of-left-column slot (see _video-dock.html). -->
+ {% with dock_pos = 'left-bottom' %}{% include 'components/detail/_video-dock.html' %}{% endwith %}
</div>