Whisper API cannot read files correctly

Hey, super old post, but I’m getting desperate while struggling with this exact same problem right now.

I can’t figure out how to get the [audio-recorder-polyfill] code included in my sveltekit vite project.

I’ve tried the ‘quick hack’ suggesting of including

import AudioRecorder from 'https://cdn.jsdelivr.net/npm/audio-recorder-polyfill/index.js'
window.MediaRecorder = AudioRecorder

I’ve also tried downloading that file and putting it and the associated code in my /lib folder, but no go.

I’m beginning to think it’s something very specific to my Sveltekit preprocessor, but I don’t have enough expertise to figure out what’s causing the issue. The error message is extremely unhelpful.

My code in my front end looks like

onMount(() =>{
		import MediaRecorder from '../../lib/audio-recorder-polyfill//index.js'
		window.MediaRecorder = MediaRecorder
	})

And the error is popping up as

[plugin:vite-plugin-svelte] Error while preprocessing /home/jared/nomnomnom/nomnomnom/src/routes/home/+page.svelte - Transform failed with 1 error:
/home/jared/nomnomnom/nomnomnom/src/routes/home/+page.svelte:12:9: ERROR: Unexpected "MediaRecorder"
/home/jared/nomnomnom/nomnomnom/src/routes/home/+page.svelte
Unexpected "MediaRecorder"
 10 |  
 11 |  	onMount(() =>{
 12 |  		import MediaRecorder from '../../lib/audio-recorder-polyfill//index.js'
    |           ^
 13 |  		window.MediaRecorder = MediaRecorder
 14 |  	})
Click outside 

I have a project that was working perfectly in desktop browser and it’s now falling apart on mobile because of the mp4 → whisper problem.