dsh-sidebar-media-player 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/LICENSE +21 -0
- package/README.md +123 -2
- package/cordis.patch.yml +12 -0
- package/docs/screenshots/01-video-subtitle.png +0 -0
- package/docs/screenshots/02-audio-lyric.png +0 -0
- package/lib/client.js +1804 -0
- package/lib/index.js +587 -0
- package/package.json +58 -3
- package/screenshots.json +1 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
所有值得注意的变更都会记录在此文件。
|
|
4
|
+
|
|
5
|
+
## 0.2.0 — 2026-11-10(改名版本)
|
|
6
|
+
|
|
7
|
+
- **插件全链路改名**:`dsh-media-player` → `dsh-sidebar-media-player`。npm 包名、GitHub 仓库 slug、宿主路由前缀(`/dsh-sidebar-media-player/media|lyric|subtitle`)、client bundle id、localStorage 偏好 key、profile 挂载项(deps + bundles + junction)一并变更。
|
|
8
|
+
- **历史版本保留旧名**:0.1.1 / 0.1.2 仍以 `dsh-media-player` 名义发布,内容不变;旧包名将在 npm 上 deprecate 指向 `dsh-sidebar-media-player`。
|
|
9
|
+
- 升级方式:卸载旧包名 → 安装 `dsh-sidebar-media-player`(本地 profile 挂载同理改 `dependencies` 与 `dsh.profile.bundles`)。
|
|
10
|
+
## 0.1.2 — 2026-11-09
|
|
11
|
+
|
|
12
|
+
- 截图更新:换为两张真实界面效果图(视频+字幕设置面板、音频+歌词+频谱+音准),移除旧图。
|
|
13
|
+
- 无功能变更,仅发布素材更新。
|
|
14
|
+
|
|
15
|
+
## 0.1.1 — 2026-11-09
|
|
16
|
+
|
|
17
|
+
首个正式发布版本(首发)。
|
|
18
|
+
|
|
19
|
+
### 功能
|
|
20
|
+
|
|
21
|
+
- 侧边栏统一音视频播放器(接管 dsh-better-sidebar 的文件预览)
|
|
22
|
+
- 支持 mp4/webm/mov/m4v/ogv 视频与 mp3/wav/flac/ogg/opus/m4a/aac 音频
|
|
23
|
+
- 拖动进度条(HTTP Range 206 流式),含 Blob 救援修复「桌面端 content-length 被剥离导致时长未知、进度条不可拖」(音频与视频统一生效,>300MB 不整文件入内存)
|
|
24
|
+
- 实时频谱柱 + 音准(Hz + 音名)
|
|
25
|
+
- 视频字幕:自动加载同目录同名 `.srt/.vtt/.ass`(服务端转 VTT),自绘字幕层,支持开关 / 字号 4 档 / 位置 3 档(设置本地记忆)
|
|
26
|
+
- 音频歌词:自动加载同目录同名 `.lrc`(含内嵌歌词),滚动高亮,支持开关
|
|
27
|
+
- 修复图标尺寸 bug(图标函数被当组件调用导致 SVG 撑到 300×150 并遮挡进度条)
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Administrator
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,124 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 侧边栏多媒体播放器(dsh-sidebar-media-player)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
侧边栏统一音视频播放器,作为 `dsh-better-sidebar` 的配套插件,接管侧边栏里音视频文件的预览。一个 viewer 同时覆盖视频与音频扩展名,解决过去做不好的三件事:**能拖的进度条**(HTTP Range 206 流式)、**实时频谱**、**音准读数**;并新增**视频字幕**(同名 `.srt/.vtt/.ass` 自动加载)与**音频歌词**(同名 `.lrc` 滚动高亮)。
|
|
4
|
+
|
|
5
|
+
**适配 DSH 内核 0.2.2-rc.1。**
|
|
6
|
+
|
|
7
|
+
- 版本:0.2.0(首个正式发布版本)
|
|
8
|
+
- 依赖:`dsh-better-sidebar`(提供 `ctx.betterSidebar` 文件查看器注册服务)
|
|
9
|
+
|
|
10
|
+
## 功能
|
|
11
|
+
|
|
12
|
+
- **侧边栏统一音视频播放器**(接管 dsh-better-sidebar 的文件预览):一个组件按扩展名分流音频与视频。
|
|
13
|
+
- **视频**:mp4 / webm / mov / m4v / ogv;**音频**:mp3 / wav / flac / ogg / opus / m4a / aac。
|
|
14
|
+
- **拖动进度条(HTTP Range 206 流式)**:自建 Range 路由,浏览器拿到 206 才解锁 seek;含 **Blob 救援**,修复「桌面端 `content-length` 被剥离导致时长未知、进度条不可拖」的问题(音频与视频统一生效,>300MB 也不整文件入内存)。
|
|
15
|
+
- **实时频谱柱 + 音准(Hz + 音名)**:`AnalyserNode` 对数分桶柱状图;归一化自相关(ACF)+ 抛物线插值给出 Hz 与音名。
|
|
16
|
+
- **视频字幕**:自动加载同目录同名 `.srt / .vtt / .ass`(服务端统一转 VTT),自绘字幕层,支持开关 / 字号 4 档 / 位置 3 档(设置本地记忆)。
|
|
17
|
+
- **音频歌词**:自动加载同目录同名 `.lrc`(含内嵌歌词),滚动高亮,支持开关。
|
|
18
|
+
- **修复图标尺寸 bug**:图标函数曾被当组件调用,导致 SVG 撑到 300×150 并遮挡进度条,本版修复。
|
|
19
|
+
|
|
20
|
+
## 截图
|
|
21
|
+
|
|
22
|
+

|
|
23
|
+
|
|
24
|
+

|
|
25
|
+
|
|
26
|
+
## 安装
|
|
27
|
+
|
|
28
|
+
本插件是 `dsh-better-sidebar` 的配套插件,安装命令:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
dsh plugin add dsh-sidebar-media-player
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
> 桌面端 `desktop` profile 由 Electron 独占管理(`dsh plugin --profile desktop add` 会被 CLI 直接拒绝),需走「真实副本 + 只加 bundles」的方式手动挂载:
|
|
35
|
+
>
|
|
36
|
+
> 1. 备份 `~/.dsh/profiles/desktop/package.json` 与 `cordis.patch.yml`;
|
|
37
|
+
> 2. 把 `local-plugins/dsh-sidebar-media-player` 复制成**真实副本**到 `~/.dsh/profiles/desktop/node_modules/dsh-sidebar-media-player`(**不要**用 `link:`/`file:` 依赖,也不要直接改 pnpm 装出来的目录);
|
|
38
|
+
> 3. 在 profile `package.json` 的 `dsh.profile.bundles` 数组里追加 `"dsh-sidebar-media-player"`;
|
|
39
|
+
> 4. **彻底退出 DSH 客户端再启动**(宿主是 Node 进程,无热重载);
|
|
40
|
+
> 5. 在侧边栏打开任意 `.mp3` / `.mp4` 验证。
|
|
41
|
+
|
|
42
|
+
## 技术要点
|
|
43
|
+
|
|
44
|
+
- **可拖动 seek**:宿主媒体路由回 200 且无 `Accept-Ranges` 时浏览器不给拖动条;本插件自建 Range 路由(`bytes=a-b` / `bytes=a-` / `bytes=-N` 三种形态 + HEAD 探测),206 到位即解锁 seek。视频用原生控件,音频用自建 `input[type=range]`(`currentTime` 节流写入,时长与 Web Audio 解码解耦)。
|
|
45
|
+
- **频谱**:`createMediaElementSource → AnalyserNode(fftSize 2048) → destination`,`requestAnimationFrame` 每帧 `getByteFrequencyData`,按 40 Hz–16 kHz 对数分桶,canvas 按 `devicePixelRatio` 缩放。
|
|
46
|
+
- **音准**:`getFloatTimeDomainData` → 归一化 ACF + 抛物线插值;取第一个达到全局峰 90% 的「先升后降」局部峰,避免八度错位。
|
|
47
|
+
- **安全围栏**:Host 信任围栏(loopback / 可信 Host)+ 路径必须落在会话 cwd 内 + 音视频扩展名白名单,本路由不能当通用下载器用。
|
|
48
|
+
|
|
49
|
+
## 已知限制
|
|
50
|
+
|
|
51
|
+
- **编码靠浏览器**:`mkv/avi/wmv/flv/ape/wma/amr` 等通常放不出来(无内置解码器),会提示并给下载链接。
|
|
52
|
+
- **没有预解码波形**:频谱是实时分析,不是预解码波形。
|
|
53
|
+
- **音准是估算**:单声道混音 + ACF,复音(和弦、多人说话)只给出最突出的基频;噪声/打击乐读数会跳动,属正常。
|
|
54
|
+
- **视频不带自建进度条**:视频用原生控件(自带拖动、全屏、画中画);音频才用自建整轨 scrubber。
|
|
55
|
+
|
|
56
|
+
## 文件结构
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
dsh-sidebar-media-player/
|
|
60
|
+
├── package.json # name/version/type/main/exports/dsh.bundle/dsh.client
|
|
61
|
+
├── cordis.patch.yml # insert 1 条 entry(id=name=dsh-sidebar-media-player)
|
|
62
|
+
├── lib/index.js # host:Range(206) 媒体路由 + 安全围栏
|
|
63
|
+
├── lib/client.js # client:__ModuleLoader__ bundle + viewer(音视频统一)
|
|
64
|
+
├── docs/screenshots/ # 两张真实界面截图
|
|
65
|
+
├── screenshots.json # 插件市场配图清单(纯数组)
|
|
66
|
+
├── CHANGELOG.md
|
|
67
|
+
├── README.md
|
|
68
|
+
└── LICENSE
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 更新日志
|
|
72
|
+
|
|
73
|
+
见 [CHANGELOG.md](CHANGELOG.md)。
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
# dsh-sidebar-media-player (Sidebar Media Player)
|
|
78
|
+
|
|
79
|
+
A unified audio + video player for `dsh-better-sidebar`: one sidebar file viewer that takes over previewing audio/video files. It fixes the three things that used to be broken — **a draggable progress bar** (streamed over an HTTP Range 206 route), **a live spectrum**, and **a pitch readout** — and adds **video subtitles** (same-name `.srt/.vtt/.ass` auto-loaded) and **audio lyrics** (same-name `.lrc`, scroll-highlighted).
|
|
80
|
+
|
|
81
|
+
**Adapts the DSH kernel 0.2.2-rc.1.**
|
|
82
|
+
|
|
83
|
+
- Version: 0.2.0 (first public release)
|
|
84
|
+
- Requires: `dsh-better-sidebar` (provides the `ctx.betterSidebar` file-viewer registration service)
|
|
85
|
+
|
|
86
|
+
## Features
|
|
87
|
+
|
|
88
|
+
- **Unified sidebar audio/video player** (takes over dsh-better-sidebar's file preview): one component dispatches by extension.
|
|
89
|
+
- **Video**: mp4 / webm / mov / m4v / ogv; **Audio**: mp3 / wav / flac / ogg / opus / m4a / aac.
|
|
90
|
+
- **Draggable progress bar (HTTP Range 206 streaming)**: a self-hosted Range route so the browser receives 206 and unlocks seeking; includes a **Blob rescue** that fixes "on desktop the stripped `content-length` leaves the duration unknown and the scrubber un-draggable" (applies to audio and video alike, and a >300MB file is never loaded fully into memory).
|
|
91
|
+
- **Live spectrum bars + pitch (Hz + note name)**: `AnalyserNode` log-binned bars; normalized autocorrelation (ACF) + parabolic interpolation yields Hz and note name.
|
|
92
|
+
- **Video subtitles**: auto-loads same-name `.srt / .vtt / .ass` (server converts to VTT), custom subtitle layer, toggle / 4 font sizes / 3 positions (prefs remembered locally).
|
|
93
|
+
- **Audio lyrics**: auto-loads same-name `.lrc` (including embedded lyrics), scroll-highlighted, toggleable.
|
|
94
|
+
- **Icon size bug fix**: the icon function was mistakenly invoked as a component, stretching the SVG to 300×150 and covering the progress bar — fixed in this release.
|
|
95
|
+
|
|
96
|
+
## Screenshots
|
|
97
|
+
|
|
98
|
+

|
|
99
|
+
|
|
100
|
+

|
|
101
|
+
|
|
102
|
+
## Install
|
|
103
|
+
|
|
104
|
+
This plugin is a companion to `dsh-better-sidebar`:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
dsh plugin add dsh-sidebar-media-player
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
> On desktop, the `desktop` profile is managed exclusively by Electron (`dsh plugin --profile desktop add` is rejected by the CLI), so mount it manually with a real copy + bundles-only:
|
|
111
|
+
>
|
|
112
|
+
> 1. Back up `~/.dsh/profiles/desktop/package.json` and `cordis.patch.yml`;
|
|
113
|
+
> 2. Copy `local-plugins/dsh-sidebar-media-player` into `~/.dsh/profiles/desktop/node_modules/dsh-sidebar-media-player` as a **real copy** (do **not** use `link:`/`file:` deps, and do not edit the pnpm-installed directory);
|
|
114
|
+
> 3. Append `"dsh-sidebar-media-player"` to the profile `package.json`'s `dsh.profile.bundles` array;
|
|
115
|
+
> 4. **Fully quit and relaunch the DSH client** (the host is a Node process, no hot reload);
|
|
116
|
+
> 5. Open any `.mp3` / `.mp4` in the sidebar to verify.
|
|
117
|
+
|
|
118
|
+
## Changelog
|
|
119
|
+
|
|
120
|
+
See [CHANGELOG.md](CHANGELOG.md).
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
MIT
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# dsh-sidebar-media-player bundle patch
|
|
2
|
+
#
|
|
3
|
+
# 装进某个 profile 时,profile boot 会合并本补丁:一条 `insert`,即插件在
|
|
4
|
+
# cordis.yml 里的挂载行。entry 的 `name` 必须与 package.json 的 name 完全一致
|
|
5
|
+
# —— client-modules 扫描靠它把 ./client 解析出来,并挂到
|
|
6
|
+
# /plugins/dsh-sidebar-media-player/client.js。
|
|
7
|
+
#
|
|
8
|
+
# 本文件只是一份「初始声明」:DSH 的设置页会反向改写 profile 里的
|
|
9
|
+
# cordis.patch.yml(不是本文件)。本地 link 测试时请手改 profile 的那份。
|
|
10
|
+
- insert:
|
|
11
|
+
- id: dsh-sidebar-media-player
|
|
12
|
+
name: 'dsh-sidebar-media-player'
|
|
Binary file
|
|
Binary file
|