Introduction¶
When assistant messages or tool results contain local audio/video/image paths, or online http(s) media links, they are automatically replaced with inline <audio> / <video controls playsInline> / <img> preview components.
Features¶
This plugin runs in unrestricted mode, meaning any file path readable by the DSH process can be accessed. Permission or I/O errors are returned with explicit HTTP status codes, allowing browser native players to present meaningful error messages.
- Range request support: Supports
bytes=start-endrequests, returning206 Partial Content, so that<video>tags can properly seek the progress bar. - Full-file reading: Uses
GETrequests by default, returning200 OK. - Caching policy: Response headers include
Cache-Control: private, max-age=60. - Path safety: The client-side regex only matches specific root paths (
/Users,/tmp,/private/tmp,/var/folders,/var/tmp) plus 15 extensions, avoiding false matches on external URLs. It also supports UTF-8-safe path encoding. - Style cleanup: When the plugin is uninstalled, the client Fiber automatically removes the injected
<style>.
Supported Formats¶
The plugin supports local paths and online links. The supported extensions are as follows:
- Audio/video (15 types):
mp3,wav,m4a,flac,ogg,opus,aac,mp4,mov,mkv,m4v,webm,avi,3gp,ogv - Images (12 types):
png,jpg,jpeg,gif,bmp,webp,svg,tiff,ico,avif,heic,heif
Installation and Configuration¶
- Enter the DSH web profile directory (default:
~/.dsh/profiles/web). - Install the plugin using the official command:
dsh plugin --profile web add media-preview
- After installation, the plugin automatically modifies
package.jsonand adds thedsh.bundle.patchanddsh.client.platformconfiguration items. - After source code changes, restart
dsh web.
Limitations and Dependencies¶
- Buffering limits: Full-file buffered reads are used, with a per-request limit of 500 MB. Large videos may have slower initial frame loading; range requests slice from the same in-memory buffer.
- Directories and links: Directory listings are not supported, and there is no symbolic link policy (it relies on
fs.stat). - Dependency: Requires
@deepseek-ai/cordis(^4.0.1).
References¶
- Plugin directory: xiaokaizhou/dsh-media-preview
- Source repository: xiaokaizhou/dsh-media-preview