Files
mediabunny/test/node/node-sample-creation.test.ts
T
2025-12-16 18:47:50 +01:00

28 lines
574 B
TypeScript

import { test } from 'vitest';
import { AudioSample, VideoSample } from '../../src/sample.js';
test('VideoSample creation from bytes', async () => {
const bytes = new Uint8Array(1024);
const sample = new VideoSample(bytes, {
codedWidth: 1280,
codedHeight: 720,
format: 'RGBA',
timestamp: 0,
});
sample.close();
});
test('AudioSample creation from bytes', async () => {
const bytes = new Uint8Array(1024);
const sample = new AudioSample({
data: bytes,
numberOfChannels: 2,
format: 's16',
sampleRate: 48000,
timestamp: 0,
});
sample.close();
});