@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/dist/index.js
CHANGED
|
@@ -2516,6 +2516,11 @@ function objectFit(fit) {
|
|
|
2516
2516
|
}
|
|
2517
2517
|
|
|
2518
2518
|
// src/plugins/video.ts
|
|
2519
|
+
var mpegtsPackageName = "mpegts.js";
|
|
2520
|
+
var loadMpegts = () => import(
|
|
2521
|
+
/* @vite-ignore */
|
|
2522
|
+
mpegtsPackageName
|
|
2523
|
+
);
|
|
2519
2524
|
var videoExtensions = /* @__PURE__ */ new Set([
|
|
2520
2525
|
"mp4",
|
|
2521
2526
|
"mpg",
|
|
@@ -2630,7 +2635,8 @@ function videoPlugin() {
|
|
|
2630
2635
|
showTranscodeFallback();
|
|
2631
2636
|
}
|
|
2632
2637
|
} else if (isFlv || isMpegTs) {
|
|
2633
|
-
const
|
|
2638
|
+
const mpegtsModule = await loadMpegts();
|
|
2639
|
+
const mpegts = resolveMpegtsApi(mpegtsModule);
|
|
2634
2640
|
if (mpegts.isSupported()) {
|
|
2635
2641
|
mpegtsPlayer = mpegts.createPlayer({
|
|
2636
2642
|
type: isFlv ? "flv" : "mpegts",
|
|
@@ -2682,6 +2688,13 @@ function videoPlugin() {
|
|
|
2682
2688
|
}
|
|
2683
2689
|
};
|
|
2684
2690
|
}
|
|
2691
|
+
function resolveMpegtsApi(module) {
|
|
2692
|
+
const api = module.default || module;
|
|
2693
|
+
if (!api.Events || !api.isSupported || !api.createPlayer) {
|
|
2694
|
+
throw new Error("mpegts.js is not available.");
|
|
2695
|
+
}
|
|
2696
|
+
return api;
|
|
2697
|
+
}
|
|
2685
2698
|
function createVideoTransformController(video, ctx) {
|
|
2686
2699
|
let scale = 1;
|
|
2687
2700
|
let rotation = 0;
|