feat: add WAV format support for audio chunks in artplayer-plugin-asr

- Implemented pcmToWav function to convert PCM audio data to WAV format.
- Updated onAudioChunk callback to receive both PCM and WAV buffers.
- Modified TypeScript definitions to reflect changes in onAudioChunk parameter and append method.
This commit is contained in:
Harvey Zack committed 2025-05-23 10:23:27 +08:00
1 parent 62835bb042
commit 10337ddb1d
6 files changed
+81 -13

No files matched your search

+2 -2
View File
@@ -10,8 +10,8 @@ var art = new Artplayer({
interval: 40,
sampleRate: 16000,
autoHideTimeout: 10000,
// Use your AI tool to convert buffer into subtitles
onAudioChunk: (buffer) => startAsr(buffer),
// Use your AI tool to convert pcm/wav into subtitles
onAudioChunk: ({ pcm, wav }) => startAsr(pcm),
}),
]
});