Add Safari DRM video playback via server-side decryption

Safari/iOS browsers lack Widevine EME support, so DRM videos couldn't play.
This adds a server-side decrypt-and-stream pipeline that reuses the existing
downloadDrmMedia() code to decrypt videos on demand, cache them, and serve
plain MP4s with Range support for native <video> playback.

- server/drm-stream.js: new router with decrypt, status, and serve endpoints
- client/src/components/ServerDrmVideo.jsx: decrypt→poll→play lifecycle component
- DrmVideo.jsx: Widevine detection, falls back to ServerDrmVideo for Safari
- MediaGrid.jsx: passes raw mpdUrl through to DrmVideo

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-02-16 12:30:26 -06:00
parent 1e5f54f60b
commit faa7dbf4d3
6 changed files with 301 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ import galleryRouter from './gallery.js';
import hlsRouter from './hls.js';
import settingsRouter from './settings.js';
import scrapeRouter from './scrape.js';
import drmStreamRouter from './drm-stream.js';
import { scanMediaFiles } from './gallery.js';
const __filename = fileURLToPath(import.meta.url);
@@ -34,6 +35,7 @@ app.use(galleryRouter);
app.use(hlsRouter);
app.use(settingsRouter);
app.use(scrapeRouter);
app.use(drmStreamRouter);
// Serve static client build in production
const clientDist = join(__dirname, '..', 'client', 'dist');