跳过主要内容
F

dsh-video-preview

feifandiv/dsh-video-preview

在右侧边栏直接播放本地视频与音频:HTTP Range 流式读取让内存不随文件变大、不点播放不缓冲、侧边栏收起即暂停;浏览器解不了的格式一键交给本机播放器。

安装

dsh plugin --profile web add github:feifandiv/dsh-video-preview

README

Video Preview — play video & audio inside the DeepSeek Harness sidebar

npm

English | 中文

The problem

DeepSeek Harness (DSH) cannot play video inside the agent. Clicking a video file in the sidebar only shows a file-type icon and an "open in external app" button — to check one clip you must leave the agent, wait for a player, then switch back. Context, broken.

This plugin makes video and audio files play directly in DSH's right sidebar: click a file and the preview tab is the player. The playback surface is the mature open-source Plyr player (MIT); the plugin itself is only wiring.

Strengths

Lightweight is the primary design goal (the author fears agent tools getting dragged down by a player):

  • Memory stays flat at any file size — an authenticated HTTP Range (206) route streams 2 MiB windows from disk; the browser only buffers around the playhead. Multi-GB files don't move the needle
  • Nothing buffers until you press play — preload="metadata"; opening a preview reads metadata only
  • Forgotten tabs cost nothing — auto-pause when the pane collapses, the tab switches, or the page hides (fullscreen playback is never interrupted); a paused player decodes nothing
  • Closing releases everything — player destroyed, buffers dropped, requests aborted
  • Hardware decoding via Chromium — while playing, the cost is ≈ one browser tab playing video; no ffmpeg, no transcoding processes
  • Plyr vendored (~114 KB, MIT) — works offline, zero external CDN requests

Details that matter:

  • Vertical (9:16 phone) footage letterboxes correctly instead of cropping
  • Speed control (0.5–2x), fullscreen, keyboard shortcuts, volume/speed memory
  • Chinese & English UI following the DSH locale
  • Audio files included: MP3/M4A and friends play in place too

Graceful handoff for what browsers can't do:

  • When the engine can't decode a file, the preview shows one-click "Open in IINA" (reads OS file associations, default app first, with icons) and "Reveal in file manager"

Weaknesses (stated honestly)

  • Format ceiling: AVI, RMVB, WMV, FLV cannot play at all (browser engine limitation; they get the native-player fallback)
  • DTS/AC3 audio is silent: browsers hold no decode license for these — MKVs with such tracks play video without sound and without an error; you have to notice and use the header's "Open in app" control yourself
  • No pro playback features: no audio-track switching, no ASS subtitles, no frame stepping, no snapshots; HDR rendering is basic. This is a "confirm the footage" tool, not a screening room — watch seriously in a native player
  • Third-party plugin pinned to DSH versions: the preview extension API is rc-stage; major DSH upgrades may need a follow-up (fully tested on 0.2.2-rc.3)
  • One extra HTTP endpoint: the Host gains one authenticated streaming route (same security pattern as the built-in /api/file: browser auth + absolute-path validation + sandboxed filesystem)
  • Files being written get interrupted: the preview framework's auto-refresh reloads the player repeatedly while a file is still recording/transcoding

Supported formats

FormatStatusNotes
MP4 / M4V (H.264)✅The common case, fully supported
MOV (H.264/H.265)✅H.265 depends on OS decoding; macOS usually has hardware support
WebM (VP8/VP9/AV1)✅
MKV (H.264/VP9 video)✅AAC/MP3 audio fine; DTS/AC3 audio plays silent
MP3, M4A, AAC, OGG/Opus, WAV, FLAC✅Audio files
AVI / RMVB / WMV / FLV❌Preview offers the native-player fallback instead

Install

Option A: local directory (recommended)

git clone https://github.com/feifandiv/dsh-video-preview.git

In DSH, open Plugins → Add plugin and select the cloned directory.

Option B: npm tarball

npm pack @fanfan4589/dsh-video-preview
tar -xzf fanfan4589-dsh-video-preview-*.tgz

Then Add plugin → select the extracted package directory.

No Host restart needed; reload the web page once so the client module loads, then click any video/audio file.

Development

node src/build.mjs       # inline Plyr + styles into client.js
node src/test-host.mjs   # Host streaming route: 12 assertions (Range/redirects/error codes)
node src/test-client.mjs # Client module: load, registration, vendored-Plyr smoke test

index.js is the Host half (streaming route); src/client-main.js is the Client half (preview renderer), built into client.js. Rebuild after Client changes and reload the page.

License

MIT © 2026 feifandiv.

The vendored Plyr player is also MIT; its license text is kept at vendor/PLYR-LICENSE.md.

相关插件