chengsokdara / use-whisper

React hook for OpenAI Whisper with speech recorder, real-time transcription, and silence removal built-in

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid file format

leopoldpoldus opened this issue · comments

When using your standard configuration:

const App = () => {
const {
recording,
speaking,
transcribing,
transcript,
pauseRecording,
startRecording,
stopRecording,
} = useWhisper({
apiKey: import.meta.env.VITE_OPENAI_API_KEY, // YOUR_OPEN_AI_TOKEN
})

return (


Recording: {recording}


Speaking: {speaking}


Transcribing: {transcribing}


Transcribed Text: {transcript.text}


<button onClick={() => startRecording()}>Start
<button onClick={() => pauseRecording()}>Pause
<button onClick={() => stopRecording()}>Stop

)
}

Error: Invalid file format. Supported formats: ['m4a', 'mp3', 'webm', 'mp4', 'mpga', 'wav', 'mpeg']

Hello @leopoldpoldus, can you tell me what device platform and browser you test this on?

This package tested on Mac + Chrome, I believe this might be other platform or browser combination that output unknown format.

I am using Windows 11 + Firefox. I believe it is producing .ogg files

@leopoldpoldus I am thinking of using .wav to see if it output the same file on any platform and browser.
I will add this in the next version.

@leopoldpoldus I just release v0.2.0, could you try if it works on your configuration?
I tested on mac with Firefox and it seems to work now.

0.2.0 will record in lossless wav then encode with lamejs into mp3 that should work on all browsers.