@file-viewer/renderer-media 3.2.2 → 3.3.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/README.en.md +2 -0
- package/README.md +15 -13
- package/README.zh-CN.md +41 -0
- package/dist/vendor/mp4v/TOOLCHAIN_THIRD_PARTY_LICENSES.json +18 -3
- package/package.json +4 -3
package/README.en.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @file-viewer/renderer-media
|
|
2
2
|
|
|
3
|
+
[English](https://github.com/flyfish-dev/file-viewer/blob/main/packages/renderers/media/README.md) · [简体中文](https://github.com/flyfish-dev/file-viewer/blob/main/packages/renderers/media/README.zh-CN.md)
|
|
4
|
+
|
|
3
5
|
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
6
|
|
|
5
7
|
## Usage
|
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# @file-viewer/renderer-media
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[English](https://github.com/flyfish-dev/file-viewer/blob/main/packages/renderers/media/README.md) · [简体中文](https://github.com/flyfish-dev/file-viewer/blob/main/packages/renderers/media/README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
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.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
6
8
|
|
|
7
9
|
```ts
|
|
8
10
|
import { mediaRenderer } from '@file-viewer/renderer-media'
|
|
@@ -13,7 +15,7 @@ const options = {
|
|
|
13
15
|
}
|
|
14
16
|
```
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
Or compose it through the full preset:
|
|
17
19
|
|
|
18
20
|
```ts
|
|
19
21
|
import { allRenderers } from '@file-viewer/preset-all'
|
|
@@ -24,16 +26,16 @@ const options = {
|
|
|
24
26
|
}
|
|
25
27
|
```
|
|
26
28
|
|
|
27
|
-
##
|
|
29
|
+
## Features
|
|
28
30
|
|
|
29
|
-
- MP4
|
|
30
|
-
- MP4
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
31
|
+
- MP4, WebM, and common audio formats use native browser `<video>` / `<audio>` controls first.
|
|
32
|
+
- 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.
|
|
33
|
+
- 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.
|
|
34
|
+
- 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.
|
|
35
|
+
- With the streaming-media capability installed, HLS `.m3u8` uses native playback first and loads `hls.js` only as a fallback.
|
|
36
|
+
- With the MIDI capability installed, MIDI / MID loads `@tonejs/midi` and renders name, duration, PPQ, tracks, and note summaries.
|
|
37
|
+
- Unmount cleanup revokes object URLs, resets media elements, and destroys the HLS instance for long-lived business applications.
|
|
36
38
|
|
|
37
|
-
##
|
|
39
|
+
## Migration Note
|
|
38
40
|
|
|
39
|
-
`@file-viewer/core`
|
|
41
|
+
`@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.zh-CN.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# @file-viewer/renderer-media
|
|
2
|
+
|
|
3
|
+
[English](https://github.com/flyfish-dev/file-viewer/blob/main/packages/renderers/media/README.md) · [简体中文](https://github.com/flyfish-dev/file-viewer/blob/main/packages/renderers/media/README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
Flyfish File Viewer 的基础音视频 renderer 包,默认只提供浏览器原生音频和视频播放。HLS fallback 与 MIDI 检查分别由 `@file-viewer/capability-streaming-media`、`@file-viewer/capability-midi` 显式启用,不进入 standard/full 默认闭包。
|
|
6
|
+
|
|
7
|
+
## 使用
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { mediaRenderer } from '@file-viewer/renderer-media'
|
|
11
|
+
|
|
12
|
+
const options = {
|
|
13
|
+
builtinRenderers: 'none',
|
|
14
|
+
renderers: [mediaRenderer],
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
也可以通过全量 preset 自动装配:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { allRenderers } from '@file-viewer/preset-all'
|
|
22
|
+
|
|
23
|
+
const options = {
|
|
24
|
+
builtinRenderers: 'none',
|
|
25
|
+
renderers: allRenderers,
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 能力
|
|
30
|
+
|
|
31
|
+
- MP4、WebM 和常见音频格式优先使用浏览器原生 `<video>` / `<audio>` 控件。
|
|
32
|
+
- MP4 会读取视频轨的编码标识。浏览器无法解码 MPEG-4 Part 2(`mp4v`)Simple Profile 时,renderer 会按需启动独立 Worker,使用 AAC 音轨校时,并把软件解码的 I420 画面绘制到 Canvas,不再出现“有声音、画面全黑”。
|
|
33
|
+
- MP4V 后备解码器来自 AOSP PacketVideo,许可证为 Apache-2.0。WASM 为 111,379 字节(gzip 34,410 字节),仅在原生解码失败时加载。实现不包含 FFmpeg、libav 或 LGPL/GPL/AGPL 源码。
|
|
34
|
+
- 浏览器缺少 Worker、OffscreenCanvas 或 VideoFrame,或者文件超出当前解码范围时,会显示明确的兼容提示。面向更多浏览器发布时,H.264/AVC 仍是更省 CPU 的选择。
|
|
35
|
+
- 安装 streaming-media capability 后,HLS `.m3u8` 优先使用浏览器原生能力,不支持时才加载 `hls.js`。
|
|
36
|
+
- 安装 MIDI capability 后,MIDI / MID 才加载 `@tonejs/midi` 并展示曲名、时长、PPQ、轨道和音符摘要。
|
|
37
|
+
- 所有资源在卸载时清理对象 URL、播放器状态和 HLS 实例,适合长时间运行的后台系统。
|
|
38
|
+
|
|
39
|
+
## 迁移说明
|
|
40
|
+
|
|
41
|
+
`@file-viewer/core` 不内置 media renderer。standard 只装配本包的原生媒体路径;打开 `.m3u8`、`.midi` 或 `.mid` 时会给出对应的 `npx file-viewer-cli add ...` 命令。`preset-all` 仅用于显式全量/调试并注册两项可选能力。
|
|
@@ -12,9 +12,16 @@
|
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"source": "https://raw.githubusercontent.com/emscripten-core/emscripten/6.0.6/system/lib/dlmalloc.c",
|
|
15
|
-
"sha256": "
|
|
16
|
-
"bytes":
|
|
17
|
-
"text": "
|
|
15
|
+
"sha256": "e1877bb510d75deed3b84c6485d497953b9295bfa4f6d9aa64746c87a18682cf",
|
|
16
|
+
"bytes": 457,
|
|
17
|
+
"text": "/*\n This is a version (aka dlmalloc) of malloc/free/realloc written by\n Doug Lea and released to the public domain, as explained at\n http://creativecommons.org/publicdomain/zero/1.0/ Send questions,\n comments, complaints, performance data, etc to dl@cs.oswego.edu\n \n * Version 2.8.6 Wed Aug 29 06:57:58 2012 Doug Lea\n Note: There may be an updated version of this malloc obtainable at\n ftp://gee.cs.oswego.edu/pub/misc/malloc.c\n Check before installing!\n \n",
|
|
18
|
+
"sourceGitBlob": "684212f81042f480b5164643ce7e95d4d8e38736",
|
|
19
|
+
"materialKind": "exact-upstream-grant-and-author-excerpt",
|
|
20
|
+
"selection": {
|
|
21
|
+
"startByte": 1653,
|
|
22
|
+
"endByteExclusive": 2110,
|
|
23
|
+
"omitted": "Technical usage commentary following the complete public-domain declaration and version/author attribution."
|
|
24
|
+
}
|
|
18
25
|
},
|
|
19
26
|
{
|
|
20
27
|
"source": "https://raw.githubusercontent.com/emscripten-core/emscripten/6.0.6/system/lib/emmalloc.c",
|
|
@@ -63,6 +70,14 @@
|
|
|
63
70
|
"sha256": "82ade5d7d9b029044b5fbbc326207fc47c2d44ee4dd71e8a559c36d728217de9",
|
|
64
71
|
"bytes": 1096,
|
|
65
72
|
"text": "MIT License\n\nCopyright (c) 2018-2025 Microsoft Corporation, Daan Leijen\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"source": "https://creativecommons.org/publicdomain/zero/1.0/legalcode.txt",
|
|
76
|
+
"sha256": "a2010f343487d3f7618affe54f789f5487602331c0a8d03f49e9a7c547cf0499",
|
|
77
|
+
"bytes": 7048,
|
|
78
|
+
"text": "Creative Commons Legal Code\n\nCC0 1.0 Universal\n\n CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE\n LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN\n ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS\n INFORMATION ON AN \"AS-IS\" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES\n REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS\n PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM\n THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED\n HEREUNDER.\n\nStatement of Purpose\n\nThe laws of most jurisdictions throughout the world automatically confer\nexclusive Copyright and Related Rights (defined below) upon the creator\nand subsequent owner(s) (each and all, an \"owner\") of an original work of\nauthorship and/or a database (each, a \"Work\").\n\nCertain owners wish to permanently relinquish those rights to a Work for\nthe purpose of contributing to a commons of creative, cultural and\nscientific works (\"Commons\") that the public can reliably and without fear\nof later claims of infringement build upon, modify, incorporate in other\nworks, reuse and redistribute as freely as possible in any form whatsoever\nand for any purposes, including without limitation commercial purposes.\nThese owners may contribute to the Commons to promote the ideal of a free\nculture and the further production of creative, cultural and scientific\nworks, or to gain reputation or greater distribution for their Work in\npart through the use and efforts of others.\n\nFor these and/or other purposes and motivations, and without any\nexpectation of additional consideration or compensation, the person\nassociating CC0 with a Work (the \"Affirmer\"), to the extent that he or she\nis an owner of Copyright and Related Rights in the Work, voluntarily\nelects to apply CC0 to the Work and publicly distribute the Work under its\nterms, with knowledge of his or her Copyright and Related Rights in the\nWork and the meaning and intended legal effect of CC0 on those rights.\n\n1. Copyright and Related Rights. A Work made available under CC0 may be\nprotected by copyright and related or neighboring rights (\"Copyright and\nRelated Rights\"). Copyright and Related Rights include, but are not\nlimited to, the following:\n\n i. the right to reproduce, adapt, distribute, perform, display,\n communicate, and translate a Work;\n ii. moral rights retained by the original author(s) and/or performer(s);\niii. publicity and privacy rights pertaining to a person's image or\n likeness depicted in a Work;\n iv. rights protecting against unfair competition in regards to a Work,\n subject to the limitations in paragraph 4(a), below;\n v. rights protecting the extraction, dissemination, use and reuse of data\n in a Work;\n vi. database rights (such as those arising under Directive 96/9/EC of the\n European Parliament and of the Council of 11 March 1996 on the legal\n protection of databases, and under any national implementation\n thereof, including any amended or successor version of such\n directive); and\nvii. other similar, equivalent or corresponding rights throughout the\n world based on applicable law or treaty, and any national\n implementations thereof.\n\n2. Waiver. To the greatest extent permitted by, but not in contravention\nof, applicable law, Affirmer hereby overtly, fully, permanently,\nirrevocably and unconditionally waives, abandons, and surrenders all of\nAffirmer's Copyright and Related Rights and associated claims and causes\nof action, whether now known or unknown (including existing as well as\nfuture claims and causes of action), in the Work (i) in all territories\nworldwide, (ii) for the maximum duration provided by applicable law or\ntreaty (including future time extensions), (iii) in any current or future\nmedium and for any number of copies, and (iv) for any purpose whatsoever,\nincluding without limitation commercial, advertising or promotional\npurposes (the \"Waiver\"). Affirmer makes the Waiver for the benefit of each\nmember of the public at large and to the detriment of Affirmer's heirs and\nsuccessors, fully intending that such Waiver shall not be subject to\nrevocation, rescission, cancellation, termination, or any other legal or\nequitable action to disrupt the quiet enjoyment of the Work by the public\nas contemplated by Affirmer's express Statement of Purpose.\n\n3. Public License Fallback. Should any part of the Waiver for any reason\nbe judged legally invalid or ineffective under applicable law, then the\nWaiver shall be preserved to the maximum extent permitted taking into\naccount Affirmer's express Statement of Purpose. In addition, to the\nextent the Waiver is so judged Affirmer hereby grants to each affected\nperson a royalty-free, non transferable, non sublicensable, non exclusive,\nirrevocable and unconditional license to exercise Affirmer's Copyright and\nRelated Rights in the Work (i) in all territories worldwide, (ii) for the\nmaximum duration provided by applicable law or treaty (including future\ntime extensions), (iii) in any current or future medium and for any number\nof copies, and (iv) for any purpose whatsoever, including without\nlimitation commercial, advertising or promotional purposes (the\n\"License\"). The License shall be deemed effective as of the date CC0 was\napplied by Affirmer to the Work. Should any part of the License for any\nreason be judged legally invalid or ineffective under applicable law, such\npartial invalidity or ineffectiveness shall not invalidate the remainder\nof the License, and in such case Affirmer hereby affirms that he or she\nwill not (i) exercise any of his or her remaining Copyright and Related\nRights in the Work or (ii) assert any associated claims and causes of\naction with respect to the Work, in either case contrary to Affirmer's\nexpress Statement of Purpose.\n\n4. Limitations and Disclaimers.\n\n a. No trademark or patent rights held by Affirmer are waived, abandoned,\n surrendered, licensed or otherwise affected by this document.\n b. Affirmer offers the Work as-is and makes no representations or\n warranties of any kind concerning the Work, express, implied,\n statutory or otherwise, including without limitation warranties of\n title, merchantability, fitness for a particular purpose, non\n infringement, or the absence of latent or other defects, accuracy, or\n the present or absence of errors, whether or not discoverable, all to\n the greatest extent permissible under applicable law.\n c. Affirmer disclaims responsibility for clearing rights of other persons\n that may apply to the Work or any use thereof, including without\n limitation any person's Copyright and Related Rights in the Work.\n Further, Affirmer disclaims responsibility for obtaining any necessary\n consents, permissions or other rights required for any use of the\n Work.\n d. Affirmer understands and acknowledges that Creative Commons is not a\n party to this document and has no duty or obligation with respect to\n this CC0 or use of the Work.\n",
|
|
79
|
+
"materialKind": "complete-standard-CC0-1.0-text",
|
|
80
|
+
"declaredLicense": "CC0-1.0"
|
|
66
81
|
}
|
|
67
82
|
],
|
|
68
83
|
"linkedArchives": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@file-viewer/renderer-media",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
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.",
|
|
@@ -71,10 +71,11 @@
|
|
|
71
71
|
"file-viewer.capability.json",
|
|
72
72
|
"LICENSE",
|
|
73
73
|
"README.en.md",
|
|
74
|
-
"README.md"
|
|
74
|
+
"README.md",
|
|
75
|
+
"README.zh-CN.md"
|
|
75
76
|
],
|
|
76
77
|
"dependencies": {
|
|
77
|
-
"@file-viewer/core": "3.
|
|
78
|
+
"@file-viewer/core": "3.3.0"
|
|
78
79
|
},
|
|
79
80
|
"fileViewer": {
|
|
80
81
|
"capabilityManifest": "./file-viewer.capability.json",
|