@lightbird/core 0.3.0 → 0.3.1
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/dist/index.cjs +12 -8
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +6 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
var assCompiler = require('ass-compiler');
|
|
4
4
|
var webSdk = require('@openfeature/web-sdk');
|
|
5
5
|
var unleashWebProvider = require('@openfeature/unleash-web-provider');
|
|
6
|
-
var ffmpeg = require('@ffmpeg/ffmpeg');
|
|
7
|
-
var util = require('@ffmpeg/util');
|
|
8
6
|
|
|
9
7
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
10
8
|
// src/config.ts
|
|
@@ -1433,6 +1431,8 @@ var ProgressEstimator = class {
|
|
|
1433
1431
|
}
|
|
1434
1432
|
// No reset() method — create a new instance per file load instead.
|
|
1435
1433
|
};
|
|
1434
|
+
|
|
1435
|
+
// src/utils/ffmpeg-singleton.ts
|
|
1436
1436
|
var instance = null;
|
|
1437
1437
|
var loading = null;
|
|
1438
1438
|
var defaultCDN = "https://unpkg.com/@ffmpeg/core@0.12.10/dist/umd";
|
|
@@ -1440,14 +1440,18 @@ async function getFFmpeg() {
|
|
|
1440
1440
|
if (instance) return instance;
|
|
1441
1441
|
if (loading) return loading;
|
|
1442
1442
|
loading = (async () => {
|
|
1443
|
-
const
|
|
1443
|
+
const [{ FFmpeg }, { toBlobURL }] = await Promise.all([
|
|
1444
|
+
import('@ffmpeg/ffmpeg'),
|
|
1445
|
+
import('@ffmpeg/util')
|
|
1446
|
+
]);
|
|
1447
|
+
const ffmpeg = new FFmpeg();
|
|
1444
1448
|
const baseURL = getConfig().ffmpegCDN || defaultCDN;
|
|
1445
|
-
await ffmpeg
|
|
1446
|
-
coreURL: await
|
|
1447
|
-
wasmURL: await
|
|
1449
|
+
await ffmpeg.load({
|
|
1450
|
+
coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`, "text/javascript"),
|
|
1451
|
+
wasmURL: await toBlobURL(`${baseURL}/ffmpeg-core.wasm`, "application/wasm")
|
|
1448
1452
|
});
|
|
1449
|
-
instance = ffmpeg
|
|
1450
|
-
return ffmpeg
|
|
1453
|
+
instance = ffmpeg;
|
|
1454
|
+
return ffmpeg;
|
|
1451
1455
|
})();
|
|
1452
1456
|
return loading;
|
|
1453
1457
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -382,6 +382,14 @@ declare class ProgressEstimator {
|
|
|
382
382
|
};
|
|
383
383
|
}
|
|
384
384
|
|
|
385
|
+
/**
|
|
386
|
+
* Returns a lazily-initialised FFmpeg.wasm instance.
|
|
387
|
+
*
|
|
388
|
+
* `@ffmpeg/ffmpeg` and `@ffmpeg/util` are pulled in via dynamic `import()` so
|
|
389
|
+
* the multi-MB FFmpeg code path is never part of the base `@lightbird/core`
|
|
390
|
+
* entry chunk. Consumers that only play HTML5-native formats (MP4/WebM) and
|
|
391
|
+
* never call `getFFmpeg()` download zero FFmpeg code. See issue #54.
|
|
392
|
+
*/
|
|
385
393
|
declare function getFFmpeg(): Promise<FFmpeg>;
|
|
386
394
|
declare function resetFFmpeg(): void;
|
|
387
395
|
|
package/dist/index.d.ts
CHANGED
|
@@ -382,6 +382,14 @@ declare class ProgressEstimator {
|
|
|
382
382
|
};
|
|
383
383
|
}
|
|
384
384
|
|
|
385
|
+
/**
|
|
386
|
+
* Returns a lazily-initialised FFmpeg.wasm instance.
|
|
387
|
+
*
|
|
388
|
+
* `@ffmpeg/ffmpeg` and `@ffmpeg/util` are pulled in via dynamic `import()` so
|
|
389
|
+
* the multi-MB FFmpeg code path is never part of the base `@lightbird/core`
|
|
390
|
+
* entry chunk. Consumers that only play HTML5-native formats (MP4/WebM) and
|
|
391
|
+
* never call `getFFmpeg()` download zero FFmpeg code. See issue #54.
|
|
392
|
+
*/
|
|
385
393
|
declare function getFFmpeg(): Promise<FFmpeg>;
|
|
386
394
|
declare function resetFFmpeg(): void;
|
|
387
395
|
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { compile } from 'ass-compiler';
|
|
2
2
|
import { OpenFeature } from '@openfeature/web-sdk';
|
|
3
3
|
import { UnleashWebProvider } from '@openfeature/unleash-web-provider';
|
|
4
|
-
import { FFmpeg } from '@ffmpeg/ffmpeg';
|
|
5
|
-
import { toBlobURL } from '@ffmpeg/util';
|
|
6
4
|
|
|
7
5
|
// src/config.ts
|
|
8
6
|
var config = {};
|
|
@@ -1430,6 +1428,8 @@ var ProgressEstimator = class {
|
|
|
1430
1428
|
}
|
|
1431
1429
|
// No reset() method — create a new instance per file load instead.
|
|
1432
1430
|
};
|
|
1431
|
+
|
|
1432
|
+
// src/utils/ffmpeg-singleton.ts
|
|
1433
1433
|
var instance = null;
|
|
1434
1434
|
var loading = null;
|
|
1435
1435
|
var defaultCDN = "https://unpkg.com/@ffmpeg/core@0.12.10/dist/umd";
|
|
@@ -1437,6 +1437,10 @@ async function getFFmpeg() {
|
|
|
1437
1437
|
if (instance) return instance;
|
|
1438
1438
|
if (loading) return loading;
|
|
1439
1439
|
loading = (async () => {
|
|
1440
|
+
const [{ FFmpeg }, { toBlobURL }] = await Promise.all([
|
|
1441
|
+
import('@ffmpeg/ffmpeg'),
|
|
1442
|
+
import('@ffmpeg/util')
|
|
1443
|
+
]);
|
|
1440
1444
|
const ffmpeg = new FFmpeg();
|
|
1441
1445
|
const baseURL = getConfig().ffmpegCDN || defaultCDN;
|
|
1442
1446
|
await ffmpeg.load({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightbird/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Client-side video player engine. Plays MKV, MP4, WebM with full subtitle, audio track, and chapter support. No server required.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Punyam Singh",
|