Skip to content

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

Python

Docked video: drag-resizable height, persisted to localStorage

Murtaza Nasir2dc70f9754fc
diff --git a/static/css/styles.css b/static/css/styles.css
index e74ad961..bee0d82d 100644
--- a/static/css/styles.css
+++ b/static/css/styles.css
@@ -4407,10 +4407,35 @@ select:disabled {
flex-shrink: 0;
display: flex;
flex-direction: column;
- height: clamp(160px, 32vh, 380px);
+ /* Height is driven by an inline style bound to videoDockHeight
+ (drag-resizable, persisted). min-height is a floor in case. */
+ min-height: 120px;
border-top: var(--border-hairline) solid var(--border-primary);
background: var(--bg-secondary);
}
+/* Drag handle on the dock's content-facing edge. Thin, ns-resize, with a
+ centred grip line that strengthens on hover. */
+.video-dock__resizer {
+ flex-shrink: 0;
+ height: 6px;
+ cursor: ns-resize;
+ position: relative;
+}
+.video-dock__resizer::before {
+ content: '';
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ transform: translate(-50%, -50%);
+ width: 36px;
+ height: 2px;
+ border-radius: 2px;
+ background: var(--border-primary);
+ transition: background-color 0.15s ease;
+}
+.video-dock__resizer:hover::before {
+ background: var(--border-accent);
+}
.video-dock__bar {
display: flex;
align-items: center;
diff --git a/static/js/app.modular.js b/static/js/app.modular.js
index a4db8873..01a8d258 100644
--- a/static/js/app.modular.js
+++ b/static/js/app.modular.js
@@ -1163,6 +1163,41 @@ document.addEventListener('DOMContentLoaded', async () => {
videoDockPosition.value = col + '-' + (vert === 'bottom' ? 'top' : 'bottom');
_persistVideoDockPosition();
};
+ // Adjustable dock height, persisted to localStorage. Clamped to a
+ // sane min and a viewport-relative max at drag time.
+ const VIDEO_DOCK_MIN_H = 120;
+ const _videoDockMaxH = () => Math.round((window.innerHeight || 800) * 0.7);
+ const _storedDockHeight = (() => {
+ try { return parseInt(localStorage.getItem('videoDockHeight'), 10); } catch (e) { return NaN; }
+ })();
+ const videoDockHeight = ref(Number.isFinite(_storedDockHeight) && _storedDockHeight >= VIDEO_DOCK_MIN_H ? _storedDockHeight : 260);
+ // Drag the dock's content-facing edge to resize. Direction depends
+ // on which tile it's in: a bottom dock grows when its top edge is
+ // dragged up; a top dock grows when its bottom edge is dragged down.
+ const startVideoDockResize = (event) => {
+ event.preventDefault();
+ const startY = event.clientY;
+ const startH = videoDockHeight.value;
+ const isBottom = videoDockPosition.value.endsWith('bottom');
+ const maxH = _videoDockMaxH();
+ document.body.style.userSelect = 'none';
+ document.body.style.cursor = 'ns-resize';
+ const onMove = (e) => {
+ const dy = e.clientY - startY;
+ let h = startH + (isBottom ? -dy : dy);
+ h = Math.max(VIDEO_DOCK_MIN_H, Math.min(maxH, h));
+ videoDockHeight.value = h;
+ };
+ const onUp = () => {
+ document.removeEventListener('mousemove', onMove);
+ document.removeEventListener('mouseup', onUp);
+ document.body.style.userSelect = '';
+ document.body.style.cursor = '';
+ try { localStorage.setItem('videoDockHeight', String(videoDockHeight.value)); } catch (e) { /* ignore */ }
+ };
+ document.addEventListener('mousemove', onMove);
+ document.addEventListener('mouseup', onUp);
+ };
const videoFullscreen = ref(false);
const fullscreenControlsVisible = ref(true);
const fullscreenControlsTimer = ref(null);
@@ -1619,6 +1654,7 @@ document.addEventListener('DOMContentLoaded', async () => {
videoFullscreen, fullscreenControlsVisible, fullscreenControlsTimer, videoCollapsed,
videoDockEnabled, isVideoRecording, toggleVideoDock,
videoDockPosition, cycleVideoDockColumn, cycleVideoDockVertical,
+ videoDockHeight, startVideoDockResize,
// Column Resizing
leftColumnWidth, rightColumnWidth, isResizing,
diff --git a/static/locales/de.json b/static/locales/de.json
index 2dd81f21..3974f7b3 100644
--- a/static/locales/de.json
+++ b/static/locales/de.json
@@ -1521,6 +1521,7 @@
"dockRight": "In rechte Spalte verschieben",
"dockTop": "Nach oben verschieben",
"dockBottom": "Nach unten verschieben",
+ "dragToResize": "Zum Ändern der Größe ziehen",
"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 faa81745..b40bbb20 100644
--- a/static/locales/en.json
+++ b/static/locales/en.json
@@ -1530,6 +1530,7 @@
"dockRight": "Move to right column",
"dockTop": "Move to top",
"dockBottom": "Move to bottom",
+ "dragToResize": "Drag to resize",
"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 e878d95c..3458c7bb 100644
--- a/static/locales/es.json
+++ b/static/locales/es.json
@@ -1521,6 +1521,7 @@
"dockRight": "Mover a la columna derecha",
"dockTop": "Mover arriba",
"dockBottom": "Mover abajo",
+ "dragToResize": "Arrastra para redimensionar",
"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 341f87c3..0d5f8f0b 100644
--- a/static/locales/fr.json
+++ b/static/locales/fr.json
@@ -1521,6 +1521,7 @@
"dockRight": "Déplacer vers la colonne de droite",
"dockTop": "Déplacer en haut",
"dockBottom": "Déplacer en bas",
+ "dragToResize": "Glisser pour redimensionner",
"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 b0c9bca2..d03fcb71 100644
--- a/static/locales/pt-BR.json
+++ b/static/locales/pt-BR.json
@@ -1521,6 +1521,7 @@
"dockRight": "Mover para a coluna direita",
"dockTop": "Mover para o topo",
"dockBottom": "Mover para baixo",
+ "dragToResize": "Arraste para redimensionar",
"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 a7432b42..86f62491 100644
--- a/static/locales/ru.json
+++ b/static/locales/ru.json
@@ -1521,6 +1521,7 @@
"dockRight": "В правый столбец",
"dockTop": "Наверх",
"dockBottom": "Вниз",
+ "dragToResize": "Потяните, чтобы изменить размер",
"expand": "Развернуть",
"followPlayerDisabled": "Включить автопрокрутку - транскрипт следует за воспроизведением аудио",
"followPlayerEnabled": "Отключить автопрокрутку - транскрипт остаётся на месте",
diff --git a/static/locales/zh.json b/static/locales/zh.json
index 470a5ab5..8281f322 100644
--- a/static/locales/zh.json
+++ b/static/locales/zh.json
@@ -1521,6 +1521,7 @@
"dockRight": "移到右栏",
"dockTop": "移到顶部",
"dockBottom": "移到底部",
+ "dragToResize": "拖动以调整大小",
"expand": "展开",
"followPlayerDisabled": "启用自动滚动 - 文字记录跟随音频播放",
"followPlayerEnabled": "禁用自动滚动 - 文字记录保持位置",
diff --git a/templates/components/detail/_video-dock.html b/templates/components/detail/_video-dock.html
index 5fda1e11..3412aaa8 100644
--- a/templates/components/detail/_video-dock.html
+++ b/templates/components/detail/_video-dock.html
@@ -13,7 +13,13 @@
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">
+ class="video-dock"
+ :style="{ height: videoDockHeight + 'px' }">
+ {# Resize handle on the content-facing edge: top edge for a bottom dock,
+ bottom edge for a top dock. Drag to change the dock height. #}
+ {% if dock_pos.endswith('bottom') %}
+ <div class="video-dock__resizer" @mousedown="startVideoDockResize" :title="t('tooltips.dragToResize') || 'Drag to resize'"></div>
+ {% endif %}
<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>
@@ -44,4 +50,7 @@
@loadedmetadata="syncDockVideo"
@canplay="syncDockVideo"
@click="toggleAudioPlayback()"></video>
+ {% if dock_pos.endswith('top') %}
+ <div class="video-dock__resizer" @mousedown="startVideoDockResize" :title="t('tooltips.dragToResize') || 'Drag to resize'"></div>
+ {% endif %}
</div>