Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chunk stream changed #21

Merged
merged 1 commit into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/slimy-spiders-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@releaseband/vite-plugin-meta": patch
---

chunk stream changed
7 changes: 4 additions & 3 deletions src/processes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,11 @@ export async function getAudioDuration(soundPath: string, params: ReadonlyArray<
return new Promise((resolve, reject) => {
const { stdout } = spawn(ffprobe.path, params.concat(soundPath));
stdout.on('error', reject).on('readable', () => {
const data = String(stdout.read());
const matched = data.match(/duration="?(\d*\.\d*)"?/);
const data = stdout.read();
if (!data) return;
const matched = String(data).match(/duration="?(\d*\.\d*)"?/);
const duration = matched?.at(0)?.split('=').at(-1);
if (!duration) return reject('Duration not found');
if (!duration) return;
resolve(parseFloat(duration));
});
});
Expand Down