@open-file-viewer/core 0.1.8 → 0.1.9
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.md +18 -0
- package/dist/index.cjs +14 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -36,6 +36,24 @@ Copy `libredwg-web.wasm` to a public directory and point `cadPlugin` to it:
|
|
|
36
36
|
cadPlugin({ libreDwg: { wasmBaseUrl: "/vendor/libredwg-web" } });
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
+
Native browser video formats such as MP4, WebM and MOV do not need extra dependencies. HLS uses `hls.js`, which is bundled with the core package. FLV and MPEG-TS/M2TS playback is optional: install `mpegts.js` in your application only if you need those formats. If it is not installed, `videoPlugin()` shows the built-in download fallback for FLV/M2TS files.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install mpegts.js
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`mpegts.js` currently depends on a git-based `webworkify-webpack` fork. pnpm 11 users with `blockExoticSubdeps` enabled can keep `@open-file-viewer/core` installed normally because `mpegts.js` is no longer a required dependency. If your app really needs FLV/M2TS playback, either allow that dependency in your app or override it to the npm release:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"pnpm": {
|
|
50
|
+
"overrides": {
|
|
51
|
+
"webworkify-webpack": "2.1.5"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
39
57
|
## Quick Start
|
|
40
58
|
|
|
41
59
|
```ts
|
package/dist/index.cjs
CHANGED
|
@@ -2569,6 +2569,11 @@ function objectFit(fit) {
|
|
|
2569
2569
|
}
|
|
2570
2570
|
|
|
2571
2571
|
// src/plugins/video.ts
|
|
2572
|
+
var mpegtsPackageName = "mpegts.js";
|
|
2573
|
+
var loadMpegts = () => import(
|
|
2574
|
+
/* @vite-ignore */
|
|
2575
|
+
mpegtsPackageName
|
|
2576
|
+
);
|
|
2572
2577
|
var videoExtensions = /* @__PURE__ */ new Set([
|
|
2573
2578
|
"mp4",
|
|
2574
2579
|
"mpg",
|
|
@@ -2683,7 +2688,8 @@ function videoPlugin() {
|
|
|
2683
2688
|
showTranscodeFallback();
|
|
2684
2689
|
}
|
|
2685
2690
|
} else if (isFlv || isMpegTs) {
|
|
2686
|
-
const
|
|
2691
|
+
const mpegtsModule = await loadMpegts();
|
|
2692
|
+
const mpegts = resolveMpegtsApi(mpegtsModule);
|
|
2687
2693
|
if (mpegts.isSupported()) {
|
|
2688
2694
|
mpegtsPlayer = mpegts.createPlayer({
|
|
2689
2695
|
type: isFlv ? "flv" : "mpegts",
|
|
@@ -2735,6 +2741,13 @@ function videoPlugin() {
|
|
|
2735
2741
|
}
|
|
2736
2742
|
};
|
|
2737
2743
|
}
|
|
2744
|
+
function resolveMpegtsApi(module2) {
|
|
2745
|
+
const api = module2.default || module2;
|
|
2746
|
+
if (!api.Events || !api.isSupported || !api.createPlayer) {
|
|
2747
|
+
throw new Error("mpegts.js is not available.");
|
|
2748
|
+
}
|
|
2749
|
+
return api;
|
|
2750
|
+
}
|
|
2738
2751
|
function createVideoTransformController(video, ctx) {
|
|
2739
2752
|
let scale = 1;
|
|
2740
2753
|
let rotation = 0;
|