Merge pull request #86 from JonnyBurger/url-source-allow-reading-small-files

Do not make UrlSource fail if the size of the file is smaller than 512kb (+ add a Vitest browser mode test)
This commit is contained in:
Jonny Burger
2025-09-03 18:13:42 +02:00
committed by GitHub
parent a2a30c3e92
commit f13a2e6732
7 changed files with 2792 additions and 8 deletions
@@ -0,0 +1,19 @@
import { expect, test } from 'vitest';
import { UrlSource } from '../../src/source.js';
import { ALL_FORMATS } from '../../src/input-format.js';
import { Input } from '../../src/input.js';
test('Should be able to load a very small video file via URL (<512 kB)', async () => {
const source = new UrlSource('/frames.webm');
const input = new Input({
source,
formats: ALL_FORMATS,
});
const primaryVideoTrack = await input.getPrimaryVideoTrack();
if (!primaryVideoTrack) {
throw new Error('No video track found');
};
const duration = await primaryVideoTrack.computeDuration();
expect(duration).toBeCloseTo(3.33333);
});