Introduction¶
In the DSH (DeepSeek Harness) ecosystem, file processing usually relies on plugin distribution. When handling local media files, converting large files directly into Base64 strings consumes a lot of memory, while relying on external links introduces stability and privacy risks. The dock-media plugin addresses this issue: it streams local files directly in the browser using HTTP Range requests, enabling immediate playback of audio and video.
What Is It¶
dock-media is a client-side plugin running in the DSH Web environment, developed by maintainer AKS1st. It registers a media file viewer for the dock-files file domain, recognizes audio and video files, and provides streaming services through its own /dock-media/source host route.
Core Features¶
-
Dual-Mode Playback
The plugin automatically switches views based on file type: pure audio files (such as MP3 and WAV) enter music player mode, displaying a spinning record and equalizer animation; video files (such as MP4 and WebM) invoke the native fullscreen player. -
Streaming
Instead of relying on whole-file Base64 encoding, it returns file bytes in chunks through HTTPRangerequests (status code 206). This supports instant opening of large files, progress bar seeking, and playback while downloading. -
Music Player Controls
The music player provides complete playback controls: play/pause, progress dragging, current/total duration display, volume adjustment, mute, playback speed adjustment (0.5x–2x), and looping of a single track. -
Metadata and Badges
File size and media type can be retrieved through the/dock-media/probeinterface (POST request). The player header displays the file format badge and size information in real time. -
Graceful Degradation and Security
- Degradation: For container formats or codecs that the browser cannot decode (such as AVI, FLV, WMV, MIDI, and WMA), the plugin shows a clear message instead of a black screen.
- Security: Media decoding is fully delegated to the native
<audio>and<video>tags, without usinginnerHTMLor dangerous DOM injection methods.
Installation and Activation¶
This plugin depends on the dock and dock-files plugins. Before installing it, make sure these two plugins are already available.
dsh plugin --profile web add dock-base
dsh plugin --profile web add dock-files
dsh plugin --profile web add dock-media
Typical Usage¶
- Browse the file list in the
dock-filesfile domain. - Click an audio file such as MP3, WAV, or FLAC, or a video file such as MP4, WebM, or MOV.
- The system automatically identifies the file type and opens the corresponding player.
- Access the media stream through the
/dock-media/sourceroute, which supports HTTP Range requests.
Security and Notes¶
- Route Security: The
/dock-mediaroute only accepts requests from trusted sources, including loopback addresses (localhost) and domains configured throughtrustedHosts, and performs same-origin checks. - File Access: The read path only needs to be an absolute path. It is not limited to the current session workspace, and read/write permissions are not enforced (read-only access only).
- Format Limitations:
.tsfiles are handled bydock-editor, anddock-mediadoes not take over them. - Decoding Capability: Whether a browser can decode a file is determined by its decoder. The plugin cannot bypass browser restrictions to play every format (for example, AVI and FLV cannot be decoded in most browsers).
Conclusion¶
dock-media provides a lightweight, memory-friendly way to play local media inside the DSH workbench. Through HTTP Range streaming and native tag rendering, it balances performance and security, making it suitable for scenarios that frequently require processing local audio and video resources.
- Documentation and Catalog: dock-media Catalog
- Source Repository: github.com/AKS1st/dock-media