BlueGit

timfa filemanager

big stream

timfa Tim Falken · pushed by timfa

Authored 2026-05-08 · 6 months ago

Hash
37872c5fcf90febb4a3b4a860a34ebbbc8e0e333
Parent
ec1bfab7
2 files changed +43 −2
public/app.js +26 −2
@@ -65,6 +65,7 @@ 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_FORWARD_BUFFER_SECONDS = 60 * 60;
68 69 let videoJsLoaderPromise = null;
69 70
70 71 // ───────────────────────────────────────────────────────────────────────────
@@ -2354,17 +2355,40 @@ function ensureScript (id, src)
2354 2355
2355 2356 async function ensureVideoJsLoaded ()
2356 2357 {
2357 if (window.videojs) return window.videojs;
2358 if (window.videojs)
2359 {
2360 configureVideoJsBuffering(window.videojs);
2361 return window.videojs;
2362 }
2358 2363 if (!videoJsLoaderPromise)
2359 2364 {
2360 2365 videoJsLoaderPromise = Promise.all([
2361 2366 ensureStylesheet('videojs-styles', '/vendor/video.js/video-js.css'),
2362 2367 ensureScript('videojs-script', '/vendor/video.js/video.min.js'),
2363 ]).then(() => window.videojs);
2368 ]).then(() =>
2369 {
2370 configureVideoJsBuffering(window.videojs);
2371 return window.videojs;
2372 });
2364 2373 }
2365 2374 return videoJsLoaderPromise;
2366 2375 }
2367 2376
2377 function configureVideoJsBuffering (videojs)
2378 {
2379 if (!videojs || !videojs.Vhs || videojs.__filemanagerBufferingConfigured) return;
2380 videojs.__filemanagerBufferingConfigured = true;
2381
2382 try
2383 {
2384 videojs.Vhs.GOAL_BUFFER_LENGTH = VIDEO_FORWARD_BUFFER_SECONDS;
2385 videojs.Vhs.MAX_GOAL_BUFFER_LENGTH = VIDEO_FORWARD_BUFFER_SECONDS;
2386 } catch
2387 {
2388 // Ignore builds that do not expose VHS buffer configuration.
2389 }
2390 }
2391
2368 2392 async function createVideoStreamSessionForItem (item)
2369 2393 {
2370 2394 return api('POST', '/files/video-stream', { filePath: item.path });
@@ -65,6 +65,7 @@ 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_FORWARD_BUFFER_SECONDS = 60 * 60;
68let videoJsLoaderPromise = null;
69let videoJsLoaderPromise = null;
69
70
70// ───────────────────────────────────────────────────────────────────────────
71// ───────────────────────────────────────────────────────────────────────────
@@ -2354,17 +2355,40 @@ function ensureScript (id, src)
2354
2355
2355async function ensureVideoJsLoaded ()
2356async function ensureVideoJsLoaded ()
2356{
2357{
2357 if (window.videojs) return window.videojs;
2358 if (window.videojs)
2359 {
2360 configureVideoJsBuffering(window.videojs);
2361 return window.videojs;
2362 }
2358 if (!videoJsLoaderPromise)
2363 if (!videoJsLoaderPromise)
2359 {
2364 {
2360 videoJsLoaderPromise = Promise.all([
2365 videoJsLoaderPromise = Promise.all([
2361 ensureStylesheet('videojs-styles', '/vendor/video.js/video-js.css'),
2366 ensureStylesheet('videojs-styles', '/vendor/video.js/video-js.css'),
2362 ensureScript('videojs-script', '/vendor/video.js/video.min.js'),
2367 ensureScript('videojs-script', '/vendor/video.js/video.min.js'),
2363 ]).then(() => window.videojs);
2368 ]).then(() =>
2369 {
2370 configureVideoJsBuffering(window.videojs);
2371 return window.videojs;
2372 });
2364 }
2373 }
2365 return videoJsLoaderPromise;
2374 return videoJsLoaderPromise;
2366}
2375}
2367
2376
2377function configureVideoJsBuffering (videojs)
2378{
2379 if (!videojs || !videojs.Vhs || videojs.__filemanagerBufferingConfigured) return;
2380 videojs.__filemanagerBufferingConfigured = true;
2381
2382 try
2383 {
2384 videojs.Vhs.GOAL_BUFFER_LENGTH = VIDEO_FORWARD_BUFFER_SECONDS;
2385 videojs.Vhs.MAX_GOAL_BUFFER_LENGTH = VIDEO_FORWARD_BUFFER_SECONDS;
2386 } catch
2387 {
2388 // Ignore builds that do not expose VHS buffer configuration.
2389 }
2390}
2391
2368async function createVideoStreamSessionForItem (item)
2392async function createVideoStreamSessionForItem (item)
2369{
2393{
2370 return api('POST', '/files/video-stream', { filePath: item.path });
2394 return api('POST', '/files/video-stream', { filePath: item.path });
public/share.html +17 −0
@@ -247,10 +247,26 @@
247 247 'use strict';
248 248
249 249 const token = location.pathname.split('/').pop();
250 const VIDEO_FORWARD_BUFFER_SECONDS = 60 * 60;
250 251 let expiresAt = null;
251 252 let timerInterval = null;
252 253 let shareVideoPlayer = null;
253 254
255 function configureVideoJsBuffering ()
256 {
257 if (!window.videojs || !window.videojs.Vhs || window.videojs.__filemanagerBufferingConfigured) return;
258 window.videojs.__filemanagerBufferingConfigured = true;
259
260 try
261 {
262 window.videojs.Vhs.GOAL_BUFFER_LENGTH = VIDEO_FORWARD_BUFFER_SECONDS;
263 window.videojs.Vhs.MAX_GOAL_BUFFER_LENGTH = VIDEO_FORWARD_BUFFER_SECONDS;
264 } catch
265 {
266 // Ignore builds that do not expose VHS buffer configuration.
267 }
268 }
269
254 270 // ── Timer ───────────────────────────────────────────────────────────────
255 271 function startTimer ()
256 272 {
@@ -422,6 +438,7 @@
422 438 .then(({ ok, data }) =>
423 439 {
424 440 if (!ok) throw new Error(data.error || 'Streaming failed');
441 configureVideoJsBuffering();
425 442
426 443 const video = document.createElement('video');
427 444 video.className = 'video-js vjs-big-play-centered';
@@ -247,10 +247,26 @@
247 'use strict';
247 'use strict';
248
248
249 const token = location.pathname.split('/').pop();
249 const token = location.pathname.split('/').pop();
250 const VIDEO_FORWARD_BUFFER_SECONDS = 60 * 60;
250 let expiresAt = null;
251 let expiresAt = null;
251 let timerInterval = null;
252 let timerInterval = null;
252 let shareVideoPlayer = null;
253 let shareVideoPlayer = null;
253
254
255 function configureVideoJsBuffering ()
256 {
257 if (!window.videojs || !window.videojs.Vhs || window.videojs.__filemanagerBufferingConfigured) return;
258 window.videojs.__filemanagerBufferingConfigured = true;
259
260 try
261 {
262 window.videojs.Vhs.GOAL_BUFFER_LENGTH = VIDEO_FORWARD_BUFFER_SECONDS;
263 window.videojs.Vhs.MAX_GOAL_BUFFER_LENGTH = VIDEO_FORWARD_BUFFER_SECONDS;
264 } catch
265 {
266 // Ignore builds that do not expose VHS buffer configuration.
267 }
268 }
269
254 // ── Timer ───────────────────────────────────────────────────────────────
270 // ── Timer ───────────────────────────────────────────────────────────────
255 function startTimer ()
271 function startTimer ()
256 {
272 {
@@ -422,6 +438,7 @@
422 .then(({ ok, data }) =>
438 .then(({ ok, data }) =>
423 {
439 {
424 if (!ok) throw new Error(data.error || 'Streaming failed');
440 if (!ok) throw new Error(data.error || 'Streaming failed');
441 configureVideoJsBuffering();
425
442
426 const video = document.createElement('video');
443 const video = document.createElement('video');
427 video.className = 'video-js vjs-big-play-centered';
444 video.className = 'video-js vjs-big-play-centered';