File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ This Hook allows you to fetch waveform data of an audio file.
3030
3131- ** channel** : ` 1 | 2 `
3232
33- The number of audio channels in the audio file, defaults to ` 2 ` .
33+ The number of audio channels in the audio file, defaults to ` 2 ` . ·
3434
3535- ** samples** : ` number `
3636
@@ -44,6 +44,10 @@ This Hook allows you to fetch waveform data of an audio file.
4444
4545 The waveform data. Returns ` number[] ` when ` channel ` is ` 1 ` and ` number[][] ` when ` channel ` is ` 2 ` .
4646
47+ - ** audioDuration** : ` React.MutableRefObject<number> `
48+
49+ The duration of the audio file is in seconds and needs to be obtained using ` .current `
50+
4751- ** error** : ` boolean `
4852
4953 Indicates whether an error occurred during waveform data generation.
Original file line number Diff line number Diff line change @@ -44,6 +44,10 @@ import { Github } from 'lucide-react'
4444
4545 波形数据,当入参 ` channel ` 为 ` 1 ` 时返回 ` number[] ` ,为 ` 2 ` 时返回 ` number[][] `
4646
47+ - ** audioDuration** : ` React.MutableRefObject<number> `
48+
49+ 音频文件的时长单位为秒,需要使用 ` .current ` 获取
50+
4751- ** error** : ` boolean `
4852
4953 在生成 Waveform 数据过程中是否发生错误
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ const SAMPLES = 512 * 2
2222 *
2323 * @returns {object } An object containing the waveform data and any error information:
2424 * - data: An array of numbers (for mono) or an array of arrays of numbers (for stereo), representing the simplified waveform data.
25+ * - audioDuration: A ref object containing the duration of the audio in seconds.
2526 * - error: A boolean indicating if an error has occurred during processing.
2627 * - errorMessage: A string containing the error message if an error has occurred.
2728 *
You can’t perform that action at this time.
0 commit comments