dsh-media-preview: Directly play audio/video in the DSH right preview panel

Introduction

When opening workspace files in DeepSeek Harness (DSH), the built-in document preview covers formats such as text, code, Markdown, images, PDF, HTML, Office, and spreadsheets. Although audio and video suffixes are recognized as “known binary containers,” they lack corresponding renderers, so the preview area only displays an icon and a prompt such as “Cannot preview this format.” To quickly inspect a media asset in a conversation or the file tree, users currently have to rely on the system player or drag the file out of the workspace.

Below is an introduction to the community plugin dsh-media-preview (maintained by 439436269-ctrl). It registers audio and video suffixes in the document preview located in the right Sidebar, playing media via native browser <video> / <audio> controls. Data is streamed via authenticated HTTP Range requests, avoiding loading entire files into memory or injecting them into the conversation context. The plugin is classified as a client-side plugin and currently has 0 stars on GitHub; source code and documentation are subject to the repository’s README.

What is this

dsh-media-preview is a client-side plugin for DeepSeek Harness (npm package name dsh-media-preview, see the repository package.json for the version, MIT license). In one sentence: it plays common videos (e.g., mp4, mov, mkv, webm) and audio (e.g., mp3, flac, wav) inside the right-hand preview pane, replacing the built-in empty state.

The plugin has no official affiliation with DeepSeek or High-Flyer. Information can be obtained from the community directory skillhub.cn plugin page or the GitHub repository. The DSH ecosystem emphasizes “everything is a plugin,” and the directory site is independent of vendor app stores.

Core Features

Document Preview Renderers

The plugin registers two document-preview implementations:

  • dsh-media-preview/media: Video suffixes
  • dsh-media-preview/audio: Audio suffixes

The priority is set to extension with loading: 'renderer', and suffixes are declared as binary to prevent fallback to “plain text” preview. The player uses native browser controls; videos are fitted within the preview area using object-fit: contain, allowing vertical or horizontal clips to be fully displayed with black bars filling the empty space. Below the video, options for Speed (cycling 1× → 1.25× → 1.5× → 1.75× → 2× → 0.5× → 0.75×), Loop, Full screen, and Picture in picture are provided. Audio also supports speed and loop, with selections remembered by the browser. Audio is displayed as a card showing the filename, size, and player. The page reports loaded / failed to the document preview to signal the end of the loading state for the tab.

Default claimed suffixes (configurable, see next section) include:

  • Video: mp4, m4v, mov, webm, ogv, ogg, mkv, avi, wmv, flv, 3gp, ts, m2ts, mts
  • Audio: mp3, wav, flac, m4a, aac, oga, opus, weba, wma, aiff, aif

Authenticated Streaming Route

The Host provides the route GET|HEAD /api/media-preview?path=<absolute path> (default path, configurable):

  • Normal responses return 200 with Accept-Ranges: bytes
  • Range requests return 206 with Content-Range
  • Unsatisfiable ranges return 416
  • HEAD returns headers only

Reading is chunked via ctx.fs.readByteRange (default chunkBytes is 1 MiB), ensuring stable memory usage. The route is mounted under /api/ and is subject to the composed connection service’s Host/Origin fencing and session cookie validation, preventing cross-site pages from reading local files. Files exceeding maxBytes (default 2 GiB) return 413.

Desktop Drag-to-Seek (loopback)

The desktop application serves pages from dsh-app://app and proxies requests via protocol.handle. Chromium collapses video.seekable to [0, 0] for custom protocol responses, so using only the authenticated route may allow playback but prevent seeking. By default, the plugin starts a temporary port on 127.0.0.1 and issues half of a capability token to the browser via GET /api/media-preview?discover=1. The player inside the desktop shell pulls the stream from this loopback source, allowing timeline scrubbing via standard HTTP Range requests. Pure browser environments still use the authenticated route. The loopback binds only to 127.0.0.1, and request paths must include a token generated at startup, otherwise a bare 404 is returned.

