BlueGit

timfa filemanager

Apply minimal caption overrides for Video.js defaults

timfa Tim Falken · pushed by timfa

Authored 2026-05-08 · 6 months ago

Hash
ee1b6cb23a0931276e39b3db396ff55eb58a0043
Parent
b9d7f07c
5 files changed +9 −37
.github/technical-reference.md +3 −3
@@ -86,7 +86,7 @@
86 86 - Standalone public share page served at /share/:token; no auth required.
87 87 - Timer bar - Live HH:MM:SS countdown showing remaining validity; turns red and disables download when expired.
88 88 - tryPreview(name, isDir) - Renders inline preview (img/video/audio/text pre); no-op for unsupported types or directories.
89 - Share video preview - Uses the same Video.js playback behaviour as app previews: VOD UI enforcement, long forward buffer, forced caption-style defaults, and subtitle/audio track restore/save by matching track names when available.
89 - Share video preview - Uses the same Video.js playback behaviour as app previews: VOD UI enforcement, long forward buffer, forced caption overrides (text background opacity transparent + text edge style uniform), and subtitle/audio track restore/save by matching track names when available.
90 90 - Fetches /api/share/info/:token on load; shows error state for 404/410 responses.
91 91 - Download link points to /api/share/download/:token; labelled "Download als .zip" for directories.
92 92
@@ -125,7 +125,7 @@
125 125 - disconnectThumbnailObserver() - Clears active IntersectionObserver when the grid is rebuilt.
126 126 - setThumbnailPending(iconEl, pending) - Toggles per-icon pending spinner state while a cached image thumbnail is not ready yet.
127 127 - buildThumbnailSource(item, blob, kind) - Produces thumbnail image source (data/blob URL) for icon injection.
128 - renderStreamedVideoPreview(item, targetEl) - Creates the Video.js player with HLS source/track config, enforces non-live playback UI for file streams, uses container-fill sizing to keep previews within bounds, restores per-user video prefs (volume + subtitle/audio track names when present), forces default caption style presets on each open, reports watch progress, and warns when subtitle streams exist but none are web-compatible.
128 - renderStreamedVideoPreview(item, targetEl) - Creates the Video.js player with HLS source/track config, enforces non-live playback UI for file streams, uses container-fill sizing to keep previews within bounds, restores per-user video prefs (volume + subtitle/audio track names when present), forces caption overrides on each open (text background opacity transparent + text edge style uniform), reports watch progress, and warns when subtitle streams exist but none are web-compatible.
129 129 - closePreview(opts) - Closes expanded previews; video previews ignore backdrop close and require explicit close action.
130 130
131 131 ## tests/thumbnail-cache.test.js
@@ -205,7 +205,7 @@
205 205 - video preview restores saved subtitle/audio track names when available - Verifies per-user subtitle/audio selections are reapplied by matching track names.
206 206 - video preview keeps default tracks when saved names are not present - Verifies subtitle/audio defaults remain unchanged when saved names are missing.
207 207 - video preview saves subtitle/audio track names per user when selection changes - Verifies subtitle/audio selections are persisted into per-user video preferences.
208 - video preview applies default caption style per open - Verifies requested caption defaults are always loaded into Video.js settings.
208 - video preview applies caption overrides per open - Verifies requested caption overrides are always loaded into Video.js settings.
209 209 - video preview does not save caption style settings per user on close - Verifies caption style changes are not persisted to per-user video preferences.
210 210
211 211 ## tests/video-stream.test.js
@@ -86,7 +86,7 @@
86- Standalone public share page served at /share/:token; no auth required.
86- Standalone public share page served at /share/:token; no auth required.
87- Timer bar - Live HH:MM:SS countdown showing remaining validity; turns red and disables download when expired.
87- Timer bar - Live HH:MM:SS countdown showing remaining validity; turns red and disables download when expired.
88- tryPreview(name, isDir) - Renders inline preview (img/video/audio/text pre); no-op for unsupported types or directories.
88- tryPreview(name, isDir) - Renders inline preview (img/video/audio/text pre); no-op for unsupported types or directories.
89- Share video preview - Uses the same Video.js playback behaviour as app previews: VOD UI enforcement, long forward buffer, forced caption-style defaults, and subtitle/audio track restore/save by matching track names when available.
89- Share video preview - Uses the same Video.js playback behaviour as app previews: VOD UI enforcement, long forward buffer, forced caption overrides (text background opacity transparent + text edge style uniform), and subtitle/audio track restore/save by matching track names when available.
90- Fetches /api/share/info/:token on load; shows error state for 404/410 responses.
90- Fetches /api/share/info/:token on load; shows error state for 404/410 responses.
91- Download link points to /api/share/download/:token; labelled "Download als .zip" for directories.
91- Download link points to /api/share/download/:token; labelled "Download als .zip" for directories.
92
92
@@ -125,7 +125,7 @@
125- disconnectThumbnailObserver() - Clears active IntersectionObserver when the grid is rebuilt.
125- disconnectThumbnailObserver() - Clears active IntersectionObserver when the grid is rebuilt.
126- setThumbnailPending(iconEl, pending) - Toggles per-icon pending spinner state while a cached image thumbnail is not ready yet.
126- setThumbnailPending(iconEl, pending) - Toggles per-icon pending spinner state while a cached image thumbnail is not ready yet.
127- buildThumbnailSource(item, blob, kind) - Produces thumbnail image source (data/blob URL) for icon injection.
127- buildThumbnailSource(item, blob, kind) - Produces thumbnail image source (data/blob URL) for icon injection.
128- renderStreamedVideoPreview(item, targetEl) - Creates the Video.js player with HLS source/track config, enforces non-live playback UI for file streams, uses container-fill sizing to keep previews within bounds, restores per-user video prefs (volume + subtitle/audio track names when present), forces default caption style presets on each open, reports watch progress, and warns when subtitle streams exist but none are web-compatible.
128- renderStreamedVideoPreview(item, targetEl) - Creates the Video.js player with HLS source/track config, enforces non-live playback UI for file streams, uses container-fill sizing to keep previews within bounds, restores per-user video prefs (volume + subtitle/audio track names when present), forces caption overrides on each open (text background opacity transparent + text edge style uniform), reports watch progress, and warns when subtitle streams exist but none are web-compatible.
129- closePreview(opts) - Closes expanded previews; video previews ignore backdrop close and require explicit close action.
129- closePreview(opts) - Closes expanded previews; video previews ignore backdrop close and require explicit close action.
130
130
131## tests/thumbnail-cache.test.js
131## tests/thumbnail-cache.test.js
@@ -205,7 +205,7 @@
205- video preview restores saved subtitle/audio track names when available - Verifies per-user subtitle/audio selections are reapplied by matching track names.
205- video preview restores saved subtitle/audio track names when available - Verifies per-user subtitle/audio selections are reapplied by matching track names.
206- video preview keeps default tracks when saved names are not present - Verifies subtitle/audio defaults remain unchanged when saved names are missing.
206- video preview keeps default tracks when saved names are not present - Verifies subtitle/audio defaults remain unchanged when saved names are missing.
207- video preview saves subtitle/audio track names per user when selection changes - Verifies subtitle/audio selections are persisted into per-user video preferences.
207- video preview saves subtitle/audio track names per user when selection changes - Verifies subtitle/audio selections are persisted into per-user video preferences.
208- video preview applies default caption style per open - Verifies requested caption defaults are always loaded into Video.js settings.
208- video preview applies caption overrides per open - Verifies requested caption overrides are always loaded into Video.js settings.
209- video preview does not save caption style settings per user on close - Verifies caption style changes are not persisted to per-user video preferences.
209- video preview does not save caption style settings per user on close - Verifies caption style changes are not persisted to per-user video preferences.
210
210
211## tests/video-stream.test.js
211## tests/video-stream.test.js
public/app.js +3 −10
@@ -65,16 +65,9 @@ const MOBILE_LONG_PRESS_MOVE_THRESHOLD = 10;
65 65 const THUMB_OBSERVER_ROOT_MARGIN = '120px';
66 66 const VIDEO_PREFS_KEY_PREFIX = 'filemanager.video-prefs.v1.';
67 67 const VIDEO_TEXT_TRACK_SETTINGS_KEY = 'vjs-text-track-settings';
68 const VIDEO_TEXT_TRACK_DEFAULT_SETTINGS_RAW = JSON.stringify({
69 color: '#fff',
70 textOpacity: '1',
71 backgroundColor: '#000',
68 const VIDEO_TEXT_TRACK_OVERRIDE_SETTINGS_RAW = JSON.stringify({
72 69 backgroundOpacity: '0',
73 windowColor: '#000',
74 windowOpacity: '0',
75 fontPercent: '1.00',
76 70 edgeStyle: 'uniform',
77 fontFamily: 'proportionalSansSerif',
78 71 });
79 72 const VIDEO_FORWARD_BUFFER_SECONDS = 60 * 60;
80 73 let videoJsLoaderPromise = null;
@@ -250,8 +243,8 @@ function applyUserVideoTextTrackPrefs ()
250 243 {
251 244 try
252 245 {
253 // Always force known caption defaults to avoid stale user overrides.
254 localStorage.setItem(VIDEO_TEXT_TRACK_SETTINGS_KEY, VIDEO_TEXT_TRACK_DEFAULT_SETTINGS_RAW);
246 // Only override the two requested defaults and leave other settings at Video.js defaults.
247 localStorage.setItem(VIDEO_TEXT_TRACK_SETTINGS_KEY, VIDEO_TEXT_TRACK_OVERRIDE_SETTINGS_RAW);
255 248 } catch
256 249 {
257 250 // Ignore localStorage failures.
@@ -65,16 +65,9 @@ const MOBILE_LONG_PRESS_MOVE_THRESHOLD = 10;
65const THUMB_OBSERVER_ROOT_MARGIN = '120px';
65const THUMB_OBSERVER_ROOT_MARGIN = '120px';
66const VIDEO_PREFS_KEY_PREFIX = 'filemanager.video-prefs.v1.';
66const VIDEO_PREFS_KEY_PREFIX = 'filemanager.video-prefs.v1.';
67const VIDEO_TEXT_TRACK_SETTINGS_KEY = 'vjs-text-track-settings';
67const VIDEO_TEXT_TRACK_SETTINGS_KEY = 'vjs-text-track-settings';
68const VIDEO_TEXT_TRACK_DEFAULT_SETTINGS_RAW = JSON.stringify({
68const VIDEO_TEXT_TRACK_OVERRIDE_SETTINGS_RAW = JSON.stringify({
69 color: '#fff',
70 textOpacity: '1',
71 backgroundColor: '#000',
72 backgroundOpacity: '0',
69 backgroundOpacity: '0',
73 windowColor: '#000',
74 windowOpacity: '0',
75 fontPercent: '1.00',
76 edgeStyle: 'uniform',
70 edgeStyle: 'uniform',
77 fontFamily: 'proportionalSansSerif',
78});
71});
79const VIDEO_FORWARD_BUFFER_SECONDS = 60 * 60;
72const VIDEO_FORWARD_BUFFER_SECONDS = 60 * 60;
80let videoJsLoaderPromise = null;
73let videoJsLoaderPromise = null;
@@ -250,8 +243,8 @@ function applyUserVideoTextTrackPrefs ()
250{
243{
251 try
244 try
252 {
245 {
253 // Always force known caption defaults to avoid stale user overrides.
246 // Only override the two requested defaults and leave other settings at Video.js defaults.
254 localStorage.setItem(VIDEO_TEXT_TRACK_SETTINGS_KEY, VIDEO_TEXT_TRACK_DEFAULT_SETTINGS_RAW);
247 localStorage.setItem(VIDEO_TEXT_TRACK_SETTINGS_KEY, VIDEO_TEXT_TRACK_OVERRIDE_SETTINGS_RAW);
255 } catch
248 } catch
256 {
249 {
257 // Ignore localStorage failures.
250 // Ignore localStorage failures.
public/share.html +3 −10
@@ -250,16 +250,9 @@
250 250 const VIDEO_FORWARD_BUFFER_SECONDS = 60 * 60;
251 251 const SHARE_VIDEO_PREFS_KEY = 'filemanager.share-video-prefs.v1';
252 252 const VIDEO_TEXT_TRACK_SETTINGS_KEY = 'vjs-text-track-settings';
253 const VIDEO_TEXT_TRACK_DEFAULT_SETTINGS_RAW = JSON.stringify({
254 color: '#fff',
255 textOpacity: '1',
256 backgroundColor: '#000',
253 const VIDEO_TEXT_TRACK_OVERRIDE_SETTINGS_RAW = JSON.stringify({
257 254 backgroundOpacity: '0',
258 windowColor: '#000',
259 windowOpacity: '0',
260 fontPercent: '1.00',
261 255 edgeStyle: 'uniform',
262 fontFamily: 'proportionalSansSerif',
263 256 });
264 257 let expiresAt = null;
265 258 let timerInterval = null;
@@ -296,8 +289,8 @@
296 289 {
297 290 try
298 291 {
299 // Always force known caption defaults to avoid stale user overrides.
300 localStorage.setItem(VIDEO_TEXT_TRACK_SETTINGS_KEY, VIDEO_TEXT_TRACK_DEFAULT_SETTINGS_RAW);
292 // Only override the two requested defaults and leave other settings at Video.js defaults.
293 localStorage.setItem(VIDEO_TEXT_TRACK_SETTINGS_KEY, VIDEO_TEXT_TRACK_OVERRIDE_SETTINGS_RAW);
301 294 } catch
302 295 {
303 296 // Ignore localStorage failures.
@@ -250,16 +250,9 @@
250 const VIDEO_FORWARD_BUFFER_SECONDS = 60 * 60;
250 const VIDEO_FORWARD_BUFFER_SECONDS = 60 * 60;
251 const SHARE_VIDEO_PREFS_KEY = 'filemanager.share-video-prefs.v1';
251 const SHARE_VIDEO_PREFS_KEY = 'filemanager.share-video-prefs.v1';
252 const VIDEO_TEXT_TRACK_SETTINGS_KEY = 'vjs-text-track-settings';
252 const VIDEO_TEXT_TRACK_SETTINGS_KEY = 'vjs-text-track-settings';
253 const VIDEO_TEXT_TRACK_DEFAULT_SETTINGS_RAW = JSON.stringify({
253 const VIDEO_TEXT_TRACK_OVERRIDE_SETTINGS_RAW = JSON.stringify({
254 color: '#fff',
255 textOpacity: '1',
256 backgroundColor: '#000',
257 backgroundOpacity: '0',
254 backgroundOpacity: '0',
258 windowColor: '#000',
259 windowOpacity: '0',
260 fontPercent: '1.00',
261 edgeStyle: 'uniform',
255 edgeStyle: 'uniform',
262 fontFamily: 'proportionalSansSerif',
263 });
256 });
264 let expiresAt = null;
257 let expiresAt = null;
265 let timerInterval = null;
258 let timerInterval = null;
@@ -296,8 +289,8 @@
296 {
289 {
297 try
290 try
298 {
291 {
299 // Always force known caption defaults to avoid stale user overrides.
292 // Only override the two requested defaults and leave other settings at Video.js defaults.
300 localStorage.setItem(VIDEO_TEXT_TRACK_SETTINGS_KEY, VIDEO_TEXT_TRACK_DEFAULT_SETTINGS_RAW);
293 localStorage.setItem(VIDEO_TEXT_TRACK_SETTINGS_KEY, VIDEO_TEXT_TRACK_OVERRIDE_SETTINGS_RAW);
301 } catch
294 } catch
302 {
295 {
303 // Ignore localStorage failures.
296 // Ignore localStorage failures.
tests/page.load.test.js +0 −7
@@ -7,15 +7,8 @@ const { once } = require('events');
7 7 const { webcrypto } = require('crypto');
8 8
9 9 const DEFAULT_VIDEO_TEXT_TRACK_SETTINGS_RAW = JSON.stringify({
10 color: '#fff',
11 textOpacity: '1',
12 backgroundColor: '#000',
13 10 backgroundOpacity: '0',
14 windowColor: '#000',
15 windowOpacity: '0',
16 fontPercent: '1.00',
17 11 edgeStyle: 'uniform',
18 fontFamily: 'proportionalSansSerif',
19 12 });
20 13
21 14 describe('page load smoke test', () =>
@@ -7,15 +7,8 @@ const { once } = require('events');
7const { webcrypto } = require('crypto');
7const { webcrypto } = require('crypto');
8
8
9const DEFAULT_VIDEO_TEXT_TRACK_SETTINGS_RAW = JSON.stringify({
9const DEFAULT_VIDEO_TEXT_TRACK_SETTINGS_RAW = JSON.stringify({
10 color: '#fff',
11 textOpacity: '1',
12 backgroundColor: '#000',
13 backgroundOpacity: '0',
10 backgroundOpacity: '0',
14 windowColor: '#000',
15 windowOpacity: '0',
16 fontPercent: '1.00',
17 edgeStyle: 'uniform',
11 edgeStyle: 'uniform',
18 fontFamily: 'proportionalSansSerif',
19});
12});
20
13
21describe('page load smoke test', () =>
14describe('page load smoke test', () =>
tests/share.page.load.test.js +0 −7
@@ -8,15 +8,8 @@ const { webcrypto } = require('crypto');
8 8
9 9 const SHARE_VIDEO_PREFS_KEY = 'filemanager.share-video-prefs.v1';
10 10 const DEFAULT_VIDEO_TEXT_TRACK_SETTINGS_RAW = JSON.stringify({
11 color: '#fff',
12 textOpacity: '1',
13 backgroundColor: '#000',
14 11 backgroundOpacity: '0',
15 windowColor: '#000',
16 windowOpacity: '0',
17 fontPercent: '1.00',
18 12 edgeStyle: 'uniform',
19 fontFamily: 'proportionalSansSerif',
20 13 });
21 14
22 15 describe('share page video preview', () =>
@@ -8,15 +8,8 @@ const { webcrypto } = require('crypto');
8
8
9const SHARE_VIDEO_PREFS_KEY = 'filemanager.share-video-prefs.v1';
9const SHARE_VIDEO_PREFS_KEY = 'filemanager.share-video-prefs.v1';
10const DEFAULT_VIDEO_TEXT_TRACK_SETTINGS_RAW = JSON.stringify({
10const DEFAULT_VIDEO_TEXT_TRACK_SETTINGS_RAW = JSON.stringify({
11 color: '#fff',
12 textOpacity: '1',
13 backgroundColor: '#000',
14 backgroundOpacity: '0',
11 backgroundOpacity: '0',
15 windowColor: '#000',
16 windowOpacity: '0',
17 fontPercent: '1.00',
18 edgeStyle: 'uniform',
12 edgeStyle: 'uniform',
19 fontFamily: 'proportionalSansSerif',
20});
13});
21
14
22describe('share page video preview', () =>
15describe('share page video preview', () =>