📜  获取音频持续时间节点 js - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:51.053000             🧑  作者: Mango

代码示例2
const { getAudioDurationInSeconds } = require('get-audio-duration');

// From a local path...
getAudioDurationInSeconds('audio.flac').then((duration) => {
  console.log(duration);
});

// From a readable stream...

const fs = require('fs');
const stream = fs.createReadStream('audio.flac');

getAudioDurationInSeconds(stream).then((duration) => {
  console.log(duration);
});