creates video voice memos from audio clips; with bluesky integration. trill.ptr.pet

feat: log more info related to audio in errors

ptr.pet aab61039 35505cff

verified
Changed files
+8 -5
src
components
lib
+7 -4
src/components/MicRecorder.tsx
··· 22 22 let mediaStream: MediaStream | null = null; 23 23 let audioChunks: Blob[] = []; 24 24 25 - const preferredMimeType = "audio/webm; codecs=opus"; 25 + const preferredMimeType = "audio/webm;codecs=opus"; 26 26 const fallbackMimeType = "audio/webm"; 27 27 28 28 const startRecording = async () => { ··· 49 49 if (!audioTrack) throw "no audio track found"; 50 50 51 51 let mimeType = ""; 52 - if (MediaRecorder.isTypeSupported(preferredMimeType)) 52 + if (MediaRecorder.isTypeSupported(preferredMimeType)) { 53 53 mimeType = preferredMimeType; 54 - else if (MediaRecorder.isTypeSupported(fallbackMimeType)) 54 + } else if (MediaRecorder.isTypeSupported(fallbackMimeType)) { 55 + console.warn(`falling back to ${fallbackMimeType} for recording audio`); 55 56 mimeType = fallbackMimeType; 56 - else { 57 + } else { 57 58 console.warn( 58 59 `browser does not support preffered audio / container type. 59 60 falling back to whatever the browser picks`, ··· 97 98 const file = new File([blob], `rec-${fileDate}.${fileExtension}`, { 98 99 type: usedMime, 99 100 }); 101 + 102 + console.info(usedMime, file.size); 100 103 101 104 addTask(props.selectedAccount(), file); 102 105 audioChunks = [];
+1 -1
src/lib/render.ts
··· 274 274 if (!audioTrack) throw "no audio track found."; 275 275 276 276 if (!(await audioTrack.canDecode())) 277 - throw "audio track cannot be decoded by browser."; 277 + throw `audio track (${audioTrack.codec}) cannot be decoded by browser.`; 278 278 279 279 const duration = opts.duration ?? (await audioTrack.computeDuration()); 280 280 if (!duration) throw "couldn't get audio duration.";