Installation and Activation

Run the official installation command in the target profile (as per the README):

dsh plugin --profile <profile> add dsh-media-preview

Then, restart the desktop application (profile patches are read at startup). No additional configuration is needed by default to cover common suffixes.

To verify loading: open any .mp4 in the Files tab; the preview pane should display a player instead of an unsupported format message.

package.json specifies Node >=22 and marks compatibility with DSH 0.2.0-rc.2 in plugin metadata; please check your local DSH version against the plugin’s release notes before installing.

Configuration (Optional)

Configuration is attached to the media-preview entry in the profile (Settings → Plugins, or profile patch). Keys have code-side defaults; some only need to be filled in if changed.

Key Default Description
enabled true Whether to mount the route; if off, renderers are still registered but byte transfer returns 503
routePath /api/media-preview Path must start with /api/, otherwise falls back to default to maintain auth fencing
loopback true Whether to enable the token-protected 127.0.0.1 source (desktop seek depends on this)
debug false When true, writes diagnostics to $DSH_HOME/media-preview-debug.log
maxBytes 2147483648 Maximum file size that can be served
chunkBytes 1048576 Bytes read per Range request
videoExtensions See README list Suffixes claimed by the video player
audioExtensions See README list Suffixes claimed by the audio player

The Host injects the route path into the page as __DSH_MEDIA_PREVIEW_CONFIG__, consistent with the player URL. When modifying suffix lists, sync them with the lists in lib/client.js.

Typical Usage

No command line is needed for daily use: after installation and restart, click a media file with a supported suffix in the workspace file tree or Files tab; the right-hand preview allows playback, speed adjustment, and looping. Videos support fullscreen or picture-in-picture.

For local development or regression testing, the repository provides:

node --test test/*.test.js

End-to-end probing for a Host with the plugin installed (replace port, token, and absolute video path as needed):

node scripts/e2e-browser.mjs --base http://127.0.0.1:<port> --token <token> --video "<absolute path to a video>"

Desktop seek shape can be tested with:

node scripts/e2e-seek.mjs --base http://127.0.0.1:<port> --token <token> --video "<absolute path to a video>" --simulate-desktop

Playback Capability and Known Limitations

Decoding capability depends on the browser; the plugin does not transcode. Chromium/Electron can typically play MP4 (H.264/AAC), WebM (VP8/VP9/Opus), Ogg, and most audio. Matroska (.mkv) and AVI often cannot be decoded in Chromium; the player will show a “Browser does not support this codec” prompt. The “Open in app” button in the preview header can still hand the file to the system player, but remuxing to MP4/WebM is a reliable solution.

Other limitations (excerpt from README):

  • Each request serves only one byte window; multi-range Range returns 416 (browser media elements usually request single windows)
  • No built-in playlists, subtitle tracks, or independent speed UI (except for the speed button provided by the plugin; others rely on native controls)
  • If environment policy blocks loopback, it automatically falls back to the authenticated route: playback remains possible, but desktop timeline seeking may fail

Use Cases and Notes

Suitable for agent developers or daily users who need to quickly audition or preview assets within the DSH workspace, especially when verifying audio/video content against scripts, annotations, or conversation context.

Please note before installation:

  • The plugin accesses the file system with current DSH process permissions; streaming reads still go through the composed fs policy and are as sensitive as directly opening workspace files.
  • Before installation, read the source code and the MIT license to confirm organizational policy allows pulling this package from npm / community directories.
  • Community directory and GitHub star counts do not represent security audit results; please evaluate the loopback port and /api/ route policies yourself in production or restricted network environments.

Conclusion

Through the steps above, dsh-media-preview supplements the DSH right-hand preview, turning “audio/video cannot be previewed” into seekable streaming playback (on desktop when loopback is enabled by default). It also controls single file size and chunked reading to avoid loading large files entirely. For further information, visit the community directory page and the GitHub repository.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye