@file-viewer/renderer-media 3.2.0 → 3.2.2
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/README.en.md +35 -3
- package/README.md +35 -3
- package/package.json +2 -2
package/README.en.md
CHANGED
|
@@ -1,7 +1,39 @@
|
|
|
1
1
|
# @file-viewer/renderer-media
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Base audio and video renderer package for Flyfish File Viewer. It provides browser-native media playback by default. HLS fallback and MIDI inspection are enabled explicitly by `@file-viewer/capability-streaming-media` and `@file-viewer/capability-midi`; neither enters the standard/full default closure.
|
|
4
4
|
|
|
5
|
-
Usage
|
|
5
|
+
## Usage
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```ts
|
|
8
|
+
import { mediaRenderer } from '@file-viewer/renderer-media'
|
|
9
|
+
|
|
10
|
+
const options = {
|
|
11
|
+
builtinRenderers: 'none',
|
|
12
|
+
renderers: [mediaRenderer],
|
|
13
|
+
}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Or compose it through the full preset:
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { allRenderers } from '@file-viewer/preset-all'
|
|
20
|
+
|
|
21
|
+
const options = {
|
|
22
|
+
builtinRenderers: 'none',
|
|
23
|
+
renderers: allRenderers,
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
- MP4, WebM, and common audio formats use native browser `<video>` / `<audio>` controls first.
|
|
30
|
+
- The renderer inspects MP4 video tracks before playback. If the browser rejects an MPEG-4 Part 2 (`mp4v`) Simple Profile track, it starts a dedicated Worker, uses the AAC track as the playback clock, and draws software-decoded I420 frames to a Canvas. This fixes the case where audio plays over a black frame.
|
|
31
|
+
- The fallback uses the Apache-2.0 AOSP PacketVideo decoder. Its WASM file is 111,379 bytes, or 34,410 bytes with gzip, and loads only after native decoding fails. The implementation contains no FFmpeg, libav, or LGPL/GPL/AGPL source.
|
|
32
|
+
- Files outside the decoder's current coverage, and browsers without Worker, OffscreenCanvas, or VideoFrame support, get a codec compatibility notice. H.264/AVC still uses less CPU and works in more browsers.
|
|
33
|
+
- With the streaming-media capability installed, HLS `.m3u8` uses native playback first and loads `hls.js` only as a fallback.
|
|
34
|
+
- With the MIDI capability installed, MIDI / MID loads `@tonejs/midi` and renders name, duration, PPQ, tracks, and note summaries.
|
|
35
|
+
- Unmount cleanup revokes object URLs, resets media elements, and destroys the HLS instance for long-lived business applications.
|
|
36
|
+
|
|
37
|
+
## Migration Note
|
|
38
|
+
|
|
39
|
+
`@file-viewer/core` does not bundle media renderers. Standard installs only this package's native media path. Opening `.m3u8`, `.midi`, or `.mid` without its capability shows the exact `npx file-viewer-cli add ...` command. `preset-all` is reserved for explicit all/debug use and registers both optional capabilities.
|
package/README.md
CHANGED
|
@@ -1,7 +1,39 @@
|
|
|
1
1
|
# @file-viewer/renderer-media
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Flyfish File Viewer 的基础音视频 renderer 包,默认只提供浏览器原生音频和视频播放。HLS fallback 与 MIDI 检查分别由 `@file-viewer/capability-streaming-media`、`@file-viewer/capability-midi` 显式启用,不进入 standard/full 默认闭包。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 使用
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```ts
|
|
8
|
+
import { mediaRenderer } from '@file-viewer/renderer-media'
|
|
9
|
+
|
|
10
|
+
const options = {
|
|
11
|
+
builtinRenderers: 'none',
|
|
12
|
+
renderers: [mediaRenderer],
|
|
13
|
+
}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
也可以通过全量 preset 自动装配:
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { allRenderers } from '@file-viewer/preset-all'
|
|
20
|
+
|
|
21
|
+
const options = {
|
|
22
|
+
builtinRenderers: 'none',
|
|
23
|
+
renderers: allRenderers,
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 能力
|
|
28
|
+
|
|
29
|
+
- MP4、WebM 和常见音频格式优先使用浏览器原生 `<video>` / `<audio>` 控件。
|
|
30
|
+
- MP4 会读取视频轨的编码标识。浏览器无法解码 MPEG-4 Part 2(`mp4v`)Simple Profile 时,renderer 会按需启动独立 Worker,使用 AAC 音轨校时,并把软件解码的 I420 画面绘制到 Canvas,不再出现“有声音、画面全黑”。
|
|
31
|
+
- MP4V 后备解码器来自 AOSP PacketVideo,许可证为 Apache-2.0。WASM 为 111,379 字节(gzip 34,410 字节),仅在原生解码失败时加载。实现不包含 FFmpeg、libav 或 LGPL/GPL/AGPL 源码。
|
|
32
|
+
- 浏览器缺少 Worker、OffscreenCanvas 或 VideoFrame,或者文件超出当前解码范围时,会显示明确的兼容提示。面向更多浏览器发布时,H.264/AVC 仍是更省 CPU 的选择。
|
|
33
|
+
- 安装 streaming-media capability 后,HLS `.m3u8` 优先使用浏览器原生能力,不支持时才加载 `hls.js`。
|
|
34
|
+
- 安装 MIDI capability 后,MIDI / MID 才加载 `@tonejs/midi` 并展示曲名、时长、PPQ、轨道和音符摘要。
|
|
35
|
+
- 所有资源在卸载时清理对象 URL、播放器状态和 HLS 实例,适合长时间运行的后台系统。
|
|
36
|
+
|
|
37
|
+
## 迁移说明
|
|
38
|
+
|
|
39
|
+
`@file-viewer/core` 不内置 media renderer。standard 只装配本包的原生媒体路径;打开 `.m3u8`、`.midi` 或 `.mid` 时会给出对应的 `npx file-viewer-cli add ...` 命令。`preset-all` 仅用于显式全量/调试并注册两项可选能力。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@file-viewer/renderer-media",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Standalone native audio and video renderer for File Viewer; HLS fallback and MIDI inspection are explicit opt-in capabilities.",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"README.md"
|
|
75
75
|
],
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@file-viewer/core": "3.2.
|
|
77
|
+
"@file-viewer/core": "3.2.2"
|
|
78
78
|
},
|
|
79
79
|
"fileViewer": {
|
|
80
80
|
"capabilityManifest": "./file-viewer.capability.json",
|